Completed
Push — master ( 70fbd1...217a07 )
by Joachim
03:18
created

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