Checks balances and transactions of MUFG-DIRECT account.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib/Finance/Bank/JP Checking in changes prior to tagging of version 0.07. Oct 21, 2012
t
xt initial commit Jun 26, 2012
.gitignore
.shipit
Changes
MANIFEST
MANIFEST.SKIP
META.yml
Makefile.PL
README
README.pod

README.pod

NAME

Finance::Bank::JP::MUFG - Checks account balances and transactions of MUFG-DIRECT account.

SYNOPSIS

use Finance::Bank::JP::MUFG;

my $mufg = Finance::Bank::JP::MUFG->new(
    contract_no => 'your_contract_no',
    password    => 'your_direct_password',
)->login;

my @accounts = $mufg->accounts;

for my $account (@accounts) {
    printf "%-s  %-s  %-7s %9syen %9syen\n",
        $account->branch,
        $account->account_kind,
        $account->account_no,
        commify($account->balance),
        commify($account->withdrawal_limit);
}

my @transactions = $mufg->transactions(
    account_no       => 1,
    transaction_kind => 1,
    period           => 1,
);

for my $transaction (@transactions) {
    printf "%-s  %-s  %-s  %syen  %syen  %syen  %-s\n",
        $transaction->date->ymd('/'),
        $transaction->abstract,
        $transaction->description,
        commify($transaction->outlay),
        commify($transaction->income),
        commify($transaction->balance),
        $transaction->memo;
}

my $csv_path = $mufg->download_transactions(
    account_no       => 1,
    transaction_kind => 1,
    period           => 4,
    from             => '2012/9/1',
    to               => '2012/10/12',
    save_dir         => '/tmp',
    to_utf8          => 0,
);

say $csv_path;

$mufg->logout;

DESCRIPTION

This module provides methods to access data from MUFG-DIRECT accounts, including account balances and recent transactions. It also provides a method to download data in CSV format from a given date or date range.

CONSTRUCTOR AND STARTUP

new( %options )

Creates and returns a new Finance::Bank::JP::MUFG object.

my $mufg = Finance::Bank::JP::MUFG->new( ... );

This constructor has to pass two parameters of the Contract Number and Password.

contract_no => 'your_contract_no',
password    => 'your_direct_password',

You can also specify the user agent.

agent => [alias]

The list of valid aliases is:

  • Windows IE 6

  • Windows Mozilla

  • Mac Safari

  • Mac Mozilla(Default value)

  • Linux Mozilla

  • Linux Konqueror

METHODS

$mufg->login()

Runs login process and returns a self object. Be sure to call after object creation.

$mufg->accounts()

Returns an array of all the account balances. This array stores Finance::Bank::JP::MUFG::Account objects, and you can access with the following accessors.

  • branch

  • account_kind

  • account_no

  • balance

  • withdrawal_limit

$mufg->transactions( %options )

Specify as follows, passing the hash to the argument.

  • account_no => [1|2|3|..N]

    Choose which account to retrieve data. Default value is 1 and which is optional.

  • transaction_kind => [1|2|3|4]

    Choose transaction kinds. Default value is 1 and which is optional.

    1 ALL
    2 MONEY RECEIVED
    3 WITHDRAWAL
    4 TRANSFER PAYMENT
  • period => [1|2|3|4]

    Choose period to retrieve data. Default value is 1 and which is optional.

    1 From the beginning of one month ago until today
    2 Recent 10 days
    3 Specified date
    4 Specified period
  • date => '%Y/%m/%d'

    If period's value is 3, specified date is used. Default value is today and which is optional.

  • from => '%Y/%m/%d'

    If period's value is 4, specified date is used. This parameter is required.

  • to => '%Y/%m/%d'

    If period's value is 4, specified date is used. Default value is today and which is optional.

Returns an array of transactions. This array stores Finance::Bank::JP::MUFG::Transaction objects, and you can access with the following accessors.

  • date

  • abstract

  • description

  • outlay

  • income

  • balance

  • memo

$mufg->download_transactions( %options )

Returns a saved path. Specify as follows, passing the hash to the argument.

  • account_no => [1|2|3|..N]

    Choose which account to retrieve data. Default value is 1 and which is optional.

  • transaction_kind => [1|2|3|4]

    Choose transaction kinds. Default value is 1 and which is optional.

    1 ALL
    2 MONEY RECEIVED
    3 WITHDRAWAL
    4 TRANSFER PAYMENT
  • period => [1|2|3|4]

    Choose period to retrieve data. Default value is 1 and which is optional.

    1 From the beginning of one month ago until today
    2 Recent 10 days
    3 Specified date
    4 Specified period
  • date => '%Y/%m/%d'

    If period's value is 3, specified date is used. Default value is today and which is optional.

  • from => '%Y/%m/%d'

    If period's value is 4, specified date is used. This parameter is required.

  • to => '%Y/%m/%d'

    If period's value is 4, specified date is used. Default value is today and which is optional.

  • save_dir => '/path/to/save_dir'

    Set the save directory.

  • to_utf8 => [0|1]

    Set a flag. If flag is off, CSV's charset is cp932. Default is off and which is optional.

AUTHOR

Yusuke Maeda <dev.perfumed.garden@gmail.com>

FINANCE::BANK::JP::MUFG'S GIT REPOSITORY

Finance::Bank::JP::MUFG is hosted at GitHub.

Repository: https://github.com/perforb/p5-Finance-Bank-JP-MUFG

SEE ALSO

MUFG-DIRECT

WWW::Mechanize

HTML::TreeBuilder::XPath

HTML::Selector::XPath

Finance::Bank::JP::MUFG::Account

Finance::Bank::JP::MUFG::Transaction

LICENSE

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