@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function pay(): RedirectionForm |
113 | 113 | { |
114 | - $url = $this->settings->apiPaymentUrl . $this->invoice->getTransactionId(); |
|
114 | + $url = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId(); |
|
115 | 115 | |
116 | 116 | return $this->redirectWithForm($url, [], 'GET'); |
117 | 117 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | protected function notVerified($message, $status = 0) |
197 | 197 | { |
198 | 198 | if (empty($message)) { |
199 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
199 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
200 | 200 | } else { |
201 | - throw new InvalidPaymentException($message, (int)$status); |
|
201 | + throw new InvalidPaymentException($message, (int) $status); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function pay(): RedirectionForm |
113 | 113 | { |
114 | - $payUrl = $this->settings->apiPaymentUrl . $this->invoice->getTransactionId(); |
|
114 | + $payUrl = $this->settings->apiPaymentUrl.$this->invoice->getTransactionId(); |
|
115 | 115 | |
116 | 116 | return $this->redirectWithForm($payUrl, [], 'GET'); |
117 | 117 | } |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | ); |
207 | 207 | |
208 | 208 | if (array_key_exists($status, $translations)) { |
209 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
209 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
210 | 210 | } else { |
211 | - throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', (int)$status); |
|
211 | + throw new InvalidPaymentException('تراکنش با خطا مواجه شد.', (int) $status); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function pay(): RedirectionForm |
92 | 92 | { |
93 | 93 | $url = $this->settings->mode === "normal" ? $this->settings->apiPaymentUrl : $this->settings->apiPaymentUrlSandbox; |
94 | - $url = $url . $this->invoice->getTransactionId(); |
|
94 | + $url = $url.$this->invoice->getTransactionId(); |
|
95 | 95 | |
96 | 96 | return $this->redirectWithForm($url, [], 'GET'); |
97 | 97 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $tracking_number = Request::post("tracking_number"); |
108 | 108 | $transid = Request::post("transid"); |
109 | - if ($tracking_number === null || $tracking_number === ""|| $transid === ""|| $transid === null) { |
|
109 | + if ($tracking_number === null || $tracking_number === "" || $transid === "" || $transid === null) { |
|
110 | 110 | $this->notVerified('پرداخت ناموفق.'); |
111 | 111 | } |
112 | 112 | $data = [ |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | protected function notVerified($message, $status = 0) |
161 | 161 | { |
162 | 162 | if (empty($message)) { |
163 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
163 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
164 | 164 | } else { |
165 | - throw new InvalidPaymentException($message, (int)$status); |
|
165 | + throw new InvalidPaymentException($message, (int) $status); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | protected function getErrorMessage($code) |
174 | 174 | { |
175 | - $code = (int)$code; |
|
175 | + $code = (int) $code; |
|
176 | 176 | switch ($code) { |
177 | 177 | case -1: return "مبلغ نباید خالی باشد."; |
178 | 178 | case -2: return "کد پین درگاه نمیتواند خالی باشد."; |
@@ -166,9 +166,9 @@ |
||
166 | 166 | private function notVerified($message, $status) |
167 | 167 | { |
168 | 168 | if ($message) { |
169 | - throw new InvalidPaymentException($message, (int)$status); |
|
169 | + throw new InvalidPaymentException($message, (int) $status); |
|
170 | 170 | } else { |
171 | - throw new InvalidPaymentException('payment failed', (int)$status); |
|
171 | + throw new InvalidPaymentException('payment failed', (int) $status); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -200,7 +200,7 @@ |
||
200 | 200 | */ |
201 | 201 | private function notVerified($message, $status) |
202 | 202 | { |
203 | - throw new InvalidPaymentException($message, (int)$status); |
|
203 | + throw new InvalidPaymentException($message, (int) $status); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -155,9 +155,9 @@ |
||
155 | 155 | private function notVerified($message, $status) |
156 | 156 | { |
157 | 157 | if (empty($message)) { |
158 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
158 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
159 | 159 | } else { |
160 | - throw new InvalidPaymentException($message, (int)$status); |
|
160 | + throw new InvalidPaymentException($message, (int) $status); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
@@ -233,9 +233,9 @@ |
||
233 | 233 | "54" => "مدت زمان تایید پرداخت سپری شده است.", |
234 | 234 | ); |
235 | 235 | if (array_key_exists($status, $translations)) { |
236 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
236 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
237 | 237 | } else { |
238 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
238 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function __construct(Invoice $invoice, $settings) |
46 | 46 | { |
47 | 47 | $this->invoice($invoice); |
48 | - $this->settings = (object)$settings; |
|
48 | + $this->settings = (object) $settings; |
|
49 | 49 | $this->client = new Client([ |
50 | 50 | 'curl' => [CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1'], |
51 | 51 | ]); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function verify(): ReceiptInterface |
132 | 132 | { |
133 | - $status = (int)Request::input('Status'); |
|
133 | + $status = (int) Request::input('Status'); |
|
134 | 134 | if ($status != 2) { |
135 | 135 | $this->purchaseFailed($status); |
136 | 136 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | ); |
234 | 234 | |
235 | 235 | if (array_key_exists($status, $translations)) { |
236 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
236 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
237 | 237 | } else { |
238 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
238 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function __construct(Invoice $invoice, $settings) |
50 | 50 | { |
51 | 51 | $this->invoice($invoice); |
52 | - $this->settings = (object)$settings; |
|
52 | + $this->settings = (object) $settings; |
|
53 | 53 | $this->client = new Client( |
54 | 54 | [ |
55 | 55 | 'base_uri' => $this->settings->apiPurchaseUrl, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $referenceId = hexdec(uniqid()); |
115 | 115 | |
116 | - $callback = $this->settings->callbackUrl . "?referenceId=" . $referenceId . "&price=" . $amount . "&mobile=" . $mobile; |
|
116 | + $callback = $this->settings->callbackUrl."?referenceId=".$referenceId."&price=".$amount."&mobile=".$mobile; |
|
117 | 117 | |
118 | 118 | $data = [ |
119 | 119 | 'referenceId' => $referenceId, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | public function verify(): ReceiptInterface |
170 | 170 | { |
171 | 171 | $data = [ |
172 | - 'referenceId' => (int)$this->getInvoice()->getTransactionId(), |
|
172 | + 'referenceId' => (int) $this->getInvoice()->getTransactionId(), |
|
173 | 173 | 'header' => '', |
174 | 174 | 'content' => http_build_query($_POST), |
175 | 175 | ]; |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | if ($message) { |
298 | - throw new InvalidPaymentException($message, (int)$status); |
|
298 | + throw new InvalidPaymentException($message, (int) $status); |
|
299 | 299 | } else { |
300 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
300 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | { |
306 | 306 | $header[] = 'Content-Type: application/json'; |
307 | 307 | if ($forAuth) { |
308 | - $header[] = 'Authorization: Bearer ' . $this->auth(); |
|
308 | + $header[] = 'Authorization: Bearer '.$this->auth(); |
|
309 | 309 | } |
310 | 310 | $ch = curl_init($url); |
311 | 311 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); |