line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::OnlinePayment::PaymenTech::Orbital; |
2
|
1
|
|
|
1
|
|
25545
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
94
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.7'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Business::OnlinePayment::PaymenTech::Orbital - PaymenTech Orbital backend for Business::OnlinePayment |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNPOSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my %options; |
13
|
|
|
|
|
|
|
$options{'merchantid'} = '1234'; |
14
|
|
|
|
|
|
|
my $tx = Business::OnlinePayment->new('PaymenTech::Orbital', %options); |
15
|
|
|
|
|
|
|
$tx->content( |
16
|
|
|
|
|
|
|
username => 'username', |
17
|
|
|
|
|
|
|
password => 'pass', |
18
|
|
|
|
|
|
|
invoice_number => $orderid, |
19
|
|
|
|
|
|
|
trace_number => $trace_num, # Optional |
20
|
|
|
|
|
|
|
action => 'Authorization Only', |
21
|
|
|
|
|
|
|
cvn => 123, # cvv2, cvc2, cid |
22
|
|
|
|
|
|
|
card_number => '1234123412341234', |
23
|
|
|
|
|
|
|
exp_date => '0410', |
24
|
|
|
|
|
|
|
address => '123 Test Street', |
25
|
|
|
|
|
|
|
name => 'Test User', |
26
|
|
|
|
|
|
|
amount => 100 # $1.00 |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
$tx->submit; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
if($tx->is_success) { |
31
|
|
|
|
|
|
|
print "Card processed successfully: ".$tx->authorization."\n"; |
32
|
|
|
|
|
|
|
} else { |
33
|
|
|
|
|
|
|
print "Card was rejected: ".$tx->error_message."\n"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Business::OnlinePayment::PaymenTech::Orbital allows you to utilize |
39
|
|
|
|
|
|
|
PaymenTech's Orbital SDK credit card services. You will need to install the |
40
|
|
|
|
|
|
|
Perl Orbital SDK for this to work. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This module was previous named Business::OnlinePayment::PaymenTech but was |
43
|
|
|
|
|
|
|
renamed since it is specific to the Orbital SDK product. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
For detailed information see L. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SUPPORTED ACTIONS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Authorization Only, Authorization and Capture, Capture, Credit |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
By default, Business::Online::PaymenTech::Orbital uses the MOTO API calls in |
52
|
|
|
|
|
|
|
the PaymenTech library. If you specifically set the C option to a |
53
|
|
|
|
|
|
|
true value in your C then the CC API will be used where applicable, |
54
|
|
|
|
|
|
|
notably Authorization, Authorization and Capture and Refund. (Actually, |
55
|
|
|
|
|
|
|
refund uses ECOMMERCE_REFUND when C is true). |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NOTES |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
There are a few rough edges to this module, but having it significantly eased |
60
|
|
|
|
|
|
|
a transition from one processor to another. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SOFT DESCRIPTORS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The Soft Descriptor feature is enabled by setting C and, |
65
|
|
|
|
|
|
|
optionally, any of the the following fields: |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item sd_merchant_name |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item sd_product_description |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item sd_merchant_city |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item sd_merchant_phone |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item sd_merchant_url |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item sd_merchant_email |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 DEFAULTS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item time zone defaults to 706 (Central) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item BIN defaults 001 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Some extra getters are provided. They are: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
response - Get the response code |
94
|
|
|
|
|
|
|
avs_response - Get the AVS response |
95
|
|
|
|
|
|
|
cvv2_response - Get the CVV2 response |
96
|
|
|
|
|
|
|
transaction_id - Get the PaymenTech assigned Transaction Id |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
1
|
|
|
1
|
|
6
|
use base qw(Business::OnlinePayment); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
943
|
|
101
|
|
|
|
|
|
|
|
102
|
1
|
|
|
1
|
|
558
|
use Paymentech::SDK; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
use Paymentech::eCommerce::RequestBuilder 'requestBuilder'; |
104
|
|
|
|
|
|
|
use Paymentech::eCommerce::RequestTypes qw(CC_AUTHORIZE_REQUEST MOTO_AUTHORIZE_REQUEST CC_MARK_FOR_CAPTURE_REQUEST ECOMMERCE_REFUND_REQUEST MOTO_REFUND_REQUEST); |
105
|
|
|
|
|
|
|
use Paymentech::eCommerce::TransactionProcessor ':alias'; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub set_defaults { |
108
|
|
|
|
|
|
|
my $self = shift; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
$self->{'_content'} = {}; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
$self->build_subs( |
113
|
|
|
|
|
|
|
qw(response avs_response cvv2_response transaction_id card_proc_resp) |
114
|
|
|
|
|
|
|
); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub submit { |
118
|
|
|
|
|
|
|
my $self = shift; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my %content = $self->content; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $req; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
if($content{'action'} eq 'Authorization Only') { |
125
|
|
|
|
|
|
|
if(lc($content{industry}) eq 'ecommerce') { |
126
|
|
|
|
|
|
|
$req = requestBuilder()->make(CC_AUTHORIZE_REQUEST()); |
127
|
|
|
|
|
|
|
if(defined($content{'cvn'})) { |
128
|
|
|
|
|
|
|
$req->CardSecVal($content{'cvn'}); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
} else { |
132
|
|
|
|
|
|
|
$req = requestBuilder()->make(MOTO_AUTHORIZE_REQUEST()); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
$self->_add_bill_to($req); |
135
|
|
|
|
|
|
|
# Authorize |
136
|
|
|
|
|
|
|
$req->MessageType('A'); |
137
|
|
|
|
|
|
|
$req->CurrencyCode('840'); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
$req->Exp($content{'exp_date'}); |
140
|
|
|
|
|
|
|
$req->AccountNum($content{'card_number'}); |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
} elsif($content{'action'} eq 'Capture') { |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
$req = requestBuilder()->make(CC_MARK_FOR_CAPTURE_REQUEST()); |
145
|
|
|
|
|
|
|
$req->TxRefNum($content{'tx_ref_num'}); |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
} elsif($content{'action'} eq 'Force Authorization Only') { |
148
|
|
|
|
|
|
|
# ? |
149
|
|
|
|
|
|
|
} elsif($content{'action'} eq 'Authorization and Capture') { |
150
|
|
|
|
|
|
|
if(lc($content{industry}) eq 'ecommerce') { |
151
|
|
|
|
|
|
|
$req = requestBuilder()->make(CC_AUTHORIZE_REQUEST()); |
152
|
|
|
|
|
|
|
if(defined($content{'cvn'})) { |
153
|
|
|
|
|
|
|
$req->CardSecVal($content{'cvn'}); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
} else { |
157
|
|
|
|
|
|
|
$req = requestBuilder()->make(MOTO_AUTHORIZE_REQUEST()); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
$self->_add_bill_to($req); |
160
|
|
|
|
|
|
|
# Authorize and Capture |
161
|
|
|
|
|
|
|
$req->MessageType('AC'); |
162
|
|
|
|
|
|
|
$req->CurrencyCode('840'); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$req->Exp($content{'exp_date'}); |
165
|
|
|
|
|
|
|
$req->AccountNum($content{'card_number'}); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
} elsif($content{'action'} eq 'Credit') { |
168
|
|
|
|
|
|
|
if(lc($content{industry}) eq 'ecommerce') { |
169
|
|
|
|
|
|
|
$req = requestBuilder()->make(ECOMMERCE_REFUND_REQUEST()); |
170
|
|
|
|
|
|
|
} else { |
171
|
|
|
|
|
|
|
$req = requestBuilder()->make(MOTO_REFUND_REQUEST()); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
$req->CurrencyCode($content{'currency_code'} || '840'); |
174
|
|
|
|
|
|
|
$req->AccountNum($content{'card_number'}); |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
} else { |
177
|
|
|
|
|
|
|
die('Unknown Action: '.$content{'action'}."\n"); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
if(defined($content{sd_merchant_name}) && $content{'action'} ne 'Capture') { |
181
|
|
|
|
|
|
|
$self->_add_soft_descriptor($req); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
$req->BIN($content{'BIN'} || '000001'); |
185
|
|
|
|
|
|
|
$req->MerchantID($self->{'merchantid'}); |
186
|
|
|
|
|
|
|
if(exists($content{'trace_number'}) && $content{'trace_number'} =~ /^\d+$/) { |
187
|
|
|
|
|
|
|
$req->traceNumber($content{'trace_number'}); |
188
|
|
|
|
|
|
|
} |
189
|
|
|
|
|
|
|
$req->OrderID($content{'invoice_number'}); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
$req->Amount(sprintf("%012d", $content{'amount'})); |
192
|
|
|
|
|
|
|
$req->TzCode($content{'TzCode'} || '706'); |
193
|
|
|
|
|
|
|
if(exists($content{'comments'})) { |
194
|
|
|
|
|
|
|
$req->Comments($content{'comments'} || ''); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
$self->{'request'} = $req; |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
$self->_post; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
$self->_process_response; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub _post { |
205
|
|
|
|
|
|
|
my $self = shift; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
my %content = $self->content; |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
if($self->test_transaction) { |
210
|
|
|
|
|
|
|
print STDERR $self->{request}->renderAsXML."\n"; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
my $gw_resp = gatewayTP()->process($self->{'request'}); |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub _process_response { |
218
|
|
|
|
|
|
|
my $self = shift; |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
my $resp = $self->{'request'}->response; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
unless(defined($resp)) { |
223
|
|
|
|
|
|
|
$self->is_success(0); |
224
|
|
|
|
|
|
|
$self->error_message($self->error_message." No response."); |
225
|
|
|
|
|
|
|
return; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
if($self->test_transaction) { |
229
|
|
|
|
|
|
|
print STDERR $resp->raw; |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
$self->transaction_id($resp->value('TxRefNum')); |
233
|
|
|
|
|
|
|
$self->cvv2_response($resp->CVV2ResponseCode); |
234
|
|
|
|
|
|
|
$self->response($resp->ResponseCode); |
235
|
|
|
|
|
|
|
$self->avs_response($resp->AVSResponseCode); |
236
|
|
|
|
|
|
|
$self->authorization($resp->value('AuthCode')); |
237
|
|
|
|
|
|
|
$self->error_message($resp->status); |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
if(!$resp->approved) { |
240
|
|
|
|
|
|
|
$self->is_success(0); |
241
|
|
|
|
|
|
|
return; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
$self->is_success(1); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
sub _add_bill_to { |
248
|
|
|
|
|
|
|
my ($self, $req) = @_; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
my %content = $self->content; |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
$req->AVSname($content{'name'}); |
253
|
|
|
|
|
|
|
$req->AVSaddress1($content{'address'}); |
254
|
|
|
|
|
|
|
$req->AVSaddress2($content{'address2'}); |
255
|
|
|
|
|
|
|
$req->AVScity($content{'city'}); |
256
|
|
|
|
|
|
|
$req->AVSstate($content{'state'}); |
257
|
|
|
|
|
|
|
$req->AVSzip($content{'zip'}); |
258
|
|
|
|
|
|
|
$req->AVScountryCode($content{'country'}); |
259
|
|
|
|
|
|
|
if(exists($content{'phone_number'})) { |
260
|
|
|
|
|
|
|
$req->AVSphoneNum($content{'phone_number'}); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub _add_soft_descriptor { |
265
|
|
|
|
|
|
|
my ($self, $req) = @_; |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
my %content = $self->content; |
268
|
|
|
|
|
|
|
$req->SDMerchantName($content{'sd_merchant_name'}); |
269
|
|
|
|
|
|
|
$req->SDProductDescription($content{'sd_product_description'}); |
270
|
|
|
|
|
|
|
$req->SDMerchantCity($content{'sd_merchant_city'}); |
271
|
|
|
|
|
|
|
$req->SDMerchantPhone($content{'sd_merchant_phone'}); |
272
|
|
|
|
|
|
|
$req->SDMerchantURL($content{'sd_merchant_url'}); |
273
|
|
|
|
|
|
|
$req->SDMerchantEmail($content{'sd_merchant_email'}); |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head1 AUTHOR |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
Cory 'G' Watson |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=head2 CONTRIBUTORS |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
Garth Sainio |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=head1 SEE ALSO |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
perl(1), L. |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Copyright 2008 by Magazines.com, LLC |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
You can redistribute and/or modify this code under the same terms as Perl |
293
|
|
|
|
|
|
|
itself. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=cut |
296
|
|
|
|
|
|
|
1; |