stdnum.nz.bankaccount

New Zealand bank account number

The New Zealand bank account numbers consist of 16 digits. The first two represent the bank, followed by four for the branch, seven digits for the account base number and three for the account type.

More information:

>>> validate('01-0242-0100194-00')
'0102420100194000'
>>> validate('01-0242-0100195-00')  # invalid check digits
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('01-9999-0100197-00')  # invalid branch
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> format('0102420100194000')
'01-0242-0100194-000'
stdnum.nz.bankaccount.compact(number)

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

stdnum.nz.bankaccount.format(number)

Reformat the number to the standard presentation format.

stdnum.nz.bankaccount.info(number)

Return a dictionary of data about the supplied number. This typically returns the name of the bank and branch and a BIC if it is valid.

stdnum.nz.bankaccount.is_valid(number)

Check if the number provided is a valid bank account number.

stdnum.nz.bankaccount.validate(number)

Check if the number provided is a valid bank account number.