stdnum.au.tfn

TFN (Australian Tax File Number).

The Tax File Number (TFN) is issued by the Australian Taxation Office (ATO) to taxpaying individuals and organisations. A business has both a TFN and an Australian Business Number (ABN).

The number consists of 8 (older numbers) or 9 digits and includes a check digit but otherwise without structure.

More information:

>>> validate('123 456 782')
'123456782'
>>> validate('999 999 999')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('123456782')
'123 456 782'
stdnum.au.tfn.checksum(number: str) int

Calculate the checksum.

stdnum.au.tfn.compact(number: str) str

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

stdnum.au.tfn.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.au.tfn.is_valid(number: str) bool

Check if the number is a valid TFN.

stdnum.au.tfn.validate(number: str) str

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