stdnum.cr.cpj

CPJ (Cédula de Persona Jurídica, Costa Rica tax number).

The Cédula de Persona Jurídica (CPJ) is an identifier of legal entities for tax purposes.

This number consists of 10 digits, the first indicates the class of juridical person, followed by a 3 digit sequence number identifying the type of juridical person, followed by 6 digits sequence number assigned by Registro Nacional de la República de Costa Rica.

More information:

>>> validate('3-101-999999')
'3101999999'
>>> validate('3-534-123559')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('310132541')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('4 000 042138')
'4-000-042138'
stdnum.cr.cpj.compact(number)

Convert the number to the minimal representation.

This strips the number of any valid separators and removes surrounding whitespace.

stdnum.cr.cpj.format(number)

Reformat the number to the standard presentation format.

stdnum.cr.cpj.is_valid(number)

Check if the number is a valid Costa Rica CPJ number.

stdnum.cr.cpj.validate(number)

Check if the number is a valid Costa Rica CPJ number.

This checks the length and formatting.