line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::Giropay::Request::Transaction; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Giropay::Request::Transaction - start payment transaction request |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
16403
|
use Business::Giropay::Types qw/Int Maybe Str/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
10
|
2
|
|
|
2
|
|
985
|
use Carp; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
118
|
|
11
|
2
|
|
|
2
|
|
548
|
use Moo; |
|
2
|
|
|
|
|
8768
|
|
|
2
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
with 'Business::Giropay::Role::Request', 'Business::Giropay::Role::Urls'; |
13
|
2
|
|
|
2
|
|
1573
|
use namespace::clean; |
|
2
|
|
|
|
|
8299
|
|
|
2
|
|
|
|
|
10
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
See L for attributes common to |
18
|
|
|
|
|
|
|
all request classes and also L. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 response_class |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
The response class to use. Defaults to |
23
|
|
|
|
|
|
|
L. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has response_class => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => Str, |
30
|
|
|
|
|
|
|
default => "Business::Giropay::Response::Transaction", |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 merchantTxId |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Unique transaction ID to identify this request. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has merchantTxId => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
isa => Str, # Varchar [255] |
42
|
|
|
|
|
|
|
required => 1, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 amount |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Amount of transaction in cents/pennies/etc so EUR 23.54 will be 2354. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has amount => ( |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
isa => Int, |
54
|
|
|
|
|
|
|
required => 1, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 currency |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Three letter currency code, e.g.: EUR for Euros |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has currency => ( |
64
|
|
|
|
|
|
|
is => 'ro', |
65
|
|
|
|
|
|
|
isa => Str, # Char [3] |
66
|
|
|
|
|
|
|
required => 1, |
67
|
|
|
|
|
|
|
coerce => sub { uc( $_[0] ) }, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 purpose |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Short purpose for transaction, e.g.: product purchase |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has purpose => ( |
77
|
|
|
|
|
|
|
is => 'ro', |
78
|
|
|
|
|
|
|
isa => Str, # Varchar [27] |
79
|
|
|
|
|
|
|
required => 1, |
80
|
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 bic |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Bank BIC code. Required for eps and giropay. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
has bic => ( |
89
|
|
|
|
|
|
|
is => 'rwp', |
90
|
|
|
|
|
|
|
isa => Str, # Varchar [11] |
91
|
|
|
|
|
|
|
default => '', |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 iban |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Bank account IBAN. Optional for giropay only. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
has iban => ( |
101
|
|
|
|
|
|
|
is => 'ro', |
102
|
|
|
|
|
|
|
isa => Str, # Varchar [34] |
103
|
|
|
|
|
|
|
default => '', |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 issuer |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
iDEAL issuer bank. Required for ideal only. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
has issuer => ( |
113
|
|
|
|
|
|
|
is => 'rwp', |
114
|
|
|
|
|
|
|
isa => Str, |
115
|
|
|
|
|
|
|
default => '', |
116
|
|
|
|
|
|
|
); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 info1Label |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Optional for giropay only. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 info1Text |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Text for L. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 info2Label |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Optional for giropay only. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 info2Text |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Text for L. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 info3Label |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Optional for giropay only. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 info3Text |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Text for L. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 info4Label |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Optional for giropay only. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 info4Text |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Text for L. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 info5Label |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Optional for giropay only. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 info5Text |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Text for L. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
has [qw(info1Label info2Label info3Label info4Label info5Label)] => ( |
161
|
|
|
|
|
|
|
is => 'ro', |
162
|
|
|
|
|
|
|
isa => Str, # Varchar [30] |
163
|
|
|
|
|
|
|
default => '', |
164
|
|
|
|
|
|
|
); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
has [qw(info1Text info2Text info3Text info4Text info5Text)] => ( |
167
|
|
|
|
|
|
|
is => 'ro', |
168
|
|
|
|
|
|
|
isa => Str, # Varchar [80] |
169
|
|
|
|
|
|
|
default => '', |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 urlRedirect |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Override to make it required. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
has '+urlRedirect' => ( |
179
|
|
|
|
|
|
|
required => 1, |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 urlNotify |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Shop URL to which the outgoing payment is reported. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
has '+urlNotify' => ( |
189
|
|
|
|
|
|
|
required => 1, |
190
|
|
|
|
|
|
|
); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 METHODS |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
See L in addition to the following: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 BUILD |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Different networks require different attributes to be set. Check for them here. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub BUILD { |
203
|
6
|
|
|
6
|
1
|
1249
|
my $self = shift; |
204
|
6
|
100
|
|
|
|
34
|
if ( $self->network =~ /^(eps|giropay)$/ ) { |
|
|
50
|
|
|
|
|
|
205
|
4
|
100
|
|
|
|
70
|
croak "Missing required argument: bic" unless $self->bic; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
elsif ( $self->network eq 'ideal' ) { |
208
|
2
|
100
|
|
|
|
31
|
croak "Missing required argument: issuer" unless $self->issuer; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 parameters |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Returns additional parameters for the request. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=cut |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub parameters { |
219
|
|
|
|
|
|
|
return [ |
220
|
3
|
|
|
3
|
1
|
14
|
qw/merchantTxId amount currency purpose bic iban issuer |
221
|
|
|
|
|
|
|
info1Label info1Text info2Label info2Text info3Label |
222
|
|
|
|
|
|
|
info3Text info4Label info4Text info5Label info5Text |
223
|
|
|
|
|
|
|
urlRedirect urlNotify/ |
224
|
|
|
|
|
|
|
]; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head2 sandbox_data \%data |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Clean up data to be submitted in request to contain only safe data for testing. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
It is not normally necessary to call this method since it happens automatically |
232
|
|
|
|
|
|
|
if L is true. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=cut |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub sandbox_data { |
237
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
238
|
0
|
0
|
|
|
|
0
|
if ( $self->network eq 'ideal' ) { |
239
|
0
|
|
|
|
|
0
|
$self->_set_issuer('RABOBANK'); |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
else { |
242
|
0
|
|
|
|
|
0
|
$self->_set_bic('TESTDETT421'); |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 uri |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
Returns the URI to be appended to L |
249
|
|
|
|
|
|
|
to construct the appropriate URL for the request. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub uri { |
254
|
3
|
|
|
3
|
1
|
43
|
return 'transaction/start'; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
1; |