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

New Netherlands VAT Codes Fail to Validate

twaddell opened this issue · comments

New VAT Codes were introduced in the Netherlands at the start of the year (https://www.belastingdienst.nl/wps/wcm/connect/bldcontenten/belastingdienst/business/vat/new-vat-id/)

It appears that although in the same format as before NLXXXXXXXXXBXX (where X is a digit) the checksum calculation no longer works.
Codes that validate on VIES return false on https://se-panfilov.github.io/jsvat/

@se-panfilov Is there any chance you'll have time to fix this issue? :)

I found another library, sharing the same name, that implements this check properly: https://www.braemoor.co.uk/software/vat.shtml

In line 1130 of the script, the a second function is used if the first check (the only one implemented in this repo) fails, that converts the VAT number (A-Z are converted to 10-35, + to 36 and * to 37) to an arbitrary precision integer by appending all digits, and finally calculates a modulus 97 that is compared to 1.

@twaddell I guess it was done in pr #90 and available in v2.2.0

@ofavre Please be aware that library you mentioned use eval function under the hood which is quite unsecure. At least last time I checked it. Also i didn't found any license info there, so I wonder if you legally can use it.