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