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