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: str) str

Convert the number to the minimal representation.

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

stdnum.cr.cpj.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.cr.cpj.is_valid(number: str) bool

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

stdnum.cr.cpj.validate(number: str) str

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

This checks the length and formatting.