Skip to content

Commit 0f94ca6

Browse files
committed
Support Ecuador public RUC with juridical format
It seems that numbers with a format used for juridical RUCs have been issued to companies. Closes #457
1 parent 928a09d commit 0f94ca6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

stdnum/ec/ruc.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,11 @@ def validate(number):
9999
except ValidationError:
100100
_validate_natural(number)
101101
elif number[2] == '9':
102-
# 9 = juridical RUC
103-
_validate_juridical(number)
102+
# 9 = juridical RUC (or public RUC)
103+
try:
104+
_validate_public(number)
105+
except ValidationError:
106+
_validate_juridical(number)
104107
else:
105108
raise InvalidComponent() # third digit wrong
106109
return number

tests/test_ec_ruc.doctest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ Normal juridical RUC values (third digit is 9) that should just work.
288288
... 1792141869001
289289
... 1792147638001
290290
... 1792373255001
291+
... 1793221293001
291292
... 1890001323001
292293
... 1890003628001
293294
... 1890037646001

0 commit comments

Comments
 (0)