Alex Peters


Finance::Bank::Bankwest::Session - operate on an established Bankwest Online Banking session


This module is part of distribution Finance-Bank-Bankwest v1.2.1.

This distribution's version numbering follows the conventions defined at


    # 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) {
            "Account %s has available balance %s\n",
        my @txns = $session->transactions(
            account     => $acct->number,
            from_date   => '31/12/2012',
        for my $txn (@txns) {
                "> Transaction: %s (%s)\n",


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.



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.


The location of the page holding a list of accounts and their balances. Use the default value during normal operation.


The location of the resource that provides transaction information. Use the default value during normal operation.


The location of the resource that closes the Bankwest Online Banking session on the remote server. Use the default value during normal operation.



    @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.


    @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 => '303-111 0012345'

The BSB and account numbers of a single account to which all returned transaction details belong. Must be in BBB-BBB AAAAAAA format where B refers to a BSB digit and A refers to an account digit.

    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 => 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 the from_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 the from_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 and to_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.



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.



Alex Peters <>


This software is copyright (c) 2013 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.