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

Italian fiscal code ("codice fiscale") should accept VATs #180

Closed ghost closed 4 years ago

ghost commented 4 years ago

The current validation of an Italian fiscal code ("codice fiscale", https://github.com/arthurdejong/python-stdnum/blob/master/stdnum/it/codicefiscale.py) is incomplete, since by definition an Italian fiscal code could be:

Reference: https://it.wikipedia.org/wiki/Codice_fiscale (italian). I'm unable to find a proper english translation. Event the english Wikipedia seems incomplete.

Notice: the opposite is not true. An Italian VAT cannot be 16 characters long.

arthurdejong commented 4 years ago

Hi Nicholas,

Thanks for pointing this out. Does the individual number also have a distinctive name that can be used to reference it? If so it may be a good idea to add a separate module for that and have codicefiscale just reference the two modules, otherwise I'll add checking for the VAT to the codicefiscale module.

ghost commented 4 years ago

@arthurdejong

Hi Arthur, the the individual number is called "Codice Fiscale", while the non-individual number is the "Partita IVA" (VAT). So, basically:

There are not other names (to my knowledge). I hope I have clarified it (I know, little messy).

So, yes, if you have a Codice Fiscale of 11 characters, it should not be refused and it should be validated against the partitaiva (vat) module instead. In fact in my original post I missed to provide some expected behaviour for codicefiscale module:

arthurdejong commented 4 years ago

Thanks for the clarification. I've fixed it in 9605dbe.

For now I've not allowed the IT prefix in the Codice Fiscale until it becomes common within Italy to use the prefix in the Codice Fiscale.