Completed
Push — master ( c6944c...1ab139 )
by Joachim
02:11
created

PaymentRequest::getFullCallBackOkUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Loevgaard\Dandomain\Pay;
3
4
use Loevgaard\Dandomain\Pay\PaymentRequest\PaymentLine;
5
use Psr\Http\Message\ServerRequestInterface;
6
7
class PaymentRequest
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $apiKey;
13
14
    /**
15
     * @var string
16
     */
17
    protected $merchant;
18
19
    /**
20
     * @var int
21
     */
22
    protected $orderId;
23
24
    /**
25
     * @var string
26
     */
27
    protected $sessionId;
28
29
    /**
30
     * @var string
31
     */
32
    protected $currencySymbol;
33
34
    /**
35
     * @var float
36
     */
37
    protected $totalAmount;
38
39
    /**
40
     * @var string
41
     */
42
    protected $callBackUrl;
43
44
    /**
45
     * @var string
46
     */
47
    protected $fullCallBackOkUrl;
48
49
    /**
50
     * @var string
51
     */
52
    protected $callBackOkUrl;
53
54
    /**
55
     * @var string
56
     */
57
    protected $callBackServerUrl;
58
59
    /**
60
     * @var int
61
     */
62
    protected $languageId;
63
64
    /**
65
     * @var boolean
66
     */
67
    protected $testMode;
68
69
    /**
70
     * @var int
71
     */
72
    protected $paymentGatewayCurrencyCode;
73
74
    /**
75
     * @var int
76
     */
77
    protected $cardTypeId;
78
79
    /**
80
     * @var string
81
     */
82
    protected $customerRekvNr;
83
84
    /**
85
     * @var string
86
     */
87
    protected $customerName;
88
89
    /**
90
     * @var string
91
     */
92
    protected $customerCompany;
93
94
    /**
95
     * @var string
96
     */
97
    protected $customerAddress;
98
99
    /**
100
     * @var string
101
     */
102
    protected $customerAddress2;
103
104
    /**
105
     * @var string
106
     */
107
    protected $customerZipCode;
108
109
    /**
110
     * @var string
111
     */
112
    protected $customerCity;
113
114
    /**
115
     * @var int
116
     */
117
    protected $customerCountryId;
118
119
    /**
120
     * @var string
121
     */
122
    protected $customerCountry;
123
124
    /**
125
     * @var string
126
     */
127
    protected $customerPhone;
128
129
    /**
130
     * @var string
131
     */
132
    protected $customerFax;
133
134
    /**
135
     * @var string
136
     */
137
    protected $customerEmail;
138
139
    /**
140
     * @var string
141
     */
142
    protected $customerNote;
143
144
    /**
145
     * @var string
146
     */
147
    protected $customerCvrnr;
148
149
    /**
150
     * @var int
151
     */
152
    protected $customerCustTypeId;
153
154
    /**
155
     * @var string
156
     */
157
    protected $customerEan;
158
159
    /**
160
     * @var string
161
     */
162
    protected $customerRes1;
163
164
    /**
165
     * @var string
166
     */
167
    protected $customerRes2;
168
169
    /**
170
     * @var string
171
     */
172
    protected $customerRes3;
173
174
    /**
175
     * @var string
176
     */
177
    protected $customerRes4;
178
179
    /**
180
     * @var string
181
     */
182
    protected $customerRes5;
183
184
    /**
185
     * @var string
186
     */
187
    protected $customerIp;
188
189
    /**
190
     * @var string
191
     */
192
    protected $deliveryName;
193
194
    /**
195
     * @var string
196
     */
197
    protected $deliveryCompany;
198
199
    /**
200
     * @var string
201
     */
202
    protected $deliveryAddress;
203
204
    /**
205
     * @var string
206
     */
207
    protected $deliveryAddress2;
208
209
    /**
210
     * @var string
211
     */
212
    protected $deliveryZipCode;
213
214
    /**
215
     * @var string
216
     */
217
    protected $deliveryCity;
218
219
    /**
220
     * @var int
221
     */
222
    protected $deliveryCountryID;
223
224
    /**
225
     * @var string
226
     */
227
    protected $deliveryCountry;
228
229
    /**
230
     * @var string
231
     */
232
    protected $deliveryPhone;
233
234
    /**
235
     * @var string
236
     */
237
    protected $deliveryFax;
238
239
    /**
240
     * @var string
241
     */
242
    protected $deliveryEmail;
243
244
    /**
245
     * @var string
246
     */
247
    protected $deliveryEan;
248
249
    /**
250
     * @var string
251
     */
252
    protected $shippingMethod;
253
254
    /**
255
     * @var float
256
     */
257
    protected $shippingFee;
258
259
    /**
260
     * @var string
261
     */
262
    protected $paymentMethod;
263
264
    /**
265
     * @var float
266
     */
267
    protected $paymentFee;
268
269
    /**
270
     * @var string
271
     */
