Finance-Bank-AllianceAndLeicester

 view release on metacpan or  search on metacpan

lib/Finance/Bank/AllianceAndLeicester.pm  view on Meta::CPAN

    $overdraft = 0 if ($overdraft eq 'n/a');

    # Get the available balance.
    $stream->get_tag('td');
    $available_balance = $stream->get_trimmed_text('/td');

    # Strip pounds signs from balances.
    $balance   =~ s/^\x{00A3}//;
    $overdraft =~ s/^\x{00A3}//;
    $available_balance =~ s/^\x{00A3}//;

    # Strip Comma ',' from balances.
    $balance   =~ s/\,//g;
    $overdraft =~ s/\,//g;
    $available_balance =~ s/\,//g;

    # Add to list of accounts to return.
    push(@accounts, {balance           => $balance,
                     name              => $name,
                     overdraft         => $overdraft,
                     account           => $account,
                     available_balance => $available_balance});
  }

  return @accounts;
}

1;

__END__

=head1 NAME

Finance::Bank::AllianceAndLeicester - Check your Alliance & Leicester bank
accounts from Perl

=head1 SYNOPSIS

  use Finance::Bank::AllianceAndLeicester;
  my @accounts = Finance::Bank::AllianceAndLeicester->check_balance(
      customerid  => '01234567',
      pin         => '12345',
      memorable   => 'mybirthplace',
      phrase      => 'my unique phrase'
  );

  foreach (@accounts) {
      printf("%8s(%20s):  GBP %8.2f " .
             "(Overdraft: GBP %8.2f Available: GBP %8.2f)\n",
             $_->{account}, $_->{name},
             $_->{balance}, $_->{overdraft}, $_->{available_balance});
  }

=head1 DESCRIPTION

This module provides a rudimentary interface to the Alliance & Leicester
online banking system at L<https://www.mybank.alliance-leicester.co.uk/>.

=head1 DEPENDENCIES

You will need either L<Crypt::SSLeay> or L<IO::Socket::SSL> installed
for HTTPS support to work with LWP.  This module also depends on
L<WWW::Mechanize> and L<HTML::TokeParser> for screen-scraping.

=head1 CLASS METHODS

=over

=item B<check_balance>

  check_balance ( customerid => $c,
                  pin        => $p,
                  memorable  => $m,
                  phrase     => $s )

Return an array of account hashes, one for each of your bank accounts.

=item customerid

The Customer ID is the 8-digit number supplied with your account.

=item pin

Your 5-digit PIN number.

=item memorable

This is your memorable information, such as your birth place.
This is asked for when you first login to your bank account.

=item phrase

Your unique phrase. This is used to make sure we are connecting to
the Alliance & Leicester website and that the connection has not been hijacked.

This is created when you first sign up for online access to your account, and
can be changed on the Alliance & Leicester internet banking website.

=back

=head1 ACCOUNT HASH KEYS

  $ac->account
  $ac->name
  $ac->balance
  $ac->overdraft
  $ac->available_balance

Return the account number, account name (e.g. 'PlusSaver'), account
balance, account overdraft limit and available balance as a signed floating
point value.

=head1 WARNING

This warning is from Simon Cozens' L<Finance::Bank::LloydsTSB>, and seems
just as apt here.

This is code for B<online banking>, and that means B<your money>, and
that means B<BE CAREFUL>. You are encouraged, nay, expected, to audit
the source of this module yourself to reassure yourself that I am not
doing anything untoward with your banking data. This software is useful



( run in 1.715 second using v1.01-cache-2.11-cpan-364913b4093 )