line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bank::ES::Cajamadrid;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
8595
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
6
|
use Carp;
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
67
|
|
6
|
1
|
|
|
1
|
|
1425
|
use WWW::Mechanize;
|
|
1
|
|
|
|
|
376874
|
|
|
1
|
|
|
|
|
528
|
|
7
|
|
|
|
|
|
|
our $VERSION='0.04';
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# hackery for https proxy support, inspired by Finance::Bank::Barclays
|
11
|
|
|
|
|
|
|
# thanks Dave Holland!
|
12
|
|
|
|
|
|
|
my $https_proxy=$ENV{https_proxy};
|
13
|
|
|
|
|
|
|
delete $ENV{https_proxy} if($https_proxy);
|
14
|
|
|
|
|
|
|
our $browser = WWW::Mechanize->new(env_proxy=>1);
|
15
|
|
|
|
|
|
|
$browser->env_proxy; # Load proxy settings (but not the https proxy)
|
16
|
|
|
|
|
|
|
$ENV{https_proxy}=$https_proxy if($https_proxy);
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub check_balances {
|
19
|
0
|
|
|
0
|
0
|
|
my ($class,%opts)=@_;
|
20
|
0
|
0
|
|
|
|
|
croak "Must provide a DNI number" unless exists $opts{dni};
|
21
|
0
|
0
|
|
|
|
|
croak "Must provide a PIN" unless exists $opts{pin};
|
22
|
0
|
|
|
|
|
|
my $base="https://oi.cajamadrid.es";
|
23
|
0
|
|
|
|
|
|
my $re=' |
(\d+) .*? | (.*?) Euros | .*?
';
24
|
0
|
|
|
|
|
|
my $self=bless { %opts }, $class;
|
25
|
0
|
|
|
|
|
|
$browser->quiet(1);
|
26
|
0
|
|
|
|
|
|
$browser->agent_alias("Windows IE 6");
|
27
|
0
|
|
|
|
|
|
$browser->get("$base/CajaMadrid/oi/pt_oi/Login/login");
|
28
|
0
|
|
|
|
|
|
$browser->form('f1');
|
29
|
0
|
|
|
|
|
|
$browser->field("Documento_s", $opts{dni});
|
30
|
0
|
|
|
|
|
|
$browser->field("ClaveAcceso_s", $opts{pin});
|
31
|
0
|
|
|
|
|
|
my $r=$browser->submit();
|
32
|
0
|
|
|
|
|
|
$browser->form('f_lanzar')
|
33
|
|
|
|
|
|
|
->action("$base/CajaMadrid/oi/puente_oi?pagina=5950&tran=0");
|
34
|
0
|
|
|
|
|
|
$r=$browser->submit();
|
35
|
0
|
|
|
|
|
|
my $datos=$r->content;
|
36
|
0
|
|
|
|
|
|
my @cuentas=();
|
37
|
0
|
|
|
|
|
|
while ($datos=~m{$re}gs){
|
38
|
0
|
|
|
|
|
|
push @cuentas,( { numero => $1,
|
39
|
|
|
|
|
|
|
saldo => $2 } );
|
40
|
|
|
|
|
|
|
}
|
41
|
0
|
|
|
|
|
|
return @cuentas;
|
42
|
|
|
|
|
|
|
}
|
43
|
|
|
|
|
|
|
sub ver_saldos {
|
44
|
0
|
|
|
0
|
0
|
|
my ($class,%opts)=@_;
|
45
|
0
|
0
|
|
|
|
|
croak "Debe proporcionar un DNI" unless exists $opts{dni};
|
46
|
0
|
0
|
|
|
|
|
croak "Debe proporcionar un PIN" unless exists $opts{pin};
|
47
|
0
|
|
|
|
|
|
return &check_balances($class,%opts);
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
1;
|
50
|
|
|
|
|
|
|
__END__
|