272
    protected $loadBalancerRealIp;
273
274
    /**
275
     * @var string
276
     */
277
    protected $referrer;
278
279
    /**
280
     * @var PaymentLine[]
281
     */
282
    protected $paymentLines;
283
284 15
    public function __construct()
285
    {
286 15
        $this->paymentLines = [];
287 15
    }
288
289 12
    public function populateFromRequest(ServerRequestInterface $request)
290
    {
291 12
        $body = $request->getParsedBody();
292 12
        $body = is_array($body) ? $body : [];
293
294 12
        $serverParams = $request->getServerParams();
295 12
        $serverParams = is_array($serverParams) ? $serverParams : [];
296
297 12
        $this->setApiKey($body['APIkey'] ?? '');
298 12
        $this->setMerchant($body['APIMerchant'] ?? '');
299 12
        $this->setOrderId($body['APIOrderID'] ?? 0);
300 12
        $this->setSessionId($body['APISessionID'] ?? '');
301 12
        $this->setCurrencySymbol($body['APICurrencySymbol'] ?? '');
302 12
        $this->setTotalAmount(static::currencyStringToFloat($body['APITotalAmount'] ?? '0.00'));
303 12
        $this->setCallBackUrl($body['APICallBackUrl'] ?? '');
304 12
        $this->setFullCallBackOkUrl($body['APIFullCallBackOKUrl'] ?? '');
305 12
        $this->setCallBackOkUrl($body['APICallBackOKUrl'] ?? '');
306 12
        $this->setCallBackServerUrl($body['APICallBackServerUrl'] ?? '');
307 12
        $this->setLanguageId(isset($body['APILanguageID']) ? (int)$body['APILanguageID'] :  0);
308 12
        $this->setTestMode(isset($body['APITestMode']) && $body['APITestMode'] === 'True');
309 12
        $this->setPaymentGatewayCurrencyCode(
310 12
            isset($body['APIPayGatewayCurrCode']) ? (int)$body['APIPayGatewayCurrCode'] : 0
311
        );
312 12
        $this->setCardTypeId(isset($body['APICardTypeID']) ? (int)$body['APICardTypeID'] : 0);
313 12
        $this->setCustomerRekvNr($body['APICRekvNr'] ?? '');
314 12
        $this->setCustomerName($body['APICName'] ?? '');
315 12
        $this->setCustomerCompany($body['APICCompany'] ?? '');
316 12
        $this->setCustomerAddress($body['APICAddress'] ?? '');
317 12
        $this->setCustomerAddress2($body['APICAddress2'] ?? '');
318 12
        $this->setCustomerZipCode($body['APICZipCode'] ?? '');
319 12
        $this->setCustomerCity($body['APICCity'] ?? '');
320 12
        $this->setCustomerCountryId(isset($body['APICCountryID']) ? (int)$body['APICCountryID'] : 0);
321 12
        $this->setCustomerCountry($body['APICCountry'] ?? '');
322 12
        $this->setCustomerPhone($body['APICPhone'] ?? '');
323 12
        $this->setCustomerFax($body['APICFax'] ?? '');
324 12
        $this->setCustomerEmail($body['APICEmail'] ?? '');
325 12
        $this->setCustomerNote($body['APICNote'] ?? '');
326 12
        $this->setCustomerCvrnr($body['APICcvrnr'] ?? '');
327 12
        $this->setCustomerCustTypeId(isset($body['APICCustTypeID']) ? (int)$body['APICCustTypeID'] : 0);
328 12
        $this->setCustomerEan($body['APICEAN'] ?? '');
329 12
        $this->setCustomerRes1($body['APICres1'] ?? '');
330 12
        $this->setCustomerRes2($body['APICres2'] ?? '');
331 12
        $this->setCustomerRes3($body['APICres3'] ?? '');
332 12
        $this->setCustomerRes4($body['APICres4'] ?? '');
333 12
        $this->setCustomerRes5($body['APICres5'] ?? '');
334 12
        $this->setDeliveryName($body['APIDName'] ?? '');
335 12
        $this->setDeliveryCompany($body['APIDCompany'] ?? '');
336 12
        $this->setDeliveryAddress($body['APIDAddress'] ?? '');
337 12
        $this->setDeliveryAddress2($body['APIDAddress2'] ?? '');
338 12
        $this->setDeliveryZipCode($body['APIDZipCode'] ?? '');
339 12
        $this->setDeliveryCity($body['APIDCity'] ?? '');
340 12
        $this->setDeliveryCountryID(isset($body['APIDCountryID']) ? (int)$body['APIDCountryID'] : 0);
341 12
        $this->setDeliveryCountry($body['APIDCountry'] ?? '');
342 12
        $this->setDeliveryPhone($body['APIDPhone'] ?? '');
343 12
        $this->setDeliveryFax($body['APIDFax'] ?? '');
344 12
        $this->setDeliveryEmail($body['APIDEmail'] ?? '');
345 12
        $this->setDeliveryEan($body['APIDean'] ?? '');
346 12
        $this->setShippingMethod($body['APIShippingMethod'] ?? '');
347 12
        $this->setShippingFee(static::currencyStringToFloat($body['APIShippingFee'] ?? '0.00'));
348 12
        $this->setPaymentMethod($body['APIPayMethod'] ?? '');
349 12
        $this->setPaymentFee(static::currencyStringToFloat($body['APIPayFee'] ?? '0.00'));
350 12
        $this->setCustomerIp($body['APICIP'] ?? '');
351 12
        $this->setLoadBalancerRealIp($body['APILoadBalancerRealIP'] ?? '');
352 12
        $this->setReferrer($serverParams['HTTP_REFERER'] ?? '');
353
354
        // populate order lines
355 12
        $i = 1;
356 12
        while (true) {
357 12
            $exists = isset($body['APIBasketProdAmount'.$i]);
358 12
            if ($exists === false) {
359 12
                break;
360
            }
361
362 3
            $qty = isset($body['APIBasketProdAmount'.$i]) ? (int)$body['APIBasketProdAmount'.$i] : 0;
363 3
            $productNumber = isset($body['APIBasketProdNumber'.$i]) ? $body['APIBasketProdNumber'.$i] : '';
364 3
            $name = isset($body['APIBasketProdName'.$i]) ? $body['APIBasketProdName'.$i] : '';
365 3
            $price = isset($body['APIBasketProdPrice'.$i]) ?
366 3
                static::currencyStringToFloat($body['APIBasketProdPrice'.$i]) : 0.00;
367 3
            $vat = isset($body['APIBasketProdVAT'.$i]) ? (int)$body['APIBasketProdVAT'.$i] : 0;
368
369 3
            $orderLine = new PaymentLine();
370
            $orderLine
371 3
                ->setQuantity($qty)
372 3
                ->setProductNumber($productNumber)
373 3
                ->setName($name)
374 3
                ->setPrice($price)
375 3
                ->setVat($vat)
376
            ;
377 3
            $this->addOrderLine($orderLine);
378
379 3
            $i++;
380
        }
381 12
    }
