Completed
Push — master ( be140a...173b04 )
by Joachim
06:35
created

Payment::createPaymentLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 5
1
<?php
2
3
namespace Loevgaard\DandomainAltapayBundle\Entity;
4
5
use Brick\Math\BigDecimal;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\ORM\Mapping as ORM;
8
use Loevgaard\Dandomain\Pay\Model\Payment as BasePayment;
9
use Money\Currency;
10
use Money\Money;
11
use Symfony\Component\Validator\Constraints as Assert;
12
13
/**
14
 * The Payment entity is a special entity since it maps a payment from the Dandomain Payment API
15
 * This is also the reason why it doesn't implement an interface but extends the PaymentRequest
16
 * from the Dandomain Pay PHP SDK.
17
 *
18
 * Also it doesn't relate to any other entities other than PaymentLine since the Dandomain Payment API
19
 * POST request is not complete with all information needed to populate all the related entities, i.e. customers,
20
 * deliveries etc.
21
 *
22
 * @ORM\Table(name="dandomain_altapay_payments")
23
 * @ORM\Entity()
24
 */
25
class Payment extends BasePayment
26
{
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Id
31
     * @ORM\Column(name="id", type="integer")
32
     * @ORM\GeneratedValue(strategy="AUTO")
33
     */
34
    protected $id;
35
36
    /**
37
     * @Assert\NotBlank()
38
     * @Assert\Length(max="191")
39
     *
40
     * @ORM\Column(type="string", length=191)
41
     */
42
    protected $apiKey;
43
44
    /**
45
     * @Assert\NotBlank()
46
     * @Assert\Length(max="191")
47
     *
48
     * @ORM\Column(type="string", length=191)
49
     */
50
    protected $merchant;
51
52
    /**
53
     * @ORM\Column(type="integer")
54
     */
55
    protected $orderId;
56
57
    /**
58
     * @ORM\Column(type="text")
59
     */
60
    protected $sessionId;
61
62
    /**
63
     * @Assert\NotBlank()
64
     * @Assert\Length(max="191")
65
     *
66
     * @ORM\Column(type="string", length=191)
67
     */
68
    protected $currencySymbol;
69
70
    /**
71
     * @Assert\NotBlank()
72
     *
73
     * @ORM\Column(type="integer")
74
     */
75
    protected $totalAmountAmount;
76
77
    /**
78
     * @Assert\NotBlank()
79
     *
80
     * @ORM\Column(type="string")
81
     */
82
    protected $totalAmountCurrency;
83
84
    /**
85
     * @Assert\NotBlank()
86
     * @Assert\Length(max="191")
87
     *
88
     * @ORM\Column(type="string", length=191)
89
     */
90
    protected $callBackUrl;
91
92
    /**
93
     * @Assert\NotBlank()
94
     * @Assert\Length(max="191")
95
     *
96
     * @ORM\Column(type="string", length=191)
97
     */
98
    protected $fullCallBackOkUrl;
99
100
    /**
101
     * @Assert\NotBlank()
102
     * @Assert\Length(max="191")
103
     *
104
     * @ORM\Column(type="string", length=191)
105
     */
106
    protected $callBackOkUrl;
107
108
    /**
109
     * @Assert\NotBlank()
110
     * @Assert\Length(max="191")
111
     *
112
     * @ORM\Column(type="string", length=191)
113
     */
114
    protected $callBackServerUrl;
115
116
    /**
117
     * @Assert\NotBlank()
118
     *
119
     * @ORM\Column(type="integer")
120
     */
121
    protected $languageId;
122
123
    /**
124
     * @Assert\NotBlank()
125
     * @Assert\Length(max="191")
126
     *
127
     * @ORM\Column(type="string", length=191)
128
     */
129
    protected $testMode;
130
131
    /**
132
     * @Assert\NotBlank()
133
     *
134
     * @ORM\Column(type="integer")
135
     */
136
    protected $paymentGatewayCurrencyCode;
137
138
    /**
139
     * @Assert\NotBlank()
140
     *
141
     * @ORM\Column(type="integer")
142
     */
143
    protected $cardTypeId;
144
145
    /**
146
     * @Assert\NotBlank()
147
     * @Assert\Length(max="191")
148
     *
149
     * @ORM\Column(type="string", length=191)
150
     */
151
    protected $customerRekvNr;
152
153
    /**
154
     * @Assert\NotBlank()
155
     * @Assert\Length(max="191")
156
     *
157
     * @ORM\Column(type="string", length=191)
158
     */
159
    protected $customerName;
160
161
    /**
162
     * @ORM\Column(type="string", nullable=true)
163
     */
164
    protected $customerCompany;
165
166
    /**
167
     * @Assert\NotBlank()
168
     * @Assert\Length(max="191")
169
     *
170
     * @ORM\Column(type="string", length=191)
171
     */
172
    protected $customerAddress;
173
174
    /**
175
     * @ORM\Column(type="string", nullable=true)
176
     */
177
    protected $customerAddress2;
178
179
    /**
180
     * @Assert\NotBlank()
181
     * @Assert\Length(max="191")
182
     *
183
     * @ORM\Column(type="string", length=191)
184
     */
185
    protected $customerZipCode;
186
187
    /**
188
     * @Assert\NotBlank()
189
     * @Assert\Length(max="191")
190
     *
191
     * @ORM\Column(type="string", length=191)
192
     */
193
    protected $customerCity;
194
195
    /**
196
     * @Assert\NotBlank()
197
     *
198
     * @ORM\Column(type="integer")
199
     */
200
    protected $customerCountryId;
201
202
    /**
203
     * @Assert\NotBlank()
204
     * @Assert\Length(max="191")
205
     *
206
     * @ORM\Column(type="string", length=191)
207
     */
208
    protected $customerCountry;
209
210
    /**
211
     * @Assert\NotBlank()
212
     * @Assert\Length(max="191")
213
     *
214
     * @ORM\Column(type="string", length=191)
215
     */
216
    protected $customerPhone;
217
218
    /**
219
     * @ORM\Column(type="string", nullable=true)
220
     */
221
    protected $customerFax;
222
223
    /**
224
     * @Assert\NotBlank()
225
     * @Assert\Length(max="191")
226
     *
227
     * @ORM\Column(type="string", length=191)
228
     */
229
    protected $customerEmail;
230
231
    /**
232
     * @ORM\Column(type="text", nullable=true)
233
     */
234
    protected $customerNote;
235
236
    /**
237
     * @ORM\Column(type="string", nullable=true, length=191)
238
     */
239
    protected $customerCvrnr;
240
241
    /**
242
     * @Assert\NotBlank()
243
     *
244
     * @ORM\Column(type="integer")
245
     */
246
    protected $customerCustTypeId;
247
248
    /**
249
     * @ORM\Column(type="string", nullable=true, length=191)
250
     */
251
    protected $customerEan;
252
253
    /**
254
     * @ORM\Column(type="string", nullable=true, length=191)
255
     */
256
    protected $customerRes1;
257
258
    /**
259
     * @ORM\Column(type="string", nullable=true, length=191)
260
     */
261
    protected $customerRes2;
262
263
    /**
264
     * @ORM\Column(type="string", nullable=true, length=191)
265
     */
266
    protected $customerRes3;
267
268
    /**
269
     * @ORM\Column(type="string", nullable=true, length=191)
270
     */
271
    protected $customerRes4;
272
273
    /**
274
     * @ORM\Column(type="string", nullable=true, length=191)
275
     */
276
    protected $customerRes5;
277
278
    /**
279
     * @Assert\NotBlank()
280
     * @Assert\Length(max="191")
281
     *
282
     * @ORM\Column(type="string", length=191)
283
     */
284
    protected $customerIp;
285
286
    /**
287
     * @ORM\Column(type="string", nullable=true, length=191)
288
     */
289
    protected $deliveryName;
290
291
    /**
292
     * @ORM\Column(type="string", nullable=true, length=191)
293
     */
294
    protected $deliveryCompany;
295
296
    /**
297
     * @ORM\Column(type="string", nullable=true, length=191)
298
     */
299
    protected $deliveryAddress;
300
301
    /**
302
     * @ORM\Column(type="string", nullable=true, length=191)
303
     */
304
    protected $deliveryAddress2;
305
306
    /**
307
     * @ORM\Column(type="string", nullable=true, length=191)
308
     */
309
    protected $deliveryZipCode;
310
311
    /**
312
     * @ORM\Column(type="string", nullable=true, length=191)
313
     */
314
    protected $deliveryCity;
315
316
    /**
317
     * @ORM\Column(type="integer", nullable=true)
318
     */
319
    protected $deliveryCountryID;
320
321
    /**
322
     * @ORM\Column(type="string", nullable=true, length=191)
323
     */
324
    protected $deliveryCountry;
325
326
    /**
327
     * @ORM\Column(type="string", nullable=true, length=191)
328
     */
329
    protected $deliveryPhone;
330
331
    /**
332
     * @ORM\Column(type="string", nullable=true, length=191)
333
     */
334
    protected $deliveryFax;
335
336
    /**
337
     * @ORM\Column(type="string", nullable=true, length=191)
338
     */
339
    protected $deliveryEmail;
340
341
    /**
342
     * @ORM\Column(type="string", nullable=true, length=191)
343
     */
344
    protected $deliveryEan;
345
346
    /**
347
     * @Assert\NotBlank()
348
     * @Assert\Length(max="191")
349
     *
350
     * @ORM\Column(type="string", length=191)
351
     */
352
    protected $shippingMethod;
353
354
    /**
355
     * @Assert\NotBlank()
356
     *
357
     * @ORM\Column(type="integer")
358
     */
359
    protected $shippingFeeAmount;
360
361
    /**
362
     * @Assert\NotBlank()
363
     *
364
     * @ORM\Column(type="string")
365
     */
366
    protected $shippingFeeCurrency;
367
368
    /**
369
     * @Assert\NotBlank()
370
     * @Assert\Length(max="191")
371
     *
372
     * @ORM\Column(type="string", length=191)
373
     */
374
    protected $paymentMethod;
375
376
    /**
377
     * @Assert\NotBlank()
378
     *
379
     * @ORM\Column(type="integer")
380
     */
381
    protected $paymentFeeAmount;
382
383
    /**
384
     * @Assert\NotBlank()
385
     *
386
     * @ORM\Column(type="string")
387
     */
388
    protected $paymentFeeCurrency;
389
390
    /**
391
     * @ORM\Column(type="string", nullable=true, length=191)
392
     */
393
    protected $loadBalancerRealIp;
394
395
    /**
396
     * @var string
397
     *
398
     * @ORM\Column(type="string", nullable=true, length=191)
399
     */
400
    protected $referrer;
401
402
    /**
403
     * @ORM\OneToMany(targetEntity="PaymentLine", mappedBy="payment", cascade={"persist", "remove"}, fetch="EAGER")
404
     */
405
    protected $paymentLines;
406
407
    /**********************************
408
     * Properties specific to Altapay *
409
     *********************************/
410
411
    /**
412
     * @var string|null
413
     *
414
     * @ORM\Column(type="string", nullable=true, unique=true, length=191)
415
     */
416
    protected $altapayId;
417
418
    /**
419
     * @var string|null
420
     *
421
     * @ORM\Column(type="string", nullable=true, length=191)
422
     */
423
    protected $cardStatus;
424
425
    /**
426
     * @var string|null
427
     *
428
     * @ORM\Column(type="string", nullable=true, length=191)
429
     */
430
    protected $creditCardToken;
431
432
    /**
433
     * @var string|null
434
     *
435
     * @ORM\Column(type="string", nullable=true, length=191)
436
     */
437
    protected $creditCardMaskedPan;
438
439
    /**
440
     * @var string|null
441
     *
442
     * @ORM\Column(type="string", nullable=true, length=191)
443
     */
444
    protected $threeDSecureResult;
445
446
    /**
447
     * @var string|null
448
     *
449
     * @ORM\Column(type="string", nullable=true, length=191)
450
     */
451
    protected $liableForChargeback;
452
453
    /**
454
     * @var string|null
455
     *
456
     * @ORM\Column(type="string", nullable=true, length=191)
457
     */
458
    protected $blacklistToken;
459
460
    /**
461
     * @var string|null
462
     *
463
     * @ORM\Column(type="string", nullable=true, length=191)
464
     */
465
    protected $shop;
466
467
    /**
468
     * @var string|null
469
     *
470
     * @ORM\Column(type="string", nullable=true, length=191)
471
     */
472
    protected $terminal;
473
474
    /**
475
     * @var string|null
476
     *
477
     * @ORM\Column(type="string", nullable=true, length=191)
478
     */
479
    protected $transactionStatus;
480
481
    /**
482
     * @var string|null
483
     *
484
     * @ORM\Column(type="string", nullable=true, length=191)
485
     */
486
    protected $reasonCode;
487
488
    /**
489
     * @var int|null
490
     *
491
     * @ORM\Column(type="integer", nullable=true)
492
     */
493
    protected $merchantCurrency;
494
495
    /**
496
     * @var string|null
497
     *
498
     * @ORM\Column(type="string", nullable=true, length=191)
499
     */
500
    protected $merchantCurrencyAlpha;
501
502
    /**
503
     * @var int|null
504
     *
505
     * @ORM\Column(type="integer", nullable=true)
506
     */
507
    protected $cardHolderCurrency;
508
509
    /**
510
     * @var string|null
511
     *
512
     * @ORM\Column(type="string", nullable=true, length=191)
513
     */
514
    protected $cardHolderCurrencyAlpha;
515
516
    /**
517
     * @var float|null
518
     *
519
     * @ORM\Column(type="decimal", precision=10, scale=2)
520
     */
521
    protected $reservedAmount;
522
523
    /**
524
     * @var float|null
525
     *
526
     * @ORM\Column(type="decimal", precision=10, scale=2)
527
     */
528
    protected $capturedAmount;
529
530
    /**
531
     * @var float|null
532
     *
533
     * @ORM\Column(type="decimal", precision=10, scale=2)
534
     */
535
    protected $refundedAmount;
536
537
    /**
538
     * @var float|null
539
     *
540
     * @ORM\Column(type="decimal", precision=10, scale=2)
541
     */
542
    protected $recurringDefaultAmount;
543
544
    /**
545
     * @var \DateTime|null
546
     *
547
     * @ORM\Column(type="datetime", nullable=true)
548
     */
549
    protected $createdDate;
550
551
    /**
552
     * @var \DateTime|null
553
     *
554
     * @ORM\Column(type="datetime", nullable=true)
555
     */
556
    protected $updatedDate;
557
558
    /**
559
     * @var string|null
560
     *
561
     * @ORM\Column(type="string", nullable=true, length=191)
562
     */
563
    protected $paymentNature;
564
565
    /**
566
     * @var bool|null
567
     *
568
     * @ORM\Column(type="boolean", nullable=true)
569
     */
570
    protected $supportsRefunds;
571
572
    /**
573
     * @var bool|null
574
     *
575
     * @ORM\Column(type="boolean", nullable=true)
576
     */
577
    protected $supportsRelease;
578
579
    /**
580
     * @var bool|null
581
     *
582
     * @ORM\Column(type="boolean", nullable=true)
583
     */
584
    protected $supportsMultipleCaptures;
585
586
    /**
587
     * @var bool|null
588
     *
589
     * @ORM\Column(type="boolean", nullable=true)
590
     */
591
    protected $supportsMultipleRefunds;
592
593
    /**
594
     * @var float|null
595
     *
596
     * @ORM\Column(type="float", nullable=true)
597
     */
598
    protected $fraudRiskScore;
599
600
    /**
601
     * @var string|null
602
     *
603
     * @ORM\Column(type="string", nullable=true, length=191)
604
     */
605
    protected $fraudExplanation;
606
607
    public function __construct()
608
    {
609
        parent::__construct();
610
611
        $this->paymentLines = new ArrayCollection();
612
        $this->reservedAmount = 0;
0 ignored issues
show
Documentation Bug introduced by
It seems like 0 of type integer is incompatible with the declared type double|null of property $reservedAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
613
        $this->capturedAmount = 0;
0 ignored issues
show
Documentation Bug introduced by
It seems like 0 of type integer is incompatible with the declared type double|null of property $capturedAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
614
        $this->refundedAmount = 0;
0 ignored issues
show
Documentation Bug introduced by
It seems like 0 of type integer is incompatible with the declared type double|null of property $refundedAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
615
        $this->recurringDefaultAmount = 0;
0 ignored issues
show
Documentation Bug introduced by
It seems like 0 of type integer is incompatible with the declared type double|null of property $recurringDefaultAmount.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
616
    }
617
618
    public static function createPaymentLine(string $productNumber, string $name, int $quantity, Money $price, int $vat)
619
    {
620
        return new PaymentLine($productNumber, $name, $quantity, $price, $vat);
621
    }
622
623
    /**
624
     * Returns true if the payment can be captured.
625
     *
626
     * @return bool
627
     */
628
    public function isCaptureable(): bool
629
    {
630
        if ($this->capturableAmount() <= 0) {
631
            return false;
632
        }
633
634
        if ($this->capturedAmount > 0 && !$this->supportsMultipleCaptures) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->supportsMultipleCaptures of type boolean|null is loosely compared to false; this is ambiguous if the boolean can be false. You might want to explicitly use !== null instead.

If an expression can have both false, and null as possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.

$a = canBeFalseAndNull();

// Instead of
if ( ! $a) { }

// Better use one of the explicit versions:
if ($a !== null) { }
if ($a !== false) { }
if ($a !== null && $a !== false) { }
Loading history...
635
            return false;
636
        }
637
638
        return true;
639
    }
