Closed PavelNiedoba closed 1 year ago
Although your accountNumber
parameter is likely correct, this library expects 16 digits, i.e. the 10-digit account number appended to the 6-digit code as shown in the IBAN registry. Unfortunately, the IBAN registry does not indicate what those six digits are, although the "Domestic account number example" gives some indication (19 with pre-filled zeros).
This issue is resolved as of version "3.2.5-RELEASE" by using setPadding(true) on the builder method:
new Iban.Builder()
.leftPadding(true)
.countryCode(CountryCode.CZ)
.bankCode("2010")
.accountNumber("2300121591")
.build()
.toString();
Thats nice!
new Iban.Builder().countryCode(CountryCode.CZ).bankCode("2010").accountNumber("2300121591").build().toString();
should be smart enough to work without leading zeroes for accountNumberfails with
org.iban4j.IbanFormatException: [20102300121591] length is 14, expected BBAN length is: 20 at org.iban4j.IbanUtil.validateBbanLength(IbanUtil.java:362) at org.iban4j.IbanUtil.validate(IbanUtil.java:79) at org.iban4j.Iban$Builder.build(Iban.java:365) at org.iban4j.Iban$Builder.build(Iban.java:337)