Skip to content

fix: support private company RUC with extended sequential#16

Merged
tavo1987 merged 2 commits into
masterfrom
hotfix/fix-private-ruc-7digit-sequential
Jan 8, 2026
Merged

fix: support private company RUC with extended sequential#16
tavo1987 merged 2 commits into
masterfrom
hotfix/fix-private-ruc-7digit-sequential

Conversation

@tavo1987

@tavo1987 tavo1987 commented Jan 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix validation for private company RUCs with 7-digit sequential numbers (>999999)
  • Per SRI official rules, these RUCs don't have a validatable check digit
  • Adds test coverage for extended sequential RUCs

Problem

Private company RUCs with extended sequential numbers were incorrectly marked as invalid with "Check digit validation failed" error, even though they are valid in SRI.

Solution

Per SRI official communication, when the sequential number exceeds 6 digits, the modulo 11 validation should be skipped. This PR:

  1. Adds hasExtendedSequential() helper method to detect 7-digit sequential
  2. Modifies performPrivateCompanyRucValidation() to skip modulo 11 for extended sequential
  3. Adds unit tests for extended sequential RUCs
  4. Updates existing test to use traditional 6-digit sequential RUC

Testing

All 96 tests pass.

Per SRI official communication, private company RUCs with sequential
numbers exceeding 6 digits (>999999) do not have a validatable check
digit. The modulo 11 validation is now skipped for these cases.

Changes:
- Add hasExtendedSequential() helper method to detect 7-digit sequential
- Modify performPrivateCompanyRucValidation() to skip modulo 11 for extended sequential
- Add unit tests for extended sequential RUCs
- Update existing test to use traditional 6-digit sequential RUC
- Improve hasExtendedSequential() with better documentation and edge case handling
- Add optimization: check if position 3 is '0' for quick traditional detection
- Add boundary tests for sequential starting with zero and exactly 1000000
@tavo1987 tavo1987 merged commit a97cc0b into master Jan 8, 2026
5 checks passed
@tavo1987 tavo1987 deleted the hotfix/fix-private-ruc-7digit-sequential branch January 8, 2026 22:01
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