Closed pe2mbs closed 9 months ago
@pe2mbs can you share an example of valid and invalid IBANs?
Would you be willing to open a PR that would fix the issue? I can help with testing if you want.
@pe2mbs You can still use
from schwifty import IBAN
from schwifty import SchwiftyException
valid: list[IBAN] = []
for i in range(1, n):
iban = IBAN("NL", "INGB", str(i))
try:
iban.validate(validate_bban=True)
except SchwiftyException:
continue
else:
valid.append(iban)
to generate random IBANs. The validate_bban
-parameter will validate the national checksum digits.
When IBAN.generate( country_code = 'NL', ank_code = 'INGB', account_code = str( i ) ) may generate an IBAN thats not 11-proof, which is required by Dutch banks, neither an exception is throw on an invalid account_code.
Also the IBAN.validate() function does not detect a non 11-proof account_code.