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
484 stars 203 forks source link

Support both corporate and individual Israeli TINs for generic validation #436

Open odony opened 1 month ago

odony commented 1 month ago

According to the official references mentioned in #107, Israeli companies can use two types of Tax Identification Numbers / VAT codes:

For example, the TIN rules that were provided to OECD by the Israeli tax administration state:

The "TIN" for an Individual is his ID number.

Based on these references, it seems that the validation of a generic VAT number for Israel via stdnum.il.vat should allow both formats.

Further, considering that stdnum.il.idnr is a simple luhn validation that will also work for the numbers that stdnum.il.hp currently verifies, this can be done by simply changin the default alias to point to it instead. The only difference between the two algorithms is that the stdnum.il.hp one verifies that the first digit is 5.

odony commented 1 month ago

@arthurdejong it make look like a stretch to use the idnr algorithm to validate the hp ones too, in case they later diverge. Perhaps you'd prefer having an actual stdnum.il.vat that explicitly tries both hp and idnum in sequence?

PS: the test_legacy (3.5) failure seems caused by the this issue in the setup-python GH action

odony commented 1 month ago

I've worked around the test failure with the workaround suggested here. It's a separate, unrelated commit that could be dropped as soon as the upstream issue is fixed.