| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::OnlinePayment::CyberSource; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3749
|
use 5.010; |
|
|
1
|
|
|
|
|
2
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
14
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
23
|
|
|
6
|
1
|
|
|
1
|
|
370
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
8537
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
478
|
use Moose; |
|
|
1
|
|
|
|
|
279901
|
|
|
|
1
|
|
|
|
|
7
|
|
|
9
|
1
|
|
|
1
|
|
5264
|
use Data::Dump 'dump'; |
|
|
1
|
|
|
|
|
3739
|
|
|
|
1
|
|
|
|
|
65
|
|
|
10
|
1
|
|
|
1
|
|
596
|
use Exception::Base; |
|
|
1
|
|
|
|
|
6700
|
|
|
|
1
|
|
|
|
|
5
|
|
|
11
|
1
|
|
|
1
|
|
524
|
use MooseX::NonMoose; |
|
|
1
|
|
|
|
|
745
|
|
|
|
1
|
|
|
|
|
2
|
|
|
12
|
1
|
|
|
1
|
|
51634
|
use MooseX::StrictConstructor; |
|
|
1
|
|
|
|
|
14345
|
|
|
|
1
|
|
|
|
|
3
|
|
|
13
|
1
|
|
|
1
|
|
9393
|
use MooseX::Types::Moose qw(Bool HashRef Int); |
|
|
1
|
|
|
|
|
41893
|
|
|
|
1
|
|
|
|
|
9
|
|
|
14
|
1
|
|
|
1
|
|
5462
|
use MooseX::Types::Common::String qw(NonEmptySimpleStr); |
|
|
1
|
|
|
|
|
83384
|
|
|
|
1
|
|
|
|
|
5
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# ABSTRACT: CyberSource backend for Business::OnlinePayment |
|
17
|
|
|
|
|
|
|
our $VERSION = '3.000010'; # TRIAL VERSION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
extends 'Business::OnlinePayment'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#### Subroutine Definitions #### |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Post-construction hook |
|
24
|
|
|
|
|
|
|
# Accepts: A reference to a hash of construction parameters |
|
25
|
|
|
|
|
|
|
# Returns: Nothing |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub BUILD { |
|
28
|
0
|
|
|
0
|
|
|
my ( $self ) = @_; |
|
29
|
0
|
|
|
|
|
|
my $fields = [ qw(type action reference_code amount) ]; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->required_fields( @$fields ); |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#### Object Attributes #### |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#### Applied Roles #### |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
with 'Business::OnlinePayment::CyberSource::Role::TransactionHandling'; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#### Method Modifiers #### |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#### Meta class stuff #### |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Business::OnlinePayment::CyberSource - CyberSource backend for Business::OnlinePayment |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 VERSION |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
version 3.000010 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use Business::OnlinePayment; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $tx = Business::OnlinePayment->new( "CyberSource" ); |
|
67
|
|
|
|
|
|
|
$tx->content( |
|
68
|
|
|
|
|
|
|
login => 'username', |
|
69
|
|
|
|
|
|
|
password => 'password', |
|
70
|
|
|
|
|
|
|
type => 'CC', |
|
71
|
|
|
|
|
|
|
action => 'Normal Authorization', |
|
72
|
|
|
|
|
|
|
invoice_number => '00000001', # MurchantReferenceCode |
|
73
|
|
|
|
|
|
|
first_name => 'Peter', |
|
74
|
|
|
|
|
|
|
last_name => 'Bowen', |
|
75
|
|
|
|
|
|
|
address => '123 Anystreet', |
|
76
|
|
|
|
|
|
|
city => 'Orem', |
|
77
|
|
|
|
|
|
|
state => 'Utah', |
|
78
|
|
|
|
|
|
|
zip => '84097', |
|
79
|
|
|
|
|
|
|
country => 'US', |
|
80
|
|
|
|
|
|
|
email => 'foo@bar.net', |
|
81
|
|
|
|
|
|
|
card_number => '4111111111111111', |
|
82
|
|
|
|
|
|
|
expiration => '09/06', |
|
83
|
|
|
|
|
|
|
cvv2 => '1234', #optional |
|
84
|
|
|
|
|
|
|
amount => '5.00', |
|
85
|
|
|
|
|
|
|
currency => 'USD', |
|
86
|
|
|
|
|
|
|
); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$tx->submit(); |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
if($tx->is_success()) { |
|
91
|
|
|
|
|
|
|
print "Card processed successfully: ".$tx->authorization."\n"; |
|
92
|
|
|
|
|
|
|
} else { |
|
93
|
|
|
|
|
|
|
print "Card was rejected: ".$tx->error_message."\n"; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#### |
|
97
|
|
|
|
|
|
|
# Two step transaction, authorization and capture. |
|
98
|
|
|
|
|
|
|
# If you don't need to review order before capture, you can |
|
99
|
|
|
|
|
|
|
# process in one step as above. |
|
100
|
|
|
|
|
|
|
#### |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$tx = Business::OnlinePayment->new("CyberSource"); |
|
103
|
|
|
|
|
|
|
$tx->content( |
|
104
|
|
|
|
|
|
|
login => 'username', |
|
105
|
|
|
|
|
|
|
password => 'password', |
|
106
|
|
|
|
|
|
|
type => 'CC', |
|
107
|
|
|
|
|
|
|
action => 'Authorization Only', |
|
108
|
|
|
|
|
|
|
invoice_number => 44544, # MurchantReferenceCode |
|
109
|
|
|
|
|
|
|
description => 'Business::OnlinePayment visa test', |
|
110
|
|
|
|
|
|
|
amount => '42.39', |
|
111
|
|
|
|
|
|
|
first_name => 'Tofu', |
|
112
|
|
|
|
|
|
|
last_name => 'Beast', |
|
113
|
|
|
|
|
|
|
address => '123 Anystreet', |
|
114
|
|
|
|
|
|
|
city => 'Anywhere', |
|
115
|
|
|
|
|
|
|
state => 'Utah', |
|
116
|
|
|
|
|
|
|
zip => '84058', |
|
117
|
|
|
|
|
|
|
country => 'US', |
|
118
|
|
|
|
|
|
|
email => 'tofu@beast.org', |
|
119
|
|
|
|
|
|
|
card_number => '4111111111111111', |
|
120
|
|
|
|
|
|
|
expiration => '12/25', |
|
121
|
|
|
|
|
|
|
cvv2 => 1111, |
|
122
|
|
|
|
|
|
|
); |
|
123
|
|
|
|
|
|
|
$tx->submit(); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
if($tx->is_success()) { |
|
126
|
|
|
|
|
|
|
# get information about authorization |
|
127
|
|
|
|
|
|
|
my $authorization = $tx->authorization(); |
|
128
|
|
|
|
|
|
|
my $order_number = $tx->order_number(); # RequestId |
|
129
|
|
|
|
|
|
|
my $avs_code = $tx->avs_code(); # AVS Response Code(); |
|
130
|
|
|
|
|
|
|
my $cvv2_response = $tx->cvv2_response(); # CVV2/CVC2/CID Response Code(); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# now capture transaction |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$tx->content( |
|
135
|
|
|
|
|
|
|
login => 'username', |
|
136
|
|
|
|
|
|
|
password => 'password', |
|
137
|
|
|
|
|
|
|
type => 'CC', |
|
138
|
|
|
|
|
|
|
action => 'Post Authorization', |
|
139
|
|
|
|
|
|
|
invoice_number => 44544, #MurchantReferenceCode |
|
140
|
|
|
|
|
|
|
amount => '42.39', |
|
141
|
|
|
|
|
|
|
po_number => $tx->order_number(), # RequestId |
|
142
|
|
|
|
|
|
|
); |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
$tx->submit(); |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
if($tx->is_success()) { |
|
147
|
|
|
|
|
|
|
print "Funds captured successfully\n"; |
|
148
|
|
|
|
|
|
|
} else { |
|
149
|
|
|
|
|
|
|
print "Card was rejected: ".$tx->error_message."\n"; |
|
150
|
|
|
|
|
|
|
} |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
} else { |
|
153
|
|
|
|
|
|
|
print "Card was rejected: " . $tx->error_message() . "\n"; |
|
154
|
|
|
|
|
|
|
} |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
For detailed information see L<Business::OnlinePayment>. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 METHODS |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 BUILD |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
this is a before-construction hook for Moose. You Will never call this method directly. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 SUPPORTED TRANSACTION TYPES |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 CC |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Content required: type, login, action, amount, first_name, last_name, card_number, expiration. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
cvv2 is required in order to get back a cvv2_response value. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 Settling |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
To settle an authorization-only transaction (where you set action to |
|
177
|
|
|
|
|
|
|
C<Authorization Only>), submit the C<order_number> code in the field |
|
178
|
|
|
|
|
|
|
C<po_number> with the action set to C<Post Authorization>. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
You can get the transaction id from the authorization by calling the |
|
181
|
|
|
|
|
|
|
C<order_number> method on the object returned from the authorization. |
|
182
|
|
|
|
|
|
|
You must also submit the amount field with a value less than or equal |
|
183
|
|
|
|
|
|
|
to the amount specified in the original authorization. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 ACKNOWLEDGMENTS |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=over 4 |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item Jason Kohles |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
For writing BOP - I didn't have to create my own framework. |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item Ivan Kohler |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Tested the first pre-release version and fixed a number of bugs. |
|
196
|
|
|
|
|
|
|
He also encouraged me to add better error reporting for system |
|
197
|
|
|
|
|
|
|
errors. He also added failure_status support. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item Jason (Jayce^) Hall |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Adding Request Token Requirements (Among other significant improvements... ) |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=back |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
L<Business::OnlinePayment> |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 BUGS |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
|
212
|
|
|
|
|
|
|
https://github.com/hostgator/Business-OnlinePayment-CyberSource/issues |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
215
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
216
|
|
|
|
|
|
|
feature. |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 AUTHORS |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=over 4 |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item * |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Jad Wauthier <Jadrien dot Wauthier at GMail dot com> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item * |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Caleb Cushing <xenoterracide@gmail.com> |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Peter Bowen <peter@bowenfamily.org> |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Hostgator.com. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
241
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |