Completed
Push — master ( 10cfb1...be140a )
by Joachim
02:56
created

Payment::createFromDandomainPayment()   C

Complexity

Conditions 7
Paths 16

Size

Total Lines 35
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 35
rs 6.7272
cc 7
eloc 21
nc 16
nop 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Payment::isRefundable() 0 12 4
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 Loevgaard\Dandomain\Pay\Model\Payment as DandomainPayment;
10
use Money\Currency;
11
use Money\Money;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
/**
15
 * The Payment entity is a special entity since it maps a payment from the Dandomain Payment API
16
 * This is also the reason why it doesn't implement an interface but extends the PaymentRequest
17
 * from the Dandomain Pay PHP SDK.
18
 *
19
 * Also it doesn't relate to any other entities other than PaymentLine since the Dandomain Payment API
20
 * POST request is not complete with all information needed to populate all the related entities, i.e. customers,
21
 * deliveries etc.
22
 *
23
 * @ORM\Table(name="dandomain_altapay_payments")
24
 * @ORM\Entity()
25
 */
26
class Payment extends BasePayment
27
{
28
    /**
29
     * @var int
30
     *
31
     * @ORM\Id
32
     * @ORM\Column(name="id", type="integer")
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     */
35
    protected $id;
36
37
    /**
38
     * @Assert\NotBlank()
39
     * @Assert\Length(max="191")
40
     *
41
     * @ORM\Column(type="string", length=191)
42
     */
43
    protected $apiKey;
44
45
    /**
46
     * @Assert\NotBlank()
47
     * @Assert\Length(max="191")
48
     *
49
     * @ORM\Column(type="string", length=191)
50
     */
51
    protected $merchant;
52
53
    /**
54
     * @ORM\Column(type="integer")
55
     */
56
    protected $orderId;
57
58
    /**
59
     * @ORM\Column(type="text")
60
     */
61
    protected $sessionId;
62
63
    /**
64
     * @Assert\NotBlank()
65
     * @Assert\Length(max="191")
66
     *
67
     * @ORM\Column(type="string", length=191)
68
     */
69
    protected $currencySymbol;
70
71
    /**
72
     * @Assert\NotBlank()
73
     *
74
     * @ORM\Column(type="integer")
75
     */
76
    protected $totalAmountAmount;
77
78
    /**
79
     * @Assert\NotBlank()
80
     *
81
     * @ORM\Column(type="string")
82
     */
83
    protected $totalAmountCurrency;
84
85
    /**
86
     * @Assert\NotBlank()
87
     * @Assert\Length(max="191")
88
     *
89
     * @ORM\Column(type="string", length=191)
90
     */
91
    protected $callBackUrl;
92
93
    /**
94
     * @Assert\NotBlank()
95
     * @Assert\Length(max="191")
96
     *
97
     * @ORM\Column(type="string", length=191)
98
     */
99
    protected $fullCallBackOkUrl;
100
101
    /**
102
     * @Assert\NotBlank()
103
     * @Assert\Length(max="191")
104
     *
105
     * @ORM\Column(type="string", length=191)
106
     */
107
    protected $callBackOkUrl;
108
109
    /**
110
     * @Assert\NotBlank()
111
     * @Assert\Length(max="191")
112
     *
113
     * @ORM\Column(type="string", length=191)
114
     */
115
    protected $callBackServerUrl;
116
117
    /**
118
     * @Assert\NotBlank()
119
     *
120
     * @ORM\Column(type="integer")
121
     */
122
    protected $languageId;
123
124
    /**
125
     * @Assert\NotBlank()
126
     * @Assert\Length(max="191")
127
     *
128
     * @ORM\Column(type="string", length=191)
129
     */
130
    protected $testMode;
131
132
    /**
133
     * @Assert\NotBlank()
134
     *
135
     * @ORM\Column(type="integer")
136
     */
137
    protected $paymentGatewayCurrencyCode;
138
139
    /**
140
     * @Assert\NotBlank()
141
     *
142
     * @ORM\Column(type="integer")
143
     */
144
    protected $cardTypeId;
145
146
    /**
147
     * @Assert\NotBlank()
148
     * @Assert\Length(max="191")
149
     *
150
     * @ORM\Column(type="string", length=191)
151
     */
152
    protected $customerRekvNr;
153
154
    /**
155
     * @Assert\NotBlank()
156
     * @Assert\Length(max="191")
157
     *
158
     * @ORM\Column(type="string", length=191)
159
     */
160
    protected $customerName;
161
162
    /**
163
     * @ORM\Column(type="string", nullable=true)
164
     */
165
    protected $customerCompany;
166
167
    /**
168
     * @Assert\NotBlank()
169
     * @Assert\Length(max="191")
170
     *
171
     * @ORM\Column(type="string", length=191)
172
     */
173
    protected $customerAddress;
174
175
    /**
176
     * @ORM\Column(type="string", nullable=true)
177
     */
178
    protected $customerAddress2;
179
180
    /**
181
     * @Assert\NotBlank()
182
     * @Assert\Length(max="191")
183
     *
184
     * @ORM\Column(type="string", length=191)
185
     */
186
    protected $customerZipCode;
187
188
    /**
189
     * @Assert\NotBlank()
190
     * @Assert\Length(max="191")
191
     *
192
     * @ORM\Column(type="string", length=191)
193
     */
194
    protected $customerCity;
195
196
    /**
197
     * @Assert\NotBlank()
198
     *
199
     * @ORM\Column(type="integer")
200
     */
201
    protected $customerCountryId;
202
203
    /**
204
     * @Assert\NotBlank()
205
     * @Assert\Length(max="191")
206
     *
207
     * @ORM\Column(type="string", length=191)
208
     */
209
    protected $customerCountry;
210
211
    /**
212
     * @Assert\NotBlank()
213
     * @Assert\Length(max="191")
214
     *
215
     * @ORM\Column(type="string", length=191)
216
     */
217
    protected $customerPhone;
218
219
    /**
220
     * @ORM\Column(type="string", nullable=true)
221
     */
222
    protected $customerFax;
223
224
    /**
225
     * @Assert\NotBlank()
226
     * @Assert\Length(max="191")
227
     *
228
     * @ORM\Column(type="string", length=191)
229
     */
230
    protected $customerEmail;
231
232
    /**
233
     * @ORM\Column(type="text", nullable=true)
234
     */
235
    protected $customerNote;
236
237
    /**
238
     * @ORM\Column(type="string", nullable=true, length=191)
239
     */
240
    protected $customerCvrnr;
241
242
    /**
243
     * @Assert\NotBlank()
244
     *
245
     * @ORM\Column(type="integer")
246
     */
247
    protected $customerCustTypeId;
248
249
    /**
250
     * @ORM\Column(type="string", nullable=true, length=191)
251
     */
252
    protected $customerEan;
253
254
    /**
255
     * @ORM\Column(type="string", nullable=true, length=191)
256
     */
257
    protected $customerRes1;
258
259
    /**
260
     * @ORM\Column(type="string", nullable=true, length=191)
261
     */
262
    protected $customerRes2;
263
264
    /**
265
     * @ORM\Column(type="string", nullable=true, length=191)
266
     */
267
    protected $customerRes3;
268
269
    /**
270
     * @ORM\Column(type="string", nullable=true, length=191)
271
     */
272
    protected $customerRes4;
273
274
    /**
275
     * @ORM\Column(type="string", nullable=true, length=191)
276
     */
277
    protected $customerRes5;
278
279
    /**
280
     * @Assert\NotBlank()
281
     * @Assert\Length(max="191")
282
     *
283
     * @ORM\Column(type="string", length=191)
284
     */
285
    protected $customerIp;
286
287
    /**
288
     * @ORM\Column(type="string", nullable=true, length=191)
289
     */
290
    protected $deliveryName;
291
292
    /**
293
     * @ORM\Column(type="string", nullable=true, length=191)
294
     */
295
    protected $deliveryCompany;
296
297
    /**
298
     * @ORM\Column(type="string", nullable=true, length=191)
299
     */
300
    protected $deliveryAddress;
301
302
    /**
303
     * @ORM\Column(type="string", nullable=true, length=191)
304
     */
305
    protected $deliveryAddress2;
306
307
    /**
308
     * @ORM\Column(type="string", nullable=true, length=191)
309
     */
310
    protected $deliveryZipCode;
311
312
    /**
313
     * @ORM\Column(type="string", nullable=true, length=191)
314
     */
315
    protected $deliveryCity;
316
317
    /**
318
     * @ORM\Column(type="integer", nullable=true)
319
     */
320
    protected $deliveryCountryID;
321
322
    /**
323
     * @ORM\Column(type="string", nullable=true, length=191)
324
     */
325
    protected $deliveryCountry;
326
327
    /**
328
     * @ORM\Column(type="string", nullable=true, length=191)
329
     */
330
    protected $deliveryPhone;
331
332
    /**
333
     * @ORM\Column(type="string", nullable=true, length=191)
334
     */
335
    protected $deliveryFax;
336
337
    /**
338
     * @ORM\Column(type="string", nullable=true, length=191)
339
     */
340
    protected $deliveryEmail;
341
342
    /**
343
     * @ORM\Column(type="string", nullable=true, length=191)
344
     */
345
    protected $deliveryEan;
346
347
    /**
348
     * @Assert\NotBlank()
349
     * @Assert\Length(max="191")
350
     *
351
     * @ORM\Column(type="string", length=191)
352
     */
353
    protected $shippingMethod;
354
355
    /**
356
     * @Assert\NotBlank()
357
     *
358
     * @ORM\Column(type="integer")
359
     */
360
    protected $shippingFeeAmount;
361
362
    /**
363
     * @Assert\NotBlank()
364
     *
365
     * @ORM\Column(type="string")
366
     */
367
    protected $shippingFeeCurrency;
368
369
    /**
370
     * @Assert\NotBlank()
371
     * @Assert\Length(max="191")
372
     *
373
     * @ORM\Column(type="string", length=191)
374
     */
375
    protected $paymentMethod;
376
377
    /**
378
     * @Assert\NotBlank()
379
     *
380
     * @ORM\Column(type="integer")
381
     */
382
    protected $paymentFeeAmount;
383
384
    /**
385
     * @Assert\NotBlank()
386
     *
387
     * @ORM\Column(type="string")
388
     */
389
    protected $paymentFeeCurrency;
390
391
    /**
392
     * @ORM\Column(type="string", nullable=true, length=191)
393
     */
394
    protected $loadBalancerRealIp;
395
396
    /**
397
     * @var string
398
     *
399
     * @ORM\Column(type="string", nullable=true, length=191)
400
     */
401
    protected $referrer;
402
403
    /**
404
     * @ORM\OneToMany(targetEntity="PaymentLine", mappedBy="payment", cascade={"persist", "remove"}, fetch="EAGER")
405
     */
406
    protected $paymentLines;
407
408
    /**********************************
409
     * Properties specific to Altapay *
410
     *********************************/
411
412
    /**
413
     * @var string|null
414
     *
415
     * @ORM\Column(type="string", nullable=true, unique=true, length=191)
416
     */
417
    protected $altapayId;
418
419
    /**
420
     * @var string|null
421
     *
422
     * @ORM\Column(type="string", nullable=true, length=191)
423
     */
424
    protected $cardStatus;
425
426
    /**
427
     * @var string|null
428
     *
429
     * @ORM\Column(type="string", nullable=true, length=191)
430
     */
431
    protected $creditCardToken;
432
433
    /**
434
     * @var string|null
435
     *
436
     * @ORM\Column(type="string", nullable=true, length=191)
437
     */
438
    protected $creditCardMaskedPan;
439
440
    /**
441
     * @var string|null
442
     *
443
     * @ORM\Column(type="string", nullable=true, length=191)
444
     */
445
    protected $threeDSecureResult;
446
447
    /**
448
     * @var string|null
449
     *
450
     * @ORM\Column(type="string", nullable=true, length=191)
451
     */
452
    protected $liableForChargeback;
453
454
    /**
455
     * @var string|null
456
     *
457
     * @ORM\Column(type="string", nullable=true, length=191)
458
     */
459
    protected $blacklistToken;
460
461
    /**
462
     * @var string|null
463
     *
464
     * @ORM\Column(type="string", nullable=true, length=191)
465
     */
466
    protected $shop;
467
468
    /**
469
     * @var string|null
470
     *
471
     * @ORM\Column(type="string", nullable=true, length=191)
472
     */
473
    protected $terminal;
474
475
    /**
476
     * @var string|null
477
     *
478
     * @ORM\Column(type="string", nullable=true, length=191)
479
     */
480
    protected $transactionStatus;
481
482
    /**
483
     * @var string|null
484
     *
485
     * @ORM\Column(type="string", nullable=true, length=191)
486
     */
487
    protected $reasonCode;
488
489
    /**
490
     * @var int|null
491
     *
492
     * @ORM\Column(type="integer", nullable=true)
493
     */
494
    protected $merchantCurrency;
495
496
    /**
497
     * @var string|null
498
     *
499
     * @ORM\Column(type="string", nullable=true, length=191)
500
     */
501
    protected $merchantCurrencyAlpha;
502
503
    /**
504
     * @var int|null
505
     *
506
     * @ORM\Column(type="integer", nullable=true)
507
     */
508
    protected $cardHolderCurrency;
509
510
    /**
511
     * @var string|null
512
     *
513
     * @ORM\Column(type="string", nullable=true, length=191)
514
     */
515
    protected $cardHolderCurrencyAlpha;
516
517
    /**
518
     * @var float|null
519
     *
520
     * @ORM\Column(type="decimal", precision=10, scale=2)
521
     */
522
    protected $reservedAmount;
523
524
    /**
525
     * @var float|null
526
     *
527
     * @ORM\Column(type="decimal", precision=10, scale=2)
528
     */
529
    protected $capturedAmount;
530
531
    /**
532
     * @var float|null
533
     *
534
     * @ORM\Column(type="decimal", precision=10, scale=2)
535
     */
536
    protected $refundedAmount;
537
538
    /**
539
     * @var float|null
540
     *
541
     * @ORM\Column(type="decimal", precision=10, scale=2)
542
     */
543
    protected $recurringDefaultAmount;
544
545
    /**
546
     * @var \DateTime|null
547
     *
548
     * @ORM\Column(type="datetime", nullable=true)
549
     */
550
    protected $createdDate;
551
552
    /**
553
     * @var \DateTime|null
554
     *
555
     * @ORM\Column(type="datetime", nullable=true)
556
     */
557
    protected $updatedDate;
558
559
    /**
560
     * @var string|null
561
     *
562
     * @ORM\Column(type="string", nullable=true, length=191)
563
     */
564
    protected $paymentNature;
565
566
    /**
567
     * @var bool|null
568
     *
569
     * @ORM\Column(type="boolean", nullable=true)
570
     */
571
    protected $supportsRefunds;
572
573
    /**
574
     * @var bool|null
575
     *
576
     * @ORM\Column(type="boolean", nullable=true)
577
     */
578
    protected $supportsRelease;
579
580
    /**
581
     * @var bool|null
582
     *
583
     * @ORM\Column(type="boolean", nullable=true)
584
     */
585
    protected $supportsMultipleCaptures;
586
587
    /**
588
     * @var bool|null
589
     *
590
     * @ORM\Column(type="boolean", nullable=true)
591
     */
592
    protected $supportsMultipleRefunds;
593
594
    /**
595
     * @var float|null
596
     *
597
     * @ORM\Column(type="float", nullable=true)
598
     */
599
    protected $fraudRiskScore;
600
601
    /**
602
     * @var string|null
603
     *
604
     * @ORM\Column(type="string", nullable=true, length=191)
605
     */
606
    protected $fraudExplanation;
607
608
    public function __construct()
609
    {
610
        parent::__construct();
611
612
        $this->paymentLines = new ArrayCollection();
613
        $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...
614
        $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...
615
        $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...
616
        $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...
617
    }
618
619
    /**
620
     * Returns true if the payment can be captured.
621
     *
622
     * @return bool
623
     */
624
    public function isCaptureable(): bool
625
    {
626
        if ($this->capturableAmount() <= 0) {
627
            return false;
628
        }
629
630
        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...
631
            return false;
632
        }
633
634
        return true;
635
    }
636
637
    /**
638
     * Returns true if the payment can be refunded.
639
     *
640
     * @return bool
641
     */
642
    public function isRefundable(): bool
643
    {
644
        if ($this->refundableAmount() <= 0) {
645
            return false;
646
        }
647
648
        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...
649
            return false;
650
        }
651
652
        return true;
653
    }
654
655
    /**
656
     * @return float
657
     */
658
    public function refundableAmount()
659
    {
660
        $capturedAmount = BigDecimal::of($this->capturedAmount);
661
662
        return $capturedAmount->minus($this->refundedAmount)->toFloat();
663
    }
664
665
    /**
666
     * @return float
667
     */
668
    public function capturableAmount()
669
    {
670
        $reservedAmount = BigDecimal::of($this->reservedAmount);
671
        $realCapturedAmount = BigDecimal::of($this->capturedAmount)->minus($this->refundedAmount);
672
673
        return $reservedAmount->minus($realCapturedAmount)->toFloat();
674
    }
675
676
    // @todo create type hints for getters and setters
677
678
    public function setTotalAmount(Money $totalAmount): DandomainPayment
679
    {
680
        parent::setTotalAmount($totalAmount);
681
682
        $this->totalAmountAmount = $totalAmount->getAmount();
683
        $this->totalAmountCurrency = $totalAmount->getCurrency()->getCode();
684
685
        return $this;
686
    }
