fix(BY): allow digits in the Belarus bank identifier (4!c)#687
Open
spokodev wants to merge 1 commit into
Open
Conversation
The Belarus BBAN structure is 4!c4!n16!c per the ISO 13616 / SWIFT IBAN
Registry, so the 4-character bank identifier is alphanumeric (digits or
uppercase letters), not letters only. The regexp encoded it as [A-Z]{4},
which falsely rejects otherwise-valid Belarus IBANs whose bank code
contains a digit, e.g. BY26AKB10100000002966000000A (mod-97 check digits
are valid). The neighbouring branch field [0-9]{4} (4!n) and account
field [A-Z0-9]{16} (16!c) are already correct; only the bank field was
too strict. Change [A-Z]{4} to [A-Z0-9]{4}.
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.
Problem
The Belarus BBAN structure is
4!c4!n16!cper the ISO 13616 / SWIFT IBAN Registry, where the leading 4-character bank identifier is4!c— alphanumeric (digits or uppercase letters). The current spec encodes it as[A-Z]{4}(letters only):As a result, an otherwise-valid Belarus IBAN whose bank code contains a digit is rejected:
BY26AKB10100000002966000000Ais well-formed: 28 characters, BBAN4!c4!n16!c, and its mod-97 check digits are valid (remainder 1). The only reason it fails is the bank field rejecting the digit1.Fix
Change the bank field from
[A-Z]{4}to[A-Z0-9]{4}. The neighbouring branch field[0-9]{4}(4!n) and account field[A-Z0-9]{16}(16!c) are already correct, so this aligns the bank field with the same registry, consistent with prior BBAN-format corrections in this project.References
4!c4!n16!c, length 28.Test
Added an assertion that a Belarus IBAN with a digit in the bank code validates. It fails before the change and passes after; the full suite is green.