640
641
    /**
642
     * Returns true if the payment can be refunded.
643
     *
644
     * @return bool
645
     */
646
    public function isRefundable(): bool
647
    {
648
        if ($this->refundableAmount() <= 0) {
649
            return false;
650
        }
651
652
        if ($this->refundedAmount > 0 && !$this->supportsMultipleRefunds) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->supportsMultipleRefunds of type boolean|null is loosely compared to false; this is ambiguous if the boolean can be false. You might want to explicitly use !== null instead.

If an expression can have both false, and null as possible values. It is generally a good practice to always use strict comparison to clearly distinguish between those two values.

$a = canBeFalseAndNull();

// Instead of
if ( ! $a) { }

// Better use one of the explicit versions:
if ($a !== null) { }
if ($a !== false) { }
if ($a !== null && $a !== false) { }
Loading history...
653
            return false;
654
        }
655
656
        return true;
657
    }
658
659
    /**
660
     * @return float
661
     */
662
    public function refundableAmount()
663
    {
664
        $capturedAmount = BigDecimal::of($this->capturedAmount);
665
666
        return $capturedAmount->minus($this->refundedAmount)->toFloat();
667
    }
668
669
    /**
670
     * @return float
671
     */
672
    public function capturableAmount()
673
    {
674
        $reservedAmount = BigDecimal::of($this->reservedAmount);
675
        $realCapturedAmount = BigDecimal::of($this->capturedAmount)->minus($this->refundedAmount);
676
677
        return $reservedAmount->minus($realCapturedAmount)->toFloat();
678
    }
679
680
    // @todo create type hints for getters and setters
681
682
    public function setTotalAmount(Money $totalAmount): BasePayment
683
    {
684
        parent::setTotalAmount($totalAmount);
685
686
        $this->totalAmountAmount = $totalAmount->getAmount();
687
        $this->totalAmountCurrency = $totalAmount->getCurrency()->getCode();
688
689
        return $this;
690
    }
691
692
    public function getTotalAmount(): ?Money
693
    {
694
        if (!$this->totalAmountCurrency) {
695
            return null;
696
        }
697
698
        $amount = $this->totalAmountAmount;
699
        if (!$amount) {
700
            $amount = 0;
701
        }
702
703
        return new Money($amount, new Currency($this->totalAmountCurrency));
704
    }
705
706
    public function setShippingFee(Money $shippingFee): BasePayment
707
    {
708
        parent::setShippingFee($shippingFee);
709
710
        $this->shippingFeeAmount = $shippingFee->getAmount();
711
        $this->shippingFeeCurrency = $shippingFee->getCurrency()->getCode();
712
713
        return $this;
714
    }
715
716
    public function getShippingFee(): ?Money
717
    {
718
        if (!$this->shippingFeeCurrency) {
719
            return null;
720
        }
721
722
        $amount = $this->shippingFeeAmount;
723
        if (!$amount) {
724
            $amount = 0;
725
        }
726
727
        return new Money($amount, new Currency($this->shippingFeeCurrency));
728
    }