687
688
    public function getTotalAmount(): ?Money
689
    {
690
        if (!$this->totalAmountCurrency) {
691
            return null;
692
        }
693
694
        $amount = $this->totalAmountAmount;
695
        if (!$amount) {
696
            $amount = 0;
697
        }
698
699
        return new Money($amount, new Currency($this->totalAmountCurrency));
700
    }
701
702
    public function setShippingFee(Money $shippingFee): DandomainPayment
703
    {
704
        parent::setShippingFee($shippingFee);
705
706
        $this->shippingFeeAmount = $shippingFee->getAmount();
707
        $this->shippingFeeCurrency = $shippingFee->getCurrency()->getCode();
708
709
        return $this;
710
    }
711
712
    public function getShippingFee(): ?Money
713
    {
714
        if (!$this->shippingFeeCurrency) {
715
            return null;
716
        }
717
718
        $amount = $this->shippingFeeAmount;
719
        if (!$amount) {
720
            $amount = 0;
721
        }
722
723
        return new Money($amount, new Currency($this->shippingFeeCurrency));
724
    }
725
726
    public function setPaymentFee(Money $paymentFee): DandomainPayment
727
    {
728
        parent::setPaymentFee($paymentFee);
729
730
        $this->paymentFeeAmount = $paymentFee->getAmount();
731
        $this->paymentFeeCurrency = $paymentFee->getCurrency()->getCode();
732
733
        return $this;
734
    }
735
736
    public function getPaymentFee(): ?Money
737
    {
738
        if (!$this->paymentFeeCurrency) {
739
            return null;
740
        }
741
742
        $amount = $this->paymentFeeAmount;
743
        if (!$amount) {
744
            $amount = 0;
745
        }
746
747
        return new Money($amount, new Currency($this->paymentFeeCurrency));
748
    }
749
750
    /**
751
     * @return int
752
     */
753
    public function getId(): ?int
754
    {
755
        return $this->id;
756
    }
757
758
    /**
759
     * @param int $id
760
     *
761
     * @return Payment
762
     */
763
    public function setId(int $id): self
764
    {
765
        $this->id = $id;
766
767
        return $this;
768
    }
769
770
    /**
771
     * @return null|string
772
     */
773
    public function getAltapayId()
774
    {
775
        return $this->altapayId;
776
    }
777
778
    /**
779
     * @param null|string $altapayId
780
     *
781
     * @return Payment
782
     */
783
    public function setAltapayId($altapayId)
784
    {
785
        $this->altapayId = $altapayId;
786
787
        return $this;
788
    }
789
790
    /**
791
     * @return null|string
792
     */
793
    public function getCardStatus()
794
    {
795
        return $this->cardStatus;
796
    }
797
798
    /**
799
     * @param null|string $cardStatus
800
     *
801
     * @return Payment
802
     */
803
    public function setCardStatus($cardStatus)
804
    {
805
        $this->cardStatus = $cardStatus;
806
807
        return $this;
808
    }
809
810
    /**
811
     * @return null|string
812
     */
813
    public function getCreditCardToken()
814
    {
815
        return $this->creditCardToken;
816
    }
817
818
    /**
819
     * @param null|string $creditCardToken
820
     *
821
     * @return Payment
822
     */
823
    public function setCreditCardToken($creditCardToken)
824
    {
825
        $this->creditCardToken = $creditCardToken;
826
827
        return $this;
828
    }
829
830
    /**
831
     * @return null|string
832
     */
833
    public function getCreditCardMaskedPan()
834
    {
835
        return $this->creditCardMaskedPan;
836
    }
837
838
    /**
839
     * @param null|string $creditCardMaskedPan
840
     *
841
     * @return Payment
842
     */
843
    public function setCreditCardMaskedPan($creditCardMaskedPan)
844
    {
845
        $this->creditCardMaskedPan = $creditCardMaskedPan;
846
847
        return $this;
848
    }
849
850
    /**
851
     * @return null|string
852
     */
853
    public function getThreeDSecureResult()
854
    {
855
        return $this->threeDSecureResult;
856
    }
857
858
    /**
859
     * @param null|string $threeDSecureResult
860
     *
861
     * @return Payment
862
     */
863
    public function setThreeDSecureResult($threeDSecureResult)
864
    {
865
        $this->threeDSecureResult = $threeDSecureResult;
866
867
        return $this;
868
    }
869
870
    /**
871
     * @return null|string
872
     */
873
    public function getLiableForChargeback()
874
    {
875
        return $this->liableForChargeback;
876
    }
877
878
    /**
879
     * @param null|string $liableForChargeback
880
     *
881
     * @return Payment
882
     */
883
    public function setLiableForChargeback($liableForChargeback)
884
    {
885
        $this->liableForChargeback = $liableForChargeback;
886
887
        return $this;
888
    }
889
890
    /**
891
     * @return null|string
892
     */
893
    public function getBlacklistToken()
894
    {
895
        return $this->blacklistToken;
896
    }
897
898
    /**
899
     * @param null|string $blacklistToken
900
     *
901
     * @return Payment
902
     */
903
    public function setBlacklistToken($blacklistToken)
904
    {
905
        $this->blacklistToken = $blacklistToken;
906
907
        return $this;
908
    }
909
910
    /**
911
     * @return null|string
912
     */
913
    public function getShop()
914
    {
915
        return $this->shop;
916
    }
917
918
    /**
919
     * @param null|string $shop
920
     *
921
     * @return Payment
922
     */
923
    public function setShop($shop)
924
    {
925
        $this->shop = $shop;
926
927
        return $this;
928
    }
929
930
    /**
931
     * @return null|string
932
     */
933
    public function getTerminal()
934
    {
935
        return $this->terminal;
936
    }
937
938
    /**
939
     * @param null|string $terminal
940
     *
941
     * @return Payment
942
     */
943
    public function setTerminal($terminal)
944
    {
945
        $this->terminal = $terminal;
946
947
        return $this;
948
    }
949
950
    /**
951
     * @return null|string
952
     */
953
    public function getTransactionStatus()
954
    {
955
        return $this->transactionStatus;
956
    }
957
958
    /**
959
     * @param null|string $transactionStatus
960
     *
961
     * @return Payment
962
     */
963
    public function setTransactionStatus($transactionStatus)
964
    {
965
        $this->transactionStatus = $transactionStatus;
966
967
        return $this;
968
    }
969
970
    /**
971
     * @return null|string
972
     */
973
    public function getReasonCode()
974
    {
975
        return $this->reasonCode;
976
    }
977
978
    /**
979
     * @param null|string $reasonCode
980
     *
981
     * @return Payment
982
     */
983
    public function setReasonCode($reasonCode)
984
    {
985
        $this->reasonCode = $reasonCode;
986
987
        return $this;
988
    }
989
990
    /**
991
     * @return int|null
992
     */
993
    public function getMerchantCurrency()
994
    {
995
        return $this->merchantCurrency;
996
    }
997
998
    /**
999
     * @param int|null $merchantCurrency
1000
     *
1001
     * @return Payment
1002
     */
1003
    public function setMerchantCurrency($merchantCurrency)
1004
    {
1005
        $this->merchantCurrency = $merchantCurrency;
1006
1007
        return $this;
1008
    }
1009
1010
    /**
1011
     * @return null|string
1012
     */
1013
    public function getMerchantCurrencyAlpha()
1014
    {
1015
        return $this->merchantCurrencyAlpha;
1016
    }
1017
1018
    /**
1019
     * @param null|string $merchantCurrencyAlpha
1020
     *
1021
     * @return Payment
1022
     */
1023
    public function setMerchantCurrencyAlpha($merchantCurrencyAlpha)
1024
    {
1025
        $this->merchantCurrencyAlpha = $merchantCurrencyAlpha;
1026
1027
        return $this;
1028
    }
1029
1030
    /**
1031
     * @return int|null
1032
     */
1033
    public function getCardHolderCurrency()
1034
    {
1035
        return $this->cardHolderCurrency;
1036
    }
1037
1038
    /**
1039
     * @param int|null $cardHolderCurrency
1040
     *
1041
     * @return Payment
1042
     */
1043
    public function setCardHolderCurrency($cardHolderCurrency)
1044
    {
1045
        $this->cardHolderCurrency = $cardHolderCurrency;
1046
1047
        return $this;
1048
    }
1049
1050
    /**
1051
     * @return null|string
1052
     */
1053
    public function getCardHolderCurrencyAlpha()
1054
    {
1055
        return $this->cardHolderCurrencyAlpha;
1056
    }
1057
1058
    /**
1059
     * @param null|string $cardHolderCurrencyAlpha
1060
     *
1061
     * @return Payment
1062
     */
1063
    public function setCardHolderCurrencyAlpha($cardHolderCurrencyAlpha)
1064
    {
1065
        $this->cardHolderCurrencyAlpha = $cardHolderCurrencyAlpha;
1066
1067
        return $this;
1068
    }
1069
1070
    /**
1071
     * @return float|null
1072
     */
1073
    public function getReservedAmount()
1074
    {
1075
        return $this->reservedAmount;
1076
    }
1077
1078
    /**
1079
     * @param float|null $reservedAmount
1080
     *
1081
     * @return Payment
1082
     */
1083
    public function setReservedAmount($reservedAmount)
1084
    {
1085
        $this->reservedAmount = $reservedAmount;
1086
1087
        return $this;
1088
    }
1089
1090
    /**
1091
     * @return float|null
1092
     */
1093
    public function getCapturedAmount()
1094
    {
1095
        return $this->capturedAmount;
1096
    }
1097
1098
    /**
1099
     * @param float|null $capturedAmount
1100
     *
1101
     * @return Payment
1102
     */
1103
    public function setCapturedAmount($capturedAmount)
1104
    {
1105
        $this->capturedAmount = $capturedAmount;
1106
1107
        return $this;
1108
    }
1109
1110
    /**
1111
     * @return float|null
1112
     */
1113
    public function getRefundedAmount()
1114
    {
1115
        return $this->refundedAmount;
1116
    }
1117
1118
    /**
1119
     * @param float|null $refundedAmount
1120
     *
1121
     * @return Payment
1122
     */
1123
    public function setRefundedAmount($refundedAmount)
1124
    {
1125
        $this->refundedAmount = $refundedAmount;
1126
1127
        return $this;
1128
    }
1129
1130
    /**
1131
     * @return float|null
1132
     */
1133
    public function getRecurringDefaultAmount()
1134
    {
1135
        return $this->recurringDefaultAmount;
1136
    }
1137
1138
    /**
1139
     * @param float|null $recurringDefaultAmount
1140
     *
1141
     * @return Payment
1142
     */
1143
    public function setRecurringDefaultAmount($recurringDefaultAmount)
1144
    {
1145
        $this->recurringDefaultAmount = $recurringDefaultAmount;
1146
1147
        return $this;
1148
    }
1149
1150
    /**
1151
     * @return \DateTime|null
1152
     */
1153
    public function getCreatedDate()
1154
    {
1155
        return $this->createdDate;
1156
    }
1157
1158
    /**
1159
     * @param \DateTimeInterface|null $createdDate
1160
     *
1161
     * @return Payment
1162
     */
1163
    public function setCreatedDate($createdDate)
1164
    {
1165
        $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...
1166
1167
        return $this;
1168
    }
1169
1170
    /**
1171
     * @return \DateTime|null
1172
     */
1173
    public function getUpdatedDate()
1174
    {
1175
        return $this->updatedDate;
1176
    }
1177
1178
    /**
1179
     * @param \DateTimeInterface|null $updatedDate
1180
     *
1181
     * @return Payment
1182
     */
1183
    public function setUpdatedDate($updatedDate)
1184
    {
1185
        $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...
1186
1187
        return $this;
1188
    }
1189
1190
    /**
1191
     * @return null|string
1192
     */
1193
    public function getPaymentNature()
1194
    {
1195
        return $this->paymentNature;
1196
    }
1197
1198
    /**
1199
     * @param null|string $paymentNature
1200
     *
1201
     * @return Payment
1202
     */
1203
    public function setPaymentNature($paymentNature)
1204
    {
1205
        $this->paymentNature = $paymentNature;
1206
1207
        return $this;
1208
    }
1209
1210
    /**
1211
     * @return bool|null
1212
     */
1213
    public function getSupportsRefunds()
1214
    {
1215
        return $this->supportsRefunds;
1216
    }
1217
1218
    /**
1219
     * @param bool|null $supportsRefunds
1220
     *
1221
     * @return Payment
1222
     */
1223
    public function setSupportsRefunds($supportsRefunds)
1224
    {
1225
        $this->supportsRefunds = $supportsRefunds;
1226
1227
        return $this;
1228
    }
1229
1230
    /**
1231
     * @return bool|null
1232
     */
1233
    public function getSupportsRelease()
1234
    {
1235
        return $this->supportsRelease;
1236
    }
1237
1238
    /**
1239
     * @param bool|null $supportsRelease
1240
     *
1241
     * @return Payment
1242
     */
1243
    public function setSupportsRelease($supportsRelease)
1244
    {
1245
        $this->supportsRelease = $supportsRelease;
1246
1247
        return $this;
1248
    }
1249
1250
    /**
1251
     * @return bool|null
1252
     */
1253
    public function getSupportsMultipleCaptures()
1254
    {
1255
        return $this->supportsMultipleCaptures;
1256
    }
1257
1258
    /**
1259
     * @param bool|null $supportsMultipleCaptures
1260
     *
1261
     * @return Payment
1262
     */
1263
    public function setSupportsMultipleCaptures($supportsMultipleCaptures)
1264
    {
1265
        $this->supportsMultipleCaptures = $supportsMultipleCaptures;
1266
1267
        return $this;
1268
    }
1269
1270
    /**
1271
     * @return bool|null
1272
     */
1273
    public function getSupportsMultipleRefunds()
1274
    {
1275
        return $this->supportsMultipleRefunds;
1276
    }
1277
1278
    /**
1279
     * @param bool|null $supportsMultipleRefunds
1280
     *
1281
     * @return Payment
1282
     */
1283
    public function setSupportsMultipleRefunds($supportsMultipleRefunds)
1284
    {
1285
        $this->supportsMultipleRefunds = $supportsMultipleRefunds;
1286
1287
        return $this;
1288
    }
1289
1290
    /**
1291
     * @return float|null
1292
     */
1293
    public function getFraudRiskScore()
1294
    {
1295
        return $this->fraudRiskScore;
1296
    }
1297
1298
    /**
1299
     * @param float|null $fraudRiskScore
1300
     *
1301
     * @return Payment
1302
     */
1303
    public function setFraudRiskScore($fraudRiskScore)
1304
    {
1305
        $this->fraudRiskScore = $fraudRiskScore;
1306
1307
        return $this;
1308
    }
1309
1310
    /**
1311
     * @return null|string
1312
     */
1313
    public function getFraudExplanation()
1314
    {
1315
        return $this->fraudExplanation;
1316
    }
1317
1318
    /**
1319
     * @param null|string $fraudExplanation
1320
     *
1321
     * @return Payment
1322
     */
1323
    public function setFraudExplanation($fraudExplanation)
1324
    {
1325
        $this->fraudExplanation = $fraudExplanation;
1326
1327
        return $this;
1328
    }
1329
}
1330