1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
|
3
|
|
|
namespace SlevomatCsobGateway\Call; |
4
|
|
|
|
5
|
|
|
use DateTimeImmutable; |
6
|
|
|
use SlevomatCsobGateway\Validator; |
7
|
|
|
|
8
|
|
|
class PaymentResponse |
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
private $payId; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var DateTimeImmutable |
18
|
|
|
*/ |
19
|
|
|
private $responseDateTime; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var ResultCode |
23
|
|
|
*/ |
24
|
|
|
private $resultCode; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $resultMessage; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var PaymentStatus|null |
33
|
|
|
*/ |
34
|
|
|
private $paymentStatus; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string|null |
38
|
|
|
*/ |
39
|
|
|
private $authCode; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var string|null |
43
|
|
|
*/ |
44
|
|
|
private $merchantData; |
45
|
|
|
|
46
|
|
|
/** @var mixed[] */ |
47
|
|
|
private $extensions; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param string $payId |
51
|
|
|
* @param \DateTimeImmutable $responseDateTime |
52
|
|
|
* @param \SlevomatCsobGateway\Call\ResultCode $resultCode |
53
|
|
|
* @param string $resultMessage |
54
|
|
|
* @param \SlevomatCsobGateway\Call\PaymentStatus|null $paymentStatus |
55
|
|
|
* @param string|null $authCode |
56
|
|
|
* @param string|null $merchantData |
57
|
|
|
* @param mixed[] $extensions |
58
|
|
|
*/ |
59
|
10 |
|
public function __construct( |
60
|
|
|
string $payId, |
61
|
|
|
DateTimeImmutable $responseDateTime, |
62
|
|
|
ResultCode $resultCode, |
63
|
|
|
string $resultMessage, |
64
|
|
|
?PaymentStatus $paymentStatus, |
65
|
|
|
?string $authCode = null, |
66
|
|
|
?string $merchantData = null, |
67
|
|
|
array $extensions = [] |
68
|
|
|
) |
69
|
|
|
{ |
70
|
10 |
|
Validator::checkPayId($payId); |
71
|
10 |
|
if ($merchantData !== null) { |
72
|
1 |
|
Validator::checkMerchantData($merchantData); |
73
|
|
|
} |
74
|
|
|
|
75
|
10 |
|
$this->payId = $payId; |
76
|
10 |
|
$this->responseDateTime = $responseDateTime; |
77
|
10 |
|
$this->resultCode = $resultCode; |
78
|
10 |
|
$this->resultMessage = $resultMessage; |
79
|
10 |
|
$this->paymentStatus = $paymentStatus; |
80
|
10 |
|
$this->authCode = $authCode; |
81
|
10 |
|
$this->merchantData = $merchantData; |
82
|
10 |
|
$this->extensions = $extensions; |
83
|
10 |
|
} |
84
|
|
|
|
85
|
9 |
|
public function getPayId(): string |
86
|
|
|
{ |
87
|
9 |
|
return $this->payId; |
88
|
|
|
} |
89
|
|
|
|
90
|
9 |
|
public function getResponseDateTime(): DateTimeImmutable |
91
|
|
|
{ |
92
|
9 |
|
return $this->responseDateTime; |
93
|
|
|
} |
94
|
|
|
|
95
|
9 |
|
public function getResultCode(): ResultCode |
96
|
|
|
{ |
97
|
9 |
|
return $this->resultCode; |
98
|
|
|
} |
99
|
|
|
|
100
|
9 |
|
public function getResultMessage(): string |
101
|
|
|
{ |
102
|
9 |
|
return $this->resultMessage; |
103
|
|
|
} |
104
|
|
|
|
105
|
9 |
|
public function getPaymentStatus(): ?PaymentStatus |
106
|
|
|
{ |
107
|
9 |
|
return $this->paymentStatus; |
108
|
|
|
} |
109
|
|
|
|
110
|
9 |
|
public function getAuthCode(): ?string |
111
|
|
|
{ |
112
|
9 |
|
return $this->authCode; |
113
|
|
|
} |
114
|
|
|
|
115
|
1 |
|
public function getMerchantData(): ?string |
116
|
|
|
{ |
117
|
1 |
|
return $this->merchantData; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return mixed[] |
122
|
|
|
*/ |
123
|
|
|
public function getExtensions(): array |
124
|
|
|
{ |
125
|
|
|
return $this->extensions; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
} |
129
|
|
|
|