NAME

Finance::Bank::Natwest - Check your Natwest bank accounts from Perl

DESCRIPTION

This module provides a rudimentary interface to the Natwest online banking system at https://www.nwolb.com/. You will need either Crypt::SSLeay or IO::Socket::SSL installed for HTTPS support to work with LWP.

SYNOPSIS

  my $nw = Finance::Bank::Natwest->new( credentials => 'Constant',
                                        credentials_options => {
                                           dob => '010179',
                                           uid => '0001',
                                           password => 'Password',
                                           pin => '4321' } );

  my @accounts = $nw->accounts;

  foreach (@accounts) {
        printf "%25s : %6s / %8s : GBP %8.2f\n",
          $_->{name}, $_->{sortcode}, $_->{account}, $_->{available};
  }

METHODS

new
  my $nw = Finance::Bank::Natwest->new( credentials => 'Constant',
                                        credentials_options => {
                                           dob => '010179',
                                           uid => '0001',
                                           password => 'Password',
                                           pin => '4321' }
  );

  # Or create the credentials object ourselves
  my $credentials = Finance::Bank::Natwest::CredentialsProvider::Constant->new(
     dob => '010179', uid => '0001', password => 'Password', pin => '4321' );

  my $nw = Finance::Bank::Natwest->new( credentials => $credentials );

new can be called in two different ways. It can take a single parameter, credentials, which will accept an already created credentials object, of type Finance::Bank::Natwest::CredentialsProvider::*. Alternatively, it can take two parameters, credentials and credentials_options. In this case credentials is the name of a credentials class to create an instance of, and credentials_options is a hash of the options to pass-through to the constructor of the chosen class.

If the second form of new is being used, and the chosen class is not one of the ones supplied as standard then it will need to be required first.

If any errors occur then new will croak.

accounts
  my @accounts = $nw->accounts;

  # Or get a list ref instead
  my $accounts = $nw->accounts;

Returns a list containing a summary of any accounts available from the supplied credentials. Each item in the list is a hash reference that holds summary information for a single account, and contains this data:

name - the name of the account
account - the account number
sortcode
balance
available - the currently available funds

WARNING

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

This is code for online banking, and that means your money, and that means 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 to me, but is provided under NO GUARANTEE, explicit or implied.

NOTES

This has only been tested on my own accounts. I imagine it should work on any account types, but I can't guarantee this.

TODO

convert remaining existing functionality

I still have ministatement, direct debit and standing order functionality to copy over from my earlier, unreleased version of this code, along with ways of accessing accounts by name or account/sortcode alongside the list layout.

more tests
add bill payments
add statement querys
add statement downloads

BUGS

There are sure to be some bugs lurking in here somewhere. If you find one, please report it via RT

THANKS

Simon Cozens for Finance::Bank::LloydsTSB. Various members of London.pm for prodding me occasionally to come back to this and do some more on it.

AUTHOR

Jody Belka knew@cpan.org

COPYRIGHT AND LICENSE

Copyright 2003 by Jody Belka

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