mdomke / schwifty

IBAN parsing and validation
https://schwifty.readthedocs.io
MIT License
206 stars 80 forks source link

Validating IBANs in African countries result in 'Unknown country-code' error #171

Closed n49o7 closed 8 months ago

n49o7 commented 10 months ago

IBANs with the following prefixes return an error: ['BF', 'BJ', 'CI', 'CM', 'MA', 'MG', 'ML', 'NE', 'RW']

The corresponding Country objects in pycountries are:

[Country(alpha_2='BJ', alpha_3='BEN', flag='๐Ÿ‡ง๐Ÿ‡ฏ', name='Benin', numeric='204', official_name='Republic of Benin'),
 Country(alpha_2='BF', alpha_3='BFA', flag='๐Ÿ‡ง๐Ÿ‡ซ', name='Burkina Faso', numeric='854'),
 Country(alpha_2='CI', alpha_3='CIV', flag='๐Ÿ‡จ๐Ÿ‡ฎ', name="Cรดte d'Ivoire", numeric='384', official_name="Republic of Cรดte d'Ivoire"),
 Country(alpha_2='CM', alpha_3='CMR', flag='๐Ÿ‡จ๐Ÿ‡ฒ', name='Cameroon', numeric='120', official_name='Republic of Cameroon'),
 Country(alpha_2='MA', alpha_3='MAR', flag='๐Ÿ‡ฒ๐Ÿ‡ฆ', name='Morocco', numeric='504', official_name='Kingdom of Morocco'),
 Country(alpha_2='MG', alpha_3='MDG', flag='๐Ÿ‡ฒ๐Ÿ‡ฌ', name='Madagascar', numeric='450', official_name='Republic of Madagascar'),
 Country(alpha_2='ML', alpha_3='MLI', flag='๐Ÿ‡ฒ๐Ÿ‡ฑ', name='Mali', numeric='466', official_name='Republic of Mali'),
 Country(alpha_2='NE', alpha_3='NER', flag='๐Ÿ‡ณ๐Ÿ‡ช', name='Niger', numeric='562', official_name='Republic of the Niger'),
 Country(alpha_2='RW', alpha_3='RWA', flag='๐Ÿ‡ท๐Ÿ‡ผ', name='Rwanda', numeric='646', official_name='Rwandese Republic')]

Interestingly, the BICs located in these countries are valid.

Natim commented 10 months ago

Hello @n49o7, do you have IBAN examples we can use to test the issue?

Natim commented 10 months ago

Hello @n49o7 I couldn't find countries listed above in this list: https://www.xe.com/ibancalculator/countrylist/ or in the IBAN registry 2016 or IBAN registry 2023

n49o7 commented 10 months ago

Hello @Natim,

These countries are present on iban.com. I imagine that there is a degree of integration with the standard. On Wikipedia, they are listed as 'aspirational'. They might be on-track to be accepted soon.

IBAN/BIC checking websites (example) typically also show many more banks than the swift website, according to actual SwiftNet capabilities.

I have no opinion on the right thing to do.

mdomke commented 8 months ago

In release 2024.1.1.post0 I added all countries that are listed on Wikipedia so that general support for these African countries should be available. The information about the BBAN structure is however very scarce, so that detail information (e.g. account number, bank code), might not always be available.