BIC.bank_names doesn't let me get the actual bank name for an IBAN
jose-reveni opened this issue · 2 comments
Hello!
We are currently trying to get the bank name for a given IBAN, but in some cases, when a bank might have many names, we are unable to get the actual name for the bank.
The specific case we've ran into is using an IBAN for Banco Sabadell (spanish), BIC BSABESBB
and bank code 0081
, but when trying to get the bank name, we get ABBEY NATIONAL BANK, S.A.E.
.
Looking into the code, I think that the problem comes because BIC.bank_names
returns a sorted list of names for the given BIC code and when going from and IBAN to a BIC, we lose the context of the actual bank code.
I can think of a couple changes but I'd love to have your opinon first @mdomke
This is what we currently do to get the bank name:
name = schwifty.IBAN(value).bic.bank_names[0]
You're right. With the bank code from the IBAN it should be possible to unambiguously detect the bank and from there the bank name. I already have been looking at the change that you implemented for your fork, and I would be happy to review a pull-request here! Many thanks for this useful contribution!
Fixed in 2022.04.2