Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong bank code regexp for GB IBANs #13

Closed
990px opened this issue Jan 26, 2019 · 1 comment
Closed

Wrong bank code regexp for GB IBANs #13

990px opened this issue Jan 26, 2019 · 1 comment

Comments

@990px
Copy link

990px commented Jan 26, 2019

iban = IBAN("GB32ESSE40486562136016")
print(iban.bank_code)
'ESSE'

but should be 404865.

via https://en.wikipedia.org/wiki/International_Bank_Account_Number

GBkk bbbb ssss sscc cccc cc
b = BIC bank code
s = Bank and branch code (sort code)
c = Account number 

BIC bank code != bank code

@mdomke
Copy link
Owner

mdomke commented Jan 18, 2020

schwifty uses the official SWIFT specification that can be found here. If you look at section 2.25 of the IBAN registry linked from the SWIFT site you can see that the bank identifier is specified to be from position 1-4 of the BBAN and the branch identifier from 5-10.

BBAN = ESSE 404865 62136016
       ^  ^ ^    ^
       1  4 5    10

You have to acknowledge that schwifty uses a more generalized terminology for naming the different parts of an IBAN. The library doesn't know about any country specific wording (like sort code) nor does it take into account what additional national format might be applied to the different segments. So I think that considering the official specification schwifty's behavior is correct.

@mdomke mdomke closed this as completed Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants