-
-
Save zhiephie/b602039489bf0eba521a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Finance::Bank::ID::BCA; | |
# FBI::BCA uses Log::Any. to show logs using, e.g., Log4perl: | |
use Log::Log4perl qw(:easy); | |
use Log::Any::Adapter; | |
Log::Log4perl->easy_init($DEBUG); | |
Log::Any::Adapter->set('Log4perl'); | |
my $ibank = Finance::Bank::ID::BCA->new( | |
username => 'ABCDEFGH1234', # opt if only using parse_statement() | |
password => '123456', # idem | |
verify_https => 1, # default is 0 | |
#https_ca_dir => '/etc/ssl/certs', # default is already /etc/ssl/certs | |
); | |
eval { | |
$ibank->login(); # dies on error | |
my @accts = $ibank->list_accounts(); | |
my $bal = $ibank->check_balance($acct); # $acct is optional | |
my $stmt = $ibank->get_statement( | |
account => ..., # opt, default account will be used if undef | |
days => 31, # opt | |
start_date => DateTime->new(year=>2009, month=>10, day=>6), | |
# opt, takes precedence over 'days' | |
end_date => DateTime->today, # opt, takes precedence over 'days' | |
); | |
print "Transactions: "; | |
for my $tx (@{ $stmt->{transactions} }) { | |
print "$tx->{date} $tx->{amount} $tx->{description}\n"; | |
} | |
}; | |
# remember to call this, otherwise you will have trouble logging in again | |
# for some time | |
if ($ibank->logged_in) { $ibank->logout() } | |
# utility routines | |
my $res = $ibank->parse_statement($html); | |
source code | |
https://github.com/perlancar/perl-Finance-Bank-ID-BCA. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment