softwareinmotion / ibanizator

Ruby gem for calculating iban out of account details.
MIT License
30 stars 21 forks source link

Returns wrong bank name for bic PBNKDEFFXXX #16

Open rvasquez-flip4new opened 7 years ago

rvasquez-flip4new commented 7 years ago

Hi,

with v0.3.4 the correct bank name for bic PBNKDEFFXXX should be "Postbank Frankfurt" (see http://bank-code.net/swift-code/PBNKDEFFXXX.html).

[1] pry(main)> iban = Ibanizator.iban_from_string("DE09500100600175890604")
=> #<Ibanizator::Iban iban_string="DE09500100600175890604">
[2] pry(main)> iban.extended_data.bic
=> "PBNKDEFFXXX"
[3] pry(main)> bic = iban.extended_data.bic
=> "PBNKDEFFXXX"
[4] pry(main)> bank = Ibanizator.bank_db.bank_by_bic(bic)
=> #<Ibanizator::Bank bic="PBNKDEFFXXX" name="Postbank Leipzig" bank_code="86010090">
[5] pry(main)> bank.name
=> "Postbank Leipzig"
zaknafain commented 6 years ago

Hey,

the problem is the ordering. I fixed it a while ago in my fork. Feel free to use it.

zaknafain commented 6 years ago

Hm ... I had a second look into this. All Postbanks have the same BIC, so finding a specific bank via this BIC is not possible.

phoet commented 6 years ago

@zaknafain wouldnt it make sense to return a list of banks instead?

JGantner commented 6 years ago

@phoet that would make sense in my optinion but would require an API change that would break some client code. So this change should be planned properly.

phoet commented 6 years ago

indeed. i don't know how much adoption this gem has, i would probably go the easy way of releasing a new mayor version with a note in the changelog.