Repository navigation
Reject Norwegian org numbers not starting with 8 or 9 - #523
Open
mjanthony819 wants to merge 2 commits into
Open
mjanthony819 wants to merge 2 commits into
mjanthony819 wants to merge 2 commits into
Conversation
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.
stdnum.no.orgnraccepts any 9-digit number with a valid modulus 11 check digit, so numbers like100 000 008validate successfully. Norwegian organisation numbers are only assigned from number series starting with 8 or 9.Official sources:
Reject numbers whose first digit is not 8 or 9 with
InvalidComponent. The modulus 11 algorithm is unchanged.stdnum.no.mvadelegates to this validator, so Norwegian VAT numbers inherit the stricter check.Eight new regression cases pair a valid check digit with an invalid leading digit (0-7); all are accepted before the change and rejected after. Two constructed numbers starting with 8 and 9 confirm valid numbers remain accepted, alongside ten real numbers found online.
Validation on Python 3.10:
scripts/check_headers.pypasses.Fixes #275.
AI assistance covered research, implementation, tests and this description.