729
730
    public function setPaymentFee(Money $paymentFee): BasePayment
731
    {
732
        parent::setPaymentFee($paymentFee);
733
734
        $this->paymentFeeAmount = $paymentFee->getAmount();
735
        $this->paymentFeeCurrency = $paymentFee->getCurrency()->getCode();
736
737
        return $this;
738
    }
739
740
    public function getPaymentFee(): ?Money
741
    {
742
        if (!$this->paymentFeeCurrency) {
743
            return null;
744
        }
745
746
        $amount = $this->paymentFeeAmount;
747
        if (!$amount) {
748
            $amount = 0;
749
        }
750
751
        return new Money($amount, new Currency($this->paymentFeeCurrency));
752
    }
753
754
    /**
755
     * @return int
756
     */
757
    public function getId(): ?int
758
    {
759
        return $this->id;
760
    }
761
762
    /**
763
     * @param int $id
764
     *
765
     * @return Payment
766
     */
767
    public function setId(int $id): self
768
    {
769
        $this->id = $id;
770
771
        return $this;
772
    }
773
774
    /**
775
     * @return null|string
776
     */
777
    public function getAltapayId()
778
    {
779
        return $this->altapayId;
780
    }
781
782
    /**
783
     * @param null|string $altapayId
784
     *
785
     * @return Payment
786
     */