382
383
    /**
384
     * Takes strings like
385
     * - 1.000,50
386
     * - 1,000.50
387
     * - 1000.50
388
     * - 1000,50
389
     *
390
     * and returns 1000.50
391
     *
392
     * @param string $str
393
     * @return float
394
     */
395 15
    public static function currencyStringToFloat(string $str) : float
396
    {
397
        // verify format of string
398 15
        if (!preg_match('/(\.|,)[0-9]{2}$/', $str)) {
399 3
            throw new \InvalidArgumentException($str.' does not match the currency string format');
400
        }
401 15
        $str = preg_replace('/[^0-9]+/', '', $str);
402 15
        return intval($str) / 100;
403
    }
404
405
    /**
406
     * @return string
407
     */
408 6
    public function getApiKey() : string
409
    {
410 6
        return $this->apiKey;
411
    }
412
413
    /**
414
     * @param string $apiKey
415
     * @return PaymentRequest
416
     */
417 12
    public function setApiKey(string $apiKey) : self
418
    {
419 12
        $this->apiKey = $apiKey;
420 12
        return $this;
421
    }
422
423
    /**
424
     * @return string
425
     */
426 3
    public function getMerchant() : string
427
    {
428 3
        return $this->merchant;
429
    }
430
431
    /**
432
     * @param string $merchant
433
     * @return PaymentRequest
434
     */
435 12
    public function setMerchant(string $merchant) : self
436
    {
437 12
        $this->merchant = $merchant;
438 12
        return $this;
439
    }
440
441
    /**
442
     * @return int
443
     */
444 9
    public function getOrderId() : int
445
    {
446 9
        return $this->orderId;
447
    }
448
449
    /**
450
     * @param int $orderId
451
     * @return PaymentRequest
452
     */
453 12
    public function setOrderId(int $orderId) : self
454
    {
455 12
        $this->orderId = $orderId;
456 12
        return $this;
457
    }
458
459
    /**
460
     * @return string
461
     */
462 3
    public function getSessionId() : string
463
    {
464 3
        return $this->sessionId;
465
    }
466
467
    /**
468
     * @param string $sessionId
469
     * @return PaymentRequest
470
     */
471 12
    public function setSessionId(string $sessionId) : self
472
    {
473 12
        $this->sessionId = $sessionId;
474 12
        return $this;
475
    }
476
477
    /**
478
     * @return string
479
     */
480 3
    public function getCurrencySymbol() : string
481
    {
482 3
        return $this->currencySymbol;
483
    }
484
485
    /**
486
     * @param string $currencySymbol
487
     * @return PaymentRequest
488
     */
489 12
    public function setCurrencySymbol(string $currencySymbol) : self
490
    {
491 12
        $this->currencySymbol = $currencySymbol;
492 12
        return $this;
493
    }
