Finance-Bank-ID-BPRKS

 view release on metacpan or  search on metacpan

lib/Finance/Bank/ID/BPRKS.pm  view on Meta::CPAN

=head1 VERSION

This document describes version 0.06 of Finance::Bank::ID::BPRKS (from Perl distribution Finance-Bank-ID-BPRKS), released on 2017-07-10.

=head1 SYNOPSIS

    use Finance::Bank::ID::BPRKS;

    # FBI::BPRKS 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::BPRKS->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 @cards = $ibank->list_cards();

        my $bal = $ibank->check_balance($card); # $card is optional

        my $stmt = $ibank->get_statement(
            card       => ..., # opt, default card will be used if undef
            days       => 30,  # opt
            start_date => DateTime->new(year=>2012, month=>6, day=>1),
                               # 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);

Also see the examples/ subdirectory in the distribution for a sample script
using this module.

=head1 DESCRIPTION

B<RELEASE NOTE: This is an early release. Only parse_statement() for a single
statement page is implemented.>

This module provide a rudimentary interface to the web-based online banking
interface of the Indonesian B<BPR Karyajatnika Sadaya> (BPR KS, BPRKS) at
https://ib.bprks.co.id. You will need either L<Crypt::SSLeay> or
L<IO::Socket::SSL> installed for HTTPS support to work (and strictly
Crypt::SSLeay to enable certificate verification). L<WWW::Mechanize> is required
but you can supply your own mech-like object.

This module can only login to the individual edition of the site. I haven't
checked out the other versions.

Warning: This module is neither offical nor is it tested to be 100% safe!
Because of the nature of web-robots, everything may break from one day to the
other when the underlying web interface changes.

=head1 WARNING

This warning is from Simon Cozens' C<Finance::Bank::LloydsTSB>, and seems just
as apt here.

This is code for B<online banking>, and that means B<your money>, and that means
B<BE CAREFUL>. You are encouraged, nay, expected, to audit the source of this
module yourself to reassure yourself that I am not doing anything untoward with
your banking data. This software is useful to me, but is provided under B<NO
GUARANTEE>, explicit or implied.

=head1 ERROR HANDLING AND DEBUGGING

Most methods die() when encountering errors, so you can use eval() to trap them.

Full response headers and bodies are dumped to a separate logger. See
documentation on C<new()> below and the sample script in examples/ subdirectory
in the distribution.

=head1 ATTRIBUTES

=head2 skip_NEXT => BOOL

If set to true, then statement with NEXT status will be skipped.

=head1 METHODS

=for Pod::Coverage BUILD

=head2 new(%args)

Create a new instance. %args keys:

=over 4

=item * username

Optional if you are just using utility methods like C<parse_statement()> and not
C<login()> etc.

=item * password

Optional if you are just using utility methods like C<parse_statement()> and not
C<login()> etc.

=item * mech

Optional. A L<WWW::Mechanize>-like object. By default this module instantiate a
new L<Finance::BankUtils::ID::Mechanize> (a WWW::Mechanize subclass) object to
retrieve web pages, but if you want to use a custom/different one, you are



( run in 2.294 seconds using v1.01-cache-2.11-cpan-524268b4103 )