NAME

BankAccount::Validator::UK - Interface to validate UK bank account.

VERSION

Version 0.01

DESCRIPTION

The module uses the algorithm provided by VOCALINK to validate the bank sort code and account number. It is done by modulus checking method as specified in the document which is available on their website http://www.vocalink.com/payments/payment-support-services.aspx/modulus-checking.aspx

It currently supports the document version 2.40 published on 23rd April'2012.

Institutions covered by this document are below:

  • Allied Irish

  • Bank of England

  • Bank of Ireland

  • Bank of Scotland

  • Barclays

  • Bradford and Bingley Building Society

  • Citibank

  • Clydesdale

  • Co-Operative Bank

  • Coutts

  • First Trust

  • Halifax

  • Hoares Bank

  • HSBC

  • Lloyds TSB

  • NatWest

  • Nationwide Building Society

  • Northern

  • Royal Bank of Scotland

  • Santander

  • Secure Trust

  • Ulster Bank

  • Virgin Bank

  • Woolwich

  • Yorkshire Bank

NOTE

If the modulus check shows the account number as valid this means that the account number is a possible account number for the sorting code but does'nt necessarily mean that it's an account number being used at that sorting code. Any account details found as invalid should be checked with the account holder where possible.

METHODS

CONSTRUCTOR

The constructor simply expects debug flag, which is optional. By the default the debug flag is off.

use strict; use warnings;
use BankAccount::Validator::UK;

my ($account);
# Debug is turned off.
$account = BankAccount::Validator::UK->new();

# Debug is turned on.
$account = BankAccount::Validator::UK->new(1);

is_valid()

It expects two(2) parameters, first the sort code & then the account number. The sort code can be either nn-nn-nn or nnnnnn format. If the account number starts with 0 then its advisable to pass in as string i.e. '0nnnnnnn'.

use strict; use warnings;
use BankAccount::Validator::UK;

my $account = BankAccount::Validator::UK->new();
print "[10-79-99][88837491] is valid.\n" 
    if $account->is_valid(107999, 88837491);

print "[18-00-02][00000190] is valid.\n" 
    if $account->is_valid('18-00-02', '00000190');

get_trace()

Returns the trace information about each rule that was applied to the given sortcode & account number.

use strict; use warnings;
use Data::Dumper;
use BankAccount::Validator::UK;

my $account = BankAccount::Validator::UK->new();
print "[87-14-27][09123496] is valid.\n" 
    if $account->is_valid('871427', '09123496');

print "Trace information:\n" . Dumper($self->get_trace();

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-bankaccount-validator-uk at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=BankAccount-Validator-UK. I will be notified, & then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc BankAccount::Validator::UK

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2012 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either : the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

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.