1 | <?php |
||
7 | class Config extends Payload implements ConfigInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $callbackForm; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $callbackOk; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $callbackFail; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $callbackRedirect; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $callbackOpen; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $callbackNotification; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $callbackVerifyOrder; |
||
43 | |||
44 | 9 | public function getPayload() : array |
|
45 | { |
||
46 | $payload = [ |
||
47 | 9 | 'callback_form' => $this->callbackForm, |
|
48 | 9 | 'callback_ok' => $this->callbackOk, |
|
49 | 9 | 'callback_fail' => $this->callbackFail, |
|
50 | 9 | 'callback_redirect' => $this->callbackRedirect, |
|
51 | 9 | 'callback_open' => $this->callbackOpen, |
|
52 | 9 | 'callback_notification' => $this->callbackNotification, |
|
53 | 9 | 'callback_verify_order' => $this->callbackVerifyOrder, |
|
54 | ]; |
||
55 | |||
56 | 9 | $this->validate(); |
|
57 | |||
58 | 9 | return static::simplePayload($payload); |
|
59 | } |
||
60 | |||
61 | 9 | public function validate() |
|
62 | { |
||
63 | 9 | Assert::thatNullOr($this->callbackForm)->string(); |
|
64 | 9 | Assert::thatNullOr($this->callbackOk)->string(); |
|
65 | 9 | Assert::thatNullOr($this->callbackFail)->string(); |
|
66 | 9 | Assert::thatNullOr($this->callbackRedirect)->string(); |
|
67 | 9 | Assert::thatNullOr($this->callbackOpen)->string(); |
|
68 | 9 | Assert::thatNullOr($this->callbackNotification)->string(); |
|
69 | 9 | Assert::thatNullOr($this->callbackVerifyOrder)->string(); |
|
70 | 9 | } |
|
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | 3 | public function getCallbackForm() : ?string |
|
76 | { |
||
77 | 3 | return $this->callbackForm; |
|
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param string $callbackForm |
||
82 | * @return Config |
||
83 | */ |
||
84 | 6 | public function setCallbackForm(string $callbackForm) : self |
|
85 | { |
||
86 | 6 | $this->callbackForm = $callbackForm; |
|
87 | 6 | return $this; |
|
88 | } |
||
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | 3 | public function getCallbackOk() : ?string |
|
94 | { |
||
95 | 3 | return $this->callbackOk; |
|
96 | } |
||
97 | |||
98 | /** |
||
99 | * @param string $callbackOk |
||
100 | * @return Config |
||
101 | */ |
||
102 | 6 | public function setCallbackOk(string $callbackOk) : self |
|
103 | { |
||
104 | 6 | $this->callbackOk = $callbackOk; |
|
105 | 6 | return $this; |
|
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | 3 | public function getCallbackFail() : ?string |
|
115 | |||
116 | /** |
||
117 | * @param string $callbackFail |
||
118 | * @return Config |
||
119 | */ |
||
120 | 6 | public function setCallbackFail(string $callbackFail) : self |
|
121 | { |
||
122 | 6 | $this->callbackFail = $callbackFail; |
|
123 | 6 | return $this; |
|
124 | } |
||
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | */ |
||
129 | 3 | public function getCallbackRedirect() : ?string |
|
130 | { |
||
131 | 3 | return $this->callbackRedirect; |
|
132 | } |
||
133 | |||
134 | /** |
||
135 | * @param string $callbackRedirect |
||
136 | * @return Config |
||
137 | */ |
||
138 | 6 | public function setCallbackRedirect(string $callbackRedirect) : self |
|
139 | { |
||
140 | 6 | $this->callbackRedirect = $callbackRedirect; |
|
141 | 6 | return $this; |
|
142 | } |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | */ |
||
147 | 3 | public function getCallbackOpen() : ?string |
|
148 | { |
||
149 | 3 | return $this->callbackOpen; |
|
150 | } |
||
151 | |||
152 | /** |
||
153 | * @param string $callbackOpen |
||
154 | * @return Config |
||
155 | */ |
||
156 | 6 | public function setCallbackOpen(string $callbackOpen) : self |
|
157 | { |
||
158 | 6 | $this->callbackOpen = $callbackOpen; |
|
159 | 6 | return $this; |
|
160 | } |
||
161 | |||
162 | /** |
||
163 | * @return string |
||
164 | */ |
||
165 | 3 | public function getCallbackNotification() : ?string |
|
166 | { |
||
167 | 3 | return $this->callbackNotification; |
|
168 | } |
||
169 | |||
170 | /** |
||
171 | * @param string $callbackNotification |
||
172 | * @return Config |
||
173 | */ |
||
174 | 6 | public function setCallbackNotification(string $callbackNotification) : self |
|
175 | { |
||
176 | 6 | $this->callbackNotification = $callbackNotification; |
|
177 | 6 | return $this; |
|
178 | } |
||
179 | |||
180 | /** |
||
181 | * @return string |
||
182 | */ |
||
183 | 3 | public function getCallbackVerifyOrder() : ?string |
|
187 | |||
188 | /** |
||
189 | * @param string $callbackVerifyOrder |
||
190 | * @return Config |
||
191 | */ |
||
192 | 6 | public function setCallbackVerifyOrder(string $callbackVerifyOrder) : self |
|
193 | { |
||
194 | 6 | $this->callbackVerifyOrder = $callbackVerifyOrder; |
|
195 | 6 | return $this; |
|
196 | } |
||
197 | } |
||
198 |