Add Czech and Slovak IČO validation#504
Open
DMZ22 wants to merge 1 commit into
Open
Conversation
The IČO (Identifikační číslo osoby / Identifikačné číslo organizácie) is the 8-digit number that identifies a legal entity or sole trader in the Czech Republic and Slovakia, registered in the ARES and ORSR/RPO business registers. It carries a trailing weighted-modulo-11 check digit. For a legal entity the digits are the same as the Czech VAT number (DIČ) without the CZ prefix, so cz/ico reuses the check-digit algorithm already present in cz/dic for the 8-digit legal-entity form. The Slovak number is identical to the Czech one (until 1993 they were one country), so sk/ico delegates to cz/ico following the existing sk/rc -> cz/rc pattern. Detailed doctests validate 21 real Czech and 21 real Slovak numbers. Implements arthurdejong#450.
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.
This implements #450: validation for the IČO, the organisation identifier used in the Czech Republic and Slovakia.
Format
(11 - sum) % 11, mapped so a remainder of 0 →1).Relation to DIČ (raised in the issue)
For a legal entity the IČO is exactly the digits of the Czech VAT number (DIČ) without the
CZprefix, socz/icouses the same check-digit computation thatcz/dicalready applies to its 8-digit legal-entity form. The Slovak IČO is identical to the Czech one (until 1993 they were a single country), sosk/icodelegates tocz/ico, mirroring the existingsk/rc→cz/rcpattern.Sources
Tests
tests/test_cz_ico.doctestandtests/test_sk_ico.doctesteach bulk-validate 21 real numbers taken from public company records (e.g. Škoda Auto00177041, ČEZ45274649; Slovnaft31322832, Tatra banka00686930).NORMALIZE_WHITESPACE/IGNORE_EXCEPTION_DETAIL; every line of the new modules is exercised (100% coverage).Happy to add a
format()grouping or anIČO → DIČhelper if you'd find either useful.