1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\Dandomain\Pay\Model; |
4
|
|
|
|
5
|
|
|
use Money\Currency; |
6
|
|
|
use Money\Money; |
7
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
8
|
|
|
|
9
|
|
|
class Payment |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $apiKey; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
protected $merchant; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
*/ |
24
|
|
|
protected $orderId; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $sessionId; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $currencySymbol; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var Money |
38
|
|
|
*/ |
39
|
|
|
protected $totalAmount; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $callBackUrl; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
protected $fullCallBackOkUrl; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $callBackOkUrl; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $callBackServerUrl; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var int |
63
|
|
|
*/ |
64
|
|
|
protected $languageId; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var bool |
68
|
|
|
*/ |
69
|
|
|
protected $testMode; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var int |
73
|
|
|
*/ |
74
|
|
|
protected $paymentGatewayCurrencyCode; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var int |
78
|
|
|
*/ |
79
|
|
|
protected $cardTypeId; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
protected $customerRekvNr; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var string |
88
|
|
|
*/ |
89
|
|
|
protected $customerName; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
protected $customerCompany; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $customerAddress; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var string |
103
|
|
|
*/ |
104
|
|
|
protected $customerAddress2; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @var string |
108
|
|
|
*/ |
109
|
|
|
protected $customerZipCode; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
protected $customerCity; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @var int |
118
|
|
|
*/ |
119
|
|
|
protected $customerCountryId; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @var string |
123
|
|
|
*/ |
124
|
|
|
protected $customerCountry; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* This is the ISO 3166 country code |
128
|
|
|
* |
129
|
|
|
* @var string |
130
|
|
|
*/ |
131
|
|
|
protected $customerCountryCode; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @var string |
135
|
|
|
*/ |
136
|
|
|
protected $customerPhone; |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @var string |
140
|
|
|
*/ |
141
|
|
|
protected $customerFax; |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* @var string |
145
|
|
|
*/ |
146
|
|
|
protected $customerEmail; |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @var string |
150
|
|
|
*/ |
151
|
|
|
protected $customerNote; |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @var string |
155
|
|
|
*/ |
156
|
|
|
protected $customerCvrnr; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @var int |
160
|
|
|
*/ |
161
|
|
|
protected $customerCustTypeId; |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @var string |
165
|
|
|
*/ |
166
|
|
|
protected $customerEan; |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* @var string |
170
|
|
|
*/ |
171
|
|
|
protected $customerRes1; |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @var string |
175
|
|
|
*/ |
176
|
|
|
protected $customerRes2; |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @var string |
180
|
|
|
*/ |
181
|
|
|
protected $customerRes3; |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @var string |
185
|
|
|
*/ |
186
|
|
|
protected $customerRes4; |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @var string |
190
|
|
|
*/ |
191
|
|
|
protected $customerRes5; |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @var string |
195
|
|
|
*/ |
196
|
|
|
protected $customerIp; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @var string |
200
|
|
|
*/ |
201
|
|
|
protected $deliveryName; |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @var string |
205
|
|
|
*/ |
206
|
|
|
protected $deliveryCompany; |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @var string |
210
|
|
|
*/ |
211
|
|
|
protected $deliveryAddress; |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @var string |
215
|
|
|
*/ |
216
|
|
|
protected $deliveryAddress2; |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @var string |
220
|
|
|
*/ |
221
|
|
|
protected $deliveryZipCode; |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @var string |
225
|
|
|
*/ |
226
|
|
|
protected $deliveryCity; |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @var int |
230
|
|
|
*/ |
231
|
|
|
protected $deliveryCountryID; |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* @var string |
235
|
|
|
*/ |
236
|
|
|
protected $deliveryCountry; |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* This is the ISO 3166 country code |
240
|
|
|
* |
241
|
|
|
* @var string |
242
|
|
|
*/ |
243
|
|
|
protected $deliveryCountryCode; |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @var string |
247
|
|
|
*/ |
248
|
|
|
protected $deliveryPhone; |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @var string |
252
|
|
|
*/ |
253
|
|
|
protected $deliveryFax; |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @var string |
257
|
|
|
*/ |
258
|
|
|
protected $deliveryEmail; |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @var string |
262
|
|
|
*/ |
263
|
|
|
protected $deliveryEan; |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @var string |
267
|
|
|
*/ |
268
|
|
|
protected $shippingMethod; |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @var int |
272
|
|
|
*/ |
273
|
|
|
protected $shippingMethodId; |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @var Money |
277
|
|
|
*/ |
278
|
|
|
protected $shippingFee; |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* @var string |
282
|
|
|
*/ |
283
|
|
|
protected $paymentMethod; |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* @var int |
287
|
|
|
*/ |
288
|
|
|
protected $paymentMethodId; |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @var Money |
292
|
|
|
*/ |
293
|
|
|
protected $paymentFee; |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @var string |
297
|
|
|
*/ |
298
|
|
|
protected $loadBalancerRealIp; |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* @var string |
302
|
|
|
*/ |
303
|
|
|
protected $referrer; |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @var PaymentLine[] |
307
|
|
|
*/ |
308
|
|
|
protected $paymentLines; |
309
|
|
|
|
310
|
21 |
|
public function __construct() |
311
|
|
|
{ |
312
|
21 |
|
$this->paymentLines = []; |
313
|
21 |
|
} |
314
|
|
|
|
315
|
6 |
|
public static function createFromRequest(ServerRequestInterface $request) : Payment |
316
|
|
|
{ |
317
|
6 |
|
$payment = new static(); |
318
|
6 |
|
$payment->populateFromRequest($request); |
319
|
6 |
|
return $payment; |
320
|
|
|
} |
321
|
|
|
|
322
|
6 |
|
public function populateFromRequest(ServerRequestInterface $request) |
323
|
|
|
{ |
324
|
6 |
|
$body = $request->getParsedBody(); |
325
|
6 |
|
$body = is_array($body) ? $body : []; |
326
|
|
|
|
327
|
|
|
// set currency because we use it to create Money objects |
328
|
6 |
|
$this->setCurrencySymbol($body['APICurrencySymbol'] ?? ''); |
329
|
|
|
|
330
|
6 |
|
$totalAmount = $this->createMoneyFromFloat($body['APITotalAmount'] ?? '0.00'); |
331
|
6 |
|
if ($totalAmount) { |
332
|
3 |
|
$this->setTotalAmount($totalAmount); |
333
|
|
|
} |
334
|
|
|
|
335
|
6 |
|
$shippingFee = $this->createMoneyFromFloat($body['APIShippingFee'] ?? '0.00'); |
336
|
6 |
|
if ($shippingFee) { |
337
|
3 |
|
$this->setShippingFee($shippingFee); |
338
|
|
|
} |
339
|
|
|
|
340
|
6 |
|
$paymentFee = $this->createMoneyFromFloat($body['APIPayFee'] ?? '0.00'); |
341
|
6 |
|
if ($paymentFee) { |
342
|
3 |
|
$this->setPaymentFee($paymentFee); |
343
|
|
|
} |
344
|
|
|
|
345
|
6 |
|
$this->setApiKey($body['APIkey'] ?? ''); |
346
|
6 |
|
$this->setMerchant($body['APIMerchant'] ?? ''); |
347
|
6 |
|
$this->setOrderId($body['APIOrderID'] ?? 0); |
348
|
6 |
|
$this->setSessionId($body['APISessionID'] ?? ''); |
349
|
6 |
|
$this->setCallBackUrl($body['APICallBackUrl'] ?? ''); |
350
|
6 |
|
$this->setFullCallBackOkUrl($body['APIFullCallBackOKUrl'] ?? ''); |
351
|
6 |
|
$this->setCallBackOkUrl($body['APICallBackOKUrl'] ?? ''); |
352
|
6 |
|
$this->setCallBackServerUrl($body['APICallBackServerUrl'] ?? ''); |
353
|
6 |
|
$this->setLanguageId((int)($body['APILanguageID'] ?? 0)); |
354
|
6 |
|
$this->setTestMode(isset($body['APITestMode']) && 'True' === $body['APITestMode']); |
355
|
6 |
|
$this->setPaymentGatewayCurrencyCode((int)($body['APIPayGatewayCurrCode'] ?? 0)); |
356
|
6 |
|
$this->setCardTypeId((int)($body['APICardTypeID'] ?? 0)); |
357
|
6 |
|
$this->setCustomerRekvNr($body['APICRekvNr'] ?? ''); |
358
|
6 |
|
$this->setCustomerName($body['APICName'] ?? ''); |
359
|
6 |
|
$this->setCustomerCompany($body['APICCompany'] ?? ''); |
360
|
6 |
|
$this->setCustomerAddress($body['APICAddress'] ?? ''); |
361
|
6 |
|
$this->setCustomerAddress2($body['APICAddress2'] ?? ''); |
362
|
6 |
|
$this->setCustomerZipCode($body['APICZipCode'] ?? ''); |
363
|
6 |
|
$this->setCustomerCity($body['APICCity'] ?? ''); |
364
|
6 |
|
$this->setCustomerCountryId((int)($body['APICCountryID'] ?? 0)); |
365
|
6 |
|
$this->setCustomerCountry($body['APICCountry'] ?? ''); |
366
|
6 |
|
$this->setCustomerCountryCode($body['APICCountryCode'] ?? ''); |
367
|
6 |
|
$this->setCustomerPhone($body['APICPhone'] ?? ''); |
368
|
6 |
|
$this->setCustomerFax($body['APICFax'] ?? ''); |
369
|
6 |
|
$this->setCustomerEmail($body['APICEmail'] ?? ''); |
370
|
6 |
|
$this->setCustomerNote($body['APICNote'] ?? ''); |
371
|
6 |
|
$this->setCustomerCvrnr($body['APICcvrnr'] ?? ''); |
372
|
6 |
|
$this->setCustomerCustTypeId((int)($body['APICCustTypeID'] ?? 0)); |
373
|
6 |
|
$this->setCustomerEan($body['APICEAN'] ?? ''); |
374
|
6 |
|
$this->setCustomerRes1($body['APICres1'] ?? ''); |
375
|
6 |
|
$this->setCustomerRes2($body['APICres2'] ?? ''); |
376
|
6 |
|
$this->setCustomerRes3($body['APICres3'] ?? ''); |
377
|
6 |
|
$this->setCustomerRes4($body['APICres4'] ?? ''); |
378
|
6 |
|
$this->setCustomerRes5($body['APICres5'] ?? ''); |
379
|
6 |
|
$this->setDeliveryName($body['APIDName'] ?? ''); |
380
|
6 |
|
$this->setDeliveryCompany($body['APIDCompany'] ?? ''); |
381
|
6 |
|
$this->setDeliveryAddress($body['APIDAddress'] ?? ''); |
382
|
6 |
|
$this->setDeliveryAddress2($body['APIDAddress2'] ?? ''); |
383
|
6 |
|
$this->setDeliveryZipCode($body['APIDZipCode'] ?? ''); |
384
|
6 |
|
$this->setDeliveryCity($body['APIDCity'] ?? ''); |
385
|
6 |
|
$this->setDeliveryCountryID((int)($body['APIDCountryID'] ?? 0)); |
386
|
6 |
|
$this->setDeliveryCountry($body['APIDCountry'] ?? ''); |
387
|
6 |
|
$this->setDeliveryCountryCode($body['APIDCountryCode'] ?? ''); |
388
|
6 |
|
$this->setDeliveryPhone($body['APIDPhone'] ?? ''); |
389
|
6 |
|
$this->setDeliveryFax($body['APIDFax'] ?? ''); |
390
|
6 |
|
$this->setDeliveryEmail($body['APIDEmail'] ?? ''); |
391
|
6 |
|
$this->setDeliveryEan($body['APIDean'] ?? ''); |
392
|
6 |
|
$this->setShippingMethod($body['APIShippingMethod'] ?? ''); |
393
|
6 |
|
$this->setShippingMethodId((int)($body['APIShippingMethodID'] ?? 0)); |
394
|
6 |
|
$this->setPaymentMethod($body['APIPayMethod'] ?? ''); |
395
|
6 |
|
$this->setPaymentMethodId((int)($body['APIPayMethodID'] ?? 0)); |
396
|
6 |
|
$this->setCustomerIp($body['APICIP'] ?? ''); |
397
|
6 |
|
$this->setLoadBalancerRealIp($body['APILoadBalancerRealIP'] ?? ''); |
398
|
6 |
|
$this->setReferrer($request->hasHeader('referer') ? $request->getHeaderLine('referer') : ''); |
399
|
|
|
|
400
|
|
|
// populate order lines |
401
|
6 |
|
$i = 1; |
402
|
6 |
|
while (isset($body['APIBasketProdAmount'.$i])) { |
403
|
3 |
|
$qty = (int)$body['APIBasketProdAmount'.$i]; |
404
|
3 |
|
$productNumber = $body['APIBasketProdNumber'.$i] ?? ''; |
405
|
3 |
|
$name = $body['APIBasketProdName'.$i] ?? ''; |
406
|
3 |
|
$price = $this->createMoneyFromFloat($body['APIBasketProdPrice'.$i] ?? '0.00'); |
407
|
3 |
|
$vat = (int)($body['APIBasketProdVAT'.$i] ?? 0); |
408
|
|
|
|
409
|
3 |
|
$this->addPaymentLine(static::createPaymentLine($productNumber, $name, $qty, $price, $vat)); |
|
|
|
|
410
|
|
|
|
411
|
3 |
|
++$i; |
412
|
|
|
} |
413
|
6 |
|
} |
414
|
|
|
|
415
|
3 |
|
public static function createPaymentLine(string $productNumber, string $name, int $quantity, Money $price, int $vat) |
416
|
|
|
{ |
417
|
3 |
|
return new PaymentLine($productNumber, $name, $quantity, $price, $vat); |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
/** |
421
|
|
|
* Takes strings like |
422
|
|
|
* - 1.000,50 |
423
|
|
|
* - 1,000.50 |
424
|
|
|
* - 1000.50 |
425
|
|
|
* - 1000,50. |
426
|
|
|
* |
427
|
|
|
* and returns 100050 |
428
|
|
|
* |
429
|
|
|
* @param string $str |
430
|
|
|
* @param string $propertyPath |
431
|
|
|
* |
432
|
|
|
* @return int |
433
|
|
|
*/ |
434
|
9 |
|
public static function priceStringToInt(string $str, string $propertyPath = '') : int |
435
|
|
|
{ |
436
|
9 |
|
$str = trim($str); |
437
|
|
|
|
438
|
|
|
// verify format of string |
439
|
9 |
|
if (!preg_match('/(\.|,)[0-9]{2}$/', $str)) { |
440
|
3 |
|
throw new \InvalidArgumentException(($propertyPath ? $propertyPath.' (value: "'.$str.'")' : $str). |
441
|
3 |
|
' does not match the currency string format'); |
442
|
|
|
} |
443
|
9 |
|
$str = preg_replace('/[^0-9]+/', '', $str); |
444
|
|
|
|
445
|
9 |
|
return intval($str); |
446
|
|
|
} |
447
|
|
|
|
448
|
|
|
/** |
449
|
|
|
* @return string |
450
|
|
|
*/ |
451
|
6 |
|
public function getApiKey(): ?string |
452
|
|
|
{ |
453
|
6 |
|
return $this->apiKey; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
/** |
457
|
|
|
* @param string $apiKey |
458
|
|
|
* |
459
|
|
|
* @return Payment |
460
|
|
|
*/ |
461
|
9 |
|
public function setApiKey(string $apiKey): self |
462
|
|
|
{ |
463
|
9 |
|
$this->apiKey = $apiKey; |
464
|
|
|
|
465
|
9 |
|
return $this; |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
/** |
469
|
|
|
* @return string |
470
|
|
|
*/ |
471
|
3 |
|
public function getMerchant(): ?string |
472
|
|
|
{ |
473
|
3 |
|
return $this->merchant; |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
/** |
477
|
|
|
* @param string $merchant |
478
|
|
|
* |
479
|
|
|
* @return Payment |
480
|
|
|
*/ |
481
|
6 |
|
public function setMerchant(string $merchant): self |
482
|
|
|
{ |
483
|
6 |
|
$this->merchant = $merchant; |
484
|
|
|
|
485
|
6 |
|
return $this; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
/** |
489
|
|
|
* @return int |
490
|
|
|
*/ |
491
|
9 |
|
public function getOrderId(): ?int |
492
|
|
|
{ |
493
|
9 |
|
return $this->orderId; |
494
|
|
|
} |
495
|
|
|
|
496
|
|
|
/** |
497
|
|
|
* @param int $orderId |
498
|
|
|
* |
499
|
|
|
* @return Payment |
500
|
|
|
*/ |
501
|
12 |
|
public function setOrderId(int $orderId): self |
502
|
|
|
{ |
503
|
12 |
|
$this->orderId = $orderId; |
504
|
|
|
|
505
|
12 |
|
return $this; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* @return string |
510
|
|
|
*/ |
511
|
3 |
|
public function getSessionId(): ?string |
512
|
|
|
{ |
513
|
3 |
|
return $this->sessionId; |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
/** |
517
|
|
|
* @param string $sessionId |
518
|
|
|
* |
519
|
|
|
* @return Payment |
520
|
|
|
*/ |
521
|
6 |
|
public function setSessionId(string $sessionId): self |
522
|
|
|
{ |
523
|
6 |
|
$this->sessionId = $sessionId; |
524
|
|
|
|
525
|
6 |
|
return $this; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* @return string |
530
|
|
|
*/ |
531
|
6 |
|
public function getCurrencySymbol(): ?string |
532
|
|
|
{ |
533
|
6 |
|
return $this->currencySymbol; |
534
|
|
|
} |
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* @param string $currencySymbol |
538
|
|
|
* |
539
|
|
|
* @return Payment |
540
|
|
|
*/ |
541
|
9 |
|
public function setCurrencySymbol(string $currencySymbol): self |
542
|
|
|
{ |
543
|
|
|
$conversions = [ |
544
|
9 |
|
'€' => 'EUR', |
545
|
|
|
'$' => 'USD', |
546
|
|
|
'£' => 'GBP', |
547
|
|
|
'¥' => 'JPY' |
548
|
|
|
]; |
549
|
|
|
|
550
|
9 |
|
$currencySymbol = $conversions[$currencySymbol] ?? $currencySymbol; |
551
|
|
|
|
552
|
9 |
|
$this->currencySymbol = $currencySymbol; |
553
|
|
|
|
554
|
9 |
|
return $this; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* @return Money |
559
|
|
|
*/ |
560
|
9 |
|
public function getTotalAmount(): ?Money |
561
|
|
|
{ |
562
|
9 |
|
return $this->totalAmount; |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* @param Money $totalAmount |
567
|
|
|
* |
568
|
|
|
* @return Payment |
569
|
|
|
*/ |
570
|
6 |
|
public function setTotalAmount(Money $totalAmount): self |
571
|
|
|
{ |
572
|
6 |
|
$this->totalAmount = $totalAmount; |
573
|
|
|
|
574
|
6 |
|
return $this; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* @return string |
579
|
|
|
*/ |
580
|
3 |
|
public function getCallBackUrl(): ?string |
581
|
|
|
{ |
582
|
3 |
|
return $this->callBackUrl; |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
/** |
586
|
|
|
* @param string $callBackUrl |
587
|
|
|
* |
588
|
|
|
* @return Payment |
589
|
|
|
*/ |
590
|
6 |
|
public function setCallBackUrl(string $callBackUrl): self |
591
|
|
|
{ |
592
|
6 |
|
$this->callBackUrl = $callBackUrl; |
593
|
|
|
|
594
|
6 |
|
return $this; |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* @return string |
599
|
|
|
*/ |
600
|
3 |
|
public function getFullCallBackOkUrl(): ?string |
601
|
|
|
{ |
602
|
3 |
|
return $this->fullCallBackOkUrl; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* @param string $fullCallBackOkUrl |
607
|
|
|
* |
608
|
|
|
* @return Payment |
609
|
|
|
*/ |
610
|
6 |
|
public function setFullCallBackOkUrl(string $fullCallBackOkUrl): self |
611
|
|
|
{ |
612
|
6 |
|
$this->fullCallBackOkUrl = $fullCallBackOkUrl; |
613
|
|
|
|
614
|
6 |
|
return $this; |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
/** |
618
|
|
|
* @return string |
619
|
|
|
*/ |
620
|
3 |
|
public function getCallBackOkUrl(): ?string |
621
|
|
|
{ |
622
|
3 |
|
return $this->callBackOkUrl; |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* @param string $callBackOkUrl |
627
|
|
|
* |
628
|
|
|
* @return Payment |
629
|
|
|
*/ |
630
|
6 |
|
public function setCallBackOkUrl(string $callBackOkUrl): self |
631
|
|
|
{ |
632
|
6 |
|
$this->callBackOkUrl = $callBackOkUrl; |
633
|
|
|
|
634
|
6 |
|
return $this; |
635
|
|
|
} |
636
|
|
|
|
637
|
|
|
/** |
638
|
|
|
* @return string |
639
|
|
|
*/ |
640
|
3 |
|
public function getCallBackServerUrl(): ?string |
641
|
|
|
{ |
642
|
3 |
|
return $this->callBackServerUrl; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
/** |
646
|
|
|
* @param string $callBackServerUrl |
647
|
|
|
* |
648
|
|
|
* @return Payment |
649
|
|
|
*/ |
650
|
6 |
|
public function setCallBackServerUrl(string $callBackServerUrl): self |
651
|
|
|
{ |
652
|
6 |
|
$this->callBackServerUrl = $callBackServerUrl; |
653
|
|
|
|
654
|
6 |
|
return $this; |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
/** |
658
|
|
|
* @return int |
659
|
|
|
*/ |
660
|
3 |
|
public function getLanguageId(): ?int |
661
|
|
|
{ |
662
|
3 |
|
return $this->languageId; |
663
|
|
|
} |
664
|
|
|
|
665
|
|
|
/** |
666
|
|
|
* @param int $languageId |
667
|
|
|
* |
668
|
|
|
* @return Payment |
669
|
|
|
*/ |
670
|
6 |
|
public function setLanguageId(int $languageId): self |
671
|
|
|
{ |
672
|
6 |
|
$this->languageId = $languageId; |
673
|
|
|
|
674
|
6 |
|
return $this; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
/** |
678
|
|
|
* @return bool |
679
|
|
|
*/ |
680
|
3 |
|
public function isTestMode(): ?bool |
681
|
|
|
{ |
682
|
3 |
|
return $this->testMode; |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* @param bool $testMode |
687
|
|
|
* |
688
|
|
|
* @return Payment |
689
|
|
|
*/ |
690
|
6 |
|
public function setTestMode(bool $testMode): self |
691
|
|
|
{ |
692
|
6 |
|
$this->testMode = $testMode; |
693
|
|
|
|
694
|
6 |
|
return $this; |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
/** |
698
|
|
|
* @return int |
699
|
|
|
*/ |
700
|
9 |
|
public function getPaymentGatewayCurrencyCode() |
701
|
|
|
{ |
702
|
9 |
|
return $this->paymentGatewayCurrencyCode; |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
/** |
706
|
|
|
* @param int $paymentGatewayCurrencyCode |
707
|
|
|
* |
708
|
|
|
* @return Payment |
709
|
|
|
*/ |
710
|
12 |
|
public function setPaymentGatewayCurrencyCode(int $paymentGatewayCurrencyCode): self |
711
|
|
|
{ |
712
|
12 |
|
$this->paymentGatewayCurrencyCode = $paymentGatewayCurrencyCode; |
713
|
|
|
|
714
|
12 |
|
return $this; |
715
|
|
|
} |
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* @return int |
719
|
|
|
*/ |
720
|
3 |
|
public function getCardTypeId() |
721
|
|
|
{ |
722
|
3 |
|
return $this->cardTypeId; |
723
|
|
|
} |
724
|
|
|
|
725
|
|
|
/** |
726
|
|
|
* @param int $cardTypeId |
727
|
|
|
* |
728
|
|
|
* @return Payment |
729
|
|
|
*/ |
730
|
6 |
|
public function setCardTypeId(int $cardTypeId): self |
731
|
|
|
{ |
732
|
6 |
|
$this->cardTypeId = $cardTypeId; |
733
|
|
|
|
734
|
6 |
|
return $this; |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
/** |
738
|
|
|
* @return string |
739
|
|
|
*/ |
740
|
3 |
|
public function getCustomerRekvNr(): ?string |
741
|
|
|
{ |
742
|
3 |
|
return $this->customerRekvNr; |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* @param string $customerRekvNr |
747
|
|
|
* |
748
|
|
|
* @return Payment |
749
|
|
|
*/ |
750
|
6 |
|
public function setCustomerRekvNr(string $customerRekvNr): self |
751
|
|
|
{ |
752
|
6 |
|
$this->customerRekvNr = $customerRekvNr; |
753
|
|
|
|
754
|
6 |
|
return $this; |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
/** |
758
|
|
|
* @return string |
759
|
|
|
*/ |
760
|
3 |
|
public function getCustomerName(): ?string |
761
|
|
|
{ |
762
|
3 |
|
return $this->customerName; |
763
|
|
|
} |
764
|
|
|
|
765
|
|
|
/** |
766
|
|
|
* @param string $customerName |
767
|
|
|
* |
768
|
|
|
* @return Payment |
769
|
|
|
*/ |
770
|
6 |
|
public function setCustomerName(string $customerName): self |
771
|
|
|
{ |
772
|
6 |
|
$this->customerName = $customerName; |
773
|
|
|
|
774
|
6 |
|
return $this; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* @return string |
779
|
|
|
*/ |
780
|
3 |
|
public function getCustomerCompany(): ?string |
781
|
|
|
{ |
782
|
3 |
|
return $this->customerCompany; |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* @param string $customerCompany |
787
|
|
|
* |
788
|
|
|
* @return Payment |
789
|
|
|
*/ |
790
|
6 |
|
public function setCustomerCompany(string $customerCompany): self |
791
|
|
|
{ |
792
|
6 |
|
$this->customerCompany = $customerCompany; |
793
|
|
|
|
794
|
6 |
|
return $this; |
795
|
|
|
} |
796
|
|
|
|
797
|
|
|
/** |
798
|
|
|
* @return string |
799
|
|
|
*/ |
800
|
3 |
|
public function getCustomerAddress(): ?string |
801
|
|
|
{ |
802
|
3 |
|
return $this->customerAddress; |
803
|
|
|
} |
804
|
|
|
|
805
|
|
|
/** |
806
|
|
|
* @param string $customerAddress |
807
|
|
|
* |
808
|
|
|
* @return Payment |
809
|
|
|
*/ |
810
|
6 |
|
public function setCustomerAddress(string $customerAddress): self |
811
|
|
|
{ |
812
|
6 |
|
$this->customerAddress = $customerAddress; |
813
|
|
|
|
814
|
6 |
|
return $this; |
815
|
|
|
} |
816
|
|
|
|
817
|
|
|
/** |
818
|
|
|
* @return string |
819
|
|
|
*/ |
820
|
3 |
|
public function getCustomerAddress2(): ?string |
821
|
|
|
{ |
822
|
3 |
|
return $this->customerAddress2; |
823
|
|
|
} |
824
|
|
|
|
825
|
|
|
/** |
826
|
|
|
* @param string $customerAddress2 |
827
|
|
|
* |
828
|
|
|
* @return Payment |
829
|
|
|
*/ |
830
|
6 |
|
public function setCustomerAddress2(string $customerAddress2): self |
831
|
|
|
{ |
832
|
6 |
|
$this->customerAddress2 = $customerAddress2; |
833
|
|
|
|
834
|
6 |
|
return $this; |
835
|
|
|
} |
836
|
|
|
|
837
|
|
|
/** |
838
|
|
|
* @return string |
839
|
|
|
*/ |
840
|
3 |
|
public function getCustomerZipCode(): ?string |
841
|
|
|
{ |
842
|
3 |
|
return $this->customerZipCode; |
843
|
|
|
} |
844
|
|
|
|
845
|
|
|
/** |
846
|
|
|
* @param string $customerZipCode |
847
|
|
|
* |
848
|
|
|
* @return Payment |
849
|
|
|
*/ |
850
|
6 |
|
public function setCustomerZipCode(string $customerZipCode): self |
851
|
|
|
{ |
852
|
6 |
|
$this->customerZipCode = $customerZipCode; |
853
|
|
|
|
854
|
6 |
|
return $this; |
855
|
|
|
} |
856
|
|
|
|
857
|
|
|
/** |
858
|
|
|
* @return string |
859
|
|
|
*/ |
860
|
3 |
|
public function getCustomerCity(): ?string |
861
|
|
|
{ |
862
|
3 |
|
return $this->customerCity; |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
/** |
866
|
|
|
* @param string $customerCity |
867
|
|
|
* |
868
|
|
|
* @return Payment |
869
|
|
|
*/ |
870
|
6 |
|
public function setCustomerCity(string $customerCity): self |
871
|
|
|
{ |
872
|
6 |
|
$this->customerCity = $customerCity; |
873
|
|
|
|
874
|
6 |
|
return $this; |
875
|
|
|
} |
876
|
|
|
|
877
|
|
|
/** |
878
|
|
|
* @return int |
879
|
|
|
*/ |
880
|
3 |
|
public function getCustomerCountryId() |
881
|
|
|
{ |
882
|
3 |
|
return $this->customerCountryId; |
883
|
|
|
} |
884
|
|
|
|
885
|
|
|
/** |
886
|
|
|
* @param int $customerCountryId |
887
|
|
|
* |
888
|
|
|
* @return Payment |
889
|
|
|
*/ |
890
|
6 |
|
public function setCustomerCountryId(int $customerCountryId): self |
891
|
|
|
{ |
892
|
6 |
|
$this->customerCountryId = $customerCountryId; |
893
|
|
|
|
894
|
6 |
|
return $this; |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
/** |
898
|
|
|
* @return string |
899
|
|
|
*/ |
900
|
3 |
|
public function getCustomerCountry(): ?string |
901
|
|
|
{ |
902
|
3 |
|
return $this->customerCountry; |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
/** |
906
|
|
|
* @param string $customerCountry |
907
|
|
|
* |
908
|
|
|
* @return Payment |
909
|
|
|
*/ |
910
|
6 |
|
public function setCustomerCountry(string $customerCountry): self |
911
|
|
|
{ |
912
|
6 |
|
$this->customerCountry = $customerCountry; |
913
|
|
|
|
914
|
6 |
|
return $this; |
915
|
|
|
} |
916
|
|
|
|
917
|
|
|
/** |
918
|
|
|
* @return string |
919
|
|
|
*/ |
920
|
3 |
|
public function getCustomerCountryCode(): ?string |
921
|
|
|
{ |
922
|
3 |
|
return $this->customerCountryCode; |
923
|
|
|
} |
924
|
|
|
|
925
|
|
|
/** |
926
|
|
|
* @param string $customerCountryCode |
927
|
|
|
* @return Payment |
928
|
|
|
*/ |
929
|
6 |
|
public function setCustomerCountryCode(string $customerCountryCode): self |
930
|
|
|
{ |
931
|
6 |
|
$this->customerCountryCode = $customerCountryCode; |
932
|
6 |
|
return $this; |
933
|
|
|
} |
934
|
|
|
|
935
|
|
|
/** |
936
|
|
|
* @return string |
937
|
|
|
*/ |
938
|
3 |
|
public function getCustomerPhone(): ?string |
939
|
|
|
{ |
940
|
3 |
|
return $this->customerPhone; |
941
|
|
|
} |
942
|
|
|
|
943
|
|
|
/** |
944
|
|
|
* @param string $customerPhone |
945
|
|
|
* |
946
|
|
|
* @return Payment |
947
|
|
|
*/ |
948
|
6 |
|
public function setCustomerPhone(string $customerPhone): self |
949
|
|
|
{ |
950
|
6 |
|
$this->customerPhone = $customerPhone; |
951
|
|
|
|
952
|
6 |
|
return $this; |
953
|
|
|
} |
954
|
|
|
|
955
|
|
|
/** |
956
|
|
|
* @return string |
957
|
|
|
*/ |
958
|
3 |
|
public function getCustomerFax(): ?string |
959
|
|
|
{ |
960
|
3 |
|
return $this->customerFax; |
961
|
|
|
} |
962
|
|
|
|
963
|
|
|
/** |
964
|
|
|
* @param string $customerFax |
965
|
|
|
* |
966
|
|
|
* @return Payment |
967
|
|
|
*/ |
968
|
6 |
|
public function setCustomerFax(string $customerFax): self |
969
|
|
|
{ |
970
|
6 |
|
$this->customerFax = $customerFax; |
971
|
|
|
|
972
|
6 |
|
return $this; |
973
|
|
|
} |
974
|
|
|
|
975
|
|
|
/** |
976
|
|
|
* @return string |
977
|
|
|
*/ |
978
|
3 |
|
public function getCustomerEmail(): ?string |
979
|
|
|
{ |
980
|
3 |
|
return $this->customerEmail; |
981
|
|
|
} |
982
|
|
|
|
983
|
|
|
/** |
984
|
|
|
* @param string $customerEmail |
985
|
|
|
* |
986
|
|
|
* @return Payment |
987
|
|
|
*/ |
988
|
6 |
|
public function setCustomerEmail(string $customerEmail): self |
989
|
|
|
{ |
990
|
6 |
|
$this->customerEmail = $customerEmail; |
991
|
|
|
|
992
|
6 |
|
return $this; |
993
|
|
|
} |
994
|
|
|
|
995
|
|
|
/** |
996
|
|
|
* @return string |
997
|
|
|
*/ |
998
|
3 |
|
public function getCustomerNote(): ?string |
999
|
|
|
{ |
1000
|
3 |
|
return $this->customerNote; |
1001
|
|
|
} |
1002
|
|
|
|
1003
|
|
|
/** |
1004
|
|
|
* @param string $customerNote |
1005
|
|
|
* |
1006
|
|
|
* @return Payment |
1007
|
|
|
*/ |
1008
|
6 |
|
public function setCustomerNote(string $customerNote): self |
1009
|
|
|
{ |
1010
|
6 |
|
$this->customerNote = $customerNote; |
1011
|
|
|
|
1012
|
6 |
|
return $this; |
1013
|
|
|
} |
1014
|
|
|
|
1015
|
|
|
/** |
1016
|
|
|
* @return string |
1017
|
|
|
*/ |
1018
|
3 |
|
public function getCustomerCvrnr(): ?string |
1019
|
|
|
{ |
1020
|
3 |
|
return $this->customerCvrnr; |
1021
|
|
|
} |
1022
|
|
|
|
1023
|
|
|
/** |
1024
|
|
|
* @param string $customerCvrnr |
1025
|
|
|
* |
1026
|
|
|
* @return Payment |
1027
|
|
|
*/ |
1028
|
6 |
|
public function setCustomerCvrnr(string $customerCvrnr): self |
1029
|
|
|
{ |
1030
|
6 |
|
$this->customerCvrnr = $customerCvrnr; |
1031
|
|
|
|
1032
|
6 |
|
return $this; |
1033
|
|
|
} |
1034
|
|
|
|
1035
|
|
|
/** |
1036
|
|
|
* @return int |
1037
|
|
|
*/ |
1038
|
3 |
|
public function getCustomerCustTypeId(): ?int |
1039
|
|
|
{ |
1040
|
3 |
|
return $this->customerCustTypeId; |
1041
|
|
|
} |
1042
|
|
|
|
1043
|
|
|
/** |
1044
|
|
|
* @param int $customerCustTypeId |
1045
|
|
|
* |
1046
|
|
|
* @return Payment |
1047
|
|
|
*/ |
1048
|
6 |
|
public function setCustomerCustTypeId(int $customerCustTypeId): self |
1049
|
|
|
{ |
1050
|
6 |
|
$this->customerCustTypeId = $customerCustTypeId; |
1051
|
|
|
|
1052
|
6 |
|
return $this; |
1053
|
|
|
} |
1054
|
|
|
|
1055
|
|
|
/** |
1056
|
|
|
* @return string |
1057
|
|
|
*/ |
1058
|
3 |
|
public function getCustomerEan(): ?string |
1059
|
|
|
{ |
1060
|
3 |
|
return $this->customerEan; |
1061
|
|
|
} |
1062
|
|
|
|
1063
|
|
|
/** |
1064
|
|
|
* @param string $customerEan |
1065
|
|
|
* |
1066
|
|
|
* @return Payment |
1067
|
|
|
*/ |
1068
|
6 |
|
public function setCustomerEan(string $customerEan): self |
1069
|
|
|
{ |
1070
|
6 |
|
$this->customerEan = $customerEan; |
1071
|
|
|
|
1072
|
6 |
|
return $this; |
1073
|
|
|
} |
1074
|
|
|
|
1075
|
|
|
/** |
1076
|
|
|
* @return string |
1077
|
|
|
*/ |
1078
|
3 |
|
public function getCustomerRes1(): ?string |
1079
|
|
|
{ |
1080
|
3 |
|
return $this->customerRes1; |
1081
|
|
|
} |
1082
|
|
|
|
1083
|
|
|
/** |
1084
|
|
|
* @param string $customerRes1 |
1085
|
|
|
* |
1086
|
|
|
* @return Payment |
1087
|
|
|
*/ |
1088
|
6 |
|
public function setCustomerRes1(string $customerRes1): self |
1089
|
|
|
{ |
1090
|
6 |
|
$this->customerRes1 = $customerRes1; |
1091
|
|
|
|
1092
|
6 |
|
return $this; |
1093
|
|
|
} |
1094
|
|
|
|
1095
|
|
|
/** |
1096
|
|
|
* @return string |
1097
|
|
|
*/ |
1098
|
3 |
|
public function getCustomerRes2(): ?string |
1099
|
|
|
{ |
1100
|
3 |
|
return $this->customerRes2; |
1101
|
|
|
} |
1102
|
|
|
|
1103
|
|
|
/** |
1104
|
|
|
* @param string $customerRes2 |
1105
|
|
|
* |
1106
|
|
|
* @return Payment |
1107
|
|
|
*/ |
1108
|
6 |
|
public function setCustomerRes2(string $customerRes2): self |
1109
|
|
|
{ |
1110
|
6 |
|
$this->customerRes2 = $customerRes2; |
1111
|
|
|
|
1112
|
6 |
|
return $this; |
1113
|
|
|
} |
1114
|
|
|
|
1115
|
|
|
/** |
1116
|
|
|
* @return string |
1117
|
|
|
*/ |
1118
|
3 |
|
public function getCustomerRes3(): ?string |
1119
|
|
|
{ |
1120
|
3 |
|
return $this->customerRes3; |
1121
|
|
|
} |
1122
|
|
|
|
1123
|
|
|
/** |
1124
|
|
|
* @param string $customerRes3 |
1125
|
|
|
* |
1126
|
|
|
* @return Payment |
1127
|
|
|
*/ |
1128
|
6 |
|
public function setCustomerRes3(string $customerRes3): self |
1129
|
|
|
{ |
1130
|
6 |
|
$this->customerRes3 = $customerRes3; |
1131
|
|
|
|
1132
|
6 |
|
return $this; |
1133
|
|
|
} |
1134
|
|
|
|
1135
|
|
|
/** |
1136
|
|
|
* @return string |
1137
|
|
|
*/ |
1138
|
3 |
|
public function getCustomerRes4(): ?string |
1139
|
|
|
{ |
1140
|
3 |
|
return $this->customerRes4; |
1141
|
|
|
} |
1142
|
|
|
|
1143
|
|
|
/** |
1144
|
|
|
* @param string $customerRes4 |
1145
|
|
|
* |
1146
|
|
|
* @return Payment |
1147
|
|
|
*/ |
1148
|
6 |
|
public function setCustomerRes4(string $customerRes4): self |
1149
|
|
|
{ |
1150
|
6 |
|
$this->customerRes4 = $customerRes4; |
1151
|
|
|
|
1152
|
6 |
|
return $this; |
1153
|
|
|
} |
1154
|
|
|
|
1155
|
|
|
/** |
1156
|
|
|
* @return string |
1157
|
|
|
*/ |
1158
|
3 |
|
public function getCustomerRes5(): ?string |
1159
|
|
|
{ |
1160
|
3 |
|
return $this->customerRes5; |
1161
|
|
|
} |
1162
|
|
|
|
1163
|
|
|
/** |
1164
|
|
|
* @param string $customerRes5 |
1165
|
|
|
* |
1166
|
|
|
* @return Payment |
1167
|
|
|
*/ |
1168
|
6 |
|
public function setCustomerRes5(string $customerRes5): self |
1169
|
|
|
{ |
1170
|
6 |
|
$this->customerRes5 = $customerRes5; |
1171
|
|
|
|
1172
|
6 |
|
return $this; |
1173
|
|
|
} |
1174
|
|
|
|
1175
|
|
|
/** |
1176
|
|
|
* @return string |
1177
|
|
|
*/ |
1178
|
3 |
|
public function getCustomerIp(): ?string |
1179
|
|
|
{ |
1180
|
3 |
|
return $this->customerIp; |
1181
|
|
|
} |
1182
|
|
|
|
1183
|
|
|
/** |
1184
|
|
|
* @param string $customerIp |
1185
|
|
|
* |
1186
|
|
|
* @return Payment |
1187
|
|
|
*/ |
1188
|
6 |
|
public function setCustomerIp(string $customerIp): self |
1189
|
|
|
{ |
1190
|
6 |
|
$this->customerIp = $customerIp; |
1191
|
|
|
|
1192
|
6 |
|
return $this; |
1193
|
|
|
} |
1194
|
|
|
|
1195
|
|
|
/** |
1196
|
|
|
* @return string |
1197
|
|
|
*/ |
1198
|
3 |
|
public function getDeliveryName(): ?string |
1199
|
|
|
{ |
1200
|
3 |
|
return $this->deliveryName; |
1201
|
|
|
} |
1202
|
|
|
|
1203
|
|
|
/** |
1204
|
|
|
* @param string $deliveryName |
1205
|
|
|
* |
1206
|
|
|
* @return Payment |
1207
|
|
|
*/ |
1208
|
6 |
|
public function setDeliveryName(string $deliveryName): self |
1209
|
|
|
{ |
1210
|
6 |
|
$this->deliveryName = $deliveryName; |
1211
|
|
|
|
1212
|
6 |
|
return $this; |
1213
|
|
|
} |
1214
|
|
|
|
1215
|
|
|
/** |
1216
|
|
|
* @return string |
1217
|
|
|
*/ |
1218
|
3 |
|
public function getDeliveryCompany(): ?string |
1219
|
|
|
{ |
1220
|
3 |
|
return $this->deliveryCompany; |
1221
|
|
|
} |
1222
|
|
|
|
1223
|
|
|
/** |
1224
|
|
|
* @param string $deliveryCompany |
1225
|
|
|
* |
1226
|
|
|
* @return Payment |
1227
|
|
|
*/ |
1228
|
6 |
|
public function setDeliveryCompany(string $deliveryCompany): self |
1229
|
|
|
{ |
1230
|
6 |
|
$this->deliveryCompany = $deliveryCompany; |
1231
|
|
|
|
1232
|
6 |
|
return $this; |
1233
|
|
|
} |
1234
|
|
|
|
1235
|
|
|
/** |
1236
|
|
|
* @return string |
1237
|
|
|
*/ |
1238
|
3 |
|
public function getDeliveryAddress(): ?string |
1239
|
|
|
{ |
1240
|
3 |
|
return $this->deliveryAddress; |
1241
|
|
|
} |
1242
|
|
|
|
1243
|
|
|
/** |
1244
|
|
|
* @param string $deliveryAddress |
1245
|
|
|
* |
1246
|
|
|
* @return Payment |
1247
|
|
|
*/ |
1248
|
6 |
|
public function setDeliveryAddress(string $deliveryAddress): self |
1249
|
|
|
{ |
1250
|
6 |
|
$this->deliveryAddress = $deliveryAddress; |
1251
|
|
|
|
1252
|
6 |
|
return $this; |
1253
|
|
|
} |
1254
|
|
|
|
1255
|
|
|
/** |
1256
|
|
|
* @return string |
1257
|
|
|
*/ |
1258
|
3 |
|
public function getDeliveryAddress2(): ?string |
1259
|
|
|
{ |
1260
|
3 |
|
return $this->deliveryAddress2; |
1261
|
|
|
} |
1262
|
|
|
|
1263
|
|
|
/** |
1264
|
|
|
* @param string $deliveryAddress2 |
1265
|
|
|
* |
1266
|
|
|
* @return Payment |
1267
|
|
|
*/ |
1268
|
6 |
|
public function setDeliveryAddress2(string $deliveryAddress2): self |
1269
|
|
|
{ |
1270
|
6 |
|
$this->deliveryAddress2 = $deliveryAddress2; |
1271
|
|
|
|
1272
|
6 |
|
return $this; |
1273
|
|
|
} |
1274
|
|
|
|
1275
|
|
|
/** |
1276
|
|
|
* @return string |
1277
|
|
|
*/ |
1278
|
3 |
|
public function getDeliveryZipCode(): ?string |
1279
|
|
|
{ |
1280
|
3 |
|
return $this->deliveryZipCode; |
1281
|
|
|
} |
1282
|
|
|
|
1283
|
|
|
/** |
1284
|
|
|
* @param string $deliveryZipCode |
1285
|
|
|
* |
1286
|
|
|
* @return Payment |
1287
|
|
|
*/ |
1288
|
6 |
|
public function setDeliveryZipCode(string $deliveryZipCode): self |
1289
|
|
|
{ |
1290
|
6 |
|
$this->deliveryZipCode = $deliveryZipCode; |
1291
|
|
|
|
1292
|
6 |
|
return $this; |
1293
|
|
|
} |
1294
|
|
|
|
1295
|
|
|
/** |
1296
|
|
|
* @return string |
1297
|
|
|
*/ |
1298
|
3 |
|
public function getDeliveryCity(): ?string |
1299
|
|
|
{ |
1300
|
3 |
|
return $this->deliveryCity; |
1301
|
|
|
} |
1302
|
|
|
|
1303
|
|
|
/** |
1304
|
|
|
* @param string $deliveryCity |
1305
|
|
|
* |
1306
|
|
|
* @return Payment |
1307
|
|
|
*/ |
1308
|
6 |
|
public function setDeliveryCity(string $deliveryCity): self |
1309
|
|
|
{ |
1310
|
6 |
|
$this->deliveryCity = $deliveryCity; |
1311
|
|
|
|
1312
|
6 |
|
return $this; |
1313
|
|
|
} |
1314
|
|
|
|
1315
|
|
|
/** |
1316
|
|
|
* @return int |
1317
|
|
|
*/ |
1318
|
3 |
|
public function getDeliveryCountryID() |
1319
|
|
|
{ |
1320
|
3 |
|
return $this->deliveryCountryID; |
1321
|
|
|
} |
1322
|
|
|
|
1323
|
|
|
/** |
1324
|
|
|
* @param int $deliveryCountryID |
1325
|
|
|
* |
1326
|
|
|
* @return Payment |
1327
|
|
|
*/ |
1328
|
6 |
|
public function setDeliveryCountryID(int $deliveryCountryID): self |
1329
|
|
|
{ |
1330
|
6 |
|
$this->deliveryCountryID = $deliveryCountryID; |
1331
|
|
|
|
1332
|
6 |
|
return $this; |
1333
|
|
|
} |
1334
|
|
|
|
1335
|
|
|
/** |
1336
|
|
|
* @return string |
1337
|
|
|
*/ |
1338
|
3 |
|
public function getDeliveryCountry(): ?string |
1339
|
|
|
{ |
1340
|
3 |
|
return $this->deliveryCountry; |
1341
|
|
|
} |
1342
|
|
|
|
1343
|
|
|
/** |
1344
|
|
|
* @param string $deliveryCountry |
1345
|
|
|
* |
1346
|
|
|
* @return Payment |
1347
|
|
|
*/ |
1348
|
6 |
|
public function setDeliveryCountry(string $deliveryCountry): self |
1349
|
|
|
{ |
1350
|
6 |
|
$this->deliveryCountry = $deliveryCountry; |
1351
|
|
|
|
1352
|
6 |
|
return $this; |
1353
|
|
|
} |
1354
|
|
|
|
1355
|
|
|
/** |
1356
|
|
|
* @return string |
1357
|
|
|
*/ |
1358
|
3 |
|
public function getDeliveryCountryCode(): ?string |
1359
|
|
|
{ |
1360
|
3 |
|
return $this->deliveryCountryCode; |
1361
|
|
|
} |
1362
|
|
|
|
1363
|
|
|
/** |
1364
|
|
|
* @param string $deliveryCountryCode |
1365
|
|
|
* @return Payment |
1366
|
|
|
*/ |
1367
|
6 |
|
public function setDeliveryCountryCode(string $deliveryCountryCode) |
1368
|
|
|
{ |
1369
|
6 |
|
$this->deliveryCountryCode = $deliveryCountryCode; |
1370
|
6 |
|
return $this; |
1371
|
|
|
} |
1372
|
|
|
|
1373
|
|
|
/** |
1374
|
|
|
* @return string |
1375
|
|
|
*/ |
1376
|
3 |
|
public function getDeliveryPhone(): ?string |
1377
|
|
|
{ |
1378
|
3 |
|
return $this->deliveryPhone; |
1379
|
|
|
} |
1380
|
|
|
|
1381
|
|
|
/** |
1382
|
|
|
* @param string $deliveryPhone |
1383
|
|
|
* |
1384
|
|
|
* @return Payment |
1385
|
|
|
*/ |
1386
|
6 |
|
public function setDeliveryPhone(string $deliveryPhone): self |
1387
|
|
|
{ |
1388
|
6 |
|
$this->deliveryPhone = $deliveryPhone; |
1389
|
|
|
|
1390
|
6 |
|
return $this; |
1391
|
|
|
} |
1392
|
|
|
|
1393
|
|
|
/** |
1394
|
|
|
* @return string |
1395
|
|
|
*/ |
1396
|
3 |
|
public function getDeliveryFax(): ?string |
1397
|
|
|
{ |
1398
|
3 |
|
return $this->deliveryFax; |
1399
|
|
|
} |
1400
|
|
|
|
1401
|
|
|
/** |
1402
|
|
|
* @param string $deliveryFax |
1403
|
|
|
* |
1404
|
|
|
* @return Payment |
1405
|
|
|
*/ |
1406
|
6 |
|
public function setDeliveryFax(string $deliveryFax): self |
1407
|
|
|
{ |
1408
|
6 |
|
$this->deliveryFax = $deliveryFax; |
1409
|
|
|
|
1410
|
6 |
|
return $this; |
1411
|
|
|
} |
1412
|
|
|
|
1413
|
|
|
/** |
1414
|
|
|
* @return string |
1415
|
|
|
*/ |
1416
|
3 |
|
public function getDeliveryEmail(): ?string |
1417
|
|
|
{ |
1418
|
3 |
|
return $this->deliveryEmail; |
1419
|
|
|
} |
1420
|
|
|
|
1421
|
|
|
/** |
1422
|
|
|
* @param string $deliveryEmail |
1423
|
|
|
* |
1424
|
|
|
* @return Payment |
1425
|
|
|
*/ |
1426
|
6 |
|
public function setDeliveryEmail(string $deliveryEmail): self |
1427
|
|
|
{ |
1428
|
6 |
|
$this->deliveryEmail = $deliveryEmail; |
1429
|
|
|
|
1430
|
6 |
|
return $this; |
1431
|
|
|
} |
1432
|
|
|
|
1433
|
|
|
/** |
1434
|
|
|
* @return string |
1435
|
|
|
*/ |
1436
|
3 |
|
public function getDeliveryEan(): ?string |
1437
|
|
|
{ |
1438
|
3 |
|
return $this->deliveryEan; |
1439
|
|
|
} |
1440
|
|
|
|
1441
|
|
|
/** |
1442
|
|
|
* @param string $deliveryEan |
1443
|
|
|
* |
1444
|
|
|
* @return Payment |
1445
|
|
|
*/ |
1446
|
6 |
|
public function setDeliveryEan(string $deliveryEan): self |
1447
|
|
|
{ |
1448
|
6 |
|
$this->deliveryEan = $deliveryEan; |
1449
|
|
|
|
1450
|
6 |
|
return $this; |
1451
|
|
|
} |
1452
|
|
|
|
1453
|
|
|
/** |
1454
|
|
|
* @return string |
1455
|
|
|
*/ |
1456
|
3 |
|
public function getShippingMethod(): ?string |
1457
|
|
|
{ |
1458
|
3 |
|
return $this->shippingMethod; |
1459
|
|
|
} |
1460
|
|
|
|
1461
|
|
|
/** |
1462
|
|
|
* @param string $shippingMethod |
1463
|
|
|
* |
1464
|
|
|
* @return Payment |
1465
|
|
|
*/ |
1466
|
6 |
|
public function setShippingMethod(string $shippingMethod): self |
1467
|
|
|
{ |
1468
|
6 |
|
$this->shippingMethod = $shippingMethod; |
1469
|
|
|
|
1470
|
6 |
|
return $this; |
1471
|
|
|
} |
1472
|
|
|
|
1473
|
|
|
/** |
1474
|
|
|
* @return int |
1475
|
|
|
*/ |
1476
|
3 |
|
public function getShippingMethodId(): ?int |
1477
|
|
|
{ |
1478
|
3 |
|
return $this->shippingMethodId; |
1479
|
|
|
} |
1480
|
|
|
|
1481
|
|
|
/** |
1482
|
|
|
* @param int $shippingMethodId |
1483
|
|
|
* @return Payment |
1484
|
|
|
*/ |
1485
|
6 |
|
public function setShippingMethodId(int $shippingMethodId) : self |
1486
|
|
|
{ |
1487
|
6 |
|
$this->shippingMethodId = $shippingMethodId; |
1488
|
6 |
|
return $this; |
1489
|
|
|
} |
1490
|
|
|
|
1491
|
|
|
/** |
1492
|
|
|
* @return Money |
1493
|
|
|
*/ |
1494
|
3 |
|
public function getShippingFee(): ?Money |
1495
|
|
|
{ |
1496
|
3 |
|
return $this->shippingFee; |
1497
|
|
|
} |
1498
|
|
|
|
1499
|
|
|
/** |
1500
|
|
|
* @param Money $shippingFee |
1501
|
|
|
* |
1502
|
|
|
* @return Payment |
1503
|
|
|
*/ |
1504
|
3 |
|
public function setShippingFee(Money $shippingFee): self |
1505
|
|
|
{ |
1506
|
3 |
|
$this->shippingFee = $shippingFee; |
1507
|
|
|
|
1508
|
3 |
|
return $this; |
1509
|
|
|
} |
1510
|
|
|
|
1511
|
|
|
/** |
1512
|
|
|
* @return string |
1513
|
|
|
*/ |
1514
|
3 |
|
public function getPaymentMethod(): ?string |
1515
|
|
|
{ |
1516
|
3 |
|
return $this->paymentMethod; |
1517
|
|
|
} |
1518
|
|
|
|
1519
|
|
|
/** |
1520
|
|
|
* @param string $paymentMethod |
1521
|
|
|
* |
1522
|
|
|
* @return Payment |
1523
|
|
|
*/ |
1524
|
6 |
|
public function setPaymentMethod(string $paymentMethod): self |
1525
|
|
|
{ |
1526
|
6 |
|
$this->paymentMethod = $paymentMethod; |
1527
|
|
|
|
1528
|
6 |
|
return $this; |
1529
|
|
|
} |
1530
|
|
|
|
1531
|
|
|
/** |
1532
|
|
|
* @return int |
1533
|
|
|
*/ |
1534
|
3 |
|
public function getPaymentMethodId(): ?int |
1535
|
|
|
{ |
1536
|
3 |
|
return $this->paymentMethodId; |
1537
|
|
|
} |
1538
|
|
|
|
1539
|
|
|
/** |
1540
|
|
|
* @param int $paymentMethodId |
1541
|
|
|
* @return Payment |
1542
|
|
|
*/ |
1543
|
6 |
|
public function setPaymentMethodId(int $paymentMethodId) : self |
1544
|
|
|
{ |
1545
|
6 |
|
$this->paymentMethodId = $paymentMethodId; |
1546
|
6 |
|
return $this; |
1547
|
|
|
} |
1548
|
|
|
|
1549
|
|
|
/** |
1550
|
|
|
* @return Money |
1551
|
|
|
*/ |
1552
|
3 |
|
public function getPaymentFee(): ?Money |
1553
|
|
|
{ |
1554
|
3 |
|
return $this->paymentFee; |
1555
|
|
|
} |
1556
|
|
|
|
1557
|
|
|
/** |
1558
|
|
|
* @param Money $paymentFee |
1559
|
|
|
* |
1560
|
|
|
* @return Payment |
1561
|
|
|
*/ |
1562
|
3 |
|
public function setPaymentFee(Money $paymentFee): self |
1563
|
|
|
{ |
1564
|
3 |
|
$this->paymentFee = $paymentFee; |
1565
|
|
|
|
1566
|
3 |
|
return $this; |
1567
|
|
|
} |
1568
|
|
|
|
1569
|
|
|
/** |
1570
|
|
|
* @return string |
1571
|
|
|
*/ |
1572
|
3 |
|
public function getLoadBalancerRealIp(): ?string |
1573
|
|
|
{ |
1574
|
3 |
|
return $this->loadBalancerRealIp; |
1575
|
|
|
} |
1576
|
|
|
|
1577
|
|
|
/** |
1578
|
|
|
* @param string $loadBalancerRealIp |
1579
|
|
|
* |
1580
|
|
|
* @return Payment |
1581
|
|
|
*/ |
1582
|
6 |
|
public function setLoadBalancerRealIp(string $loadBalancerRealIp): self |
1583
|
|
|
{ |
1584
|
6 |
|
$this->loadBalancerRealIp = $loadBalancerRealIp; |
1585
|
|
|
|
1586
|
6 |
|
return $this; |
1587
|
|
|
} |
1588
|
|
|
|
1589
|
|
|
/** |
1590
|
|
|
* @return string |
1591
|
|
|
*/ |
1592
|
3 |
|
public function getReferrer(): ?string |
1593
|
|
|
{ |
1594
|
3 |
|
return $this->referrer; |
1595
|
|
|
} |
1596
|
|
|
|
1597
|
|
|
/** |
1598
|
|
|
* @param string $referrer |
1599
|
|
|
* |
1600
|
|
|
* @return Payment |
1601
|
|
|
*/ |
1602
|
6 |
|
public function setReferrer(string $referrer): self |
1603
|
|
|
{ |
1604
|
6 |
|
$this->referrer = $referrer; |
1605
|
|
|
|
1606
|
6 |
|
return $this; |
1607
|
|
|
} |
1608
|
|
|
|
1609
|
|
|
/** |
1610
|
|
|
* @return PaymentLine[]|iterable |
1611
|
|
|
*/ |
1612
|
6 |
|
public function getPaymentLines(): iterable |
1613
|
|
|
{ |
1614
|
6 |
|
return $this->paymentLines; |
1615
|
|
|
} |
1616
|
|
|
|
1617
|
|
|
/** |
1618
|
|
|
* @param PaymentLine[]|iterable $paymentLines |
1619
|
|
|
* |
1620
|
|
|
* @return Payment |
1621
|
|
|
*/ |
1622
|
3 |
|
public function setPaymentLines(iterable $paymentLines): self |
1623
|
|
|
{ |
1624
|
3 |
|
$this->paymentLines = $paymentLines; |
|
|
|
|
1625
|
|
|
|
1626
|
3 |
|
return $this; |
1627
|
|
|
} |
1628
|
|
|
|
1629
|
|
|
/** |
1630
|
|
|
* @param PaymentLine $paymentLine |
1631
|
|
|
* |
1632
|
|
|
* @return Payment |
1633
|
|
|
*/ |
1634
|
3 |
|
public function addPaymentLine(PaymentLine $paymentLine): self |
1635
|
|
|
{ |
1636
|
3 |
|
$paymentLine->setPayment($this); |
1637
|
3 |
|
$this->paymentLines[] = $paymentLine; |
1638
|
|
|
|
1639
|
3 |
|
return $this; |
1640
|
|
|
} |
1641
|
|
|
|
1642
|
|
|
/** |
1643
|
|
|
* Returns the default currency for this payment |
1644
|
|
|
* |
1645
|
|
|
* @return null|string |
1646
|
|
|
*/ |
1647
|
6 |
|
protected function getCurrency() : ?string |
1648
|
|
|
{ |
1649
|
6 |
|
return $this->currencySymbol; |
1650
|
|
|
} |
1651
|
|
|
|
1652
|
|
|
/** |
1653
|
|
|
* A helper method for creating a Money object from a float based on the shared currency |
1654
|
|
|
* |
1655
|
|
|
* @param int $amount |
1656
|
|
|
* @return Money|null |
1657
|
|
|
*/ |
1658
|
6 |
|
protected function createMoney(int $amount = 0) : ?Money |
1659
|
|
|
{ |
1660
|
6 |
|
if (!$this->getCurrency()) { |
|
|
|
|
1661
|
3 |
|
return null; |
1662
|
|
|
} |
1663
|
|
|
|
1664
|
3 |
|
return new Money($amount, new Currency($this->getCurrency())); |
1665
|
|
|
} |
1666
|
|
|
|
1667
|
|
|
/** |
1668
|
|
|
* A helper method for creating a Money object from a float based on the shared currency |
1669
|
|
|
* |
1670
|
|
|
* The float can be any format, i.e. 1.50 or 1,50 |
1671
|
|
|
* |
1672
|
|
|
* @param string $amount |
1673
|
|
|
* @return Money|null |
1674
|
|
|
*/ |
1675
|
6 |
|
protected function createMoneyFromFloat(string $amount = '0.00') : ?Money |
1676
|
|
|
{ |
1677
|
6 |
|
$amount = static::priceStringToInt((string)$amount); |
1678
|
6 |
|
return $this->createMoney($amount); |
1679
|
|
|
} |
1680
|
|
|
} |
1681
|
|
|
|
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: