# stdnum.nz.ird

IRD number (New Zealand Inland Revenue Department (Te Tari Tāke) number).

The IRD number is used by the New Zealand Inland Revenue Department (Te Tari Tāke in Māori) to identify businesses and individuals for tax purposes. The number consists of 8 or 9 digits where the last digit is a check digit.

More information:

- https://www.ird.govt.nz/

- https://www.ird.govt.nz/-/media/Project/IR/PDF/2020RWTNRWTSpecificationDocumentv10.pdf

- https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/New%20Zealand-TIN.pdf

    >>> validate('4909185-0')
    '49091850'
    >>> validate('NZ 49-098-576')
    '49098576'
    >>> validate('136410133')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('9125568')
    Traceback (most recent call last):
        ...
    InvalidLength: ...
    >>> format('49098576')
    '49-098-576'

stdnum.nz.ird.calc_check_digit(number: str) → str

  Calculate the check digit.

  The number passed should not have the check digit included.

stdnum.nz.ird.compact(number: str) → str

  Convert the number to the minimal representation.

stdnum.nz.ird.format(number: str) → str

  Reformat the number to the standard presentation format.

stdnum.nz.ird.is_valid(number: str) → bool

  Check if the number is a valid IRD number.

stdnum.nz.ird.validate(number: str) → str

  Check if the number is a valid IRD number.