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