1 | <?php |
||
15 | class PurchaseRequest extends AbstractSignatureRequest |
||
16 | { |
||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | protected $productionEndpoint = 'https://pay.vnpay.vn/vpcpay.html'; |
||
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | protected $testEndpoint = 'http://sandbox.vnpayment.vn/paymentv2/vpcpay.html'; |
||
26 | |||
27 | /** |
||
28 | * {@inheritdoc} |
||
29 | */ |
||
30 | public function initialize(array $parameters = []) |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public function sendData($data): PurchaseResponse |
||
55 | |||
56 | /** |
||
57 | * Trả về vùng ngôn ngữ hiển thị trên VNPay khi khách thanh toán. |
||
58 | * |
||
59 | * @return null|string |
||
60 | */ |
||
61 | public function getVnpLocale(): ?string |
||
65 | |||
66 | /** |
||
67 | * Thiết lập vùng ngôn ngữ hiển thị trên VNPay khi khách thanh toán. |
||
68 | * Mặc định nếu không thiết lập sẽ là `vn`. |
||
69 | * |
||
70 | * @param null|string $locale |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function setVnpLocale(?string $locale) |
||
78 | |||
79 | /** |
||
80 | * Trả về mã tiền tệ dùng để thanh toán. |
||
81 | * Đây là phương thức ánh xạ của [[getCurrency()]]. |
||
82 | * |
||
83 | * @return null|string |
||
84 | * @see getCurrency |
||
85 | */ |
||
86 | public function getVnpCurrCode(): ?string |
||
90 | |||
91 | /** |
||
92 | * Thiết lập mã tiền tệ dùng để thanh toán. |
||
93 | * Đây là phương thức ánh xạ của [[setCurrency()]]. |
||
94 | * |
||
95 | * @param null|string $code |
||
96 | * @return $this |
||
97 | * @see setCurrency |
||
98 | */ |
||
99 | public function setVnpCurrCode(?string $code) |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function getCurrency(): ?string |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | * Mặc định nếu không thiết lập sẽ là `VND`. |
||
115 | */ |
||
116 | public function setCurrency($value) |
||
120 | |||
121 | /** |
||
122 | * Trả về mã ngân hàng dùng để thanh toán. |
||
123 | * |
||
124 | * @return null|string |
||
125 | */ |
||
126 | public function getVnpBankCode(): ?string |
||
130 | |||
131 | /** |
||
132 | * Thiết lập mã ngân hàng dùng để thanh toán. |
||
133 | * |
||
134 | * @param null|string $code |
||
135 | * @return $this |
||
136 | */ |
||
137 | public function setVnpBankCode(?string $code) |
||
138 | { |
||
139 | return $this->setParameter('vnp_BankCode', $code); |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * Trả về nhóm loại đơn hàng. |
||
144 | * |
||
145 | * @return null|string |
||
146 | */ |
||
147 | public function getVnpOrderType(): ?string |
||
151 | |||
152 | /** |
||
153 | * Thiết lập nhóm loại đơn hàng. |
||
154 | * |
||
155 | * @param null|string $type |
||
156 | * @return $this |
||
157 | */ |
||
158 | public function setVnpOrderType(?string $type) |
||
162 | |||
163 | /** |
||
164 | * Trả về số tiền của đơn hàng. |
||
165 | * Đây là phương thức ánh xạ của [[getAmount()]]. |
||
166 | * |
||
167 | * @return null|string |
||
168 | * @see getAmount |
||
169 | */ |
||
170 | public function getVnpAmount(): ?string |
||
174 | |||
175 | /** |
||
176 | * Thiết lập số tiền cần thanh toán. |
||
177 | * Đây là phương thức ánh xạ của [[setAmount()]]. |
||
178 | * |
||
179 | * @param null|string $number |
||
180 | * @return $this |
||
181 | * @see setAmount |
||
182 | */ |
||
183 | public function setVnpAmount(?string $number) |
||
187 | |||
188 | /** |
||
189 | * {@inheritdoc} |
||
190 | */ |
||
191 | public function getAmount(): ?string |
||
195 | |||
196 | /** |
||
197 | * {@inheritdoc} |
||
198 | */ |
||
199 | public function setAmount($value) |
||
203 | |||
204 | /** |
||
205 | * Trả về url sẽ dẫn khách về sau khi thanh toán xong. |
||
206 | * Đây là phương thức ánh xạ của [[getVnpReturnUrl()]]. |
||
207 | * |
||
208 | * @return null|string |
||
209 | * @see getVnpReturnUrl |
||
210 | */ |
||
211 | public function getVnpReturnUrl(): ?string |
||
215 | |||
216 | /** |
||
217 | * Thiết lập url dẫn khách về sau khi thanh toán xong. |
||
218 | * Đây là phương thức ánh xạ của [[setReturnUrl()]]. |
||
219 | * |
||
220 | * @param null|string $url |
||
221 | * @return $this |
||
222 | * @see setReturnUrl |
||
223 | */ |
||
224 | public function setVnpReturnUrl(?string $url) |
||
228 | |||
229 | /** |
||
230 | * {@inheritdoc} |
||
231 | */ |
||
232 | public function getReturnUrl(): ?string |
||
236 | |||
237 | /** |
||
238 | * {@inheritdoc} |
||
239 | */ |
||
240 | public function setReturnUrl($value) |
||
244 | |||
245 | /** |
||
246 | * {@inheritdoc} |
||
247 | */ |
||
248 | protected function getSignatureParameters(): array |
||
261 | } |
||
262 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: