@@ -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 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function pay() : RedirectionForm |
| 82 | 82 | { |
| 83 | - $payUrl = $this->settings->apiPaymentUrl . '?Token=' . $this->invoice->getTransactionId() ; |
|
| 83 | + $payUrl = $this->settings->apiPaymentUrl.'?Token='.$this->invoice->getTransactionId(); |
|
| 84 | 84 | |
| 85 | 85 | return $this->redirectWithForm( |
| 86 | 86 | $payUrl, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $token = Request::input('Token'); |
| 104 | 104 | |
| 105 | 105 | if ($status != 0 || empty($token)) { |
| 106 | - throw new InvalidPaymentException('تراکنش توسط کاربر کنسل شده است.', (int)$status); |
|
| 106 | + throw new InvalidPaymentException('تراکنش توسط کاربر کنسل شده است.', (int) $status); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | $data = $this->prepareVerificationData(); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $hasWrongRRN = (!isset($result->RRN) || $result->RRN <= 0); |
| 120 | 120 | if ($hasWrongStatus || $hasWrongRRN) { |
| 121 | 121 | $message = 'خطا از سمت بانک با کد '.$result->Status.' رخ داده است.'; |
| 122 | - throw new InvalidPaymentException($message, (int)$result->Status); |
|
| 122 | + throw new InvalidPaymentException($message, (int) $result->Status); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $this->createReceipt($result->RRN); |
@@ -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 "کد پین درگاه نمیتواند خالی باشد."; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | private function generateAuthenticationEnvelope($pubKey, $terminalID, $password, $amount) |
| 44 | 44 | { |
| 45 | - $data = $terminalID . $password . str_pad($amount, 12, '0', STR_PAD_LEFT) . '00'; |
|
| 45 | + $data = $terminalID.$password.str_pad($amount, 12, '0', STR_PAD_LEFT).'00'; |
|
| 46 | 46 | $data = hex2bin($data); |
| 47 | 47 | $AESSecretKey = openssl_random_pseudo_bytes(16); |
| 48 | 48 | $ivlen = openssl_cipher_iv_length($cipher = "AES-128-CBC"); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $hmac = hash('sha256', $ciphertext_raw, true); |
| 52 | 52 | $crypttext = ''; |
| 53 | 53 | |
| 54 | - openssl_public_encrypt($AESSecretKey . $hmac, $crypttext, $pubKey); |
|
| 54 | + openssl_public_encrypt($AESSecretKey.$hmac, $crypttext, $pubKey); |
|
| 55 | 55 | |
| 56 | 56 | return array( |
| 57 | 57 | "data" => bin2hex($crypttext), |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 104 | 104 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 105 | 105 | 'Content-Type: application/json', |
| 106 | - 'Content-Length: ' . strlen($dataString) |
|
| 106 | + 'Content-Length: '.strlen($dataString) |
|
| 107 | 107 | )); |
| 108 | 108 | |
| 109 | 109 | $result = curl_exec($ch); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 171 | 171 | curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 172 | 172 | 'Content-Type: application/json', |
| 173 | - 'Content-Length: ' . strlen($dataString) |
|
| 173 | + 'Content-Length: '.strlen($dataString) |
|
| 174 | 174 | )); |
| 175 | 175 | |
| 176 | 176 | $result = curl_exec($ch); |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | 930 => 'کد ملی ارائه شده نا معتبر می باشد)Tokenization(' |
| 265 | 265 | ]; |
| 266 | 266 | if (array_key_exists($status, $translations)) { |
| 267 | - throw new InvalidPaymentException($translations[$status], (int)$status); |
|
| 267 | + throw new InvalidPaymentException($translations[$status], (int) $status); |
|
| 268 | 268 | } else { |
| 269 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status); |
|
| 269 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function __construct(Invoice $invoice, $settings) |
| 53 | 53 | { |
| 54 | 54 | $this->invoice($invoice); |
| 55 | - $this->settings=$settings; |
|
| 55 | + $this->settings = $settings; |
|
| 56 | 56 | $this->client = new Client(); |
| 57 | 57 | $this->oauthToken = $this->oauth(); |
| 58 | 58 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function verify(): ReceiptInterface |
| 115 | 115 | { |
| 116 | - $tracingId=Request::input("trackingCode"); |
|
| 116 | + $tracingId = Request::input("trackingCode"); |
|
| 117 | 117 | |
| 118 | 118 | $response = $this->client->request( |
| 119 | 119 | 'POST', |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | if ($response->getStatusCode() != 200) { |
| 133 | 133 | $message = 'تراکنش تایید نشد'; |
| 134 | 134 | |
| 135 | - throw new InvalidPaymentException($message, (int)$response->getStatusCode()); |
|
| 135 | + throw new InvalidPaymentException($message, (int) $response->getStatusCode()); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | return new Receipt('digipay', $body["trackingCode"]); |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | "grant_type" => 'password', |
| 156 | 156 | ] |
| 157 | 157 | ); |
| 158 | - if ($response->getStatusCode()!=200) { |
|
| 159 | - if ($response->getStatusCode()==401) { |
|
| 158 | + if ($response->getStatusCode() != 200) { |
|
| 159 | + if ($response->getStatusCode() == 401) { |
|
| 160 | 160 | throw new PurchaseFailedException("خطا نام کاربری یا رمز عبور شما اشتباه می باشد."); |
| 161 | 161 | } else { |
| 162 | 162 | throw new PurchaseFailedException("خطا در هنگام احراز هویت."); |
@@ -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 | } |