stdnum.ec.ruc

RUC (Registro Único de Contribuyentes, Ecuadorian company tax number).

The RUC is a tax identification number for legal entities. It has 13 digits where the third digit is a number denoting the type of entity.

>>> validate('1792060346-001')
'1792060346001'
>>> validate('1763154690001')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('179206034601')  # too short
Traceback (most recent call last):
    ...
InvalidLength: ...
stdnum.ec.ruc.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.ec.ruc.is_valid(number)

Check if the number provided is a valid RUC number. This checks the length, formatting and check digit.

stdnum.ec.ruc.validate(number)

Check if the number provided is a valid RUC number. This checks the length, formatting, check digit and check sum.