494
495
    /**
496
     * @return float
497
     */
498 6
    public function getTotalAmount() : float
499
    {
500 6
        return $this->totalAmount;
501
    }
502
503
    /**
504
     * @param float $totalAmount
505
     * @return PaymentRequest
506
     */
507 12
    public function setTotalAmount(float $totalAmount) : self
508
    {
509 12
        $this->totalAmount = $totalAmount;
510 12
        return $this;
511
    }
512
513
    /**
514
     * @return string
515
     */
516 3
    public function getCallBackUrl() : string
517
    {
518 3
        return $this->callBackUrl;
519
    }
520
521
    /**
522
     * @param string $callBackUrl
523
     * @return PaymentRequest
524
     */
525 12
    public function setCallBackUrl(string $callBackUrl) : self
526
    {
527 12
        $this->callBackUrl = $callBackUrl;
528 12
        return $this;
529
    }
530
531
    /**
532
     * @return string
533
     */
534 3
    public function getFullCallBackOkUrl() : string
535
    {
536 3
        return $this->fullCallBackOkUrl;
537
    }
538
539
    /**
540
     * @param string $fullCallBackOkUrl
541
     * @return PaymentRequest
542
     */
543 12
    public function setFullCallBackOkUrl(string $fullCallBackOkUrl) : self
544
    {
545 12
        $this->fullCallBackOkUrl = $fullCallBackOkUrl;
546 12
        return $this;
547
    }
548
549
    /**
550
     * @return string
551
     */
552 3
    public function getCallBackOkUrl() : string
553
    {
554 3
        return $this->callBackOkUrl;
555
    }
556
557
    /**
558
     * @param string $callBackOkUrl
559
     * @return PaymentRequest
560
     */
561 12
    public function setCallBackOkUrl(string $callBackOkUrl) : self
562
    {
563 12
        $this->callBackOkUrl = $callBackOkUrl;
564 12
        return $this;
565
    }
566
567
    /**
568
     * @return string
569
     */
570 3
    public function getCallBackServerUrl() : string
571
    {
572 3
        return $this->callBackServerUrl;
573
    }
574
575
    /**
576
     * @param string $callBackServerUrl
577
     * @return PaymentRequest
578
     */
579 12
    public function setCallBackServerUrl(string $callBackServerUrl) : self
580
    {
581 12
        $this->callBackServerUrl = $callBackServerUrl;
582 12
        return $this;
583
    }
584
585
    /**
586
     * @return int
587
     */
588 3
    public function getLanguageId() : int
589
    {
590 3
        return $this->languageId;
591
    }
592
593
    /**
594
     * @param int $languageId
595
     * @return PaymentRequest
596
     */
597 12
    public function setLanguageId(int $languageId) : self
598
    {
599 12
        $this->languageId = $languageId;
600 12
        return $this;
601
    }
602
603
    /**
604
     * @return bool
605
     */
606 3
    public function isTestMode(): bool
607
    {
608 3
        return $this->testMode;
609
    }
610
611
    /**
612
     * @param bool $testMode
613
     * @return PaymentRequest
614
     */
615 12
    public function setTestMode(bool $testMode) : self
616
    {
617 12
        $this->testMode = $testMode;
618 12
        return $this;
619
    }
620
621
    /**
622
     * @return int
623
     */
624 9
    public function getPaymentGatewayCurrencyCode()
625
    {
626 9
        return $this->paymentGatewayCurrencyCode;
627
    }
628
629
    /**
630
     * @param int $paymentGatewayCurrencyCode
631
     * @return PaymentRequest
632
     */
633 12
    public function setPaymentGatewayCurrencyCode(int $paymentGatewayCurrencyCode) : self
634
    {
635 12
        $this->paymentGatewayCurrencyCode = $paymentGatewayCurrencyCode;
636 12
        return $this;
637
    }
638
639
    /**
640
     * @return int
641
     */
642 3
    public function getCardTypeId()
643
    {
644 3
        return $this->cardTypeId;
645
    }
646
647
    /**
648
     * @param int $cardTypeId
649
     * @return PaymentRequest
650
     */
651 12
    public function setCardTypeId(int $cardTypeId) : self
652
    {
653 12
        $this->cardTypeId = $cardTypeId;
654 12
        return $this;
655
    }
656
657
    /**
658
     * @return string
659
     */
660 3
    public function getCustomerRekvNr() : string
661
    {
662 3
        return $this->customerRekvNr;
663
    }
664
665
    /**
666
     * @param string $customerRekvNr
667
     * @return PaymentRequest
668
     */
669 12
    public function setCustomerRekvNr(string $customerRekvNr) : self
670
    {
671 12
        $this->customerRekvNr = $customerRekvNr;
672 12
        return $this;
673
    }
674
675
    /**
676
     * @return string
677
     */
678 3
    public function getCustomerName() : string
