NAME

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

VERSION

Version 0.62

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 VOCALINK It currently supports the document v6.90 drafted 24th Dec 2021.

Institutions covered by this document are below:

  • Allied Irish

  • Bank of England

  • Bank of Ireland

  • Bank of Scotland

  • Barclays

  • Bradford and Bingley Building Society

  • Charity Bank

  • Citibank

  • Clear Bank

  • Clydesdale

  • Contis Financial Services

  • Co-Operative Bank

  • Coutts

  • First Trust

  • Halifax

  • Hoares Bank

  • HSBC

  • Lloyds

  • Metro Bank

  • NatWest

  • Nationwide Building Society

  • Northern

  • Orwell Union Ltd.

  • Royal Bank of Scotland

  • Santander

  • Secure Trust

  • Starling Bank

  • Tesco Bank

  • TSB

  • Ulster Bank

  • Unity Trust Bank

  • Virgin Bank

  • Williams & Glyn

  • 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.

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;

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

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

METHODS

is_valid($sort_code, $account_number)

It expects two parameters i.e. the sort code and 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 applied to the given sort code and 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($account->get_trace);

AUTHOR

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

REPOSITORY

https://github.com/manwar/BankAccount-Validator-UK

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, and 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 (C) 2012 - 2021 Mohammad S Anwar.

This program is free software; you can redistribute it and / or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License.By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you,you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement,then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.