| 1 | package Finance::Bank::Wachovia::DataObtainer::WWW; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use WWW::Mechanize; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use HTTP::Cookies; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Finance::Bank::Wachovia::DataObtainer::WWW::Parser; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Finance::Bank::Wachovia::ErrorHandler; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 6 | ▶ | my $DEBUG = 1 if "@ARGV" =~ /--www-debug/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | my $CONFIRM_LOGIN = 1 if "@ARGV" =~ /--www-confirm/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 6 | my @attrs; | |||||||||||||||||||||||||||
| 13 | 6 | our @ISA = qw/Finance::Bank::Wachovia::ErrorHandler/; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 6 | ▶ | BEGIN{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 16 | 6 | @attrs = qw( | |||||||||||||||||||||||||||
| 17 | customer_access_number | ||||||||||||||||||||||||||||
| 18 | user_id | ||||||||||||||||||||||||||||
| 19 | password | ||||||||||||||||||||||||||||
| 20 | pin | ||||||||||||||||||||||||||||
| 21 | code_word | ||||||||||||||||||||||||||||
| 22 | cached_content | ||||||||||||||||||||||||||||
| 23 | mech | ||||||||||||||||||||||||||||
| 24 | start_url | ||||||||||||||||||||||||||||
| 25 | logged_in | ||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 6 | my $x = @__SUPER__::ATTRIBUTES; | |||||||||||||||||||||||||||
| 29 | 6 | for( @attrs ){ | |||||||||||||||||||||||||||
| 30 | 0 | ▶ | eval "sub _$_ { $x }"; | ||||||||||||||||||||||||||
|
Subroutine
_cached_content: called CC=1 SCAR=0.1
Subroutine
_code_word: called CC=1 SCAR=0.1
Subroutine
_customer_access_number: called CC=1 SCAR=0.1
Subroutine
_logged_in: not called CC=1 SCAR=0.1
Subroutine
_mech: not called CC=1 SCAR=0.1
Subroutine
_password: called CC=1 SCAR=0.1
Subroutine
_pin: called CC=1 SCAR=0.1
Subroutine
_start_url: called CC=1 SCAR=0.1
Subroutine
_user_id: called CC=1 SCAR=0.1
| |||||||||||||||||||||||||||||
| 31 | 54 | $x++; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 10 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 10 | my($class, %attrs) = @_; | |||||||||||||||||||||||||||
| 37 | 10 | my $self = []; | |||||||||||||||||||||||||||
| 38 | 10 | bless $self, $class; | |||||||||||||||||||||||||||
| 39 | 10 | foreach my $att ( keys %attrs ){ | |||||||||||||||||||||||||||
| 40 | 10 | $self->$att( $attrs{$att} ); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 10 | $self->init(); | |||||||||||||||||||||||||||
| 43 | 10 | return $self; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 10 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 6 | ▶ | no strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 49 | 10 | ▶ | $self->start_url('https://onlineservices.wachovia.com/auth/AuthService?action=presentLogin') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | unless $self->start_url; | ||||||||||||||||||||||||||||
| 51 | 10 | $self->[ &{"_cached_content"} ] = {}; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 144 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 55 | 6 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | 144 | our $AUTOLOAD; | |||||||||||||||||||||||||||
| 57 | 144 | my $self = shift; | |||||||||||||||||||||||||||
| 58 | 144 | my $attr = lc $AUTOLOAD; | |||||||||||||||||||||||||||
| 59 | 144 | $attr =~ s/.*:://; | |||||||||||||||||||||||||||
| 60 | 144 | ▶ | return $self->Error("$attr is not a valid attribute") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | unless grep /$attr/, @attrs; | ||||||||||||||||||||||||||||
| 62 | # get if no args passed | ||||||||||||||||||||||||||||
| 63 | 144 | ▶ | return $self->[ &{"_$attr"} ] unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | # set if args passed | ||||||||||||||||||||||||||||
| 65 | 30 | $self->[ &{"_$attr"} ] = shift; | |||||||||||||||||||||||||||
| 66 | 30 | return $self; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub trash_cache { | ||||||||||||||||||||||||||
|
Subroutine
trash_cache: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 70 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 71 | 0 | $self->[ &{"_cached_content"} ] = {}; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 8 | ▶ | sub get_account_numbers { | ||||||||||||||||||||||||||
|
Subroutine
get_account_numbers: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 76 | 8 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 77 | ->get_account_numbers( $self->get_summary_content() ); | ||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 1 | ▶ | sub get_credit_account_current_balance { | ||||||||||||||||||||||||||
|
Subroutine
get_credit_account_current_balance: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 81 | 1 | get_account_available_balance( @_ ); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 2 | ▶ | sub get_credit_account_available_credit { | ||||||||||||||||||||||||||
|
Subroutine
get_credit_account_available_credit: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 85 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 86 | 2 | ▶ | return $self->Error( "must pass credit account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | 2 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 88 | ->get_credit_account_available_credit( $self->get_detail_content( @_ ) ); | ||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 2 | ▶ | sub get_credit_account_limit { | ||||||||||||||||||||||||||
|
Subroutine
get_credit_account_limit: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 92 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 93 | 2 | ▶ | return $self->Error( "must pass credit account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 2 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 95 | ->get_credit_account_limit( $self->get_detail_content( @_ ) ); | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 8 | ▶ | sub get_account_available_balance { | ||||||||||||||||||||||||||
|
Subroutine
get_account_available_balance: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 100 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 101 | 8 | ▶ | return $self->Error( "must pass account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 8 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 103 | ->get_account_available_balance( $self->get_summary_content(), @_ ); | ||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 9 | ▶ | sub get_account_name { | ||||||||||||||||||||||||||
|
Subroutine
get_account_name: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 107 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 108 | 9 | ▶ | return $self->Error( "must pass account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 9 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 110 | ->get_account_name( $self->get_summary_content(), @_ ); | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 4 | ▶ | sub get_account_type { | ||||||||||||||||||||||||||
|
Subroutine
get_account_type: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 114 | 4 | my($self) = shift; | |||||||||||||||||||||||||||
| 115 | 4 | ▶ | return $self->Error( "must pass account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 4 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 117 | ->get_account_type( $self->get_detail_content(@_) ); | ||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 1 | ▶ | sub get_account_posted_balance { | ||||||||||||||||||||||||||
|
Subroutine
get_account_posted_balance: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 122 | 1 | ▶ | return $self->Error( "must pass account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 1 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 124 | ->get_account_posted_balance( $self->get_detail_content(@_) ); | ||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 3 | ▶ | sub get_account_transactions { | ||||||||||||||||||||||||||
|
Subroutine
get_account_transactions: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 128 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 129 | 3 | ▶ | return $self->Error( "must pass account number" ) unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 3 | return Finance::Bank::Wachovia::DataObtainer::WWW::Parser | |||||||||||||||||||||||||||
| 131 | ->get_account_transactions( $self->get_detail_content(@_) ); | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 27 | ▶ | sub get_summary_content { | ||||||||||||||||||||||||||
|
Subroutine
get_summary_content: called CC=7 SCAR=29.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 135 | 6 | ▶ | no warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 136 | 27 | local $^W = 0; | |||||||||||||||||||||||||||
| 137 | 27 | ▶ | print STDERR "Getting Summary Content:\n" if $DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 27 | my $self = shift; | |||||||||||||||||||||||||||
| 139 | 27 | ▶ | if( $self->cached_content->{'summary'} ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | print STDERR "Returning cached summary:\n", | ||||||||||||||||||||||||||||
| 141 | "============== BEGIN SUMMARY =============\n", | ||||||||||||||||||||||||||||
| 142 | 27 | ▶ | $self->cached_content->{'summary'}, "\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | "=============== END SUMMARY ==============\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 144 | 27 | return $self->cached_content->{'summary'}; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if( ! $self->logged_in ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $self->login | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | or return $self->Error( $self->ErrStr ); | ||||||||||||||||||||||||||||
| 149 | 0 | return $self->get_summary_content() | |||||||||||||||||||||||||||
| 150 | or return $self->Error( $self->ErrStr ); | ||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | 0 | my $mech = $self->mech(); | |||||||||||||||||||||||||||
| 153 | 0 | $mech->form_number( 1 ); | |||||||||||||||||||||||||||
| 154 | 0 | $mech->field( inputName => 'RelationshipSummary' ); | |||||||||||||||||||||||||||
| 155 | 0 | $mech->submit(); | |||||||||||||||||||||||||||
| 156 | 0 | $self->cached_content->{'summary'} = $mech->content(); | |||||||||||||||||||||||||||
| 157 | print STDERR "Returning NOT cached summary:\n", | ||||||||||||||||||||||||||||
| 158 | "============== BEGIN SUMMARY =============\n", | ||||||||||||||||||||||||||||
| 159 | 0 | ▶ | $self->cached_content->{'summary'}, "\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | "=============== END SUMMARY ==============\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 161 | 0 | return $self->cached_content->{'summary'}; | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 14 | ▶ | sub get_detail_content { | ||||||||||||||||||||||||||
|
Subroutine
get_detail_content: called CC=7 SCAR=30.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 165 | 6 | ▶ | no warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 166 | 14 | local $^W = 0; | |||||||||||||||||||||||||||
| 167 | 14 | my($self, $account_number) = @_; | |||||||||||||||||||||||||||
| 168 | 14 | ▶ | return $self->Error( "get_detail_content in WWW must have account_number, got: '$account_number'" ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | unless $account_number; | ||||||||||||||||||||||||||||
| 170 | 14 | ▶ | if( $self->cached_content->{'details'}{$account_number} ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | print STDERR "Returning cached details:\n", | ||||||||||||||||||||||||||||
| 172 | "============ BEGIN DETAILS ===============\n", | ||||||||||||||||||||||||||||
| 173 | 14 | ▶ | $self->cached_content->{'details'}{$account_number}, "\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | "============ END DETAILS =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 175 | 14 | return $self->cached_content->{'details'}->{$account_number}; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 0 | ▶ | unless( $self->cached_content->{'summary'} ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | $self->get_summary_content(); | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | 0 | ▶ | my $stmt_type = $account_number =~ /^\d{16}$/ ? 'AccountSummary' : 'AccountDetail'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 0 | my $mech = $self->mech(); | |||||||||||||||||||||||||||
| 182 | 0 | $mech->form_number( 1 ); | |||||||||||||||||||||||||||
| 183 | 0 | $mech->field( RelSumAcctSel => $account_number ); | |||||||||||||||||||||||||||
| 184 | 0 | $mech->field( inputName => $stmt_type ); | |||||||||||||||||||||||||||
| 185 | 0 | $mech->field( RelSumStmtType => $stmt_type ); | |||||||||||||||||||||||||||
| 186 | 0 | $mech->submit(); | |||||||||||||||||||||||||||
| 187 | 0 | $self->cached_content->{'details'}->{$account_number} = $mech->content(); | |||||||||||||||||||||||||||
| 188 | # return to summary page | ||||||||||||||||||||||||||||
| 189 | 0 | $mech->form_number( 1 ); | |||||||||||||||||||||||||||
| 190 | 0 | $mech->field( inputName => 'RelationshipSummary' ); | |||||||||||||||||||||||||||
| 191 | 0 | $mech->submit(); | |||||||||||||||||||||||||||
| 192 | print STDERR "Returning NOT cached details:\n", | ||||||||||||||||||||||||||||
| 193 | "============ BEGIN DETAILS ===============\n", | ||||||||||||||||||||||||||||
| 194 | 0 | ▶ | $self->cached_content->{'details'}{$account_number}, "\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | "============ END DETAILS =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 196 | 0 | return $self->cached_content->{'details'}->{$account_number}; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | # initilizes WWW::Mech object, uses it to get to summary page | ||||||||||||||||||||||||||||
| 200 | # summary page is cached/overwritten | ||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub login { | ||||||||||||||||||||||||||
|
Subroutine
login: not called CC=14 SCAR=52.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 202 | 6 | ▶ | no warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 203 | 0 | local $^W = 0; | |||||||||||||||||||||||||||
| 204 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 205 | 0 | my %p = @_; | |||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 0 | ▶ | my $start = $p{'start_url'} || $self->start_url(); | ||||||||||||||||||||||||||
|
Condition0%0/3
$p{'start_url'} || $self->start_url
MC/DC0%0/2
$p{'start_url'} || $self->start_url
$p{'start_url'}
$self->start_url
Truth table0%0/3
A || B
A= $p{'start_url'}B= $self->start_url
| |||||||||||||||||||||||||||||
| 208 | 0 | ▶ | print STDERR "Starting Login (1)\n" if $DEBUG; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | # now we can get to business | ||||||||||||||||||||||||||||
| 211 | 0 | my $mech = WWW::Mechanize->new( | |||||||||||||||||||||||||||
| 212 | autocheck => 1, | ||||||||||||||||||||||||||||
| 213 | max_redirect => 1, | ||||||||||||||||||||||||||||
| 214 | ); | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | # caches the mech object | ||||||||||||||||||||||||||||
| 217 | 0 | $self->mech( $mech ); | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 0 | $mech->cookie_jar(HTTP::Cookies->new()); # have to turn on cookies manually apparently | |||||||||||||||||||||||||||
| 220 | 0 | $mech->agent_alias( 'Mac Safari' ); # don't want the bank to know we are geniuses, (using perl) | |||||||||||||||||||||||||||
| 221 | # but we don't want them thinking we are dumb either (using MSIE). | ||||||||||||||||||||||||||||
| 222 | # considering changing this to Firefox (mozilla), as an exercise in pointlessness. | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | # make first contact | ||||||||||||||||||||||||||||
| 225 | # TODO: add in success checking | ||||||||||||||||||||||||||||
| 226 | 0 | $mech->get( $start ); | |||||||||||||||||||||||||||
| 227 | 0 | ▶ | print STDERR "Login (2) Content:\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | "============ BEGIN CONTENT ===============\n", | ||||||||||||||||||||||||||||
| 229 | $mech->content(), "\n", | ||||||||||||||||||||||||||||
| 230 | "============ END CONTENT =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | # the website uses javascript to set this cookie, so we have to do it manually. | ||||||||||||||||||||||||||||
| 233 | # without this, an error is returned from the website about either javascript or cookies being turned off | ||||||||||||||||||||||||||||
| 234 | 0 | $mech->cookie_jar->set_cookie( undef, 'CookiesAreEnabled', 'yes', '/', '.wachovia.com', undef, undef, 1 ); | |||||||||||||||||||||||||||
| 235 | #$mech->max_redirect(1); | ||||||||||||||||||||||||||||
| 236 | #$mech->requests_redirectable([]); | ||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if( ! $self->user_id ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | print STDERR "Logging in via CAN method...\n" if $DEBUG || $CONFIRM_LOGIN; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$DEBUG or $CONFIRM_LOGIN
MC/DC0%0/2
$DEBUG or $CONFIRM_LOGIN
$DEBUG
$CONFIRM_LOGIN
Truth table0%0/3
A or B
A= $DEBUGB= $CONFIRM_LOGIN
| |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | print STDERR | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | "CAN => '", $self->customer_access_number, "'\n", | ||||||||||||||||||||||||||||
| 241 | "PIN => '", $self->pin, "'\n", | ||||||||||||||||||||||||||||
| 242 | "CODEWORD => '", $self->code_word, "'\n" | ||||||||||||||||||||||||||||
| 243 | if $CONFIRM_LOGIN; | ||||||||||||||||||||||||||||
| 244 | 0 | $mech->form_name( 'canAuthForm' ); | |||||||||||||||||||||||||||
| 245 | 0 | $mech->field( action => 'canPinLogin' ); | |||||||||||||||||||||||||||
| 246 | 0 | $mech->field( CAN => $self->customer_access_number ); | |||||||||||||||||||||||||||
| 247 | 0 | $mech->field( PIN => $self->pin ); | |||||||||||||||||||||||||||
| 248 | 0 | $mech->field( CODEWORD => $self->code_word ); | |||||||||||||||||||||||||||
| 249 | 0 | $mech->field( systemtarget => 'gotoBanking' ); | |||||||||||||||||||||||||||
| 250 | 0 | $mech->field( requestTimestamp => time() ); # the website uses javascript to set this value | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | else{ | ||||||||||||||||||||||||||||
| 253 | 0 | ▶ | print STDERR "Logging in via USERID method...\n" if $DEBUG || $CONFIRM_LOGIN; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$DEBUG or $CONFIRM_LOGIN
MC/DC0%0/2
$DEBUG or $CONFIRM_LOGIN
$DEBUG
$CONFIRM_LOGIN
Truth table0%0/3
A or B
A= $DEBUGB= $CONFIRM_LOGIN
| |||||||||||||||||||||||||||||
| 254 | 0 | ▶ | print STDERR | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | "userid => '", $self->user_id, "'\n", | ||||||||||||||||||||||||||||
| 256 | "password => '", $self->password, "'\n", | ||||||||||||||||||||||||||||
| 257 | if $CONFIRM_LOGIN; | ||||||||||||||||||||||||||||
| 258 | 0 | $mech->form_name( 'uidAuthForm' ); | |||||||||||||||||||||||||||
| 259 | 0 | $mech->field( action => 'uidLogin' ); | |||||||||||||||||||||||||||
| 260 | 0 | $mech->field( userid => $self->user_id ); | |||||||||||||||||||||||||||
| 261 | 0 | $mech->field( password => $self->password ); | |||||||||||||||||||||||||||
| 262 | 0 | $mech->field( systemtarget => 'gotoBanking' ); | |||||||||||||||||||||||||||
| 263 | 0 | $mech->field( requestTimestamp => time() ); # the website uses javascript to set this value | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | 0 | $mech->submit(); | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | print STDERR "Login (3) Content:\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | "============ BEGIN CONTENT ===============\n", | ||||||||||||||||||||||||||||
| 268 | $mech->content(), "\n", | ||||||||||||||||||||||||||||
| 269 | "============ END CONTENT =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 270 | 0 | ▶ | if( $mech->content() =~ /ASV\-201/ ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 271 | 0 | return $self->Error("Login failed, bad username/password (too many of these will lock your account)"); | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | # after the initial commit, there is what appears to be a bunch of redirects. While there are some, there are | ||||||||||||||||||||||||||||
| 275 | # also some javascript onLoad submits. The following code emulates that behavior (just submits a form that | ||||||||||||||||||||||||||||
| 276 | # has a bunch of hidden inputs ) | ||||||||||||||||||||||||||||
| 277 | 0 | $mech->form_number( 1 ); | |||||||||||||||||||||||||||
| 278 | 0 | $mech->submit(); | |||||||||||||||||||||||||||
| 279 | 0 | ▶ | print STDERR "Login (4) Content:\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | "============ BEGIN CONTENT ===============\n", | ||||||||||||||||||||||||||||
| 281 | $mech->content(), "\n", | ||||||||||||||||||||||||||||
| 282 | "============ END CONTENT =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | # removed due to wachovia website change on 1/22 | ||||||||||||||||||||||||||||
| 285 | # $mech->form_number( 1 ); | ||||||||||||||||||||||||||||
| 286 | # $mech->submit(); | ||||||||||||||||||||||||||||
| 287 | # print STDERR "Login (5) Content:\n", | ||||||||||||||||||||||||||||
| 288 | # "============ BEGIN CONTENT ===============\n", | ||||||||||||||||||||||||||||
| 289 | # $mech->content(), "\n", | ||||||||||||||||||||||||||||
| 290 | # "============ END CONTENT =================\n" if $DEBUG; | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | $self->cached_content->{'summary'} = $mech->content(); | |||||||||||||||||||||||||||
| 294 | 0 | $self->logged_in( 1 ); | |||||||||||||||||||||||||||
| 295 | 0 | return $self; | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||