-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
French iban has invalid checksum #2588
Comments
Hey @fbuys, I have no idea. You can check ibandit gem for better understanding |
I'll do some more digging but is seems like this part defines how the check digit is calculated. Might be all we need to create the correct check digits - but not sure about that yet. |
@stefannibrasil I wonder if we can add the |
done, thanks for the help! |
hi, sorry I missed this! Thanks for reporting this issue @elkesrio and @fbuys for the help! I haven't had the time to reproduce this yet. I am not sure this is happening for all country codes or "fr" only. It would be helpful to have a reproduction script for this issue. If anyone could do that before me, that would be great! |
Hi @stefannibrasil, you can reproduce it using the require 'ibandit'
while true do
iban = Faker::Bank.iban(country_code: "fr")
raise StandardError, iban unless Ibandit::IBAN.new(iban).valid?
end
# StandardError: FR007626128613KJOM8X38HG512 |
The issue can occur with multiple country codes. In addition to the IBAN check digit, some countries also make use of a "national check digit". France is one such country that not only makes use of a national check digit, but also uses their own variation of I believe I have this issue solved for France specifically - currently generating 100k valid French IBANs. While my solution is not yet generic enough to drop-in national check digits for other countries, I'd like to continue working on this so others can add them later more easily. |
I've opened a pull request to solve the issue of some generated IBANs not being valid according to More detail on this in description of the pull request tagged above. |
hi @srcoley thank you for opening a PR! What is the status of this issue? Are there next steps? Thank you! |
@stefannibrasil #2591 partially resolves the issue and has been merged into main. What it solvesInvalid IBAN checksums What it does not solveInvalid national checksums Next stepsResolving invalid national checksums will take more effort because the portion of countries that implement them use varying algorithms for generation and validation. Check this table to see what I mean. Additionally, In regard to the web validator mentioned in the original issue(https://www.ibancalculator.com/iban_validieren.html), even if the national checksum issue is resolved, validation will likely still fail because it also checks that the bank and branch codes actually exist. I'll leave the maintainers to decide what level of IBAN validity they think is acceptable for Faker's goals. |
@srcoley Thank you so much for your detailed work and response! I haven't had the time to get more context about this until now. The details you provided are constructive. I will say that fixing invalid IBAN checksums being generated is enough. Although we would like to support all cases and have higher accuracy, it would require too much effort to accommodate. Adding to the docs that Faker only generates valid IBAN check digits but does not take national check digits used within the BBAN is enough. If IMHO, the fix you added is enough, and adding variants for all edge cases is too much for Faker. I'd rather have something that serves basic needs well (without national check digits) than provide inaccurate information to users. The next step to fix this issue would be to update the docs with this information. @vbrazo @thdaraujo, what do you think? |
Although we would like to support all cases and have higher accuracy, it would require too much effort to accommodate. Faker generates valid IBAN check digits but does not support national check digits used within the BBAN. If this behavior is critical for an app, it's recommend to generate its own IBAN digits validity check. See [faker-ruby#2588](faker-ruby#2588) for more details.
Although we would like to support all cases and have higher accuracy, it would require too much effort to accommodate. Faker generates valid IBAN check digits but does not support national check digits used within the BBAN. If this behavior is critical for an app, it's recommend to generate its own IBAN digits validity check. See [#2588](#2588) for more details.
Describe the bug
Some french ibans have invalid checksums
To Reproduce
Using Faker version 2.15.1:
This iban has an invalid checksum (https://www.ibancalculator.com/iban_validieren.html)
The text was updated successfully, but these errors were encountered: