line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::OnlinePayment::Network1Financial; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
6478
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
159
|
|
4
|
3
|
|
|
3
|
|
16
|
use Carp; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1437
|
|
5
|
3
|
|
|
3
|
|
3674
|
use Business::OnlinePayment; |
|
3
|
|
|
|
|
10777
|
|
|
3
|
|
|
|
|
115
|
|
6
|
|
|
|
|
|
|
#use Business::CreditCard; |
7
|
3
|
|
|
3
|
|
6985
|
use Net::SSLeay qw( make_form post_https make_headers ); |
|
3
|
|
|
|
|
91893
|
|
|
3
|
|
|
|
|
2480
|
|
8
|
3
|
|
|
3
|
|
3924
|
use URI; |
|
3
|
|
|
|
|
30219
|
|
|
3
|
|
|
|
|
141
|
|
9
|
3
|
|
|
3
|
|
36
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $DEBUG); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
13802
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require Exporter; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
@ISA = qw(Exporter AutoLoader Business::OnlinePayment); |
14
|
|
|
|
|
|
|
@EXPORT = qw(); |
15
|
|
|
|
|
|
|
@EXPORT_OK = qw(); |
16
|
|
|
|
|
|
|
$VERSION = '0.02'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$DEBUG = 0; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#my %error = ( |
21
|
|
|
|
|
|
|
# 000000 => 'INTERNAL SERVER ERROR', |
22
|
|
|
|
|
|
|
# 000001 => 'INTERNAL SERVER ERROR', |
23
|
|
|
|
|
|
|
# 000002 => 'INTERNAL SERVER ERROR', |
24
|
|
|
|
|
|
|
# 900000 => 'INVALID T_ORDERNUM', |
25
|
|
|
|
|
|
|
# 900001 => 'INVALID C_NAME', |
26
|
|
|
|
|
|
|
# 900002 => 'INVALID C_ADDRESS', |
27
|
|
|
|
|
|
|
# 900003 => 'INVALID C_CITY', |
28
|
|
|
|
|
|
|
# 900004 => 'INVALID C_STATE', |
29
|
|
|
|
|
|
|
# 900005 => 'INVALID C_ZIP', |
30
|
|
|
|
|
|
|
# 900006 => 'INVALID C_COUNTRY', |
31
|
|
|
|
|
|
|
# 900007 => 'INVALID C_TELEPHONE', |
32
|
|
|
|
|
|
|
# 900008 => 'INVALID C_FAX', |
33
|
|
|
|
|
|
|
# 900009 => 'INVALID C_EMAIL', |
34
|
|
|
|
|
|
|
# 900010 => 'INVALID C_SHIP_NAME', |
35
|
|
|
|
|
|
|
# 900011 => 'INVALID C_SHIP_ADDRESS', |
36
|
|
|
|
|
|
|
# 900012 => 'INVALID C_SHIP_CITY', |
37
|
|
|
|
|
|
|
# 900013 => 'INVALID C_SHIP_STATE', |
38
|
|
|
|
|
|
|
# 900014 => 'INVALID C_SHIP_ZIP', |
39
|
|
|
|
|
|
|
# 900015 => 'INVALID C_SHIP_COUNTRY', |
40
|
|
|
|
|
|
|
# 900016 => 'INVALID C_CARDNUMBER', |
41
|
|
|
|
|
|
|
# 900017 => 'INVALID C_EXP', |
42
|
|
|
|
|
|
|
# 900018 => 'INVALID C_CVV', |
43
|
|
|
|
|
|
|
# 900019 => 'INVALID T_AMT', |
44
|
|
|
|
|
|
|
# 900020 => 'INVALID T_CODE', |
45
|
|
|
|
|
|
|
# 900021 => 'INVALID T_AUTH', |
46
|
|
|
|
|
|
|
# 900022 => 'INVALID T_REFERENCE', |
47
|
|
|
|
|
|
|
# 900023 => 'INVALID T_TRACKDATA', |
48
|
|
|
|
|
|
|
# 900024 => 'INVALID T_TRACKING_NUMBER', |
49
|
|
|
|
|
|
|
# 900025 => 'INVALID T_CUSTOMER_NUMBER', |
50
|
|
|
|
|
|
|
# 910000 => 'SERVICE NOT ALLOWED', |
51
|
|
|
|
|
|
|
# 910001 => 'VISA NOT ALLOWED', |
52
|
|
|
|
|
|
|
# 910002 => 'MASTERCARD NOT ALLOWED', |
53
|
|
|
|
|
|
|
# 910003 => 'AMEX NOT ALLOWED', |
54
|
|
|
|
|
|
|
# 910004 => 'DISCOVER NOT ALLOWED', |
55
|
|
|
|
|
|
|
# 910005 => 'CARD TYPE NOT ALLOWED', |
56
|
|
|
|
|
|
|
# 911911 => 'SECURITY VIOLATION', |
57
|
|
|
|
|
|
|
# 920000 => 'ITEM NOT FOUND', |
58
|
|
|
|
|
|
|
# 920001 => 'CREDIT VOL EXCEEDED', |
59
|
|
|
|
|
|
|
# 920002 => 'AVS FAILURE', |
60
|
|
|
|
|
|
|
# 999999 => 'INTERNAL SERVER ERROR', |
61
|
|
|
|
|
|
|
#); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub set_defaults { |
64
|
2
|
|
|
2
|
0
|
146
|
my $self = shift; |
65
|
2
|
|
|
|
|
69
|
$self->server('va.eftsecure.net'); |
66
|
2
|
|
|
|
|
137
|
$self->port('443'); |
67
|
|
|
|
|
|
|
#$self->path('/cgi-bin/eftBankcard.dll?transaction'); |
68
|
|
|
|
|
|
|
#$self->build_subs(qw( product_id merchant_id )); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub map_fields { |
72
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
73
|
2
|
|
|
|
|
8
|
my %content = $self->content(); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# ACTION MAP |
76
|
2
|
|
|
|
|
56
|
my %actions = ( 'normal authorization' => '01', |
77
|
|
|
|
|
|
|
'authorization only' => '02', |
78
|
|
|
|
|
|
|
'credit' => '06', |
79
|
|
|
|
|
|
|
'post authorization' => '03', |
80
|
|
|
|
|
|
|
); |
81
|
2
|
|
33
|
|
|
15
|
$content{'action'} = $actions{lc($content{'action'})} || $content{'action'}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# TYPE MAP |
84
|
2
|
|
|
|
|
17
|
my %types = ('visa' => 'BankCard', |
85
|
|
|
|
|
|
|
'mastercard' => 'BankCard', |
86
|
|
|
|
|
|
|
'american express' => 'BankCard', |
87
|
|
|
|
|
|
|
'discover' => 'BankCard', |
88
|
|
|
|
|
|
|
'cc' => 'BankCard', |
89
|
|
|
|
|
|
|
'check' => 'VirtualCheck', |
90
|
|
|
|
|
|
|
); |
91
|
2
|
|
33
|
|
|
11
|
$content{'type'} = $types{lc($content{'type'})} || $content{'type'}; |
92
|
2
|
|
|
|
|
58
|
$self->transaction_type($content{'type'}); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# stuff it back into %content |
95
|
2
|
|
|
|
|
384
|
$self->content(%content); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub revmap_fields { |
99
|
2
|
|
|
2
|
0
|
26
|
my($self, %map) = @_; |
100
|
2
|
|
|
|
|
9
|
my %content = $self->content(); |
101
|
2
|
|
|
|
|
39
|
foreach(keys %map) { |
102
|
2
|
|
|
|
|
7
|
$content{$_} = ref($map{$_}) |
103
|
32
|
100
|
|
|
|
78
|
? ${ $map{$_} } |
104
|
|
|
|
|
|
|
: $content{$map{$_}}; |
105
|
|
|
|
|
|
|
} |
106
|
2
|
|
|
|
|
17
|
$self->content(%content); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub submit { |
110
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
111
|
0
|
|
|
|
|
|
$self->map_fields(); |
112
|
0
|
|
|
|
|
|
my %content = $self->content(); |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $action = lc($content{'action'}); |
115
|
0
|
0
|
|
|
|
|
if ( $action eq '01' ) { |
116
|
|
|
|
|
|
|
} else { |
117
|
0
|
|
|
|
|
|
croak "$action not (yet) supported"; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
my $type = $content{'type'}; |
121
|
0
|
0
|
|
|
|
|
if ( $type eq 'BankCard' ) { |
122
|
|
|
|
|
|
|
} else { |
123
|
0
|
|
|
|
|
|
croak "$type not (yet) supported"; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
$content{'expiration'} =~ /^(\d+)\/(\d+)$/; |
127
|
0
|
|
|
|
|
|
my($m, $y) = ($1, $2); |
128
|
0
|
|
|
|
|
|
$m = $m+0; |
129
|
0
|
0
|
|
|
|
|
$m = "0$m" if $m<10; |
130
|
0
|
|
|
|
|
|
my $exp = "$m$y"; |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
$self->revmap_fields( |
133
|
|
|
|
|
|
|
'M_id' => 'login', |
134
|
|
|
|
|
|
|
'M_key' => 'password', |
135
|
|
|
|
|
|
|
'C_name' => 'name', |
136
|
|
|
|
|
|
|
'C_address' => 'address', |
137
|
|
|
|
|
|
|
'C_city' => 'city', |
138
|
|
|
|
|
|
|
'C_state' => 'state', |
139
|
|
|
|
|
|
|
'C_zip' => 'zip', |
140
|
|
|
|
|
|
|
'C_country' => 'country', |
141
|
|
|
|
|
|
|
'C_email' => 'email', |
142
|
|
|
|
|
|
|
'C_cardnumber' => 'card_number', |
143
|
|
|
|
|
|
|
'C_exp' => \$exp, |
144
|
|
|
|
|
|
|
'T_amt' => 'amount', |
145
|
|
|
|
|
|
|
'T_code' => 'action', |
146
|
|
|
|
|
|
|
#'T_ordernum' => 'invoice_number', #probably not unique... |
147
|
|
|
|
|
|
|
#'T_auth' => |
148
|
|
|
|
|
|
|
#'T_trackdata' => |
149
|
|
|
|
|
|
|
'C_cvv' => 'cvv', |
150
|
|
|
|
|
|
|
'T_customer_number' => 'customer_id', |
151
|
|
|
|
|
|
|
#'T_tax' => |
152
|
|
|
|
|
|
|
#'T_shipping' => |
153
|
|
|
|
|
|
|
#'C_ship_name' => |
154
|
|
|
|
|
|
|
#'C_ship_address' => |
155
|
|
|
|
|
|
|
#'C_ship_city' => |
156
|
|
|
|
|
|
|
#'C_ship_state' => |
157
|
|
|
|
|
|
|
#'C_ship_zip' => |
158
|
|
|
|
|
|
|
#'C_ship_country' => |
159
|
|
|
|
|
|
|
'C_telephone' => 'phone', |
160
|
|
|
|
|
|
|
#'C_fax' => 'fax', |
161
|
|
|
|
|
|
|
); |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
my %post_data = $self->get_fields(qw( |
164
|
|
|
|
|
|
|
M_id M_key C_name C_address C_city C_state C_zip C_country C_email |
165
|
|
|
|
|
|
|
C_cardnumber C_exp T_amt T_code |
166
|
|
|
|
|
|
|
C_cvv T_customer_number |
167
|
|
|
|
|
|
|
C_telephone |
168
|
|
|
|
|
|
|
)); |
169
|
|
|
|
|
|
|
#T_ordernum T_auth T_trackdata |
170
|
|
|
|
|
|
|
#T_tax T_shipping C_ship_name C_ship_address C_ship_city C_ship_state |
171
|
|
|
|
|
|
|
#C_ship_zip C_ship_country |
172
|
|
|
|
|
|
|
#C_fax |
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
|
my $pd = make_form(%post_data); |
175
|
0
|
|
|
|
|
|
my $s = $self->server(); |
176
|
0
|
|
|
|
|
|
my $p = $self->port(); |
177
|
0
|
|
|
|
|
|
my $t = "/cgi-bin/eft$type.dll?transaction"; |
178
|
0
|
|
|
|
|
|
my($page,$server_response,%headers) = post_https($s,$p,$t,'',$pd); |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
my $approved = substr($page,1, 1); #A is approved E is declined/error. |
181
|
0
|
|
|
|
|
|
my $result_code = substr($page, 2, 6); |
182
|
0
|
|
|
|
|
|
my $error_message = substr($page, 8, 32); |
183
|
|
|
|
|
|
|
#print "Front-End Indicator: " . substr($page, 40, 2); |
184
|
|
|
|
|
|
|
#print "CVV Indicator: " . substr($page, 42, 1); |
185
|
|
|
|
|
|
|
#print "AVS Indicator: " . substr($page, 43, 1); |
186
|
|
|
|
|
|
|
#print "Risk Indicator: " . substr($page, 44, 2); |
187
|
0
|
|
|
|
|
|
my $reference = substr($page, 46, 10); |
188
|
|
|
|
|
|
|
#print "Order Number: " . substr($page, index($page, chr(28)) + 1, |
189
|
|
|
|
|
|
|
# rindex($page, chr(28)) - index($page, chr(28)) - 1); |
190
|
|
|
|
|
|
|
|
191
|
0
|
0
|
|
|
|
|
if ( $approved eq 'A' ) { |
192
|
0
|
|
|
|
|
|
$self->is_success(1); |
193
|
0
|
|
|
|
|
|
$self->result_code($result_code); |
194
|
0
|
|
|
|
|
|
$self->error_message($error_message); |
195
|
0
|
|
|
|
|
|
$self->authorization($reference); |
196
|
|
|
|
|
|
|
} else { |
197
|
0
|
|
|
|
|
|
$self->is_success(0); |
198
|
0
|
|
|
|
|
|
$self->result_code($result_code); |
199
|
0
|
|
|
|
|
|
$self->error_message($error_message); |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
1; |
205
|
|
|
|
|
|
|
__END__ |