787
    public function setAltapayId($altapayId)
788
    {
789
        $this->altapayId = $altapayId;
790
791
        return $this;
792
    }
793
794
    /**
795
     * @return null|string
796
     */
797
    public function getCardStatus()
798
    {
799
        return $this->cardStatus;
800
    }
801
802
    /**
803
     * @param null|string $cardStatus
804
     *
805
     * @return Payment
806
     */
807
    public function setCardStatus($cardStatus)
808
    {
809
        $this->cardStatus = $cardStatus;
810
811
        return $this;
812
    }
813
814
    /**
815
     * @return null|string
816
     */
817
    public function getCreditCardToken()
818
    {
819
        return $this->creditCardToken;
820
    }
821
822
    /**
823
     * @param null|string $creditCardToken
824
     *
825
     * @return Payment
826
     */
827
    public function setCreditCardToken($creditCardToken)
828
    {
829
        $this->creditCardToken = $creditCardToken;
830
831
        return $this;
832
    }
833
834
    /**
835
     * @return null|string
836
     */
837
    public function getCreditCardMaskedPan()
838
    {
839
        return $this->creditCardMaskedPan;
840
    }
841
842
    /**
843
     * @param null|string $creditCardMaskedPan
844
     *
845
     * @return Payment
846
     */
847
    public function setCreditCardMaskedPan($creditCardMaskedPan)
