line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bank::Wachovia; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
7539
|
use Finance::Bank::Wachovia::ErrorHandler; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
69
|
|
4
|
2
|
|
|
2
|
|
1461
|
use Finance::Bank::Wachovia::Account; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
63
|
|
5
|
2
|
|
|
2
|
|
1798
|
use Finance::Bank::Wachovia::Credit; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
1456
|
use Finance::Bank::Wachovia::Transaction; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
7
|
2
|
|
|
2
|
|
1659
|
use Finance::Bank::Wachovia::DataObtainer::WWW; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
68
|
|
8
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
9
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
351
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.5'; |
12
|
|
|
|
|
|
|
my @attrs; |
13
|
|
|
|
|
|
|
our @ISA = qw/Finance::Bank::Wachovia::ErrorHandler/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN{ |
16
|
2
|
|
|
2
|
|
7
|
@attrs = qw( |
17
|
|
|
|
|
|
|
customer_access_number |
18
|
|
|
|
|
|
|
pin |
19
|
|
|
|
|
|
|
code_word |
20
|
|
|
|
|
|
|
user_id |
21
|
|
|
|
|
|
|
password |
22
|
|
|
|
|
|
|
accounts |
23
|
|
|
|
|
|
|
data_obtainer |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
6
|
my $x = @__SUPER__::ATTRIBUTES; |
27
|
2
|
|
|
|
|
6
|
for( @attrs ){ |
28
|
14
|
|
|
14
|
|
549
|
eval "sub _$_ { $x }"; |
|
14
|
|
|
8
|
|
79
|
|
|
8
|
|
|
8
|
|
43
|
|
|
8
|
|
|
20
|
|
54
|
|
|
20
|
|
|
10
|
|
70
|
|
|
10
|
|
|
8
|
|
66
|
|
|
8
|
|
|
14
|
|
51
|
|
|
14
|
|
|
|
|
203
|
|
29
|
14
|
|
|
|
|
725
|
$x++; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
34
|
4
|
|
|
4
|
1
|
2596
|
my($class, %attrs) = @_; |
35
|
4
|
|
|
|
|
11
|
my $self = []; |
36
|
4
|
|
|
|
|
14
|
bless $self, $class; |
37
|
4
|
|
|
|
|
14
|
foreach my $att ( keys %attrs ){ |
38
|
10
|
|
|
|
|
82
|
$self->$att( $attrs{$att} ); |
39
|
|
|
|
|
|
|
} |
40
|
4
|
50
|
66
|
|
|
30
|
unless( ( $self->user_id && $self->password ) || ( $self->customer_access_number && $self->pin && $self->code_word ) ){ |
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
return Finance::Bank::Wachovia->Error( "Must use either user_id/password OR customer_access_number/pin/code_word" ); |
42
|
|
|
|
|
|
|
} |
43
|
4
|
100
|
66
|
|
|
20
|
my %login_info = ( $self->user_id && $self->password ) |
44
|
|
|
|
|
|
|
? ( user_id => $self->user_id, password => $self->password ) |
45
|
|
|
|
|
|
|
: ( customer_access_number => $self->customer_access_number, pin => $self->pin, code_word => $self->code_word ); |
46
|
4
|
|
|
|
|
36
|
my $data_obtainer = Finance::Bank::Wachovia::DataObtainer::WWW->new( |
47
|
|
|
|
|
|
|
%login_info |
48
|
|
|
|
|
|
|
); |
49
|
4
|
|
|
|
|
33
|
$self->data_obtainer( $data_obtainer ); |
50
|
4
|
|
|
|
|
27
|
$self->accounts({}); |
51
|
4
|
|
|
|
|
207
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub AUTOLOAD { |
56
|
2
|
|
|
2
|
|
16
|
no strict 'refs'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1401
|
|
57
|
82
|
|
|
82
|
|
125
|
our $AUTOLOAD; |
58
|
82
|
|
|
|
|
136
|
my $self = shift; |
59
|
82
|
|
|
|
|
174
|
my $attr = lc $AUTOLOAD; |
60
|
82
|
|
|
|
|
483
|
$attr =~ s/.*:://; |
61
|
82
|
50
|
|
|
|
1561
|
return $self->Error("$attr not a valid attribute") |
62
|
|
|
|
|
|
|
unless grep /$attr/, @attrs; |
63
|
|
|
|
|
|
|
# get if no args passed |
64
|
82
|
100
|
|
|
|
191
|
return $self->[ &{"_$attr"} ] unless @_; |
|
64
|
|
|
|
|
2265
|
|
65
|
|
|
|
|
|
|
# set if args passed |
66
|
18
|
|
|
|
|
37
|
$self->[ &{"_$attr"} ] = shift; |
|
18
|
|
|
|
|
591
|
|
67
|
18
|
|
|
|
|
141
|
return $self; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub account_numbers { |
71
|
6
|
|
|
6
|
1
|
20
|
my $self = shift; |
72
|
6
|
|
|
|
|
30
|
my $do = $self->data_obtainer(); |
73
|
6
|
|
|
|
|
26
|
return $do->get_account_numbers(); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub account_names { |
77
|
2
|
|
|
2
|
1
|
14
|
my $self = shift; |
78
|
2
|
|
|
|
|
14
|
my $do = $self->data_obtainer(); |
79
|
2
|
|
|
|
|
12
|
return map { $do->get_account_name($_) } $self->account_numbers(); |
|
4
|
|
|
|
|
21
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub account_balances { |
83
|
2
|
|
|
2
|
1
|
14
|
my $self = shift; |
84
|
2
|
|
|
|
|
13
|
my $do = $self->data_obtainer(); |
85
|
2
|
|
|
|
|
10
|
return map { $do->get_account_available_balance($_) } $self->account_numbers(); |
|
4
|
|
|
|
|
22
|
|
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub account { |
89
|
5
|
|
|
5
|
1
|
8450
|
my($self, $account_number) = @_; |
90
|
5
|
50
|
|
|
|
19
|
return $self->Error("Must pass account number to account() method") |
91
|
|
|
|
|
|
|
unless $account_number; |
92
|
5
|
100
|
|
|
|
32
|
if( exists $self->accounts->{$account_number} ){ |
93
|
1
|
|
|
|
|
7
|
return $self->accounts->{$account_number}; |
94
|
|
|
|
|
|
|
} |
95
|
4
|
50
|
|
|
|
30
|
return $self->Error("must pass valid account number to account(), got '$account_number'") |
96
|
|
|
|
|
|
|
unless $account_number =~ /^\d+$/; |
97
|
4
|
|
|
|
|
24
|
my $do = $self->data_obtainer(); |
98
|
4
|
|
|
|
|
9
|
my $account; |
99
|
|
|
|
|
|
|
#note: we don't set posted_balance here, since that requires extra |
100
|
|
|
|
|
|
|
# work by the obtainer, we defer the retrieval of that until it's |
101
|
|
|
|
|
|
|
# needed (asked for via $account->posted_balance) |
102
|
4
|
100
|
|
|
|
16
|
if( $account_number =~ /\d{16}/ ){ # must be credit? |
103
|
1
|
50
|
|
|
|
12
|
$account = Finance::Bank::Wachovia::Credit->new( |
104
|
|
|
|
|
|
|
number => $account_number, |
105
|
|
|
|
|
|
|
data_obtainer => $do, |
106
|
|
|
|
|
|
|
) |
107
|
|
|
|
|
|
|
or return Error( "Couldn't create Credit object: ".Finance::Bank::Wachovia::Credit->ErrStr ); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
else{ # must be checkings or savings? |
111
|
3
|
50
|
|
|
|
38
|
$account = Finance::Bank::Wachovia::Account->new( |
112
|
|
|
|
|
|
|
number => $account_number, |
113
|
|
|
|
|
|
|
data_obtainer => $do, |
114
|
|
|
|
|
|
|
) |
115
|
|
|
|
|
|
|
or return Error( "Couldn't create Account object: ".Finance::Bank::Wachovia::Account->ErrStr ); |
116
|
|
|
|
|
|
|
} |
117
|
4
|
|
|
|
|
21
|
$self->accounts->{$account_number} = $account; |
118
|
4
|
|
|
|
|
24
|
return $account; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |