stdnum.do.cedula

Cedula (Dominican Republic national identification number).

A cedula is is an 11-digit number issues by the Dominican Republic government to citizens or residents for identification purposes.

>>> validate('00113918205')
'00113918205'
>>> validate('00113918204')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('0011391820A')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('22400022111')
'224-0002211-1'
stdnum.do.cedula.check_dgii(number, timeout=30)

Lookup the number using the DGII online web service.

This uses the validation service run by the the Dirección General de Impuestos Internos, the Dominican Republic tax department to lookup registration information for the number. The timeout is in seconds.

Returns a dict with the following structure:

{
    'cedula': '12345678901',  # The requested number
    'name': 'The registered name',
    'commercial_name': 'An additional commercial name',
    'status': '2',            # 1: inactive, 2: active
    'category': '0',          # always 0?
    'payment_regime': '2',    # 1: N/D, 2: NORMAL, 3: PST
}

Will return None if the number is invalid or unknown.

stdnum.do.cedula.compact(number)

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

stdnum.do.cedula.format(number)

Reformat the number to the standard presentation format.

stdnum.do.cedula.is_valid(number)

Check if the number provided is a valid cedula.

stdnum.do.cedula.validate(number)

Check if the number provided is a valid cedula.