|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* |
|
5
|
|
|
* NOTICE OF LICENSE |
|
6
|
|
|
* |
|
7
|
|
|
* This source file is subject to the GNU General Public License (GPL 3) |
|
8
|
|
|
* that is bundled with this package in the file LICENSE.txt |
|
9
|
|
|
* |
|
10
|
|
|
* DISCLAIMER |
|
11
|
|
|
* |
|
12
|
|
|
* Do not edit or add to this file if you wish to upgrade Payone to newer |
|
13
|
|
|
* versions in the future. If you wish to customize Payone for your |
|
14
|
|
|
* needs please refer to http://www.payone.de for more information. |
|
15
|
|
|
* |
|
16
|
|
|
* @category Payone |
|
17
|
|
|
* @package Payone_Api |
|
18
|
|
|
* @copyright Copyright (c) 2012 <[email protected]> - www.noovias.com |
|
19
|
|
|
* @author Matthias Walter <[email protected]> |
|
20
|
|
|
* @license <http://www.gnu.org/licenses/> GNU General Public License (GPL 3) |
|
21
|
|
|
* @link http://www.noovias.com |
|
22
|
|
|
*/ |
|
23
|
|
|
class Payone_Api_Factory |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
/** @var Payone_Api_Config */ |
|
27
|
|
|
protected $config = null; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @constructor |
|
31
|
|
|
* @param Payone_Api_Config $config |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct(Payone_Api_Config $config = null) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->config = $config; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @return Payone_Api_Adapter_Interface |
|
40
|
|
|
*/ |
|
41
|
|
|
protected function buildHttpClient() |
|
42
|
|
|
{ |
|
43
|
|
|
if ($this->isEnabledCurl()) { |
|
44
|
|
|
$adapter = new Payone_Api_Adapter_Http_Curl(); |
|
45
|
|
|
} else { |
|
46
|
|
|
$adapter = new Payone_Api_Adapter_Http_Socket(); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
$adapter->setUrl('https://api.pay1.de/post-gateway/'); |
|
50
|
|
|
return $adapter; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return bool |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function isEnabledCurl() |
|
57
|
|
|
{ |
|
58
|
|
|
return extension_loaded('curl'); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param string $key Service Key, e.g. 'payment/refund' |
|
63
|
|
|
* @return Payone_Api_Service_Payment_Authorize|Payone_Api_Service_Payment_Debit|Payone_Api_Service_Payment_Preauthorize|Payone_Api_Service_Payment_Refund |
|
64
|
|
|
* @throws Exception |
|
65
|
|
|
*/ |
|
66
|
|
|
public function buildService($key) |
|
67
|
|
|
{ |
|
68
|
|
|
$methodKey = str_replace(' ', '', ucwords(str_replace('/', ' ', $key))); |
|
69
|
|
|
|
|
70
|
|
|
$methodName = 'buildService' . $methodKey; |
|
71
|
|
|
if (method_exists($this, $methodName)) { |
|
72
|
|
|
return $this->$methodName(); |
|
73
|
|
|
} else { |
|
74
|
|
|
throw new Exception('Could not build service with key "' . $key . '"'); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return Payone_Api_Mapper_Currency |
|
80
|
|
|
*/ |
|
81
|
|
|
public function buildMapperCurrency() |
|
82
|
|
|
{ |
|
83
|
|
|
$mapper = new Payone_Api_Mapper_Currency(); |
|
84
|
|
|
$mapper->setPathToProperties($this->getCurrencyPropertiesPath()); |
|
85
|
|
|
return $mapper; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Returns Path to currency.properties file |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
protected function getCurrencyPropertiesPath() |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->getConfig()->getValue('default/mapper/currency/currency_properties'); |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Preauthorization |
|
99
|
|
|
*/ |
|
100
|
|
|
public function buildMapperRequestPreauthorize() |
|
101
|
|
|
{ |
|
102
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Preauthorization(); |
|
103
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
104
|
|
|
return $mapper; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Authorization |
|
109
|
|
|
*/ |
|
110
|
|
|
public function buildMapperRequestAuthorize() |
|
111
|
|
|
{ |
|
112
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Authorization(); |
|
113
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
114
|
|
|
return $mapper; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Capture |
|
119
|
|
|
*/ |
|
120
|
|
|
public function buildMapperRequestCapture() |
|
121
|
|
|
{ |
|
122
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Capture(); |
|
123
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
124
|
|
|
return $mapper; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Debit |
|
129
|
|
|
*/ |
|
130
|
|
|
public function buildMapperRequestDebit() |
|
131
|
|
|
{ |
|
132
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Debit(); |
|
133
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
134
|
|
|
return $mapper; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Refund |
|
139
|
|
|
*/ |
|
140
|
|
|
public function buildMapperRequestRefund() |
|
141
|
|
|
{ |
|
142
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Refund(); |
|
143
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
144
|
|
|
return $mapper; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Vauthorization |
|
149
|
|
|
*/ |
|
150
|
|
|
public function buildMapperRequestVauthorize() |
|
151
|
|
|
{ |
|
152
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Vauthorization(); |
|
153
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
154
|
|
|
return $mapper; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return Payone_Api_Mapper_Request_Payment_CreateAccess |
|
159
|
|
|
*/ |
|
160
|
|
|
public function buildMapperRequestCreateAccess() |
|
161
|
|
|
{ |
|
162
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_CreateAccess(); |
|
163
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
164
|
|
|
return $mapper; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @return Payone_Api_Mapper_Request_Payment_Genericpayment |
|
169
|
|
|
*/ |
|
170
|
|
|
public function buildMapperRequestGenericpayment() |
|
171
|
|
|
{ |
|
172
|
|
|
$mapper = new Payone_Api_Mapper_Request_Payment_Genericpayment(); |
|
173
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
174
|
|
|
return $mapper; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
/** |
|
178
|
|
|
* @return Payone_Api_Mapper_Request_Management_UpdateAccess |
|
179
|
|
|
*/ |
|
180
|
|
|
public function buildMapperRequestUpdateAccess() |
|
181
|
|
|
{ |
|
182
|
|
|
$mapper = new Payone_Api_Mapper_Request_Management_UpdateAccess(); |
|
183
|
|
|
$mapper->setMapperCurrency($this->buildMapperCurrency()); |
|
184
|
|
|
return $mapper; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @return Payone_Api_Mapper_Response_Preauthorization |
|
189
|
|
|
*/ |
|
190
|
|
|
protected function buildMapperResponsePreauthorize() |
|
191
|
|
|
{ |
|
192
|
|
|
$mapper = new Payone_Api_Mapper_Response_Preauthorization(); |
|
193
|
|
|
return $mapper; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
/** |
|
197
|
|
|
* @return Payone_Api_Mapper_Response_Authorization |
|
198
|
|
|
*/ |
|
199
|
|
|
protected function buildMapperResponseAuthorize() |
|
200
|
|
|
{ |
|
201
|
|
|
$mapper = new Payone_Api_Mapper_Response_Authorization(); |
|
202
|
|
|
return $mapper; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
/** |
|
206
|
|
|
* @return Payone_Api_Mapper_Response_Capture |
|
207
|
|
|
*/ |
|
208
|
|
|
protected function buildMapperResponseCapture() |
|
209
|
|
|
{ |
|
210
|
|
|
$mapper = new Payone_Api_Mapper_Response_Capture(); |
|
211
|
|
|
return $mapper; |
|
212
|
|
|
} |
|
213
|
|
|
|
|
214
|
|
|
/** |
|
215
|
|
|
* @return Payone_Api_Mapper_Response_Debit |
|
216
|
|
|
*/ |
|
217
|
|
|
protected function buildMapperResponseDebit() |
|
218
|
|
|
{ |
|
219
|
|
|
$mapper = new Payone_Api_Mapper_Response_Debit(); |
|
220
|
|
|
return $mapper; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @return Payone_Api_Mapper_Response_Refund |
|
225
|
|
|
*/ |
|
226
|
|
|
protected function buildMapperResponseRefund() |
|
227
|
|
|
{ |
|
228
|
|
|
$mapper = new Payone_Api_Mapper_Response_Refund(); |
|
229
|
|
|
return $mapper; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @return Payone_Api_Mapper_Response_3dsCheck |
|
234
|
|
|
*/ |
|
235
|
|
|
protected function buildMapperResponse3dsCheck() |
|
236
|
|
|
{ |
|
237
|
|
|
$mapper = new Payone_Api_Mapper_Response_3dsCheck(); |
|
238
|
|
|
return $mapper; |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @return Payone_Api_Mapper_Response_AddressCheck |
|
243
|
|
|
*/ |
|
244
|
|
|
protected function buildMapperResponseAddressCheck() |
|
245
|
|
|
{ |
|
246
|
|
|
$mapper = new Payone_Api_Mapper_Response_AddressCheck(); |
|
247
|
|
|
return $mapper; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @return Payone_Api_Mapper_Response_BankAccountCheck |
|
252
|
|
|
*/ |
|
253
|
|
|
protected function buildMapperResponseBankAccountCheck() |
|
254
|
|
|
{ |
|
255
|
|
|
$mapper = new Payone_Api_Mapper_Response_BankAccountCheck(); |
|
256
|
|
|
return $mapper; |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
/** |
|
260
|
|
|
* @return Payone_Api_Mapper_Response_Consumerscore |
|
261
|
|
|
*/ |
|
262
|
|
|
protected function buildMapperResponseConsumerscore() |
|
263
|
|
|
{ |
|
264
|
|
|
$mapper = new Payone_Api_Mapper_Response_Consumerscore(); |
|
265
|
|
|
return $mapper; |
|
266
|
|
|
} |
|
267
|
|
|
|
|
268
|
|
|
/** |
|
269
|
|
|
* @return Payone_Api_Mapper_Response_CreditCardCheck |
|
270
|
|
|
*/ |
|
271
|
|
|
protected function buildMapperResponseCreditCardCheck() |
|
272
|
|
|
{ |
|
273
|
|
|
$mapper = new Payone_Api_Mapper_Response_CreditCardCheck(); |
|
274
|
|
|
return $mapper; |
|
275
|
|
|
} |
|
276
|
|
|
|
|
277
|
|
|
/** |
|
278
|
|
|
* @return Payone_Api_Mapper_Response_GetInvoice |
|
279
|
|
|
*/ |
|
280
|
|
|
protected function buildMapperResponseGetInvoice() |
|
281
|
|
|
{ |
|
282
|
|
|
$mapper = new Payone_Api_Mapper_Response_GetInvoice(); |
|
283
|
|
|
return $mapper; |
|
284
|
|
|
} |
|
285
|
|
|
|
|
286
|
|
|
/** |
|
287
|
|
|
* @return Payone_Api_Mapper_Response_GetFile |
|
288
|
|
|
*/ |
|
289
|
|
|
protected function buildMapperResponseGetFile() |
|
290
|
|
|
{ |
|
291
|
|
|
$mapper = new Payone_Api_Mapper_Response_GetFile(); |
|
292
|
|
|
return $mapper; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* @return Payone_Api_Mapper_Response_Vauthorization |
|
297
|
|
|
*/ |
|
298
|
|
|
public function buildMapperResponseVauthorize() |
|
299
|
|
|
{ |
|
300
|
|
|
$mapper = new Payone_Api_Mapper_Response_Vauthorization(); |
|
301
|
|
|
return $mapper; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* @return Payone_Api_Mapper_Response_CreateAccess |
|
306
|
|
|
*/ |
|
307
|
|
|
public function buildMapperResponseCreateAccess() |
|
308
|
|
|
{ |
|
309
|
|
|
$mapper = new Payone_Api_Mapper_Response_CreateAccess(); |
|
310
|
|
|
return $mapper; |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
/** |
|
314
|
|
|
* @return Payone_Api_Mapper_Response_Genericpayment |
|
315
|
|
|
*/ |
|
316
|
|
|
public function buildMapperResponseGenericpayment() |
|
317
|
|
|
{ |
|
318
|
|
|
$mapper = new Payone_Api_Mapper_Response_Genericpayment(); |
|
319
|
|
|
return $mapper; |
|
320
|
|
|
} |
|
321
|
|
|
|
|
322
|
|
|
/** |
|
323
|
|
|
* @return Payone_Api_Mapper_Response_UpdateAccess |
|
324
|
|
|
*/ |
|
325
|
|
|
public function buildMapperResponseUpdateAccess() |
|
326
|
|
|
{ |
|
327
|
|
|
$mapper = new Payone_Api_Mapper_Response_UpdateAccess(); |
|
328
|
|
|
return $mapper; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
/** |
|
332
|
|
|
* @return Payone_Api_Mapper_Response_ManageMandate |
|
333
|
|
|
*/ |
|
334
|
|
|
public function buildMapperResponseManageMandate() |
|
335
|
|
|
{ |
|
336
|
|
|
$mapper = new Payone_Api_Mapper_Response_ManageMandate(); |
|
337
|
|
|
return $mapper; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
/** |
|
341
|
|
|
* @return Payone_Api_Service_Payment_Preauthorize |
|
342
|
|
|
*/ |
|
343
|
|
View Code Duplication |
public function buildServicePaymentPreauthorize() |
|
|
|
|
|
|
344
|
|
|
{ |
|
345
|
|
|
$service = new Payone_Api_Service_Payment_Preauthorize(); |
|
346
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
347
|
|
|
$service->setMapperRequest($this->buildMapperRequestPreauthorize()); |
|
348
|
|
|
$service->setMapperResponse($this->buildMapperResponsePreauthorize()); |
|
349
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
350
|
|
|
return $service; |
|
351
|
|
|
} |
|
352
|
|
|
|
|
353
|
|
|
/** |
|
354
|
|
|
* @return Payone_Api_Service_Payment_Authorize |
|
355
|
|
|
*/ |
|
356
|
|
View Code Duplication |
public function buildServicePaymentAuthorize() |
|
|
|
|
|
|
357
|
|
|
{ |
|
358
|
|
|
$service = new Payone_Api_Service_Payment_Authorize(); |
|
359
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
360
|
|
|
$service->setMapperRequest($this->buildMapperRequestAuthorize()); |
|
361
|
|
|
$service->setMapperResponse($this->buildMapperResponseAuthorize()); |
|
362
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
363
|
|
|
return $service; |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @return Payone_Api_Service_Payment_Capture |
|
368
|
|
|
*/ |
|
369
|
|
View Code Duplication |
public function buildServicePaymentCapture() |
|
|
|
|
|
|
370
|
|
|
{ |
|
371
|
|
|
$service = new Payone_Api_Service_Payment_Capture(); |
|
372
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
373
|
|
|
$service->setMapperRequest($this->buildMapperRequestCapture()); |
|
374
|
|
|
$service->setMapperResponse($this->buildMapperResponseCapture()); |
|
375
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
376
|
|
|
return $service; |
|
377
|
|
|
} |
|
378
|
|
|
|
|
379
|
|
|
/** |
|
380
|
|
|
* @return Payone_Api_Service_Payment_Debit |
|
381
|
|
|
*/ |
|
382
|
|
View Code Duplication |
public function buildServicePaymentDebit() |
|
|
|
|
|
|
383
|
|
|
{ |
|
384
|
|
|
$service = new Payone_Api_Service_Payment_Debit(); |
|
385
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
386
|
|
|
$service->setMapperRequest($this->buildMapperRequestDebit()); |
|
387
|
|
|
$service->setMapperResponse($this->buildMapperResponseDebit()); |
|
388
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
389
|
|
|
return $service; |
|
390
|
|
|
} |
|
391
|
|
|
|
|
392
|
|
|
/** |
|
393
|
|
|
* @return Payone_Api_Service_Payment_Refund |
|
394
|
|
|
*/ |
|
395
|
|
View Code Duplication |
public function buildServicePaymentRefund() |
|
|
|
|
|
|
396
|
|
|
{ |
|
397
|
|
|
$service = new Payone_Api_Service_Payment_Refund(); |
|
398
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
399
|
|
|
$service->setMapperRequest($this->buildMapperRequestRefund()); |
|
400
|
|
|
$service->setMapperResponse($this->buildMapperResponseRefund()); |
|
401
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
402
|
|
|
return $service; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
/** |
|
406
|
|
|
* @return Payone_Api_Service_Verification_3dsCheck |
|
407
|
|
|
*/ |
|
408
|
|
|
public function buildServiceVerification3dscheck() |
|
409
|
|
|
{ |
|
410
|
|
|
$service = new Payone_Api_Service_Verification_3dsCheck(); |
|
411
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
412
|
|
|
$service->setMapperResponse($this->buildMapperResponse3dsCheck()); |
|
413
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
414
|
|
|
return $service; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* @return Payone_Api_Service_Verification_AddressCheck |
|
419
|
|
|
*/ |
|
420
|
|
|
public function buildServiceVerificationAddressCheck() |
|
421
|
|
|
{ |
|
422
|
|
|
$service = new Payone_Api_Service_Verification_AddressCheck(); |
|
423
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
424
|
|
|
$service->setMapperResponse($this->buildMapperResponseAddressCheck()); |
|
425
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
426
|
|
|
return $service; |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
/** |
|
430
|
|
|
* @return Payone_Api_Service_Verification_BankAccountCheck |
|
431
|
|
|
*/ |
|
432
|
|
|
public function buildServiceVerificationBankAccountCheck() |
|
433
|
|
|
{ |
|
434
|
|
|
$service = new Payone_Api_Service_Verification_BankAccountCheck(); |
|
435
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
436
|
|
|
$service->setMapperResponse($this->buildMapperResponseBankAccountCheck()); |
|
437
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
438
|
|
|
return $service; |
|
439
|
|
|
} |
|
440
|
|
|
|
|
441
|
|
|
/** |
|
442
|
|
|
* @return Payone_Api_Service_Verification_Consumerscore |
|
443
|
|
|
*/ |
|
444
|
|
|
public function buildServiceVerificationConsumerscore() |
|
445
|
|
|
{ |
|
446
|
|
|
$service = new Payone_Api_Service_Verification_Consumerscore(); |
|
447
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
448
|
|
|
$service->setMapperResponse($this->buildMapperResponseConsumerscore()); |
|
449
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
450
|
|
|
return $service; |
|
451
|
|
|
} |
|
452
|
|
|
|
|
453
|
|
|
/** |
|
454
|
|
|
* @return Payone_Api_Service_Verification_CreditCardCheck |
|
455
|
|
|
*/ |
|
456
|
|
|
public function buildServiceVerificationCreditCardCheck() |
|
457
|
|
|
{ |
|
458
|
|
|
$service = new Payone_Api_Service_Verification_CreditCardCheck(); |
|
459
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
460
|
|
|
$service->setMapperResponse($this->buildMapperResponseCreditCardCheck()); |
|
461
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
462
|
|
|
return $service; |
|
463
|
|
|
} |
|
464
|
|
|
|
|
465
|
|
|
/** |
|
466
|
|
|
* @return Payone_Api_Service_Management_GetInvoice |
|
467
|
|
|
*/ |
|
468
|
|
|
public function buildServiceManagementGetInvoice() |
|
469
|
|
|
{ |
|
470
|
|
|
$service = new Payone_Api_Service_Management_GetInvoice(); |
|
471
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
472
|
|
|
$service->setMapperResponse($this->buildMapperResponseGetInvoice()); |
|
473
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
474
|
|
|
return $service; |
|
475
|
|
|
} |
|
476
|
|
|
|
|
477
|
|
|
/** |
|
478
|
|
|
* @return Payone_Api_Service_Management_GetFile |
|
479
|
|
|
*/ |
|
480
|
|
|
public function buildServiceManagementGetFile() |
|
481
|
|
|
{ |
|
482
|
|
|
$service = new Payone_Api_Service_Management_GetFile(); |
|
483
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
484
|
|
|
$service->setMapperResponse($this->buildMapperResponseGetFile()); |
|
485
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
486
|
|
|
return $service; |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
/** |
|
490
|
|
|
* @return Payone_Api_Service_Management_ManageMandate |
|
491
|
|
|
*/ |
|
492
|
|
|
public function buildServiceManagementManageMandate() |
|
493
|
|
|
{ |
|
494
|
|
|
$service = new Payone_Api_Service_Management_ManageMandate(); |
|
495
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
496
|
|
|
$service->setMapperResponse($this->buildMapperResponseManageMandate()); |
|
497
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
498
|
|
|
return $service; |
|
499
|
|
|
} |
|
500
|
|
|
|
|
501
|
|
|
/** |
|
502
|
|
|
* @return Payone_Api_Service_Payment_Vauthorize |
|
503
|
|
|
*/ |
|
504
|
|
View Code Duplication |
public function buildServicePaymentVauthorize() |
|
|
|
|
|
|
505
|
|
|
{ |
|
506
|
|
|
$service = new Payone_Api_Service_Payment_Vauthorize(); |
|
507
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
508
|
|
|
$service->setMapperRequest($this->buildMapperRequestVauthorize()); |
|
509
|
|
|
$service->setMapperResponse($this->buildMapperResponseVauthorize()); |
|
510
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
511
|
|
|
return $service; |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
/** |
|
515
|
|
|
* @return Payone_Api_Service_Payment_CreateAccess |
|
516
|
|
|
*/ |
|
517
|
|
View Code Duplication |
public function buildServicePaymentCreateAccess() |
|
|
|
|
|
|
518
|
|
|
{ |
|
519
|
|
|
$service = new Payone_Api_Service_Payment_CreateAccess(); |
|
520
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
521
|
|
|
$service->setMapperRequest($this->buildMapperRequestCreateAccess()); |
|
522
|
|
|
$service->setMapperResponse($this->buildMapperResponseCreateAccess()); |
|
523
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
524
|
|
|
return $service; |
|
525
|
|
|
} |
|
526
|
|
|
|
|
527
|
|
|
/** |
|
528
|
|
|
* Create service for genericpayment request. |
|
529
|
|
|
* @return Payone_Api_Service_Payment_Genericpayment |
|
530
|
|
|
*/ |
|
531
|
|
View Code Duplication |
public function buildServicePaymentGenericpayment() |
|
|
|
|
|
|
532
|
|
|
{ |
|
533
|
|
|
$service = new Payone_Api_Service_Payment_Genericpayment(); |
|
534
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
535
|
|
|
$service->setMapperRequest($this->buildMapperRequestGenericpayment()); |
|
536
|
|
|
$service->setMapperResponse($this->buildMapperResponseGenericpayment()); |
|
537
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
538
|
|
|
return $service; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
/** |
|
542
|
|
|
* @return Payone_Api_Service_Management_UpdateAccess |
|
543
|
|
|
*/ |
|
544
|
|
View Code Duplication |
public function buildServiceManagementUpdateAccess() |
|
|
|
|
|
|
545
|
|
|
{ |
|
546
|
|
|
$service = new Payone_Api_Service_Management_UpdateAccess(); |
|
547
|
|
|
$service->setAdapter($this->buildHttpClient()); |
|
548
|
|
|
$service->setMapperRequest($this->buildMapperRequestUpdateAccess()); |
|
549
|
|
|
$service->setMapperResponse($this->buildMapperResponseUpdateAccess()); |
|
550
|
|
|
$service->setValidator($this->buildValidatorDefault()); |
|
551
|
|
|
return $service; |
|
552
|
|
|
} |
|
553
|
|
|
|
|
554
|
|
|
/** |
|
555
|
|
|
* @return Payone_Api_Service_ProtocolRequest |
|
556
|
|
|
*/ |
|
557
|
|
|
public function buildServiceProtocolRequest() |
|
558
|
|
|
{ |
|
559
|
|
|
$servicePR = new Payone_Api_Service_ProtocolRequest(); |
|
560
|
|
|
|
|
561
|
|
|
return $servicePR; |
|
562
|
|
|
} |
|
563
|
|
|
|
|
564
|
|
|
/** |
|
565
|
|
|
* @return Payone_Api_Validator_DefaultParameters |
|
566
|
|
|
*/ |
|
567
|
|
|
public function buildValidatorDefault() |
|
568
|
|
|
{ |
|
569
|
|
|
$validator = new Payone_Api_Validator_DefaultParameters(); |
|
570
|
|
|
|
|
571
|
|
|
return $validator; |
|
572
|
|
|
} |
|
573
|
|
|
|
|
574
|
|
|
/** |
|
575
|
|
|
* @param Payone_Api_Config $config |
|
576
|
|
|
*/ |
|
577
|
|
|
public function setConfig($config) |
|
578
|
|
|
{ |
|
579
|
|
|
$this->config = $config; |
|
580
|
|
|
} |
|
581
|
|
|
|
|
582
|
|
|
/** |
|
583
|
|
|
* @return Payone_Api_Config |
|
584
|
|
|
*/ |
|
585
|
|
|
public function getConfig() |
|
586
|
|
|
{ |
|
587
|
|
|
return $this->config; |
|
588
|
|
|
} |
|
589
|
|
|
|
|
590
|
|
|
} |
|
591
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.