DiUS / java-faker

Brings the popular ruby faker gem to Java
http://dius.github.io/java-faker
Other
4.64k stars 844 forks source link

Invalid IBAN numbers for Costa Rica (CR) #674

Open zolv opened 2 years ago

zolv commented 2 years ago

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:

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

bodiam commented 2 years ago

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

Lance-Azrael commented 2 years ago

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