Validation Rules

If you want to understand more about how we can declare the data you enter as valid or not, or are just curious about how it all works, then this is the topic for you.

Install Guide Errors Explained

Validation Rules

When you configure the Bank Validator Setup, you specify which validation rule should be used as the default. You can override the validation rule for individual bank accounts by selecting the hyperlink drill-down on the Bank Account Validation Result field. This topic is divided to explain the checks that are applied for each of the possible validation rules.

No Validation

You can use this option for foreign bank accounts (that have neither New Zealand or Australian bank account numbers). The validation algorithm for the No Validation option will always return valid, no matter what you enter in to the input fields. The Bank Account Validation Result will show the following text:

❔ Not validated.

New Zealand Bank Validation

Full Bank Account Number

The first step is to use the Bank Branch No. and Bank Account No. fields to make one full bank account number. The full bank account number is generated by taking the Bank Branch No. field and the Bank Account No. fields from the input page (such as the Bank Account Card, Vendor Bank Account Card, Customer Bank Account Card, or Employee Card) and concatenating the two fields into one long text element. If both the Bank Branch No. field and the Bank Account No. field contain values, they will be separated with a single “-“ character.

Standardise the Format

There is some variability in the lengths of the base account number and the suffix, so before we can validate the full bank account number, we normalise it to be in a consistent format using zeros to pad the account base and suffix to be eight and four digits in length.

BB-bbbb-AAAAAAAA-SSSS

BB - a two-digit bank code.

bbbb - a four-digit branch number.

AAAAAAAA - an eight-digit account base number, left padded with zeros.

SSSS - a four-digit account suffix, left padded with zeros.

The validation at this point can fail if there are insufficient digits or “-“ separators.

Determine the Algorithm to Use

We use the two-digit bank id and four-digit branch number to verify that the entered values exist in the Bank Branch Register provided by PaymentsNZ. Once we have ensured the numbers are valid we can determine which validation alogorithm to use for the bank account and account number base you have entered.

The algorithm to use tells us the following things:

  • An array of 18 weightings to be applied to each of the 18-digits of the normalised full bank account
  • A Modulo to be used to divide the weightings multiplied by the digits. The remainder (the modulus) should be zero for the number to be deemed valid
  • Whether this algorithm is a “special case”

Apply the Weightings

Each of the digits in the normalised account number is multiplied by the weighting for the digit in the particular algorithm. If the multiplication of the weighting is less than 10, or this algorithm is not a special case, we add the multiplication to a total result, otherwise we add the digits of the multiplication together until we end up with a single-digit number which will be added to the total result.

Apply the Modulo

The total result will be divided by the modulo for the algorithm and the remainder (the modulus) is compared to zero. If this is a valid bank account number, the modulus will be zero.

Australian Bank Validation

Full Bank Account Number

The first step is to use the Bank Branch No. and Bank Account No. fields to make one full bank account number. The full bank account number is generated by taking the Bank Branch No. field and the Bank Account No. fields from the input page (such as the Bank Account Card, Vendor Bank Account Card, Customer Bank Account Card, or Employee Card) and concatenating the two fields into one long text element. If both the Bank Branch No. field and the Bank Account No. field contain values, they will be separated with a single “-“ character.

Verify the Format

The full bank account is validated against the allowed format.

BBB-BBB-AAAAAAAAA

BBB-BBB - a seven-digit Bank State Branch number.

AAAAAAAAA - an account number (between six and nine digits).

The validation at this point can fail if there are insufficient digits or “-“ separators.

Validate BSB Number

We use the seven-digit Bank State Branch number to verify that the entered values exist in the BSB Directory provided by the Australian Payments Network. If the entered value is not found, a validation error will be displayed.