NAME
Finance::Bank::Bankwest::Session - operate on an established Bankwest Online Banking session
VERSION
This module is part of distribution Finance-Bank-Bankwest v1.2.8.
This distribution's version numbering follows the conventions defined at semver.org.
SYNOPSIS
# prepare a WWW::Mechanize instance with the right cookies first
# (Finance::Bank::Bankwest->login does this for you)
my $mech = ...;
my $session = Finance::Bank::Bankwest::Session->new($mech);
for my $acct ($session->accounts) {
printf(
"Account %s has available balance %s\n",
$acct->number,
$acct->available_balance,
);
my @txns = $session->transactions(
account => $acct->number,
from_date => '31/12/2012',
);
for my $txn (@txns) {
printf(
"> Transaction: %s (%s)\n",
$txn->narrative,
$txn->amount,
);
}
}
$session->logout;
DESCRIPTION
This module provides the logic for operating on a Bankwest Online Banking session once that session has been established.
Directly creating a usable instance of this module requires a WWW::Mechanize instance with the correct cookies. Obtain a properly established session using "login" in Finance::Bank::Bankwest.
ATTRIBUTES
mech
The WWW::Mechanize instance used to communicate with the Bankwest Online Banking server. Needs to be pre-populated with the correct cookies. Required; use "login" in Finance::Bank::Bankwest to obtain a session object with the right one of these.
accounts_uri
The location of the page holding a list of accounts and their balances. Use the default value during normal operation.
transactions_uri
The location of the resource that provides transaction information. Use the default value during normal operation.
logout_uri
The location of the resource that closes the Bankwest Online Banking session on the remote server. Use the default value during normal operation.
METHODS
accounts
@accts = $session->accounts;
Returns a list of Finance::Bank::Bankwest::Account objects, each representing the details of an account. The list is ordered according to user-defined settings within the Bankwest Online Banking web interface.
See Finance::Bank::Bankwest::Account for further details on what information is returned per account.
transactions
@txns = $session->transactions(
account => '303-111 0012345', # required
from_date => '31/01/2013', # required
to_date => '28/02/2013', # optional
);
Returns a list of Finance::Bank::Bankwest::Transaction objects, each representing a single transaction. On failure, throws a Finance::Bank::Bankwest::Error::ExportFailed exception.
The following arguments are accepted:
account
-
account => '303-111 0012345' account => '5500 0000 0000 0004'
The full account number of a single account to which all returned transaction details belong. Must be in the same format as the "number" attribute of the Account objects returned by "accounts".
from_date
-
from_date => '31/12/2012'
A string in
DD/MM/YYYY
format representing the earliest date allowed in returned transactions (time is ignored). Cannot be a future date, and cannot be a date earlier than 1 January of the year before the last. to_date
-
to_date => undef # default to_date => '31/12/2013'
A string in
DD/MM/YYYY
format representing the latest date allowed in returned transactions. Cannot be before thefrom_date
, and cannot be a date later than 31 December of next year.Defaults to
undef
, causing all transactions with a date on or later than thefrom_date
to be returned.Transactions with a posted date occurring later than this date are not returned, even if those transactions actually occurred before or on this date. For example, setting both
from_date
andto_date
to a Saturday will probably result in nothing being returned because all transactions actually occurring on that day will probably have a posted date of the following Monday.
logout
$session->logout;
Close down the Bankwest Online Banking session. The session will no longer be usable.
This method should be called when the session is no longer needed so that Bankwest's server can release resources used by the session.
SEE ALSO
AUTHOR
Alex Peters <lxp@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Alex Peters.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
The full text of the license can be found in the LICENSE file included with this distribution.