arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
498 stars 206 forks source link

Romanian CNP for resident but non-citizen does not validate #230

Closed dotbit1 closed 4 years ago

dotbit1 commented 4 years ago

My CNP starts with 7, and does not validate using stdnum. I am male, so probably 8 is for female? I checked the source code of CNP.py and it seems like 7-8 are not valid first (century) digits.

I am resident but non-citizen in romanian with a registration certificate.

Wikipedia states thatwhere it is stated that 7 and 8 are for non-citizen but resident. - this corresponds with my cnp. On europa.eu - TIN spec it is stated that non-citizen codes are separate (?!) I use my cnp in every place a citizen would use it.

If you think it is useful to see my cnp or picture of my certificate please do so in private, probably not a good idea to share my cnp code online.

Currently researching this - we probably need some official document in order to commit this.

Problem 1: It seems like the 'S' - first number of cnp is 7 for male or 8 for female no matter what century they are born during. For ex. I was born in 1986, and my cnp starts with 786... Should the get_birth_date(number) allow validation but not return a birthdate, or should we (incorrectly) assume that the person is younger than 100 years?

arthurdejong commented 4 years ago

Thanks for providing this information. For now I've considered the first digit of 7, 8 or 9 as valid, mostly because there is not super-clear documentation on the format and it is likely better to accept invalid numbers than the other way around.