Perl interface to the permanenttsb open24 homebanking on http://www.open24.ie
This is a set of functions that can be used in your Perl code to perform some operations with a Permanent \s-1TSB\s0 homebanking account.
Features:
account(s) balance: retrieves the balance for all the accounts you have set up (current account, visa card, etc.)
account(s) statement: retrieves the statement for a particular account, in a range of date.
mobile phone top-up (to be implemented): top up your mobile phone!
funds transfer (to be implemented): transfer money between your accounts or third party accounts.
The constants below are used with the account_statement() function:
\*(C`ALL\*(C': shortcut for (\s-1WITHDRAWAL\s0 and \s-1DEPOSIT\s0);
\*(C`WITHDRAWAL\*(C': shows only the WITHDRAWALs;
\*(C`DEPOSIT\*(C': shows only the DEPOSITs;
\*(C`VISA_ACCOUNT\*(C': the account refers to a Visa Card;
\*(C`SWITCH_ACCOUNT\*(C': the account is a normal Current Account;
Every function in this module requires, as the first argument, a reference to an hash which contains the configuration:
my %config = ( "open24numba" => "your open24 number", "password" => "your internet password", "pan" => "your personal access number", "debug" => 1, );
This is a private function used by other function within the module. You don't need to call it directly from you code!
This function performs the login. It takes just one required argument, which is an hash reference for the configuration. The function returns true (1) if success or undef for any other state. If debug => 1 then it will dump the html page on the current working directory. Please be aware that this has a security risk. The information will persist on your filesystem until you reboot your machine (and /var/tmp get clean at boot time). This is a private function used by other function within the module. You don't need to call it directly from you code!
This is used for the second step of the login process. The web interface ask you to insert 3 of the 6 digits that form the \s-1PAN\s0 code. The \s-1PAN\s0 is a secret code that only the PermanentTSB customer knows. If your \s-1PAN\s0 code is 123234 and the web interface is asking for this:
The function will fill out the form providing 2,3,4 respectively.
This function doesn't return anything. This function require the configuration hash reference as argument. It returns an reference to an array of hashes, one hash for each account. In case of error it return undef; Each hash has these keys:
'accname': account name, i.e. \*(L"Switch Current A/C\*(R".
'accno': account number. An integer representing the last 4 digits of the account.
'accbal': account balance. In \s-1EURO\s0.
Here is an example:
$VAR1 = { 'availbal' => 'euro amount', 'accno' => '0223', 'accbal' => 'euro amount', 'accname' => 'Switch Current A/C' }; $VAR2 = { 'availbal' => 'euro amount', 'accno' => '2337', 'accbal' => 'euro amount', 'accname' => 'Visa Card' };
The array can be printed using, for example, a foreach loop like this one:
foreach my $acc (@$balance) { printf ("%s ending with %s: %s\n", $acc->{'accname'}, $acc->{'accno'}, $acc->{'accbal'} ); } This function requires 4 mandatory arguments, the 5th is optional.
The function returns an reference to an array of hashes, one hash for each row of the statement. The array of hashes can be printed using, for example, a foreach loop like this one:
foreach my $row (@$statement) { printf("%s | %s | %s | %s \n", $row->{date}, $row->{description}, $row->{euro_amount}, $row->{balance}); }
Undef is returned in case of error;
To install this module type the following:
perl Makefile.PL make make test make install
This module requires these other modules and libraries:
WWW::Mechanize HTML::TokeParser Date::Calc
Project homepage on Google code (with \s-1SVN\s0 repository): http://code.google.com/p/finance-bank-ie-permanenttsb <http://code.google.com/p/finance-bank-ie-permanenttsb>
Project homepage on \s-1CPAN\s0.org: http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/ <http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/>
use Finance::Bank::IE::PermanentTSB;
my %config = ( "open24numba" => "your open24 number", "password" => "your internet password", "pan" => "your personal access number", "debug" => 1, # <- enable debug messages );
my $balance = Finance::Bank::IE::PermanentTSB->check_balance(\%config);
if(not defined $balance) { print "Error!\n" exit; }
foreach my $acc (@$balance) { printf ("%s ending with %s: %s\n", $acc->{'accname'}, $acc->{'accno'}, $acc->{'accbal'} ); }
my $statement = Finance::Bank::IE::PermanentTSB->account_statement( \%config, SWITCH_ACCOUNT, '2667','2008/12/01','2008/12/31');
if(not defined $statement) { print "Error!\n" exit; }
foreach my $row (@$statement) { printf("%s | %s | %s | %s |\n", $row->{date}, $row->{description}, $row->{euro_amount}, $row->{balance} ); }
ptsb - \s-1CLI\s0 tool to interact with your home banking http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/ptsb <http://search.cpan.org/~pallotron/Finance-Bank-IE-PermanentTSB/ptsb>
Ronan Waider's \*(C`Finance::Bank::IE::BankOfIreland\*(C' - http://search.cpan.org/~waider/Finance-Bank-IE/ <http://search.cpan.org/~waider/Finance-Bank-IE/>
Angelo \*(L"pallotron\*(R" Failla, <[email protected]> - <http://www.pallotron.net> - <http://www.vitadiunsysadmin.net>
Copyright (C) 2009 by Angelo \*(L"pallotron\*(R" Failla
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.