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