Completed
Push — master ( 6a68ad...603d58 )
by Joachim
04:11
created

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