679
    {
680 3
        return $this->customerName;
681
    }
682
683
    /**
684
     * @param string $customerName
685
     * @return PaymentRequest
686
     */
687 12
    public function setCustomerName(string $customerName) : self
688
    {
689 12
        $this->customerName = $customerName;
690 12
        return $this;
691
    }
692
693
    /**
694
     * @return string
695
     */
696 3
    public function getCustomerCompany() : string
697
    {
698 3
        return $this->customerCompany;
699
    }
700
701
    /**
702
     * @param string $customerCompany
703
     * @return PaymentRequest
704
     */
705 12
    public function setCustomerCompany(string $customerCompany) : self
706
    {
707 12
        $this->customerCompany = $customerCompany;
708 12
        return $this;
709
    }
710
711
    /**
712
     * @return string
713
     */
714 3
    public function getCustomerAddress() : string
715
    {
716 3
        return $this->customerAddress;
717
    }
718
719
    /**
720
     * @param string $customerAddress
721
     * @return PaymentRequest
722
     */
723 12
    public function setCustomerAddress(string $customerAddress) : self
724
    {
725 12
        $this->customerAddress = $customerAddress;
726 12
        return $this;
727
    }
728
729
    /**
730
     * @return string
731
     */
732 3
    public function getCustomerAddress2() : string
733
    {
734 3
        return $this->customerAddress2;
735
    }
736
737
    /**
738
     * @param string $customerAddress2
739
     * @return PaymentRequest
740
     */
741 12
    public function setCustomerAddress2(string $customerAddress2) : self
742
    {
743 12
        $this->customerAddress2 = $customerAddress2;
744 12
        return $this;
745
    }
746
747
    /**
748
     * @return string
749
     */
750 3
    public function getCustomerZipCode() : string
751
    {
752 3
        return $this->customerZipCode;
753
    }
754
755
    /**
756
     * @param string $customerZipCode
757
     * @return PaymentRequest
758
     */
759 12
    public function setCustomerZipCode(string $customerZipCode) : self
760
    {
761 12
        $this->customerZipCode = $customerZipCode;
762 12
        return $this;
763
    }
764
765
    /**
766
     * @return string
767
     */
768 3
    public function getCustomerCity() : string
769
    {
770 3
        return $this->customerCity;
771
    }
772
773
    /**
774
     * @param string $customerCity
775
     * @return PaymentRequest
776
     */
777 12
    public function setCustomerCity(string $customerCity) : self
778
    {
779 12
        $this->customerCity = $customerCity;
780 12
        return $this;
781
    }
782
783
    /**
784
     * @return int
785
     */
786 3
    public function getCustomerCountryId()
787
    {
788 3
        return $this->customerCountryId;
789
    }
790
791
    /**
792
     * @param int $customerCountryId
793
     * @return PaymentRequest
794
     */
795 12
    public function setCustomerCountryId(int $customerCountryId) : self
796
    {
797 12
        $this->customerCountryId = $customerCountryId;
798 12
        return $this;
799
    }
800
801
    /**
802
     * @return string
803
     */
804 3
    public function getCustomerCountry() : string
805
    {
806 3
        return $this->customerCountry;
807
    }
808
809
    /**
810
     * @param string $customerCountry
811
     * @return PaymentRequest
812
     */
813 12
    public function setCustomerCountry(string $customerCountry) : self
814
    {
815 12
        $this->customerCountry = $customerCountry;
816 12
        return $this;
817
    }
818
819
    /**
820
     * @return string
821
     */
822 3
    public function getCustomerPhone() : string
823
    {
824 3
        return $this->customerPhone;
825
    }
826
827
    /**
828
     * @param string $customerPhone
829
     * @return PaymentRequest
830
     */
831 12
    public function setCustomerPhone(string $customerPhone) : self
832
    {
833 12
        $this->customerPhone = $customerPhone;
834 12
        return $this;
835
    }
836
837
    /**
838
     * @return string
839
     */
840 3
    public function getCustomerFax() : string
841
    {
842 3
        return $this->customerFax;
843
    }
844
845
    /**
846
     * @param string $customerFax
847
     * @return PaymentRequest
848
     */
849 12
    public function setCustomerFax(string $customerFax) : self
850
    {
851 12
        $this->customerFax = $customerFax;
852 12
        return $this;
853
    }
854
855
    /**
856
     * @return string
857
     */
858 3
    public function getCustomerEmail() : string
859
    {
860 3
        return $this->customerEmail;
861
    }
862
863
    /**
864
     * @param string $customerEmail
865
     * @return PaymentRequest
866
     */
867 12
    public function setCustomerEmail(string $customerEmail) : self
868
    {
869 12
        $this->customerEmail = $customerEmail;
870 12
        return $this;
871
    }
872
873
    /**
874
     * @return string
875
     */
876 3
    public function getCustomerNote() : string
877
    {
878 3
        return $this->customerNote;
879
    }
