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

Updating Irish PPS validator #441

Closed Ollymid closed 1 week ago

Ollymid commented 1 month ago

Resolves: https://github.com/arthurdejong/python-stdnum/issues/440

Unfortunately the company I work for have had a sudden increasing number of complaints from Irish clients whose PPS numbers end with the letter B.

PPS numbers ending in B is a new thing as of 2024. I've tried to find more information and I’ve found confirmation from Chartered Accountants Ireland that there is a new range of numbers and the Irish Department of Social Protection confirmed it to me in an email:

Screenshot 2024-05-31 at 21 30 16

Currently the PPS package operates under the assumption that the second letter can be 'A' (for individuals) or 'H' (for non-individuals, such as limited companies, trusts, partnerships and unincorporated bodies hence why PPSN's ending in B are rejected as being valid.

To enable B-range numbers to work I have changed to the regex on line 64 to accept B as a character and updated the new format conditional on line 80 to allow numbers ending in B

I've also added a doctest file for PPS numbers

Please let me know your thoughts