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

IT and SM generate not acting consistently. #8

Open
sliiser opened this issue Jun 7, 2017 · 1 comment
Open

IT and SM generate not acting consistently. #8

sliiser opened this issue Jun 7, 2017 · 1 comment

Comments

@sliiser
Copy link

sliiser commented Jun 7, 2017

I wrote a short script expecting .bank_code and .branch_code to return the same values I pass into .generate. It worked well for all cases except for 2 of them. IT and SM. They are the only 2 countries whose bank_code does not start at position 4.

See the following snippet.

ISO::IBAN.specifications.keys.reject do |country|
  spec = ISO::IBAN.specification(country)
  bank_code = ('1' * spec.bank_code_length).presence
  branch_code = ('2' * spec.branch_code_length).presence
  account_code = ('3' * spec.account_code_length).presence
  iban = ISO::IBAN.generate(country, *[bank_code, branch_code, account_code].compact)
  iban.bank_code == bank_code && iban.branch_code == branch_code && iban.account_code == account_code
end

The resulting array contains just 'IT' and 'SM'.

If the former behaviour is expected, then please tell me how is generate supposed to be used.

Using ruby 2.3.3p222 on mac os and iso-iban (0.1.3).

@apeiros
Copy link
Owner

apeiros commented Jun 15, 2017

Hi @sliiser
If you look at https://github.com/apeiros/iso-iban/blob/master/dev/ErrorsInRegistry.markdown you can see that the official iban specs are riddled with errors. I suspect it's due to yet another bug in the specs. I'll investigate it. Thanks for reporting!

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