Skip to content
/ iban4g Public

A port of Artur Mkrtchyan's iban4j project so that it will work with Java, GWT or J2CL. A library for generation and validation of the International Bank Account Numbers IBAN (ISO_13616) and Business Identifier Codes BIC (ISO_9362).

License

Notifications You must be signed in to change notification settings

NaluKit/iban4g

Repository files navigation

IBAN4G

GWT3/J2CL compatible License Chat on Gitter CI Maven Central Test

A port of Artur Mkrtchyan's iban4j project, so that it works in a pure Java project and projects using GWT or J2CL. Artur's project can be found here

A Java, GWT and J2CL ready library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362). The library can be used on the client and server side!

The library can be used in a Java-, GWT- or J2CL-environment.

Documentation and most of the classes are copied from iban4j.

Iban quick examples:

That's the way how to generate an Iban using the new keyword:

Iban iban = new Iban.Builder()
                .countryCode(CountryCode.AT)
                .bankCode("19043")
                .accountNumber("00234573201")
                .build();

and that is the way to generate an IBAN without using the new keyword:

Iban iban = Iban.builder()
                .countryCode(CountryCode.AT)
                .bankCode("19043")
                .accountNumber("00234573201")
                .build();

Creating an Iban object from String:

Iban iban = Iban.valueOf("DE89370400440532013000");

and from formatted String:

Iban iban = Iban.valueOf("DE89 3704 0044 0532 0130 00", IbanFormat.Default);

Generating a random Iban:

 // How to generate random Iban
 Iban iban = Iban.random(CountryCode.AT);
 Iban iban = Iban.random();
 Iban iban = Iban.builder()
                 .countryCode(CountryCode.AT)
                 .bankCode("19043")
                 .buildRandom();

Validating an Iban:

try {
    IbanUtil.validate("AT611904300234573201");
    IbanUtil.validate("DE89 3704 0044 0532 0130 00", IbanFormat.Default);
    // valid
} catch (IbanFormatException |
         InvalidCheckDigitException |
         UnsupportedCountryException e) {
    // invalid
}

Bic quick examples:

 //How to create Bic object from String
 Bic bic = Bic.valueOf("DEUTDEFF");


 //How to validate Bic
 try {
     BicUtil.validate("DEUTDEFF500");
     // valid
 } catch (BicFormatException e) {
     // invalid
 }

Maven dependency:

<dependency>
  <groupId>com.github.nalukit</groupId>
  <artifactId>iban4g</artifactId>
  <version>2.2.0</version>
</dependency>

Module dependency:

(Only in case you are using iban4g with GWT!)

<inherits name="com.github.nalukit.iban4g.Iban4g" />

References

To get in touch with the developer

Please use the Nalu Gitter room.

Notes

In case you find a bug, please open an issue.

License

Copyright 2015 Artur Mkrtchyan

Modifications Copyright 2020 Frank Hossfeld

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

About

A port of Artur Mkrtchyan's iban4j project so that it will work with Java, GWT or J2CL. A library for generation and validation of the International Bank Account Numbers IBAN (ISO_13616) and Business Identifier Codes BIC (ISO_9362).

Topics

Resources

License

Stars

Watchers

Forks

Languages