848
    {
849
        $this->creditCardMaskedPan = $creditCardMaskedPan;
850
851
        return $this;
852
    }
853
854
    /**
855
     * @return null|string
856
     */
857
    public function getThreeDSecureResult()
858
    {
859
        return $this->threeDSecureResult;
860
    }
861
862
    /**
863
     * @param null|string $threeDSecureResult
864
     *
865
     * @return Payment
866
     */
867
    public function setThreeDSecureResult($threeDSecureResult)
868
    {
869
        $this->threeDSecureResult = $threeDSecureResult;
870
871
        return $this;
872
    }
873
874
    /**
875
     * @return null|string
876
     */
877
    public function getLiableForChargeback()
878
    {
879
        return $this->liableForChargeback;
880
    }
881
882
    /**
883
     * @param null|string $liableForChargeback
884
     *
885
     * @return Payment
886
     */
887
    public function setLiableForChargeback($liableForChargeback)
888
    {
889
        $this->liableForChargeback = $liableForChargeback;
890
891
        return $this;
892
    }
893
894
    /**
895
     * @return null|string
896
     */
897
    public function getBlacklistToken()
898
    {
899
        return $this->blacklistToken;
900
    }
901
902
    /**
903
     * @param null|string $blacklistToken
904
     *
905
     * @return Payment
906
     */
907
    public function setBlacklistToken($blacklistToken)
908
    {
909
        $this->blacklistToken = $blacklistToken;
910
911
        return $this;
912
    }
913
914
    /**
915
     * @return null|string
916
     */
917
    public function getShop()
918
    {
919
        return $this->shop;
920
    }
921
922
    /**
923
     * @param null|string $shop
924
     *
925
     * @return Payment
926
     */
927
    public function setShop($shop)
928
    {
929
        $this->shop = $shop;
930
931
        return $this;
932
    }
933
934
    /**
935
     * @return null|string
936
     */
937
    public function getTerminal()
938
    {
939
        return $this->terminal;
940
    }
941
942
    /**
943
     * @param null|string $terminal
944
     *
945
     * @return Payment
946
     */
947
    public function setTerminal($terminal)
948
    {
949
        $this->terminal = $terminal;
950
951
        return $this;
952
    }
953
954
    /**
955
     * @return null|string
956
     */
957
    public function getTransactionStatus()
958
    {
959
        return $this->transactionStatus;
960
    }
961
962
    /**
963
     * @param null|string $transactionStatus
964
     *
965
     * @return Payment
966
     */
967
    public function setTransactionStatus($transactionStatus)
968
    {
969
        $this->transactionStatus = $transactionStatus;
970
971
        return $this;
972
    }
973
974
    /**
975
     * @return null|string
976
     */
977
    public function getReasonCode()
978
    {
979
        return $this->reasonCode;
980
    }
981
982
    /**
983
     * @param null|string $reasonCode
984
     *
985
     * @return Payment
986
     */
987
    public function setReasonCode($reasonCode)
988
    {
989
        $this->reasonCode = $reasonCode;
990
991
        return $this;
992
    }
993
994
    /**
995
     * @return int|null
996
     */
997
    public function getMerchantCurrency()
998
    {
999
        return $this->merchantCurrency;
1000
    }
