| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Business::Giropay; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Business::Giropay - Giropay payments API |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.103 |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.103'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
15331
|
use Business::Giropay::Request::Bankstatus; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
27
|
|
|
16
|
1
|
|
|
1
|
|
329
|
use Business::Giropay::Request::Issuer; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
17
|
1
|
|
|
1
|
|
319
|
use Business::Giropay::Request::Status; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
23
|
|
|
18
|
1
|
|
|
1
|
|
336
|
use Business::Giropay::Request::Transaction; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
19
|
1
|
|
|
1
|
|
321
|
use Business::Giropay::Notification; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
3
|
|
|
22
|
|
|
|
|
|
|
with 'Business::Giropay::Role::Core', 'Business::Giropay::Role::Network', |
|
23
|
|
|
|
|
|
|
'Business::Giropay::Role::Urls'; |
|
24
|
1
|
|
|
1
|
|
197
|
use namespace::clean; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
3
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub bankstatus { |
|
27
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
28
|
0
|
|
|
|
|
|
my $request = Business::Giropay::Request::Bankstatus->new( |
|
29
|
|
|
|
|
|
|
network => $self->network, |
|
30
|
|
|
|
|
|
|
merchantId => $self->merchantId, |
|
31
|
|
|
|
|
|
|
projectId => $self->projectId, |
|
32
|
|
|
|
|
|
|
sandbox => $self->sandbox, |
|
33
|
|
|
|
|
|
|
secret => $self->secret, |
|
34
|
|
|
|
|
|
|
@args, |
|
35
|
|
|
|
|
|
|
); |
|
36
|
0
|
|
|
|
|
|
return $request->submit; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub issuer { |
|
40
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
41
|
0
|
|
|
|
|
|
my $request = Business::Giropay::Request::Issuer->new( |
|
42
|
|
|
|
|
|
|
network => $self->network, |
|
43
|
|
|
|
|
|
|
merchantId => $self->merchantId, |
|
44
|
|
|
|
|
|
|
projectId => $self->projectId, |
|
45
|
|
|
|
|
|
|
sandbox => $self->sandbox, |
|
46
|
|
|
|
|
|
|
secret => $self->secret, |
|
47
|
|
|
|
|
|
|
); |
|
48
|
0
|
|
|
|
|
|
return $request->submit; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub status { |
|
52
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
53
|
0
|
|
|
|
|
|
my $request = Business::Giropay::Request::Status->new( |
|
54
|
|
|
|
|
|
|
network => $self->network, |
|
55
|
|
|
|
|
|
|
merchantId => $self->merchantId, |
|
56
|
|
|
|
|
|
|
projectId => $self->projectId, |
|
57
|
|
|
|
|
|
|
secret => $self->secret, |
|
58
|
|
|
|
|
|
|
@args, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
0
|
|
|
|
|
|
return $request->submit; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub transaction { |
|
64
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
65
|
0
|
|
|
|
|
|
my $request = Business::Giropay::Request::Transaction->new( |
|
66
|
|
|
|
|
|
|
network => $self->network, |
|
67
|
|
|
|
|
|
|
merchantId => $self->merchantId, |
|
68
|
|
|
|
|
|
|
projectId => $self->projectId, |
|
69
|
|
|
|
|
|
|
sandbox => $self->sandbox, |
|
70
|
|
|
|
|
|
|
secret => $self->secret, |
|
71
|
|
|
|
|
|
|
urlRedirect => $self->urlRedirect, |
|
72
|
|
|
|
|
|
|
urlNotify => $self->urlNotify, |
|
73
|
|
|
|
|
|
|
@args, |
|
74
|
|
|
|
|
|
|
); |
|
75
|
0
|
|
|
|
|
|
return $request->submit; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub notification { |
|
79
|
0
|
|
|
0
|
1
|
|
my ( $self, @args ) = @_; |
|
80
|
0
|
|
|
|
|
|
return Business::Giropay::Notification->new( |
|
81
|
|
|
|
|
|
|
merchantId => $self->merchantId, |
|
82
|
|
|
|
|
|
|
projectId => $self->projectId, |
|
83
|
|
|
|
|
|
|
secret => $self->secret, |
|
84
|
|
|
|
|
|
|
@args, |
|
85
|
|
|
|
|
|
|
); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
B implement's Giropay's GiroCheckout API to make direct |
|
91
|
|
|
|
|
|
|
calls to Giropay's payments server. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Giropay facilitates payments via various provider networks in addition to |
|
94
|
|
|
|
|
|
|
their own. This module currently supports the following networks: |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=over |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item eps - EPS (Austria) |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item giropay - Giropay's own network (Germany) |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item ideal - iDEAL (The Netherlands) |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Contributions to allow this module to support other networks available via |
|
107
|
|
|
|
|
|
|
Giropay are most welcome. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
use Business::Giropay; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $giropay = Business::Giropay->new( |
|
114
|
|
|
|
|
|
|
network => 'giropay', |
|
115
|
|
|
|
|
|
|
merchantId => '123456789', |
|
116
|
|
|
|
|
|
|
projectId => '1234567', |
|
117
|
|
|
|
|
|
|
sandbox => 1, |
|
118
|
|
|
|
|
|
|
secret => 'project_secret', |
|
119
|
|
|
|
|
|
|
); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $response = $giropay->transaction( |
|
122
|
|
|
|
|
|
|
merchantTxId => 'tx-10928374', |
|
123
|
|
|
|
|
|
|
amount => 2938, # 29.38 in cents |
|
124
|
|
|
|
|
|
|
currency => 'EUR', |
|
125
|
|
|
|
|
|
|
purpose => 'Test Transaction', |
|
126
|
|
|
|
|
|
|
bic => 'TESTDETT421', |
|
127
|
|
|
|
|
|
|
urlRedirect => 'https://www.example.com/return_page', |
|
128
|
|
|
|
|
|
|
urlNotify => 'https://www.example.com/api/giropay/notify', |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
if ( $response->success ) { |
|
132
|
|
|
|
|
|
|
# all is good so redirect customer to GiroCheckout |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
else { |
|
135
|
|
|
|
|
|
|
# transaction request failed |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
C and C can also be passed to C: |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
use Business::Giropay; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
my $giropay = Business::Giropay->new( |
|
143
|
|
|
|
|
|
|
network => 'giropay', |
|
144
|
|
|
|
|
|
|
merchantId => '123456789', |
|
145
|
|
|
|
|
|
|
projectId => '1234567', |
|
146
|
|
|
|
|
|
|
urlRedirect => 'https://www.example.com/return_page', |
|
147
|
|
|
|
|
|
|
urlNotify => 'https://www.example.com/api/giropay/notify', |
|
148
|
|
|
|
|
|
|
sandbox => 1, |
|
149
|
|
|
|
|
|
|
secret => 'project_secret', |
|
150
|
|
|
|
|
|
|
); |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $response = $giropay->transaction( |
|
153
|
|
|
|
|
|
|
merchantTxId => 'tx-10928374', |
|
154
|
|
|
|
|
|
|
amount => 2938, # 29.38 in cents |
|
155
|
|
|
|
|
|
|
currency => 'EUR', |
|
156
|
|
|
|
|
|
|
purpose => 'Test Transaction', |
|
157
|
|
|
|
|
|
|
bic => 'TESTDETT421', |
|
158
|
|
|
|
|
|
|
); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
if ( $response->success ) { |
|
161
|
|
|
|
|
|
|
# all is good so redirect customer to GiroCheckout |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
else { |
|
164
|
|
|
|
|
|
|
# transaction request failed |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Elsewhere in your C route: |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $notification = $giropay->notification( %request_params ); |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
if ( $notification->success ) { |
|
173
|
|
|
|
|
|
|
# save stuff in DB - customer probably still on bank site |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
else { |
|
176
|
|
|
|
|
|
|
# bad stuff happened - make a note of it |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
And in the C route: |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
my $notification = $giropay->notification( %request_params ); |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
if ( $notification->success ) { |
|
184
|
|
|
|
|
|
|
# we should already have earlier notification but check anyway |
|
185
|
|
|
|
|
|
|
# in case customer came back before we received it then thank |
|
186
|
|
|
|
|
|
|
# customer for purchase |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
else { |
|
189
|
|
|
|
|
|
|
# bad stuff - check out the details and tell the customer |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
See L for full details of the |
|
196
|
|
|
|
|
|
|
following attributes that can be passed to C. |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=over |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item * network |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * merchantId |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item * projectId |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * sandbox |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * secret |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=back |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
See L for full details of the |
|
213
|
|
|
|
|
|
|
following attributes that can be passed to C. |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=over |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * urlRedirect |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item * urlNotify |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head1 METHODS |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
B it is not necessary to pass in any attributes that were already |
|
226
|
|
|
|
|
|
|
passed to C since they are passed through automatically. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 bankstatus %attributes |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This API call checks if a bank supports the giropay/eps payment method. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Returns a L object. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
See L for full details of |
|
235
|
|
|
|
|
|
|
the following attribute that can be passed to this method: |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=over |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=item * bic |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=back |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head2 issuer |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
Returns a L object which includes a |
|
246
|
|
|
|
|
|
|
list which contains all supported giropay/eps/ideal issuer banks. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=head2 transaction %attributes |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
This API call creates the start of a transaction and returns a |
|
251
|
|
|
|
|
|
|
L object. If the response indicates |
|
252
|
|
|
|
|
|
|
success then customer can be redirected to |
|
253
|
|
|
|
|
|
|
L to complete payment. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Returns a L object. |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
See L for full details of |
|
258
|
|
|
|
|
|
|
the following attributes that can be passed to this method: |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=over |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=item * merchantTxId |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=item * amount |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=item * currency |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=item * purpose |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item * bic |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=item * urlRedirect |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
=item * urlNotify |
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=back |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 notification %query_params |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Accepts query parameters and returns a L |
|
281
|
|
|
|
|
|
|
object. |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head2 status %attributes |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
Returns a L object with details of |
|
286
|
|
|
|
|
|
|
the requested transaction. |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
See L for full details of |
|
289
|
|
|
|
|
|
|
the following attribute that can be passed to this method: |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=over |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=item * reference |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=back |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
L which has links for |
|
300
|
|
|
|
|
|
|
the various payment network types (giropay, eps, etc). For L see |
|
301
|
|
|
|
|
|
|
L. |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 TODO |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Add more of Giropay's payment networks. |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head1 AUTHOR |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
Peter Mottram (SysPete) |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Alexandr Ciornii (chorny) |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Many thanks to L for sponsoring |
|
318
|
|
|
|
|
|
|
development of this module. |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
Copyright 2016 Peter Mottram (SysPete) |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
325
|
|
|
|
|
|
|
under the terms of Perl itself. |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=cut |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
1; |