line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::OnlinePayment::IPayment::Transaction; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
7
|
|
|
7
|
|
142
|
use 5.010001; |
|
7
|
|
|
|
|
24
|
|
5
|
7
|
|
|
7
|
|
32
|
use strict; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
136
|
|
6
|
7
|
|
|
7
|
|
30
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
192
|
|
7
|
7
|
|
|
7
|
|
36
|
use utf8; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
62
|
|
8
|
7
|
|
|
7
|
|
210
|
use Scalar::Util qw/looks_like_number/; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
445
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=encoding utf8 |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Business::OnlinePayment::IPayment::Transaction - Simple object to hold the transaction request |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$IPayment_object->transaction(transactionType => 'auth', |
19
|
|
|
|
|
|
|
trxAmount => 5000, # 50 € |
20
|
|
|
|
|
|
|
trxCurrency => 'EUR', |
21
|
|
|
|
|
|
|
invoiceText => "Thanks!", |
22
|
|
|
|
|
|
|
trxUserComment => "Hello!", |
23
|
|
|
|
|
|
|
paymentType => "cc", |
24
|
|
|
|
|
|
|
shopper_id => int(rand(5000)), |
25
|
|
|
|
|
|
|
options => { |
26
|
|
|
|
|
|
|
fromIp => '99.99.99.99', |
27
|
|
|
|
|
|
|
checkDoubleTrx => 1, |
28
|
|
|
|
|
|
|
errorLang => 'en', |
29
|
|
|
|
|
|
|
# and possibly others, see doc wsdl |
30
|
|
|
|
|
|
|
}); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
7
|
|
|
7
|
|
37
|
use Moo; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
39
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head3 TransactionData |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This class holds the data of a single transaction. Given that the |
41
|
|
|
|
|
|
|
values are all related and shouldn't change over its lifetime, it's |
42
|
|
|
|
|
|
|
everything read-only. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item trxCurrency |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Currency in which the payment is processed. There are all known |
50
|
|
|
|
|
|
|
three-letter ISO Currency codes allowed. A list of known currency |
51
|
|
|
|
|
|
|
codes, see L under B. E.g C |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
CGI Name: C |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Note that the processing of payments in the currency must be agreed |
56
|
|
|
|
|
|
|
with your payment provider. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Default to C in this implementation. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has trxCurrency => (is => 'ro', |
64
|
|
|
|
|
|
|
default => sub { return 'EUR'}, |
65
|
|
|
|
|
|
|
isa => sub { |
66
|
|
|
|
|
|
|
die "Only one argument for trxCurrency" unless @_ == 1; |
67
|
|
|
|
|
|
|
die "Wrong currency" unless $_[0] =~ m/^[A-Z]{3}$/s; |
68
|
|
|
|
|
|
|
}); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item trxAmount |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Amount to be debited, in the B, for Example |
74
|
|
|
|
|
|
|
cents. B or other characters except numbers are |
75
|
|
|
|
|
|
|
B. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
CGI Name: C |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has trxAmount => (is => 'ro', |
82
|
|
|
|
|
|
|
default => sub { return 0 }, |
83
|
|
|
|
|
|
|
isa => sub { |
84
|
|
|
|
|
|
|
die "Not a number" unless looks_like_number($_[0]); |
85
|
|
|
|
|
|
|
my $num = $_[0]; |
86
|
|
|
|
|
|
|
die "<$num> is not an integer\n" |
87
|
|
|
|
|
|
|
unless $num =~ m/^[1-9][0-9]*$/s; |
88
|
|
|
|
|
|
|
}); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item shopper_id |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This parameter allows you to specify a unique ID for an order process. |
94
|
|
|
|
|
|
|
Under this Shopper ID is saved to the associated transaction in order |
95
|
|
|
|
|
|
|
ipayment system. The Shopper ID must be unique only if the extended |
96
|
|
|
|
|
|
|
examination of the IDs Avoidance of double use transactions. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
has shopper_id => (is => 'ro'); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item invoiceText |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
has invoiceText => (is => 'ro'); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item trxUserComment |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has trxUserComment => (is => 'ro'); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item recurringData |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
has recurringData => (is => 'ro'); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item installmentData |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
has installmentData => (is => 'ro'); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item transactionData |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Return the hashref with the transaction data details |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub transactionData { |
136
|
18
|
|
|
18
|
1
|
493
|
my $self = shift; |
137
|
18
|
|
|
|
|
125
|
my %trx = ( |
138
|
|
|
|
|
|
|
trxAmount => $self->trxAmount, |
139
|
|
|
|
|
|
|
trxCurrency => $self->trxCurrency, |
140
|
|
|
|
|
|
|
shopperId => $self->shopper_id, |
141
|
|
|
|
|
|
|
); |
142
|
18
|
100
|
|
|
|
84
|
if ($self->invoiceText) { |
143
|
5
|
|
|
|
|
18
|
$trx{invoiceText} = $self->invoiceText; |
144
|
|
|
|
|
|
|
} |
145
|
18
|
100
|
|
|
|
68
|
if ($self->trxUserComment) { |
146
|
3
|
|
|
|
|
9
|
$trx{trxUserComment} = $self->trxUserComment; |
147
|
|
|
|
|
|
|
} |
148
|
18
|
50
|
|
|
|
68
|
if ($self->recurringData) { |
149
|
0
|
|
|
|
|
0
|
$trx{recurringData} = $self->recurringData; |
150
|
|
|
|
|
|
|
} |
151
|
18
|
50
|
|
|
|
60
|
if ($self->installmentData) { |
152
|
0
|
|
|
|
|
0
|
$trx{installmentData} = $self->installmentData; |
153
|
|
|
|
|
|
|
} |
154
|
18
|
|
|
|
|
89
|
return \%trx; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=item transactionType |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
The transaction type, choosen from the types below. It defaults to C |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
preauth |
163
|
|
|
|
|
|
|
auth |
164
|
|
|
|
|
|
|
base_check |
165
|
|
|
|
|
|
|
check_save |
166
|
|
|
|
|
|
|
grefund_cap |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
CGI Name: C |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
has transactionType => (is => 'ro', |
173
|
|
|
|
|
|
|
default => sub { return "auth" }, |
174
|
|
|
|
|
|
|
isa => sub { |
175
|
|
|
|
|
|
|
my %avail = ( |
176
|
|
|
|
|
|
|
preauth => 1, |
177
|
|
|
|
|
|
|
auth => 1, |
178
|
|
|
|
|
|
|
base_check => 1, |
179
|
|
|
|
|
|
|
check_save => 1, |
180
|
|
|
|
|
|
|
grefund_cap => 1, |
181
|
|
|
|
|
|
|
); |
182
|
|
|
|
|
|
|
my $type = $_[0]; |
183
|
|
|
|
|
|
|
die "Missing transaction type\n" unless $type; |
184
|
|
|
|
|
|
|
die "Only one arg is supported\n" unless @_ == 1; |
185
|
|
|
|
|
|
|
die "$type not valid\n" unless $avail{$type}; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
); |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item paymentType |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
The payment type, choosen from the types below. It defaults to C |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
cc |
194
|
|
|
|
|
|
|
elv |
195
|
|
|
|
|
|
|
pp |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
CGI Name: C |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=back |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
has paymentType => (is => 'ro', |
204
|
|
|
|
|
|
|
default => sub { return "cc" }, |
205
|
|
|
|
|
|
|
isa => sub { |
206
|
|
|
|
|
|
|
my %avail = ( |
207
|
|
|
|
|
|
|
pp => 1, |
208
|
|
|
|
|
|
|
cc => 1, |
209
|
|
|
|
|
|
|
elv => 1, |
210
|
|
|
|
|
|
|
); |
211
|
|
|
|
|
|
|
my $type = $_[0]; |
212
|
|
|
|
|
|
|
die "Missing payment type\n" unless $type; |
213
|
|
|
|
|
|
|
die "Only one arg is supported\n" unless @_ == 1; |
214
|
|
|
|
|
|
|
die "Invalid payment type $type\n" unless $avail{$type}; |
215
|
|
|
|
|
|
|
}); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=head3 options |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Additional options for the SOAP request, as a hashref. These options are |
222
|
|
|
|
|
|
|
quite advanced, so we don't do any additional checking ourselves, |
223
|
|
|
|
|
|
|
delegating them to the SOAP compiler. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
has options => (is => 'ro', |
229
|
|
|
|
|
|
|
isa => sub { die "options should be a hash\n" |
230
|
|
|
|
|
|
|
unless (ref$_[0]) eq 'HASH' }); |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 Additional transaction information |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head3 addr_info |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
Hashref to hold additional information, notably the information about |
238
|
|
|
|
|
|
|
the cardholder. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
has addr_info => (is => 'ro', |
243
|
|
|
|
|
|
|
default => sub { return {} }, |
244
|
|
|
|
|
|
|
isa => sub { die "options should be a hash\n" |
245
|
|
|
|
|
|
|
unless (ref$_[0]) eq 'HASH' }); |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
1; |