1001
1002
    /**
1003
     * @param int|null $merchantCurrency
1004
     *
1005
     * @return Payment
1006
     */
1007
    public function setMerchantCurrency($merchantCurrency)
1008
    {
1009
        $this->merchantCurrency = $merchantCurrency;
1010
1011
        return $this;
1012
    }
1013
1014
    /**
1015
     * @return null|string
1016
     */
1017
    public function getMerchantCurrencyAlpha()
1018
    {
1019
        return $this->merchantCurrencyAlpha;
1020
    }
1021
1022
    /**
1023
     * @param null|string $merchantCurrencyAlpha
1024
     *
1025
     * @return Payment
1026
     */
1027
    public function setMerchantCurrencyAlpha($merchantCurrencyAlpha)
1028
    {
1029
        $this->merchantCurrencyAlpha = $merchantCurrencyAlpha;
1030
1031
        return $this;
1032
    }
1033
1034
    /**
1035
     * @return int|null
1036
     */
1037
    public function getCardHolderCurrency()
1038
    {
1039
        return $this->cardHolderCurrency;
1040
    }
1041
1042
    /**
1043
     * @param int|null $cardHolderCurrency
1044
     *
1045
     * @return Payment
1046
     */
1047
    public function setCardHolderCurrency($cardHolderCurrency)
1048
    {
1049
        $this->cardHolderCurrency = $cardHolderCurrency;
1050
1051
        return $this;
1052
    }
1053
1054
    /**
1055
     * @return null|string
1056
     */
1057
    public function getCardHolderCurrencyAlpha()
1058
    {
1059
        return $this->cardHolderCurrencyAlpha;
1060
    }
1061
1062
    /**
1063
     * @param null|string $cardHolderCurrencyAlpha
1064
     *
1065
     * @return Payment
1066
     */
1067
    public function setCardHolderCurrencyAlpha($cardHolderCurrencyAlpha)
1068
    {
1069
        $this->cardHolderCurrencyAlpha = $cardHolderCurrencyAlpha;
1070
1071
        return $this;
1072
    }
1073
1074
    /**
1075
     * @return float|null
1076
     */
1077
    public function getReservedAmount()
1078
    {
1079
        return $this->reservedAmount;
1080
    }
1081
1082
    /**
1083
     * @param float|null $reservedAmount
1084
     *
1085
     * @return Payment
1086
     */
1087
    public function setReservedAmount($reservedAmount)
1088
    {
1089
        $this->reservedAmount = $reservedAmount;
1090
1091
        return $this;
1092
    }
1093
1094
    /**
1095
     * @return float|null
1096
     */
1097
    public function getCapturedAmount()
1098
    {
1099
        return $this->capturedAmount;
1100
    }
1101
1102
    /**
1103
     * @param float|null $capturedAmount
1104
     *
1105
     * @return Payment
1106
     */
1107
    public function setCapturedAmount($capturedAmount)
1108
    {
1109
        $this->capturedAmount = $capturedAmount;
1110
1111
        return $this;
1112
    }
1113
1114
    /**
1115
     * @return float|null
1116
     */
1117
    public function getRefundedAmount()
1118
    {
1119
        return $this->refundedAmount;
1120
    }
1121
1122
    /**
1123
     * @param float|null $refundedAmount
1124
     *
1125
     * @return Payment
1126
     */
1127
    public function setRefundedAmount($refundedAmount)
1128
    {
1129
        $this->refundedAmount = $refundedAmount;
1130
1131
        return $this;
1132
    }
1133
1134
    /**
1135
     * @return float|null
1136
     */
1137
    public function getRecurringDefaultAmount()
1138
    {
1139
        return $this->recurringDefaultAmount;
1140
    }
1141
1142
    /**
1143
     * @param float|null $recurringDefaultAmount
1144
     *
1145
     * @return Payment
1146
     */
1147
    public function setRecurringDefaultAmount($recurringDefaultAmount)
1148
    {
1149
        $this->recurringDefaultAmount = $recurringDefaultAmount;
1150
1151
        return $this;
1152
    }
1153
1154
    /**
1155
     * @return \DateTime|null
1156
     */
1157
    public function getCreatedDate()
1158
    {
1159
        return $this->createdDate;
1160
    }
1161
1162
    /**
1163
     * @param \DateTimeInterface|null $createdDate
1164
     *
1165
     * @return Payment
1166
     */
1167
    public function setCreatedDate($createdDate)
