| 1 | package Business::OnlinePayment::IPPay; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Tie::IxHash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use XML::Writer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Locale::Country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Business::OnlinePayment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Business::OnlinePayment::HTTPS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use vars qw($VERSION $DEBUG @ISA $me); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | @ISA = qw(Business::OnlinePayment::HTTPS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | $VERSION = '0.13'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | $VERSION = eval $VERSION; # modperlstyle: convert the string into a number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | $DEBUG = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | $me = 'Business::OnlinePayment::IPPay'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | sub _info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_info: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | 'info_compat' => '0.01', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 'module_version' => $VERSION, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 'supported_types' => [ qw( CC ECHECK ) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 'supported_actions' => { 'CC' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'Normal Authorization', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'Authorization Only', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 'Post Authorization', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 'Void', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 'Credit', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 'Reverse Authorization', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 'ECHECK' => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 'Normal Authorization', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 'Void', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 'Credit', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'CC_void_requires_card' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'ECHECK_void_requires_account' => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | ▶ | sub set_defaults { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_defaults: called CC=7 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # standard B::OP methods/data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 9 | ▶ | $self->server('gtwy.ippay.com') unless $self->server; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | ▶ | $self->port('443') unless $self->port; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 9 | ▶ | $self->path('/ippay') unless $self->path; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | $self->build_subs(qw( order_number avs_code cvv2_response | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | response_page response_code response_headers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | )); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ▶ | $DEBUG = exists($opts{debug}) ? $opts{debug} : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # module specific data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | my %_defaults = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 9 | foreach my $key (keys %opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | ▶ | $key =~ /^default_(\w*)$/ or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 9 | $_defaults{$1} = $opts{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 9 | delete $opts{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 9 | $self->{_defaults} = \%_defaults; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 8 | ▶ | sub map_fields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_fields: called CC=9 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 8 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 8 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # TYPE MAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 8 | my %types = ( 'visa' => 'CC', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 'mastercard' => 'CC', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 'american express' => 'CC', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 'discover' => 'CC', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 'check' => 'ECHECK', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 8 | ▶ | $content{'type'} = $types{lc($content{'type'})} || $content{'type'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$types{lc $content{'type'}} || $content{'type'}
MC/DC0%0/2
$types{lc $content{'type'}} || $content{'type'}
$types{lc $content{'type'}}
$content{'type'}
Truth table33%1/3
A || B
A= $types{lc $content{'type'}}B= $content{'type'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 8 | $self->transaction_type($content{'type'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # ACTION MAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 8 | my $action = lc($content{'action'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 8 | my %actions = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ( 'normal authorization' => 'SALE', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 'authorization only' => 'AUTHONLY', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 'post authorization' => 'CAPT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 'reverse authorization' => 'REVERSEAUTH', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 'void' => 'VOID', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 'credit' => 'CREDIT', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 8 | my %check_actions = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ( 'normal authorization' => 'CHECK', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 'void' => 'VOIDACH', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 'credit' => 'REVERSAL', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 8 | ▶ | if ($self->transaction_type eq 'CC') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 6 | ▶ | $content{'TransactionType'} = $actions{$action} || $action; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$actions{$action} || $action
MC/DC0%0/2
$actions{$action} || $action
$actions{$action}
$action
Truth table33%1/3
A || B
A= $actions{$action}B= $action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } elsif ($self->transaction_type eq 'ECHECK') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | $content{'TransactionType'} = $check_actions{$action} || $action; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$check_actions{$action} || $action
MC/DC0%0/2
$check_actions{$action} || $action
$check_actions{$action}
$action
Truth table33%1/3
A || B
A= $check_actions{$action}B= $action
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # ACCOUNT TYPE MAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2 | my %account_types = ('personal checking' => 'CHECKING', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 'personal savings' => 'SAVINGS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 'business checking' => 'CHECKING', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 'business savings' => 'SAVINGS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | #not technically B:OP valid i guess? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 'checking' => 'CHECKING', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 'savings' => 'SAVINGS', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | $content{'account_type'} = $account_types{lc($content{'account_type'})} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | || $content{'account_type'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$account_types{lc $content{'account_type'}} || $content{'account_type'}
MC/DC0%0/2
$account_types{lc $content{'account_type'}} || $content{'account_type'}
$account_types{lc $content{'account_type'}}
$content{'account_type'}
Truth table33%1/3
A || B
A= $account_types{lc $content{'account_type'}}B= $content{'account_type'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $content{Origin} = 'RECURRING' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 8 | ▶ | if ($content{recurring_billing} &&$content{recurring_billing} eq 'YES' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$content{"recurring_billing"} and $content{"recurring_billing"} eq "YES"
MC/DC0%0/2
$content{"recurring_billing"} and $content{"recurring_billing"} eq "YES"
$content{"recurring_billing"}
$content{"recurring_billing"} eq "YES"
Truth table33%1/3
A and B
A= $content{"recurring_billing"}B= $content{"recurring_billing"} eq "YES"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # stuff it back into %content | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 8 | $self->content(%content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 16 | ▶ | sub expdate_month { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expdate_month: called CC=5 SCAR=17.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 16 | my ($self, $exp) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 16 | my $month; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 16 | ▶ | if ( defined($exp) and $exp =~ /^(\d+)\D+\d*\d{2}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $exp and $exp =~ /^(\d+)\D+\d*\d{2}$/
MC/DC50%1/2
defined $exp and $exp =~ /^(\d+)\D+\d*\d{2}$/
defined $exp
$exp =~ /^(\d+)\D+\d*\d{2}$/
Truth table66%2/3
A and B
A= defined $expB= $exp =~ /^(\d+)\D+\d*\d{2}$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | $month = sprintf( "%02d", $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ▶ | }elsif ( defined($exp) and $exp =~ /^(\d{2})\d{2}$/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $exp and $exp =~ /^(\d{2})\d{2}$/
MC/DC0%0/2
defined $exp and $exp =~ /^(\d{2})\d{2}$/
defined $exp
$exp =~ /^(\d{2})\d{2}$/
Truth table33%1/3
A and B
A= defined $expB= $exp =~ /^(\d{2})\d{2}$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $month = sprintf( "%02d", $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 16 | return $month; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 16 | ▶ | sub expdate_year { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expdate_year: called CC=5 SCAR=17.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 16 | my ($self, $exp) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 16 | my $year; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 16 | ▶ | if ( defined($exp) and $exp =~ /^\d+\D+\d*(\d{2})$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $exp and $exp =~ /^\d+\D+\d*(\d{2})$/
MC/DC50%1/2
defined $exp and $exp =~ /^\d+\D+\d*(\d{2})$/
defined $exp
$exp =~ /^\d+\D+\d*(\d{2})$/
Truth table66%2/3
A and B
A= defined $expB= $exp =~ /^\d+\D+\d*(\d{2})$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 6 | $year = sprintf( "%02d", $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ▶ | }elsif ( defined($exp) and $exp =~ /^\d{2}(\d{2})$/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $exp and $exp =~ /^\d{2}(\d{2})$/
MC/DC0%0/2
defined $exp and $exp =~ /^\d{2}(\d{2})$/
defined $exp
$exp =~ /^\d{2}(\d{2})$/
Truth table33%1/3
A and B
A= defined $expB= $exp =~ /^\d{2}(\d{2})$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | $year = sprintf( "%02d", $1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 16 | return $year; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 46 | ▶ | sub revmap_fields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
revmap_fields: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 46 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 46 | tie my(%map), 'Tie::IxHash', @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 46 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 46 | my $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 446 | ▶ | if ( ref( $map{$_} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 32 | ▶ | $value = $map{$_} if ( keys %{ $map{$_} } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | }elsif( ref( $map{$_} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 102 | $value = ${ $map{$_} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }elsif( exists( $content{ $map{$_} } ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 91 | $value = $content{ $map{$_} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 446 | ▶ | if (defined($value)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 173 | ($_ => $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 273 | (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } (keys %map); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 8 | ▶ | sub submit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit: called CC=59 SCAR=44.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 8 | my($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 8 | $self->is_success(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 8 | $self->map_fields(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 8 | my @required_fields = qw(action login password type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 8 | my $action = lc($self->{_content}->{action}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 8 | my $type = $self->transaction_type(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 8 | ▶ | if ( $action eq 'normal authorization' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition88%8/9
$action eq "normal authorization" or $action eq "credit" or $action eq "authorization only" and $type eq "CC"
$action eq "normal authorization" or $action eq "credit"
$action eq "authorization only" and $type eq "CC"
MC/DC75%3/4
$action eq "normal authorization" or $action eq "credit" or $action eq "authorization only" and $type eq "CC"
$action eq "normal authorization"
$action eq "credit"
$action eq "authorization only"
$type eq "CC"
Truth table80%4/5
A or B or C and D
A= $action eq "normal authorization"B= $action eq "credit"C= $action eq "authorization only"D= $type eq "CC"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | || $action eq 'credit' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | || $action eq 'authorization only' && $type eq 'CC') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 6 | push @required_fields, qw( amount ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 6 | ▶ | push @required_fields, qw( card_number expiration ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | if ($type eq "CC"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 6 | ▶ | push @required_fields, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | qw( routing_code account_number name ) # account_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | if ($type eq "ECHECK"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | ▶ | }elsif ( $action eq 'post authorization' && $type eq 'CC') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$action eq "post authorization" and $type eq "CC"
MC/DC50%1/2
$action eq "post authorization" and $type eq "CC"
$action eq "post authorization"
$type eq "CC"
Truth table66%2/3
A and B
A= $action eq "post authorization"B= $type eq "CC"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | push @required_fields, qw( order_number ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | ▶ | }elsif ( $action eq 'reverse authorization' && $type eq 'CC') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$action eq "reverse authorization" and $type eq "CC"
MC/DC0%0/2
$action eq "reverse authorization" and $type eq "CC"
$action eq "reverse authorization"
$type eq "CC"
Truth table33%1/3
A and B
A= $action eq "reverse authorization"B= $type eq "CC"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | push @required_fields, qw( order_number card_number expiration amount ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | }elsif ( $action eq 'void') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | push @required_fields, qw( order_number amount ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | push @required_fields, qw( authorization card_number ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | if ($type eq "CC"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | ▶ | push @required_fields, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | qw( routing_code account_number name ) # account_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | if ($type eq "ECHECK"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | croak "$me can't handle transaction type: ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $self->{_content}->{action}. " for ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | $self->transaction_type(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 8 | my %content = $self->content(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 8 | foreach ( keys ( %{($self->{_defaults})} ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 8 | ▶ | $content{$_} = $self->{_defaults}->{$_} unless exists($content{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 8 | ▶ | if ($self->test_transaction()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 8 | $content{'login'} = 'TESTTERMINAL'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 8 | ▶ | $self->server('testgtwy.ippay.com') if $self->server eq 'gtwy.ippay.com'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 8 | $self->content(%content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 8 | $self->required_fields(@required_fields); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | #quick validation because ippay dumps an error indecipherable to the end user | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 8 | ▶ | if (grep { /^routing_code$/ } @required_fields) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 2 | ▶ | unless( $content{routing_code} =~ /^\d{9}$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $self->_error_response('Invalid routing code'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 8 | my $transaction_id = $content{'order_number'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 8 | ▶ | unless ($transaction_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | my ($page, $server_response, %headers) = $self->https_get('dummy' => 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | warn "fetched transaction id: (HTTPS response: $server_response) ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | "(HTTPS headers: ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | join(", ", map { "$_ => ". $headers{$_} } keys %headers ). ") ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | "(Raw HTTPS content: $page)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | if $DEBUG > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 6 | ▶ | return unless $server_response=~ /^200/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 6 | $transaction_id = $page; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 8 | my $cardexpmonth = $self->expdate_month($content{expiration}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 8 | my $cardexpyear = $self->expdate_year($content{expiration}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 8 | my $cardstartmonth = $self->expdate_month($content{card_start}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 8 | my $cardstartyear = $self->expdate_year($content{card_start}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 8 | my $amount; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 8 | ▶ | if (defined($content{amount})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 8 | $amount = sprintf("%.2f", $content{amount}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 8 | $amount =~ s/\.//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | my $name = length($content{name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ? $content{name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 8 | ▶ | : $content{first_name}. ' '. $content{last_name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | my $check_number = $content{check_number} || "100" # make one up | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | ▶ | if($content{account_number}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$content{'check_number'} || '100'
MC/DC0%0/1
$content{'check_number'} || '100'
$content{'check_number'}
Truth table50%1/2
A
A= $content{'check_number'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 8 | ▶ | my $terminalid = $content{login} if $type eq 'CC'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 8 | ▶ | my $merchantid = $content{login} if $type eq 'ECHECK'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 8 | my $country = country2code( $content{country}, LOCALE_CODE_ALPHA_3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | $country = country_code2code( $content{country}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 8 | ▶ | LOCALE_CODE_ALPHA_2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | LOCALE_CODE_ALPHA_3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | unless $country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | $country = $content{country} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 8 | ▶ | unless $country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 8 | ▶ | $country = uc($country) if $country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | my $ship_name = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | length($content{ship_name}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | ? $content{ship_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | : (length($content{ship_first_name}) || length($content{ship_last_name})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | ? $content{ship_first_name}. ' '. $content{ship_last_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 8 | ▶ | : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
length $content{"ship_first_name"} or length $content{"ship_last_name"}
MC/DC0%0/2
length $content{"ship_first_name"} or length $content{"ship_last_name"}
length $content{"ship_first_name"}
length $content{"ship_last_name"}
Truth table33%1/3
A or B
A= length $content{"ship_first_name"}B= length $content{"ship_last_name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | my $ship_country = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 8 | country2code( $content{ship_country}, LOCALE_CODE_ALPHA_3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | $ship_country = country_code2code( $content{ship_country}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 8 | ▶ | LOCALE_CODE_ALPHA_2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | LOCALE_CODE_ALPHA_3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | unless $ship_country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | $ship_country = $content{ship_country} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 8 | ▶ | unless $ship_country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 8 | ▶ | $ship_country = uc($ship_country) if $ship_country; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 8 | tie my %ach, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | #wtf, this is a "Type"" attribute of the ACH element, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # not a child element like the others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | #AccountType => 'account_type', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | AccountNumber => 'account_number', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ABA => 'routing_code', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | CheckNumber => \$check_number, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 8 | tie my %industryinfo, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | Type => 'IndustryInfo', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 8 | tie my %shippingaddr, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | Address => 'ship_address', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | City => 'ship_city', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | StateProv => 'ship_state', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | Country => \$ship_country, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | Phone => 'ship_phone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 8 | ▶ | unless ( $type ne 'CC' || keys %shippingaddr ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type ne "CC" or keys %shippingaddr
MC/DC50%1/2
$type ne "CC" or keys %shippingaddr
$type ne "CC"
keys %shippingaddr
Truth table66%2/3
A or B
A= $type ne "CC"B= keys %shippingaddr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 6 | tie %shippingaddr, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | Address => 'address', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | City => 'city', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | StateProv => 'state', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | Country => \$country, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | Phone => 'phone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 8 | ▶ | delete $shippingaddr{Country} unless $shippingaddr{Country}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 8 | tie my %shippinginfo, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | CustomerPO => 'CustomerPO', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ShippingMethod => 'ShippingMethod', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | ShippingName => \$ship_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | ShippingAddr => \%shippingaddr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 8 | tie my %req, 'Tie::IxHash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | $self->revmap_fields( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | TransactionType => 'TransactionType', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | TerminalID => 'login', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # TerminalID => \$terminalid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # MerchantID => \$merchantid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | TransactionID => \$transaction_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | RoutingCode => 'RoutingCode', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | Approval => 'authorization', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | BatchID => 'BatchID', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | Origin => 'Origin', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | Password => 'password', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | OrderNumber => 'invoice_number', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | CardNum => 'card_number', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | CVV2 => 'cvv2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | Issue => 'issue_number', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | CardExpMonth => \$cardexpmonth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | CardExpYear => \$cardexpyear, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | CardStartMonth => \$cardstartmonth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | CardStartYear => \$cardstartyear, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | Track1 => 'track1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | Track2 => 'track2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | ACH => \%ach, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | CardName => \$name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | DispositionType => 'DispositionType', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | TotalAmount => \$amount, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | FeeAmount => 'FeeAmount', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | TaxAmount => 'TaxAmount', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | BillingAddress => 'address', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | BillingCity => 'city', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | BillingStateProv => 'state', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | BillingPostalCode => 'zip', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | BillingCountry => \$country, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | BillingPhone => 'phone', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | Email => 'email', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | UserIPAddress => 'customer_ip', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | UserHost => 'UserHost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | UDField1 => 'UDField1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | UDField2 => 'UDField2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | UDField3 => \"$me $VERSION", #'UDField3', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | ActionCode => 'ActionCode', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | IndustryInfo => \%industryinfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | ShippingInfo => \%shippinginfo, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 8 | ▶ | delete $req{BillingCountry} unless $req{BillingCountry}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 8 | my $post_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 8 | my $writer = new XML::Writer( OUTPUT => \$post_data, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | DATA_MODE => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | DATA_INDENT => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | ENCODING => 'us-ascii', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 8 | $writer->xmlDecl(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 8 | $writer->startTag('ippay'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 8 | foreach ( keys ( %req ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 129 | $self->_xmlwrite($writer, $_, $req{$_}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 8 | $writer->endTag('ippay'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 8 | $writer->end(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 8 | ▶ | warn "$post_data\n" if $DEBUG > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 8 | my ($page,$server_response,%headers) = $self->https_post($post_data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 8 | ▶ | warn "$page\n" if $DEBUG > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 8 | my $response = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 8 | ▶ | if ($server_response =~ /^200/){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 8 | $response = XMLin($page); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 8 | ▶ | if ( exists($response->{ActionCode}) && !exists($response->{ErrMsg})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $response->{"ActionCode"} and not exists $response->{"ErrMsg"}
MC/DC50%1/2
exists $response->{"ActionCode"} and not exists $response->{"ErrMsg"}
exists $response->{"ActionCode"}
not exists $response->{"ErrMsg"}
Truth table66%2/3
A and not(B)
A= exists $response->{"ActionCode"}B= not exists $response->{"ErrMsg"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 7 | $self->error_message($response->{ResponseText}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 1 | $self->error_message($response->{ErrMsg}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # $self->error_message("Server Failed"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 8 | ▶ | $self->result_code($response->{ActionCode} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$response->{'ActionCode'} || ''
MC/DC0%0/1
$response->{'ActionCode'} || ''
$response->{'ActionCode'}
Truth table50%1/2
A
A= $response->{'ActionCode'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 8 | ▶ | $self->order_number($response->{TransactionID} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$response->{'TransactionID'} || ''
MC/DC100%1/1
$response->{'TransactionID'} || ''
$response->{'TransactionID'}
Truth table100%2/2
A
A= $response->{'TransactionID'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | ▶ | $self->authorization($response->{Approval} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$response->{'Approval'} || ''
MC/DC100%1/1
$response->{'Approval'} || ''
$response->{'Approval'}
Truth table100%2/2
A
A= $response->{'Approval'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 8 | ▶ | $self->cvv2_response($response->{CVV2} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$response->{'CVV2'} || ''
MC/DC0%0/1
$response->{'CVV2'} || ''
$response->{'CVV2'}
Truth table50%1/2
A
A= $response->{'CVV2'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 8 | ▶ | if ( ref($response->{AVS}) eq 'HASH' && ! keys(%{$response->{AVS}}) ) { #empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $response->{"AVS"} eq "HASH" and not keys %{$$response{"AVS"};}
MC/DC50%1/2
ref $response->{"AVS"} eq "HASH" and not keys %{$$response{"AVS"};}
ref $response->{"AVS"} eq "HASH"
not keys %{$$response{"AVS"};}
Truth table66%2/3
A and not(B)
A= ref $response->{"AVS"} eq "HASH"B= not keys %{$$response{"AVS"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 3 | $self->avs_code(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 5 | ▶ | $self->avs_code($response->{AVS} || ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$response->{'AVS'} || ''
MC/DC100%1/1
$response->{'AVS'} || ''
$response->{'AVS'}
Truth table100%2/2
A
A= $response->{'AVS'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 8 | ▶ | $self->is_success($self->result_code() eq '000' ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 8 | ▶ | unless ($self->is_success()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 1 | ▶ | unless ( $self->error_message() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( $DEBUG ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #additional logging information, possibly too sensitive for an error msg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # (IPPay seems to have a failure mode where they return the full | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # original request including card number) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | $self->error_message( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | "(HTTPS response: $server_response) ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | "(HTTPS headers: ". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | join(", ", map { "$_ => ". $headers{$_} } keys %headers ). ") ". | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | "(Raw HTTPS content: $page)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $self->error_message('No ResponseText or ErrMsg was returned by IPPay (enable debugging for raw HTTPS response)'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | sub _error_response { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error_response: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my ($self, $error_message) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $self->result_code(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | $self->order_number(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | $self->authorization(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $self->cvv2_response(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->avs_code(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | $self->is_success( 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->error_message($error_message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 173 | ▶ | sub _xmlwrite { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xmlwrite: called CC=7 SCAR=19.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 173 | my ($self, $writer, $item, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 173 | my %att = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 173 | ▶ | if ( $item eq 'ACH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | $att{'Type'} = $self->{_content}->{'account_type'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | ▶ | if $self->{_content}->{'account_type'}; #necessary so we don't pass empty? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | $att{'SEC'} = $self->{_content}->{'nacha_sec_code'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | ▶ | || ( $att{'Type'} =~ /business/i ? 'CCD' : 'PPD' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{'_content'}{'nacha_sec_code'} || ($att{'Type'} =~ /business/i ? 'CCD' : 'PPD')
MC/DC0%0/2
$self->{'_content'}{'nacha_sec_code'} || ($att{'Type'} =~ /business/i ? 'CCD' : 'PPD')
$self->{'_content'}{'nacha_sec_code'}
($att{'Type'} =~ /business/i ? 'CCD' : 'PPD')
Truth table33%1/3
A || B
A= $self->{'_content'}{'nacha_sec_code'}B= ($att{'Type'} =~ /business/i ? 'CCD' : 'PPD')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 173 | $writer->startTag($item, %att); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 173 | ▶ | if ( ref( $value ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 16 | foreach ( keys ( %$value ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 44 | $self->_xmlwrite($writer, $_, $value->{$_}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 157 | $writer->characters($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 173 | $writer->endTag($item); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||