1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
|
3
|
|
|
namespace SlevomatCsobGateway\Call\Masterpass; |
4
|
|
|
|
5
|
|
|
use DateTimeImmutable; |
6
|
|
|
use SlevomatCsobGateway\Call\PaymentStatus; |
7
|
|
|
use SlevomatCsobGateway\Call\ResultCode; |
8
|
|
|
use SlevomatCsobGateway\Validator; |
9
|
|
|
|
10
|
|
|
class CheckoutResponse |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
/** @var string */ |
14
|
|
|
private $payId; |
15
|
|
|
|
16
|
|
|
/** @var DateTimeImmutable */ |
17
|
|
|
private $responseDateTime; |
18
|
|
|
|
19
|
|
|
/** @var ResultCode */ |
20
|
|
|
private $resultCode; |
21
|
|
|
|
22
|
|
|
/** @var string */ |
23
|
|
|
private $resultMessage; |
24
|
|
|
|
25
|
|
|
/** @var PaymentStatus|null */ |
26
|
|
|
private $paymentStatus; |
27
|
|
|
|
28
|
|
|
/** @var mixed[]|null */ |
29
|
|
|
private $lightboxParams; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param string $payId |
33
|
|
|
* @param DateTimeImmutable $responseDateTime |
34
|
|
|
* @param ResultCode $resultCode |
35
|
|
|
* @param string $resultMessage |
36
|
|
|
* @param PaymentStatus|null $paymentStatus |
37
|
|
|
* @param mixed[]|null $lightboxParams |
38
|
|
|
*/ |
39
|
2 |
|
public function __construct( |
40
|
|
|
string $payId, |
41
|
|
|
DateTimeImmutable $responseDateTime, |
42
|
|
|
ResultCode $resultCode, |
43
|
|
|
string $resultMessage, |
44
|
|
|
?PaymentStatus $paymentStatus, |
45
|
|
|
?array $lightboxParams |
46
|
|
|
) |
47
|
|
|
{ |
48
|
2 |
|
Validator::checkPayId($payId); |
49
|
|
|
|
50
|
2 |
|
$this->payId = $payId; |
51
|
2 |
|
$this->responseDateTime = $responseDateTime; |
52
|
2 |
|
$this->resultCode = $resultCode; |
53
|
2 |
|
$this->resultMessage = $resultMessage; |
54
|
2 |
|
$this->paymentStatus = $paymentStatus; |
55
|
2 |
|
$this->lightboxParams = $lightboxParams; |
56
|
2 |
|
} |
57
|
|
|
|
58
|
2 |
|
public function getPayId(): string |
59
|
|
|
{ |
60
|
2 |
|
return $this->payId; |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
public function getResponseDateTime(): DateTimeImmutable |
64
|
|
|
{ |
65
|
2 |
|
return $this->responseDateTime; |
66
|
|
|
} |
67
|
|
|
|
68
|
2 |
|
public function getResultCode(): ResultCode |
69
|
|
|
{ |
70
|
2 |
|
return $this->resultCode; |
71
|
|
|
} |
72
|
|
|
|
73
|
2 |
|
public function getResultMessage(): string |
74
|
|
|
{ |
75
|
2 |
|
return $this->resultMessage; |
76
|
|
|
} |
77
|
|
|
|
78
|
2 |
|
public function getPaymentStatus(): ?PaymentStatus |
79
|
|
|
{ |
80
|
2 |
|
return $this->paymentStatus; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return mixed[]|null |
85
|
|
|
*/ |
86
|
2 |
|
public function getLightboxParams(): ?array |
87
|
|
|
{ |
88
|
2 |
|
return $this->lightboxParams; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
} |
92
|
|
|
|