stdnum.za.tin

TIN (South African Tax Identification Number).

The South African Tax Identification Number (TIN or Tax Reference Number) is issued to individuals and legal entities for tax purposes. The number consists of 10 digits.

More information:

>>> validate('0001339050')
'0001339050'
>>> validate('2449/494/16/0')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('9125568')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('084308984-8')
'0843089848'
stdnum.za.tin.compact(number: str) str

Convert the number to the minimal representation.

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

stdnum.za.tin.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.za.tin.is_valid(number: str) bool

Check if the number is a valid South Africa Tax Reference Number.

stdnum.za.tin.validate(number: str) str

Check if the number is a valid South Africa Tax Reference Number.

This checks the length, formatting and check digit.