880
881
    /**
882
     * @param string $customerNote
883
     * @return PaymentRequest
884
     */
885 12
    public function setCustomerNote(string $customerNote) : self
886
    {
887 12
        $this->customerNote = $customerNote;
888 12
        return $this;
889
    }
890
891
    /**
892
     * @return string
893
     */
894 3
    public function getCustomerCvrnr() : string
895
    {
896 3
        return $this->customerCvrnr;
897
    }
898
899
    /**
900
     * @param string $customerCvrnr
901
     * @return PaymentRequest
902
     */
903 12
    public function setCustomerCvrnr(string $customerCvrnr) : self
904
    {
905 12
        $this->customerCvrnr = $customerCvrnr;
906 12
        return $this;
907
    }
908
909
    /**
910
     * @return int
911
     */
912 3
    public function getCustomerCustTypeId() : int
913
    {
914 3
        return $this->customerCustTypeId;
915
    }
916
917
    /**
918
     * @param int $customerCustTypeId
919
     * @return PaymentRequest
920
     */
921 12
    public function setCustomerCustTypeId(int $customerCustTypeId) : self
922
    {
923 12
        $this->customerCustTypeId = $customerCustTypeId;
924 12
        return $this;
925
    }
926
927
    /**
928
     * @return string
929
     */
930 3
    public function getCustomerEan() : string
931
    {
932 3
        return $this->customerEan;
933
    }
934
935
    /**
936
     * @param string $customerEan
937
     * @return PaymentRequest
938
     */
939 12
    public function setCustomerEan(string $customerEan) : self
940
    {
941 12
        $this->customerEan = $customerEan;
942 12
        return $this;
943
    }
944
945
    /**
946
     * @return string
947
     */
948 3
    public function getCustomerRes1() : string
949
    {
950 3
        return $this->customerRes1;
951
    }
952
953
    /**
954
     * @param string $customerRes1
955
     * @return PaymentRequest
956
     */
957 12
    public function setCustomerRes1(string $customerRes1) : self
958
    {
959 12
        $this->customerRes1 = $customerRes1;
960 12
        return $this;
961
    }
962
963
    /**
964
     * @return string
965
     */
966 3
    public function getCustomerRes2() : string
967
    {
968 3
        return $this->customerRes2;
969
    }
970
971
    /**
972
     * @param string $customerRes2
973
     * @return PaymentRequest
974
     */
975 12
    public function setCustomerRes2(string $customerRes2) : self
976
    {
977 12
        $this->customerRes2 = $customerRes2;
978 12
        return $this;
979
    }
980
981
    /**
982
     * @return string
983
     */
984 3
    public function getCustomerRes3() : string
985
    {
986 3
        return $this->customerRes3;
987
    }
988
989
    /**
990
     * @param string $customerRes3
991
     * @return PaymentRequest
992
     */
993 12
    public function setCustomerRes3(string $customerRes3) : self
994
    {
995 12
        $this->customerRes3 = $customerRes3;
996 12
        return $this;
997
    }
998
999
    /**
1000
     * @return string
1001
     */
1002 3
    public function getCustomerRes4() : string
1003
    {
1004 3
        return $this->customerRes4;
1005
    }
1006
1007
    /**
1008
     * @param string $customerRes4
1009
     * @return PaymentRequest
1010
     */
1011 12
    public function setCustomerRes4(string $customerRes4) : self
1012
    {
1013 12
        $this->customerRes4 = $customerRes4;
1014 12
        return $this;
1015
    }
1016
1017
    /**
1018
     * @return string
1019
     */
1020 3
    public function getCustomerRes5() : string
1021
    {
1022 3
        return $this->customerRes5;
1023
    }
1024
1025
    /**
1026
     * @param string $customerRes5
1027
     * @return PaymentRequest
1028
     */
1029 12
    public function setCustomerRes5(string $customerRes5) : self
1030
    {
1031 12
        $this->customerRes5 = $customerRes5;
1032 12
        return $this;
1033
    }
1034
1035
    /**
1036
     * @return string
1037
     */
1038 3
    public function getCustomerIp() : string
1039
    {
1040 3
        return $this->customerIp;
1041
    }
1042
1043
    /**
1044
     * @param string $customerIp
1045
     * @return PaymentRequest
1046
     */
1047 12
    public function setCustomerIp(string $customerIp) : self
1048
    {
1049 12
        $this->customerIp = $customerIp;
1050 12
        return $this;
1051
    }
1052
1053
    /**
1054
     * @return string
1055
     */
1056 3
    public function getDeliveryName() : string
1057
    {
1058 3
        return $this->deliveryName;
1059
    }
1060
1061
    /**
1062
     * @param string $deliveryName
1063
     * @return PaymentRequest
1064
     */
1065 12
    public function setDeliveryName(string $deliveryName) : self
1066
    {
1067 12
        $this->deliveryName = $deliveryName;
1068 12
        return $this;
1069
    }
