NAME

Finance::Bank::IE::PermanentTSB - Perl Interface to the PermanentTSB Open24 homebanking on http://www.open24.ie

DESCRIPTION

This is a set of functions that can be used in your Perl code to perform some operations with a Permanent TSB 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.

CONSTANTS

The constants below are used with the account_statement() function:

  • ALL: shortcut for (WITHDRAWAL and DEPOSIT);

  • WITHDRAWAL: shows only the WITHDRAWALs;

  • DEPOSIT: shows only the DEPOSITs;

  • VISA_ACCOUNT: the account refers to a Visa Card;

  • SWITCH_ACCOUNT: the account is a normal Current Account;

METHODS / FUNCTIONS

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,
);

$boolean = login($config_ref) - private

    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 false (0) 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).

set_pan_fields($config_ref) - private

    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 PAN code. The PAN is a secret code that only the PermanentTSB customer knows. If your PAN code is 123234 and the web interface is asking for this:

    Digit no. 2:
    Digit no. 5:
    Digit no. 6:

    The function will fill out the form providing 2,3,4 respectively.

    This function doesn't return anything.

@accounts_balance = check_balance($config_ref) - public

    This function require the configuration hash reference as argument. It returns 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. "Switch Current A/C".

    • 'accno': account number. An integer representing the last 4 digits of the account.

    • 'accbal': account balance. In EURO.

    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'}
        );
    }

@account_statement = account_statement($config_ref, $acc_tupe, $acc_no, $from, $to, [$type]) - public

    This function requires 4 mandatory arguments, the 5th is optional.

    1. $config_ref: the hash reference to the configuration
    2. $acc_type: this is a constant: can be VISA_ACCOUNT or SWITCH_ACCOUNT
    3. $acc_no: this is a 4 digits field representing the last 4 digits of the account number (or Visa card number)
    4. $from: from date, in format dd/mm/yyyy
    5. $to: to date, in format dd/mm/yyyy
    6. $type (optional): type of statement (optional). Default: ALL. It can be WITHDRAWAL, DEPOSIT or ALL.

    The function returns 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;

INSTALLATION

To install this module type the following:

perl Makefile.PL
make
make test
make install

DEPENDENCIES

This module requires these other modules and libraries:

WWW::Mechanize
HTML::TokeParser
Date::Calc

MODULE HOMEPAGES

SYNOPSIS

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);
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 Current A/C - 2667','2008/12/01','2008/12/31');

Finance::Bank::IE::PermanentTSB->logoff(\%config);

SEE ALSO

AUTHOR

Angelo "pallotron" Failla, <pallotron@freaknet.org> - http://www.pallotron.net - http://www.vitadiunsysadmin.net

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Angelo "pallotron" 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.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 666:

'=item' outside of any '=over'

Around line 682:

You forgot a '=back' before '=head1'