Repository navigation
6.1: IBAN and VAT ID sources with real check digits - #15
Merged
Merged
Conversation
Germany and Croatia run on ISO 7064 MOD 11,10, Austria on the BMF digit sum with its 96 minus sum step, the Netherlands and Poland on a weighted mod 11 and Italy on Luhn with the office code kept in the range that is handed out. The tests are calibrated against twelve registered VAT IDs of real companies and the worked example of the BMF specification before they judge the generator, and the validators run the arithmetic in the opposite direction: ISO 7064 via its closure property, the weighted schemes with the check digit weighted minus one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The structures come from the SWIFT IBAN registry, the mod 97 check digits from ISO 7064, and where a country keeps its own check digits inside the BBAN they are calculated as well: the Belgian mod 97 tail, the Spanish DC pair, the French and Monegasque RIB key, the Italian and Sammarinese CIN letter, the Norwegian, Estonian, Finnish, Hungarian, Polish and Icelandic schemes and the Portuguese and Slovenian ISO 7064 pairs. The tests are calibrated against the official registry example of all thirty seven countries and verify every national check the other way round, with the check digit weighted into the sum; a constructed number with fresh mod 97 digits but broken national digits has to fall through. TestBlzIbanSource builds German IBANs on bank codes starting with a nine: the Bundesbank hands out the clearing areas one to eight only and the current official bank code file holds no code starting with a nine, so the number provably names nobody's account. The README says clearly why that matters more for IBANs than for card numbers: a SEPA direct debit needs no second factor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Thirteen more prefixes from the official BMF construction rules document, each calibrated against its worked example: BE (mod 97 pair), DK and SK (divisibility by eleven with a redraw when no last digit fits), EE (weights 3, 7, 1 behind the fixed 10), FI (the unusual weights 7, 9, 10, 5, 8, 4, 2), GB and XI (MOD 97 and MOD 9755 with their excluded ranges), HU (weights 9, 7, 3, 1), IE (check letter mod 23 in the eight and nine character forms), LT (the double weight pass whose worked example exercises the fallback), LU (mod 89 pair), PT and SI (mod 11 with their asymmetric special cases) and SE (Luhn over the organisation number plus the 01 to 94 suffix). EL, ES, FR, CY, CZ, LV, MT, BG and RO have not agreed to a publication of their rules and stay out on purpose. The mutation test skips GB, XI, LT and PT, whose schemes can legitimately accept a mutated number; everywhere else no single digit change survives. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What is in here
Three sources in
holonsoft.AutoPoco.DataSources.Identifiers, plus the check digit helpers they need (Mod97,Iso7064Mod1110,WeightedMod11in the internalCheckDigits).IbanSource / NullableIbanSource
TestBlzIbanSource / NullableTestBlzIbanSource
VatIdSource / NullableVatIdSource
Verification
dotnet build -c Release: zero warnings.dotnet teston net8/9/10: 4518 passed, 12 known skips (~490 new tests for IBAN and VAT).No release with this PR; tagging 6.1.0 follows separately.
🤖 Generated with Claude Code