# stdnum.ro.cui

CUI or CIF (Codul Unic de Înregistrare, Romanian company identifier).

The CUI (Codul Unic de Înregistrare) is assigned to companies that are required to register with the Romanian Trade Register. The CIF (Codul de identificare fiscală) is identical but assigned to entities that have no such requirement. The names seem to be used interchangeably and some sources suggest that CIF is the new name for CUI.

This number can change under some conditions. The number can be prefixed with RO to indicate that the entity has been registered for VAT.

More information:

- https://ro.wikipedia.org/wiki/Cod_de_identificare_fiscală

    >>> validate('185 472 90')
    '18547290'
    >>> validate('185 472 91')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('RO 185 472 90')  # the RO prefix is ignored
    '18547290'

stdnum.ro.cui.calc_check_digit(number: str) → str

  Calculate the check digit.

stdnum.ro.cui.compact(number: str) → str

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

stdnum.ro.cui.is_valid(number: str) → bool

  Check if the number is a valid CUI or CIF number.

stdnum.ro.cui.validate(number: str) → str

  Check if the number is a valid CUI or CIF number. This checks the length, formatting and check digit.