Completed
Push — master ( 1888b0...c02007 )
by Joachim
02:45
created

PaymentRequest::getSessionId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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