line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bank::Wachovia::Credit; |
2
|
3
|
|
|
3
|
|
814
|
use Finance::Bank::Wachovia::ErrorHandler; |
|
3
|
|
|
|
|
24
|
|
|
3
|
|
|
|
|
88
|
|
3
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
63
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
296
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.3'; |
7
|
|
|
|
|
|
|
my @attrs; |
8
|
|
|
|
|
|
|
our @ISA = qw/Finance::Bank::Wachovia::ErrorHandler/; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN{ |
11
|
3
|
|
|
3
|
|
13
|
@attrs = qw( |
12
|
|
|
|
|
|
|
name |
13
|
|
|
|
|
|
|
number |
14
|
|
|
|
|
|
|
type |
15
|
|
|
|
|
|
|
current_balance |
16
|
|
|
|
|
|
|
available_credit |
17
|
|
|
|
|
|
|
limit |
18
|
|
|
|
|
|
|
data_obtainer |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
5
|
my $x = @__SUPER__::ATTRIBUTES; |
22
|
3
|
|
|
|
|
7
|
for( @attrs ){ |
23
|
21
|
|
|
3
|
|
572
|
eval "sub _$_ { $x }"; |
|
3
|
|
|
7
|
|
9
|
|
|
7
|
|
|
7
|
|
53
|
|
|
7
|
|
|
2
|
|
27
|
|
|
2
|
|
|
3
|
|
7
|
|
|
3
|
|
|
10
|
|
17
|
|
|
10
|
|
|
6
|
|
41
|
|
|
6
|
|
|
|
|
36
|
|
24
|
21
|
|
|
|
|
376
|
$x++; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
2
|
|
|
2
|
0
|
11
|
my($class, %attrs) = @_; |
30
|
2
|
|
|
|
|
4
|
my $self = []; |
31
|
2
|
|
|
|
|
6
|
bless $self, $class; |
32
|
2
|
|
|
|
|
7
|
foreach my $att ( keys %attrs ){ |
33
|
4
|
|
|
|
|
23
|
$self->$att( $attrs{$att} ); |
34
|
|
|
|
|
|
|
} |
35
|
2
|
50
|
|
|
|
8
|
return Finance::Bank::Wachovia::Credit->Error("no account number set in Finance::Bank::Wachovia::Credit->new") |
36
|
|
|
|
|
|
|
unless $self->number; |
37
|
2
|
|
|
|
|
8
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub AUTOLOAD { |
41
|
3
|
|
|
3
|
|
18
|
no strict 'refs'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1455
|
|
42
|
17
|
|
|
17
|
|
28
|
our $AUTOLOAD; |
43
|
17
|
|
|
|
|
23
|
my $self = shift; |
44
|
17
|
|
|
|
|
31
|
my $attr = lc $AUTOLOAD; |
45
|
17
|
|
|
|
|
54
|
$attr =~ s/.*:://; |
46
|
17
|
50
|
|
|
|
177
|
return $self->Error( "$attr not a valid attribute" ) |
47
|
|
|
|
|
|
|
unless grep /$attr/, @attrs; |
48
|
|
|
|
|
|
|
# get if no args passed |
49
|
17
|
100
|
|
|
|
41
|
return $self->[ &{"_$attr"} ] unless @_; |
|
13
|
|
|
|
|
243
|
|
50
|
|
|
|
|
|
|
# set if args passed |
51
|
4
|
|
|
|
|
11
|
$self->[ &{"_$attr"} ] = shift; |
|
4
|
|
|
|
|
85
|
|
52
|
4
|
|
|
|
|
11
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
2
|
1
|
6
|
sub balance { current_balance(@_) } |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# these values are loaded on-demand |
59
|
|
|
|
|
|
|
sub limit { |
60
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
61
|
1
|
50
|
|
|
|
3
|
if(@_){ $self->[ _limit ] = shift; return $self; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
62
|
1
|
50
|
|
|
|
23
|
return $self->[ _limit ] if $self->[ _limit ]; |
63
|
1
|
|
|
|
|
5
|
my $do = $self->data_obtainer(); |
64
|
1
|
|
|
|
|
5
|
my $limit = $do->get_credit_account_limit( $self->number() ); |
65
|
1
|
|
|
|
|
18
|
$self->[ _limit ] = $limit; |
66
|
1
|
|
|
|
|
3
|
return $limit; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub name { |
71
|
1
|
|
|
1
|
1
|
311
|
my $self = shift; |
72
|
1
|
50
|
|
|
|
3
|
if(@_){ $self->[ _name ] = shift; return $self; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
73
|
1
|
50
|
|
|
|
23
|
return $self->[ _name ] if $self->[ _name ]; |
74
|
1
|
|
|
|
|
6
|
$self->[ _name ] = $self->data_obtainer->get_account_name( $self->number ); |
75
|
1
|
|
|
|
|
34
|
return $self->[ _name ]; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub type { |
79
|
3
|
|
|
3
|
1
|
4
|
my $self = shift; |
80
|
3
|
100
|
|
|
|
10
|
if(@_){ $self->[ _type ] = shift; return $self; } |
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
5
|
|
81
|
2
|
100
|
|
|
|
46
|
return $self->[ _type ] if $self->[ _type ]; |
82
|
1
|
|
|
|
|
6
|
$self->[ _type ] = $self->data_obtainer->get_account_type( $self->number ); |
83
|
1
|
|
|
|
|
34
|
return $self->[ _type ]; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub current_balance { |
87
|
3
|
|
|
3
|
1
|
5
|
my $self = shift; |
88
|
3
|
50
|
|
|
|
9
|
if(@_){ $self->[ _current_balance ] = shift; return $self; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
89
|
3
|
100
|
|
|
|
61
|
return $self->[ _current_balance ] if $self->[ _current_balance ]; |
90
|
1
|
|
|
|
|
5
|
$self->[ _current_balance ] = $self->data_obtainer->get_credit_account_current_balance( $self->number ); |
91
|
1
|
|
|
|
|
18
|
return $self->[ _current_balance ]; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub available_credit { |
96
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
97
|
1
|
50
|
|
|
|
4
|
if(@_){ $self->[ _available_credit ] = shift; return $self; } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
98
|
1
|
50
|
|
|
|
24
|
return $self->[ _available_credit ] if $self->[ _available_credit ]; |
99
|
1
|
|
|
|
|
6
|
$self->[ _available_credit ] = $self->data_obtainer->get_credit_account_available_credit( $self->number ); |
100
|
1
|
|
|
|
|
18
|
return $self->[ _available_credit ]; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
0
|
|
|
sub DESTROY {} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |