koblas / stdnum-js

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

France NIF / TIN checksum missing #55

Closed teebu closed 1 year ago

teebu commented 1 year ago

France, the terms "TIN" (Tax Identification Number) and "NIF" (Numéro d'Identification Fiscale) are used interchangeably and refer to the same thing. The French NIF is the unique identifier assigned to individuals and legal entities for tax purposes, and it serves as the TIN for tax-related matters in France.

https://ec.europa.eu/taxation_customs/tin/specs/FS-TIN%20Algorithms-Public.docx

image

teebu commented 1 year ago

Thank you for the fast updates.

How do you handle 0000000000000 scenarios?

koblas commented 1 year ago

Unless I missed something 0000000000000 is a valid checksum. Since 0 mod 511 = 0.

Though it would be great to see a rule that clarifies this:

Check digit = remainder if remainder < 100, C11 = 0 (if remainder < 10, C11 = 0 and C12 = 0).

Since this implies that if the number is 0000000001000 it's valid -- IMHO this is strange for a bunch of reasons.

teebu commented 1 year ago

Even though it is valid checksum, and probably the same for most of these mod based checksums. I think it should not pass the validation. I haven't seen any documents regarding this though.