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
271 stars 124 forks source link

Error with UK sort and account code #57

Closed andyrh3 closed 11 months ago

andyrh3 commented 5 years ago

Iban iban = new Iban.Builder() .countryCode(CountryCode.GB) .bankCode("090136") .accountNumber("99736889") .build();

org.iban4j.IbanFormatException: [0901] must contain only upper case letters. at org.iban4j.IbanUtil.validateBbanEntryCharacterType(IbanUtil.java:391) at org.iban4j.IbanUtil.validateBbanEntries(IbanUtil.java:379) at org.iban4j.IbanUtil.validate(IbanUtil.java:80) at org.iban4j.Iban$Builder.build(Iban.java:365) at org.iban4j.Iban$Builder.build(Iban.java:337)

kc-currenxie commented 5 years ago

@andyrh3 I found the answer here https://github.com/arturmkrtchyan/iban4j/blob/master/src/main/java/org/iban4j/bban/BbanStructure.java#L416

andyrh3 commented 5 years ago

Oh great thank you for looking into this I will apply the change now and see if it fixes the issue.

fahim1D commented 11 months ago

Sorry for necro-bumping; was this ever resolved? I passed in an all-numeric sort code for the bankCode property and I'm getting an IbanFormatException from here: https://github.com/arturmkrtchyan/iban4j/blob/master/src/main/java/org/iban4j/IbanUtil.java#L420

Further testing: I believe sort code should actually be assigned to branchCode. But this breaks the validation as bankCode is required, which I don't have, e.g., you can calculate IBANs from just country, sort code, and account number here: https://www.iban.com/calculate-iban.

Assigning sort code to both bankCode and branchCode doesn't work either.

hajk1 commented 11 months ago

@fahim1D Sorry, I did not get your problem. According to the initial requirements, the branch code of the GB IBAN must be alphabetical(no numeric is acceptable). So this ticket was supposed to be closed at the time. Please provide your issue as a new ticket with complete data to be verified.