Register ISO 7064 mod 97-10 checksum for BA, not BT (#264)#292
Merged
mdomke merged 1 commit intoJun 30, 2026
Merged
Conversation
The ISO 7064 mod 97-10 national checksum algorithm was registered for the country code 'BT' (Bhutan, which has no IBAN), although the comment names Bosnia and Herzegovina. Bosnia's country code is 'BA', so BA IBANs never had their national checksum validated and an IBAN with invalid national check digits passed validate_bban. Register the algorithm for 'BA'. Verified against real BA IBANs (they pass) and a BA IBAN with corrupted national check digits (now correctly rejected). Closes mdomke#264.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
- Coverage 94.30% 93.97% -0.34%
==========================================
Files 22 22
Lines 1211 1211
Branches 93 93
==========================================
- Hits 1142 1138 -4
- Misses 55 58 +3
- Partials 14 15 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #264
In
schwifty/checksum/iso7064_mod97_10.pythe ISO 7064 mod 97-10 national checksum algorithm is registered forBT:But the country code for Bosnia and Herzegovina is
BA—BTis Bhutan, which is not part of the IBAN registry. So the algorithm was attached to a non-IBAN country, andBAIBANs never had their national checksum validated:Fix
Register the algorithm for
BAinstead ofBT.Verified that Bosnia genuinely uses this algorithm: real
BAIBANs (e.g.BA391290079401028494,BA391011606058553319) passvalidate_bban=True, while aBAIBAN with corrupted national check digits is now correctly rejected withInvalidBBANChecksum. The other countries in the list (ME/MK/PT/RS/SI/TL) are unchanged.Tests
Added two assertions to
test_validate_national_checksum(valid BA passes, corrupted BA raises). They fail onmainand pass with the fix. Full suite stays green (395 tests). Added a CHANGELOG entry.