koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
37 stars 26 forks source link

Missing support for tax numbers #15

Open koblas opened 2 years ago

koblas commented 2 years ago
teebu commented 1 year ago

Netherland TIN (tax identification number) https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Netherlands-TIN.pdf

However, I am confused if its the same as Netherland BSN. They seem to be different validation methods though.

koblas commented 1 year ago

@teebu When I look at the NL BSN and the PDF they appear to be the same. Both have the same 9,8,7,6,5,4,3,2 sum factor validation. I did also find that BSN on the government of NL website indicates that it's used for tax purposes along with this document.

https://expatax.nl/bsn-citizen-service-number-your-dutch-tax-identification-number/

teebu commented 1 year ago

The BSN uses something called Elfproef is Dutch for 11-proof, while the TIN uses the checksum with weights.

The elfproef uses mod 11 and checks if its 0. While the checksum method uses the checkdigit for validation.

Something I found here: https://www.npmjs.com/package/elfproef, https://github.com/MrLuit/elfproef/blob/master/src/index.ts

They both seem to produce same results but are different methods to get there. I don't understand how that works.

https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Netherlands-TIN.pdf

Microsoft has them both 9 digits, except BSN is with space format, and TIN no spaces https://learn.microsoft.com/en-us/microsoft-365/compliance/sit-defn-netherlands-tax-identification-number?view=o365-worldwide https://learn.microsoft.com/en-us/microsoft-365/compliance/sit-defn-netherlands-citizens-service-number?view=o365-worldwide

koblas commented 1 year ago

Fliping this around. What are you looking for, the "problem" with OECD is that it only lists the identification number (BSN) for individuals. I think you're fishing for the entity (corporation) tax identifier. This article might help.

https://business.gov.nl/starting-your-business/registering-your-business/lei-rsin-vat-and-kvk-number-which-is-which/

It might be that you're looking for the RSIN Rechtspersonen en Samenwerkingsverbanden Identificatie Nummer.