se-panfilov / jsvat

Check the validity of the format of an EU VAT number

Home Page:http://se-panfilov.github.io/jsvat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only some countries working

Aeners opened this issue · comments

Hello there,
I just installed this module, and I can't get it work for some countries.

Here is an example of returns I get:

import { checkVAT, countries } from 'jsvat';

console.log(checkVat('FRXX999999999', countries).isValid)   // => true
console.log(checkVat('DE999999999', countries).isValid)     // => false
console.log(checkVat('BE1234567890', countries).isValid)    // => false

Did I miss something ?

Hi @Aeners ,

You've just killed my mind with the lower case in your example (you typed both checkVAT and checkVat, but it supposed to be checkVAT))) I literary spent an hour trying to understand how for the fucks sake checkVat could be undefined )) I guess I need a vacation... =)

Anyway, regarding your question.

I guess the problem with these lines

console.log(checkVat('DE999999999', countries).isValid)     // => false
console.log(checkVat('BE1234567890', countries).isValid)    // => false

Is simple - DE999999999 Isn't a valid VAT =) Same for BE1234567890.

In other words:

console.log(checkVAT('BE1234567890', countries).isValid)    // => false
console.log(checkVAT('BE0411905847', countries).isValid)    // => true

So the whole idea was to not let users input silly VATs, like 123456789.

So I assume the lib is working as expected, and I gonna close this issue )

If I didn't catch something - feel free to reopen it )