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
503 stars 211 forks source link

1.9.0 has problem with Belgian IBANs #78

Closed alshopov closed 6 years ago

alshopov commented 6 years ago

The new version has problem with the example IBAN: https://www.ecbs.org/iban/belgium-bank-account-number.html shows: IBAN print format example | BE68 5390 0754 7034 Here is an example in ipython:

In [1]: import stdnum

In [2]: print (stdnum.__version__)
1.9

In [3]: from stdnum.be.iban import validate

In [4]: validate('BE68 5390 0754 7034')
---------------------------------------------------------------------------
InvalidComponent                          Traceback (most recent call last)
<ipython-input-....> in <module>()
----> 1 validate('BE68 5390 0754 7034')

/..../python-stdnum/stdnum/be/iban.pyc in validate(number)
     88         raise InvalidChecksum()
     89     if not info(number):
---> 90         raise InvalidComponent()
     91     return number
     92

InvalidComponent: One of the parts of the number are invalid or unknown.
arthurdejong commented 6 years ago

The problem is that for BE68 5390 0754 7034 the local bank identifier is 539 which is not listed as a known bank. The ECBS IBAN checker also marks the number of having an unknown bank.

arthurdejong commented 6 years ago

Feel free to re-open this issue or create a new issue if this in error but I believe that stdnum behaves correctly in the described case.

alshopov commented 6 years ago

@arthurdejong - not reopening, I understand your reasoning and accept it. It is unfortunate that the mismatch happens but as long as real bank IBANs are not affected I am fine.