Finance-Bank-easybank

 view release on metacpan or  search on metacpan

lib/Finance/Bank/easybank.pod  view on Meta::CPAN


  # look for this script in the examples directory of the
  # tar ball (balance.pl).
  use Finance::Bank::easybank;
  
  use strict;
  use warnings;
  
  my $agent = Finance::Bank::easybank->new(
          user          => 'xxx',
          pass          => 'xxx',
          return_floats => 1,
  
          accounts      => [ qw/
                  200XXXXXXXX
                  / ],

          entries       => [ qw/
                  200XXXXXXXX
                  / ],
  );
  
  my @accounts = $agent->check_balance;
  my $entries  = $agent->get_entries;
  
  foreach my $account (@accounts) {
          printf("%11s: %25s\n", $_->[0], $account->{$_->[1]})
                  for(( [ qw/ Kontonummer account / ],
                        [ qw/ BLZ bc / ],
                        [ qw/ Bezeichnung name / ],
                        [ qw/ Datum date / ],
                        [ qw/ Waehrung currency / ]
                  ));
          printf("%11s: %25.2f\n", $_->[0], $account->{$_->[1]})
                  for(( [ qw/ Saldo balance / ],
                        [ qw/ Dispo final / ]
                  ));

          print "\nBuchungzeilen:\n\n";

          if(exists($entries->{$account->{account}})) {
                  foreach my $row (@{$entries->{$account->{account}}}) {
                        $row->{text} =~ s/(.{39}).*/$1.../;

                        printf("%2d %10s %42s %6s %3s %9.2f\n", 
                                (map { $row->{$_} } qw/nr date text value currency/), 
                                $row->{amount}
                        );      
                  }
          }

          print "\n";
  }
 

=head1 DESCRIPTION

This module provides a basic interface to the online banking system of
the easybank at C<http://www.easybank.at>.

Please note, that you will need either C<Crypt::SSLeay> or C<IO::Socket::SSL>
installed for working HTTPS support of C<LWP>.

=head1 METHODS

=over

=item check_balance

Queries all via attribute C<accounts> defined accounts and extracts
various informations about the account status.

If called in list context, returns an array of hashes containing all
fetched information:

 $VAR = [
          {
            'bc'        => bank code
            'account'   => account number
            'name'      => name of the account
            'date'      => date shown on the summary page
                           (format: DD.MM.YYYY/hh:mm)
            'currency'  => currency
            'balance'   => account balance
            'final'     => final account balance
          }
        ];

Otherwise, returns a hashref:

  $VAR1 = {
          'account' => {
              'bc'        => bank code
              'account'   => account number
              'name'      => name of the account
              'date'      => date shown on the summary page
                             (format: DD.MM.YYYY/hh:mm)
              'currency'  => currency
              'balance'   => account balance
              'final'     => final account balance
            }
          };

=item get_entries

Queries and parses the first page of the entry-history for all
accounts defined via the C<entries> attribute. 

Returns a hashref containing all fetched information:

  $VAR1 = {
          'account' => {
              'date'     => date of the transaction
                            (format: DD.MM.YYYY)
              'text'     => posting text
              'value'    => value date
                            (format: DD.MM.)
              'currency' => currency
              'amount'   => transfer amount
            }
          };



( run in 4.888 seconds using v1.01-cache-2.11-cpan-8dfa8b56332 )