stdnum.ro.cf

CF (Cod de înregistrare în scopuri de TVA, Romanian VAT number).

The Romanian CF is used for VAT purposes and can be from 2 to 10 digits long.

>>> validate('RO 185 472 90')
'18547290'
>>> validate('185 472 91')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('1630615123457')  # personal code
'1630615123457'
stdnum.ro.cf.calc_check_digit(number)

Calculate the check digit for organisations. The number passed should not have the check digit included.

stdnum.ro.cf.compact(number)

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

stdnum.ro.cf.is_valid(number)

Check if the number is a valid VAT number.

stdnum.ro.cf.validate(number)

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