1070
1071
    /**
1072
     * @return string
1073
     */
1074 3
    public function getDeliveryCompany() : string
1075
    {
1076 3
        return $this->deliveryCompany;
1077
    }
1078
1079
    /**
1080
     * @param string $deliveryCompany
1081
     * @return PaymentRequest
1082
     */
1083 12
    public function setDeliveryCompany(string $deliveryCompany) : self
1084
    {
1085 12
        $this->deliveryCompany = $deliveryCompany;
1086 12
        return $this;
1087
    }
1088
1089
    /**
1090
     * @return string
1091
     */
1092 3
    public function getDeliveryAddress() : string
1093
    {
1094 3
        return $this->deliveryAddress;
1095
    }
1096
1097
    /**
1098
     * @param string $deliveryAddress
1099
     * @return PaymentRequest
1100
     */
1101 12
    public function setDeliveryAddress(string $deliveryAddress) : self
1102
    {
1103 12
        $this->deliveryAddress = $deliveryAddress;
1104 12
        return $this;
1105
    }
1106
1107
    /**
1108
     * @return string
1109
     */
1110 3
    public function getDeliveryAddress2() : string
1111
    {
1112 3
        return $this->deliveryAddress2;
1113
    }
1114
1115
    /**
1116
     * @param string $deliveryAddress2
1117
     * @return PaymentRequest
1118
     */
1119 12
    public function setDeliveryAddress2(string $deliveryAddress2) : self
1120
    {
1121 12
        $this->deliveryAddress2 = $deliveryAddress2;
1122 12
        return $this;
1123
    }
1124
1125
    /**
1126
     * @return string
1127
     */
1128 3
    public function getDeliveryZipCode() : string
1129
    {
1130 3
        return $this->deliveryZipCode;
1131
    }
1132
1133
    /**
1134
     * @param string $deliveryZipCode
1135
     * @return PaymentRequest
1136
     */
1137 12
    public function setDeliveryZipCode(string $deliveryZipCode) : self
1138
    {
1139 12
        $this->deliveryZipCode = $deliveryZipCode;
1140 12
        return $this;
1141
    }
1142
1143
    /**
1144
     * @return string
1145
     */
1146 3
    public function getDeliveryCity() : string
1147
    {
1148 3
        return $this->deliveryCity;
1149
    }
1150
1151
    /**
1152
     * @param string $deliveryCity
1153
     * @return PaymentRequest
1154
     */
1155 12
    public function setDeliveryCity(string $deliveryCity) : self
1156
    {
1157 12
        $this->deliveryCity = $deliveryCity;
1158 12
        return $this;
1159
    }
1160
1161
    /**
1162
     * @return int
1163
     */
1164 3
    public function getDeliveryCountryID()
1165
    {
1166 3
        return $this->deliveryCountryID;
1167
    }
1168
1169
    /**
1170
     * @param int $deliveryCountryID
1171
     * @return PaymentRequest
1172
     */
1173 12
    public function setDeliveryCountryID(int $deliveryCountryID) : self
1174
    {
1175 12
        $this->deliveryCountryID = $deliveryCountryID;
1176 12
        return $this;
1177
    }
1178
1179
    /**
1180
     * @return string
1181
     */
1182 3
    public function getDeliveryCountry() : string
1183
    {
1184 3
        return $this->deliveryCountry;
1185
    }
1186
1187
    /**
1188
     * @param string $deliveryCountry
1189
     * @return PaymentRequest
1190
     */
1191 12
    public function setDeliveryCountry(string $deliveryCountry) : self
1192
    {
1193 12
        $this->deliveryCountry = $deliveryCountry;
1194 12
        return $this;
1195
    }
1196
1197
    /**
1198
     * @return string
1199
     */
1200 3
    public function getDeliveryPhone() : string
1201
    {
1202 3
        return $this->deliveryPhone;
1203
    }
1204
1205
    /**
1206
     * @param string $deliveryPhone
1207
     * @return PaymentRequest
1208
     */
1209 12
    public function setDeliveryPhone(string $deliveryPhone) : self
1210
    {
1211 12
        $this->deliveryPhone = $deliveryPhone;
1212 12
        return $this;
1213
    }
1214
1215
    /**
1216
     * @return string
1217
     */
1218 3
    public function getDeliveryFax() : string
1219
    {
1220 3
        return $this->deliveryFax;
1221
    }
1222
1223
    /**
1224
     * @param string $deliveryFax
1225
     * @return PaymentRequest
1226
     */
1227 12
    public function setDeliveryFax(string $deliveryFax) : self
1228
    {
1229 12
        $this->deliveryFax = $deliveryFax;
1230 12
        return $this;
1231
    }
1232
1233
    /**
1234
     * @return string
1235
     */
1236 3
    public function getDeliveryEmail() : string
1237
    {
1238 3
        return $this->deliveryEmail;
1239
    }
