Completed
Push — master ( 23b9fd...982873 )
by Joachim
11:42 queued 10:14
created

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