1168
    {
1169
        $this->createdDate = $createdDate;
0 ignored issues
show
Documentation Bug introduced by
It seems like $createdDate can also be of type object<DateTimeInterface>. However, the property $createdDate is declared as type object<DateTime>|null. 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...
1170
1171
        return $this;
1172
    }
1173
1174
    /**
1175
     * @return \DateTime|null
1176
     */
1177
    public function getUpdatedDate()
1178
    {
1179
        return $this->updatedDate;
1180
    }
1181
1182
    /**
1183
     * @param \DateTimeInterface|null $updatedDate
1184
     *
1185
     * @return Payment
1186
     */
1187
    public function setUpdatedDate($updatedDate)
1188
    {
1189
        $this->updatedDate = $updatedDate;
0 ignored issues
show
Documentation Bug introduced by
It seems like $updatedDate can also be of type object<DateTimeInterface>. However, the property $updatedDate is declared as type object<DateTime>|null. 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...
1190
1191
        return $this;
1192
    }
1193
1194
    /**
1195
     * @return null|string
1196
     */
1197
    public function getPaymentNature()
1198
    {
1199
        return $this->paymentNature;
1200
    }
1201
1202
    /**
1203
     * @param null|string $paymentNature
1204
     *
1205
     * @return Payment
1206
     */
1207
    public function setPaymentNature($paymentNature)
1208
    {
1209
        $this->paymentNature = $paymentNature;
1210
1211
        return $this;
1212
    }
1213
1214
    /**
1215
     * @return bool|null
1216
     */
1217
    public function getSupportsRefunds()
1218
    {
1219
        return $this->supportsRefunds;
1220
    }
1221
1222
    /**
1223
     * @param bool|null $supportsRefunds
1224
     *
1225
     * @return Payment
1226
     */
1227
    public function setSupportsRefunds($supportsRefunds)
1228
    {
1229
        $this->supportsRefunds = $supportsRefunds;
1230
1231
        return $this;
1232
    }
1233
1234
    /**
1235
     * @return bool|null
1236
     */
1237
    public function getSupportsRelease()
1238
    {
1239
        return $this->supportsRelease;
1240
    }
1241
1242
    /**
1243
     * @param bool|null $supportsRelease
1244
     *
1245
     * @return Payment
1246
     */
1247
    public function setSupportsRelease($supportsRelease)
1248
    {
1249
        $this->supportsRelease = $supportsRelease;
1250
1251
        return $this;
1252
    }
1253
1254
    /**
1255
     * @return bool|null
1256
     */
1257
    public function getSupportsMultipleCaptures()
1258
    {
1259
        return $this->supportsMultipleCaptures;
1260
    }
1261
1262
    /**
1263
     * @param bool|null $supportsMultipleCaptures
1264
     *
1265
     * @return Payment
1266
     */
1267
    public function setSupportsMultipleCaptures($supportsMultipleCaptures)
1268
    {
1269
        $this->supportsMultipleCaptures = $supportsMultipleCaptures;
1270
1271
        return $this;
1272
    }
1273
1274
    /**
1275
     * @return bool|null
1276
     */
1277
    public function getSupportsMultipleRefunds()
1278
    {
1279
        return $this->supportsMultipleRefunds;
1280
    }
1281
1282
    /**
1283
     * @param bool|null $supportsMultipleRefunds
1284
     *
1285
     * @return Payment
1286
     */
1287
    public function setSupportsMultipleRefunds($supportsMultipleRefunds)
1288
    {
1289
        $this->supportsMultipleRefunds = $supportsMultipleRefunds;
1290
1291
        return $this;
1292
    }
1293
1294
    /**
1295
     * @return float|null
1296
     */
1297
    public function getFraudRiskScore()
1298
    {
1299
        return $this->fraudRiskScore;
1300
    }
1301
1302
    /**
1303
     * @param float|null $fraudRiskScore
1304
     *
1305
     * @return Payment
1306
     */
1307
    public function setFraudRiskScore($fraudRiskScore)
1308
    {
1309
        $this->fraudRiskScore = $fraudRiskScore;
1310
1311
        return $this;
1312
    }
1313
1314
    /**
1315
     * @return null|string
1316
     */
1317
    public function getFraudExplanation()
1318
    {
1319
        return $this->fraudExplanation;
1320
    }
1321
1322
    /**
1323
     * @param null|string $fraudExplanation
1324
     *
1325
     * @return Payment
1326
     */
1327
    public function setFraudExplanation($fraudExplanation)
1328
    {
1329
        $this->fraudExplanation = $fraudExplanation;
1330
1331
        return $this;
1332
    }
1333
}
1334