Skip to content

Fix bank identifier after SI for SK, SM, SO, ST, SV, TL, TN, TR, UA, VA, VG and XK - #694

Open
poputu wants to merge 2 commits into
Simplify:masterfrom
poputu:fix-bank-identifier-after-si
Open

poputu wants to merge 2 commits into
Simplify:masterfrom
poputu:fix-bank-identifier-after-si

Conversation

@poputu

@poputu poputu commented Oct 20, 2026 •

Copy link
Copy Markdown

Changes proposed in this pull request:

  • extractIBAN() now returns bankIdentifier for SK, SM, SO, ST, SV, TL, TN, TR, UA, VA, VG and XK. For example, extractIBAN('UA213223130000026007233566001').bankIdentifier was undefined and is now '322313', the registry's bank identifier example for UA.
  • Cause: in script/registry.txt, SI's "Bank identifier position within the BBAN" cell is a quoted value with a line break ("1-5 on line 11, the closing " on line 12). builder.rb read the file line by line, so it ignored line 12, which holds the positions of the 12 countries after SI. The same bug made the builder emit bank_identifier: '-1-4' for SI, which Fixed specs for Slovenian IBAN #452 corrected by hand.
  • script/builder.rb now reads the registry with CSV.read(..., col_sep: "\t"), so a quoted cell can span lines. (It also drops trailing spaces from two blank lines.)
  • src/ibantools.ts: added bank_identifier for the 12 countries, converted from the registry's 1-based positions (UA 1-6 → 0-5, SM 2-6 → 1-5, and so on). Nothing else changes; composeIBAN, validation and getCountrySpecifications() don't read bank_identifier.
  • script/iban_spec.js is the regenerated output. Besides the 12 additions, SI now shows the registry's values (bank_identifier: '0-4', account_indentifier: '4-19') instead of Fixed specs for Slovenian IBAN #452's hand edit. src/ibantools.ts keeps Fixed specs for Slovenian IBAN #452's SI values and tests.

Tests: a bankIdentifier test for each of the 12 countries using the registry's example IBAN, and a full extractIBAN() block for UA. For ST the registry's example IBAN has invalid check digits, so the test uses ST68000100010051845310112; its bank and branch codes (0001) match the registry's examples. Without the src change, 13 of the new tests fail. With it, npm run all passes and coverage is unchanged.

Tests (check [x] one of those)

  • I have added test(s)

ChangeLog

  • I have added entry in ChangeLog file (if not, please do so)

@poputu poputu changed the title Fix bank identifier after si for SK, SM, SO, ST, SV, TL, TN, TR, UA, VA, VG and XK Fix bank identifier after SI for SK, SM, SO, ST, SV, TL, TN, TR, UA, VA, VG and XK Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant