Completed
Push — master ( c55f61...fd7370 )
by Joachim
16:23
created

Payment   D

Complexity

Total Complexity 69

Size/Duplication

Total Lines 1136
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 69
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 1136
rs 4.871

63 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A isCaptureable() 0 12 4
A isRefundable() 0 12 4
A refundableAmount() 0 6 1
A capturableAmount() 0 7 1
A getId() 0 4 1
A setId() 0 6 1
A getAltapayId() 0 4 1
A setAltapayId() 0 6 1
A getCardStatus() 0 4 1
A setCardStatus() 0 6 1
A getCreditCardToken() 0 4 1
A setCreditCardToken() 0 6 1
A getCreditCardMaskedPan() 0 4 1
A setCreditCardMaskedPan() 0 6 1
A getThreeDSecureResult() 0 4 1
A setThreeDSecureResult() 0 6 1
A getLiableForChargeback() 0 4 1
A setLiableForChargeback() 0 6 1
A getBlacklistToken() 0 4 1
A setBlacklistToken() 0 6 1
A getShop() 0 4 1
A setShop() 0 6 1
A getTerminal() 0 4 1
A setTerminal() 0 6 1
A getTransactionStatus() 0 4 1
A setTransactionStatus() 0 6 1
A getReasonCode() 0 4 1
A setReasonCode() 0 6 1
A getMerchantCurrency() 0 4 1
A setMerchantCurrency() 0 6 1
A getMerchantCurrencyAlpha() 0 4 1
A setMerchantCurrencyAlpha() 0 6 1
A getCardHolderCurrency() 0 4 1
A setCardHolderCurrency() 0 6 1
A getCardHolderCurrencyAlpha() 0 4 1
A setCardHolderCurrencyAlpha() 0 6 1
A getReservedAmount() 0 4 1
A setReservedAmount() 0 6 1
A getCapturedAmount() 0 4 1
A setCapturedAmount() 0 6 1
A getRefundedAmount() 0 4 1
A setRefundedAmount() 0 6 1
A getRecurringDefaultAmount() 0 4 1
A setRecurringDefaultAmount() 0 6 1
A getCreatedDate() 0 4 1
A setCreatedDate() 0 6 1
A getUpdatedDate() 0 4 1
A setUpdatedDate() 0 6 1
A getPaymentNature() 0 4 1
A setPaymentNature() 0 6 1
A getSupportsRefunds() 0 4 1
A setSupportsRefunds() 0 6 1
A getSupportsRelease() 0 4 1
A setSupportsRelease() 0 6 1
A getSupportsMultipleCaptures() 0 4 1
A setSupportsMultipleCaptures() 0 6 1
A getSupportsMultipleRefunds() 0 4 1
A setSupportsMultipleRefunds() 0 6 1
A getFraudRiskScore() 0 4 1
A setFraudRiskScore() 0 6 1
A getFraudExplanation() 0 4 1
A setFraudExplanation() 0 6 1

How to fix   Complexity   

Complex Class

Complex classes like Payment often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use Payment, and based on these observations, apply Extract Interface, too.

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