367
|
0 |
0 |
0 |
$self->{'statements'} ||= do {
my $retry;
retry: $self->{'feedback'}->("get statements") if $self->{'feedback'};
my $response = $self->{'ua'}->request("HTTP::Request"->new("GET", $url));
die "can't access account $self->{'name'} statements\n" . $response->error_as_HTML unless $response->is_success;
my $html = $response->content;
$self->{'balance'} ||= do {
my $balance = ($html =~ m[(.*?) euros] || $html =~ m[(.*?) €]) && $1;
&$normalize_number($balance)
};
my $l = &$parse_table($html);
@$l = map({my($date, $description, $amount1, $amount2) = @$_;
my $amount = &$normalize_number($amount2 || $amount1);
$date && $date =~ m[(\d+)/(\d+)] ? [$date, $description, $amount] : ();} @$l);
[map({my($date, $description, $amount) = @$_;
my($day, $month, $year) = $date =~ m[(\d+)/(\d+)/(\d+)];
"Finance::Bank::LaPoste::Statement"->new("day", $day, "month", $month, "year", $year, "description", $description, "amount", $amount);} @$l)]
} |