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
|
|
|
public function __construct( |
50
|
|
|
string $payId, |
51
|
|
|
DateTimeImmutable $responseDateTime, |
52
|
|
|
ResultCode $resultCode, |
53
|
|
|
string $resultMessage, |
54
|
|
|
PaymentStatus $paymentStatus = null, |
55
|
|
|
string $authCode = null, |
56
|
|
|
string $merchantData = null, |
57
|
|
|
array $extensions = [] |
58
|
|
|
) |
59
|
|
|
{ |
60
|
|
|
Validator::checkPayId($payId); |
61
|
|
|
if ($merchantData !== null) { |
62
|
|
|
Validator::checkMerchantData($merchantData); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
$this->payId = $payId; |
66
|
|
|
$this->responseDateTime = $responseDateTime; |
67
|
|
|
$this->resultCode = $resultCode; |
68
|
|
|
$this->resultMessage = $resultMessage; |
69
|
|
|
$this->paymentStatus = $paymentStatus; |
70
|
|
|
$this->authCode = $authCode; |
71
|
|
|
$this->merchantData = $merchantData; |
72
|
|
|
$this->extensions = $extensions; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getPayId(): string |
76
|
|
|
{ |
77
|
|
|
return $this->payId; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function getResponseDateTime(): DateTimeImmutable |
81
|
|
|
{ |
82
|
|
|
return $this->responseDateTime; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function getResultCode(): ResultCode |
86
|
|
|
{ |
87
|
|
|
return $this->resultCode; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getResultMessage(): string |
91
|
|
|
{ |
92
|
|
|
return $this->resultMessage; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return PaymentStatus|null |
97
|
|
|
*/ |
98
|
|
|
public function getPaymentStatus() |
99
|
|
|
{ |
100
|
|
|
return $this->paymentStatus; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return string|null |
105
|
|
|
*/ |
106
|
|
|
public function getAuthCode() |
107
|
|
|
{ |
108
|
|
|
return $this->authCode; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @return null|string |
113
|
|
|
*/ |
114
|
|
|
public function getMerchantData() |
115
|
|
|
{ |
116
|
|
|
return $this->merchantData; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getExtensions(): array |
120
|
|
|
{ |
121
|
|
|
return $this->extensions; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
} |
125
|
|
|
|