1240
1241
    /**
1242
     * @param string $deliveryEmail
1243
     * @return PaymentRequest
1244
     */
1245 12
    public function setDeliveryEmail(string $deliveryEmail) : self
1246
    {
1247 12
        $this->deliveryEmail = $deliveryEmail;
1248 12
        return $this;
1249
    }
1250
1251
    /**
1252
     * @return string
1253
     */
1254 3
    public function getDeliveryEan() : string
1255
    {
1256 3
        return $this->deliveryEan;
1257
    }
1258
1259
    /**
1260
     * @param string $deliveryEan
1261
     * @return PaymentRequest
1262
     */
1263 12
    public function setDeliveryEan(string $deliveryEan) : self
1264
    {
1265 12
        $this->deliveryEan = $deliveryEan;
1266 12
        return $this;
1267
    }
1268
1269
    /**
1270
     * @return string
1271
     */
1272 3
    public function getShippingMethod() : string
1273
    {
1274 3
        return $this->shippingMethod;
1275
    }
1276
1277
    /**
1278
     * @param string $shippingMethod
1279
     * @return PaymentRequest
1280
     */
1281 12
    public function setShippingMethod(string $shippingMethod) : self
1282
    {
1283 12
        $this->shippingMethod = $shippingMethod;
1284 12
        return $this;
1285
    }
1286
1287
    /**
1288
     * @return float
1289
     */
1290 3
    public function getShippingFee() : float
1291
    {
1292 3
        return $this->shippingFee;
1293
    }
1294
1295
    /**
1296
     * @param float $shippingFee
1297
     * @return PaymentRequest
1298
     */
1299 12
    public function setShippingFee(float $shippingFee) : self
1300
    {
1301 12
        $this->shippingFee = $shippingFee;
1302 12
        return $this;
1303
    }
1304
1305
    /**
1306
     * @return string
1307
     */
1308 3
    public function getPaymentMethod() : string
1309
    {
1310 3
        return $this->paymentMethod;
1311
    }
1312
1313
    /**
1314
     * @param string $paymentMethod
1315
     * @return PaymentRequest
1316
     */
1317 12
    public function setPaymentMethod(string $paymentMethod) : self
1318
    {
1319 12
        $this->paymentMethod = $paymentMethod;
1320 12
        return $this;
1321
    }
1322
1323
    /**
1324
     * @return float
1325
     */
1326 3
    public function getPaymentFee() : float
1327
    {
1328 3
        return $this->paymentFee;
1329
    }
1330
1331
    /**
1332
     * @param float $paymentFee
1333
     * @return PaymentRequest
1334
     */
1335 12
    public function setPaymentFee(float $paymentFee) : self
1336
    {
1337 12
        $this->paymentFee = $paymentFee;
1338 12
        return $this;
1339
    }
1340
1341
    /**
1342
     * @return string
1343
     */
1344 3
    public function getLoadBalancerRealIp() : string
1345
    {
1346 3
        return $this->loadBalancerRealIp;
1347
    }
1348
1349
    /**
1350
     * @param string $loadBalancerRealIp
1351
     * @return PaymentRequest
1352
     */
1353 12
    public function setLoadBalancerRealIp(string $loadBalancerRealIp) : self
1354
    {
1355 12
        $this->loadBalancerRealIp = $loadBalancerRealIp;
1356 12
        return $this;
1357
    }
1358
1359
    /**
1360
     * @return string
1361
     */
1362 3
    public function getReferrer(): string
1363
    {
1364 3
        return $this->referrer;
1365
    }
1366
1367
    /**
1368
     * @param string $referrer
1369
     * @return PaymentRequest
1370
     */
1371 12
    public function setReferrer(string $referrer) : self
1372
    {
1373 12
        $this->referrer = $referrer;
1374 12
        return $this;
1375
    }
1376
1377
    /**
1378
     * @return PaymentLine[]|iterable
1379
     */
1380 6
    public function getPaymentLines() : iterable
1381
    {
1382 6
        return $this->paymentLines;
1383
    }
1384
1385
    /**
1386
     * @param PaymentLine[]|iterable $paymentLines
1387
     * @return PaymentRequest
1388
     */
1389 3
    public function setPaymentLines(iterable $paymentLines) : self
1390
    {
1391 3
        $this->paymentLines = $paymentLines;
0 ignored issues
show
Documentation Bug introduced by
It seems like $paymentLines can also be of type object<Loevgaard\Dandomain\Pay\iterable>. However, the property $paymentLines is declared as type array<integer,object<Loe...ntRequest\PaymentLine>>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
1392 3
        return $this;
1393
    }
1394
1395
    /**
1396
     * @param PaymentLine $orderLine
1397
     * @return PaymentRequest
1398
     */
1399 3
    public function addOrderLine(PaymentLine $orderLine) : self
1400
    {
1401 3
        $this->paymentLines[] = $orderLine;
1402 3
        return $this;
1403
    }
1404
}
1405