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