java-faker icon indicating copy to clipboard operation
java-faker copied to clipboard

Invalid IBAN numbers for Costa Rica (CR)

Open zolv opened this issue 3 years ago • 2 comments

Describe the bug Faker generates invalid IBAN numbers for Costa Rica, CR... code

To Reproduce


  @Test
  void costaRicaIbanMustBeValid() {
    /*
     * Given
     */
    final String givenCountryCode = "CR";

    /*
     * When
     */
    final Faker faker = new Faker();
    final String ibanFaker = faker.finance().iban(givenCountryCode).toUpperCase();

    /*
     * Then
     */
    Assertions.assertTrue(
        fr.marcwrobel.jbanking.iban.Iban.isValid(ibanFaker), "Costa Rica IBAN is not valid");
  }

Expected behavior I expect the generated CR IBANs are valid.

Versions:

  • OS: Linux Ubuntu 20.04.3 LTS
  • JDK: OpenJDK 14
  • Faker Version: 1.0.2

Additional context For IBAN validation above I use [marcwrobel/jbanking](https://github.com/marcwrobel/jbanking. I've also checked some of generated CR IBANs on an IBAN validator websites (like bank-code.net/iban-checked) and all of them failed e.g:

⚠ IBAN: CR7965732675616991526 is NOT VALID.
✔ IBAN checksum is VALID.
⚠ IBAN Length standard is not correct.
⚠ IBAN Formatting and Structure is incorrect.

https://bank-code.net/iban-checker?iban=CR7965732675616991526

According to IBAN for Costa Rica there is a reserved digit 0 missing: https://bank.codes/iban/structure/costa-rica/ I've put a comment: #557

zolv avatar Nov 21 '21 21:11 zolv

Hi @zolv , just wanted to let you know that our port of Javafaker, called Datafaker, doesn't have this bug, as can be seen here: https://github.com/datafaker-net/datafaker/commit/bd1c1896fab18b0decc2b4395cde9bc6bb31794b

bodiam avatar Feb 14 '22 12:02 bodiam

Hello @zolv , our group are interested in this issue, and we will try to fix it. ---- SE_SUSTech, group: Lanrand

Lance-Azrael avatar Mar 09 '22 13:03 Lance-Azrael