The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Business::BankAccount::NZ - validates New Zealand bank account numbers

SYNOPSIS

  use Business::BankAccount::NZ;
  
  # Returns a hash table with bank data in it (if specified)
  my $nz = Business::BankAccount::NZ->new(
      bank_no => '030510',
      account_no => '072049700'
  );
  
  # Or set the bank and account numbers independantly of new()
  my $nz = Business::BankAccount::NZ->new();
  $nz->set_bank_no('086523');
  $nz->set_account_no('1954512001');
  
  # Either way, you'd validate the account number with...
  $nz->validate() or die "$nz->{error_string}";
  
  print $nz->{error_string} if ($nz->{error});
  
  print "The bank name is " . $nz->{bank_name} . "\n";

DESCRIPTION

This module provides validation on New Zealand bank account numbers.

The extent of the validation is simply that the account number is checked to ensure that it conforms with the notion of an account number laid out in the 'Bank Account Number Check Digit Validation Routines' brochure prepared by the Bank of New Zealand, dated 27 October, 1999.

Thus the module does not tell you whether or not a given bank account number is an actual account known to the bank, just that it is a valid number according to their rules.

The module uses validation code developed by John Bolland.

METHODS

new

The minimum invocation is:

  use Business::BankAccount::NZ;
  $nz = Business::BankAccount::NZ->new(
      bank_no => '033565', 
      account_no => '384642737'
  );
  $nz->validate();

set_bank_no

Sets the bank number against whose rules we wish to validate an account number.

  $nz->set_bank_no('168392');

set_account_no

Sets the account number we wish to validate.

    $nz->set_account_no('02836723000');

validate

  $nz->validate();

This method checks the bank number and validates the account number.

The validation is based rules set out in the 'Bank Account Number Check Digit Validation Routines' brochure prepared by the Bank of New Zealand, dated 27 October, 1999.

The "error" and "error_string" attributes are set if validate() fails. The "bank_name" attribute contains the bank name identified by the bank number.

  $nz->validate() or die "$nz->{error_string}";
  print $nz->{error_string} if ($nz->{error});
  
  print "The bank name is " . $nz->{bank_name} . "\n";

DISCLAIMER

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

But do let us know if it gives you any problems.

AUTHORS

    Becky Alcorn, Unisolve Pty Ltd
    Simon Taylor, Unisolve Pty Ltd
    John Bolland, Mainzeal Property and Construction Ltd

Copyright 2002, Unisolve Pty Ltd All rights reserved

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Address bug reports and comments to: simon@unisolve.com.au

SEE ALSO

Business::CreditCard