arturmkrtchyan / iban4j

A Java library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362).
http://iban4j.org
Apache License 2.0
270 stars 124 forks source link

Incorrect IBAN format for IS (Iceland) #132

Closed proshin-roman closed 6 months ago

proshin-roman commented 6 months ago

Problem

Currently, the library defines the following IBAN format for IS country (Iceland):

4 bank code + 2 branch code + 6 account number + 10 identification number

However, Wikipedia shows another format: see International Bank Account Number / IBAN formats by country page - here is a screenshot screenshot

where only the first two chars are the bank code, the next two are the branch code, then another two for an account type, and so on.

Even though there are other sources like xe.com and Bank codes, they seem to be wrong.

Here is an example of why it makes sense to have only 2 letters for the bank code. Let's take IBAN IS140159260076545510730339 - it belongs to a bank with BIC NBIIISREXXX. Searching for this BIC on ibancalculator.com gives us a long list of banks where bank codes consist of three digits, and only the leading 1 is common across all these branches, while 59 points to just one of them.

So, if we change the format of the IBAN of Iceland - reduce the bank code from 4 to 2 symbols - we would extract only 01 from the IBAN above, which would result in the same bank code across IBANs pointing to any branch of the bank.

TODO

Change the IBAN's format for IS code. The new format should be the following:

BbanStructureEntry.bankCode(2, 'n'),
BbanStructureEntry.branchCode(2, 'n'),
BbanStructureEntry.accountType(2, 'n'),
BbanStructureEntry.accountNumber(6, 'n'),
BbanStructureEntry.identificationNumber(10, 'n')
proshin-roman commented 6 months ago

Fixed this issue in pull request #133. @arturmkrtchyan could you please take a look?