@@ -135,15 +135,15 @@ discard block |
||
135 | 135 | { |
136 | 136 | $receipt = new Receipt('fanavacard', $referenceId); |
137 | 137 | $receipt->detail([ |
138 | - 'ResNum'=>Request::input('ResNum'), |
|
139 | - 'RefNum'=>Request::input('RefNum'), |
|
140 | - 'token'=>Request::input('token'), |
|
141 | - 'CustomerRefNum'=>Request::input('CustomerRefNum'), |
|
142 | - 'CardMaskPan'=>Request::input('CardMaskPan'), |
|
143 | - 'transactionAmount'=>Request::input('transactionAmount'), |
|
144 | - 'emailAddress'=>Request::input('emailAddress'), |
|
145 | - 'mobileNo'=>Request::input('mobileNo'), |
|
146 | - ]); |
|
138 | + 'ResNum'=>Request::input('ResNum'), |
|
139 | + 'RefNum'=>Request::input('RefNum'), |
|
140 | + 'token'=>Request::input('token'), |
|
141 | + 'CustomerRefNum'=>Request::input('CustomerRefNum'), |
|
142 | + 'CardMaskPan'=>Request::input('CardMaskPan'), |
|
143 | + 'transactionAmount'=>Request::input('transactionAmount'), |
|
144 | + 'emailAddress'=>Request::input('emailAddress'), |
|
145 | + 'mobileNo'=>Request::input('mobileNo'), |
|
146 | + ]); |
|
147 | 147 | return $receipt; |
148 | 148 | } |
149 | 149 | |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | private function httpClientInit(): void |
186 | 186 | { |
187 | 187 | $this->client = new Client([ |
188 | - 'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1',], |
|
189 | - 'verify' => false, |
|
190 | - 'base_uri' => $this->settings->baseUri, |
|
191 | - 'headers' => ['Content-Type' => 'application/json',], |
|
192 | - ]); |
|
188 | + 'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1',], |
|
189 | + 'verify' => false, |
|
190 | + 'base_uri' => $this->settings->baseUri, |
|
191 | + 'headers' => ['Content-Type' => 'application/json',], |
|
192 | + ]); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | private function getWsContext(): array |
@@ -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->httpClientInit(); |
50 | 50 | } |
51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function purchase() |
60 | 60 | { |
61 | 61 | $this->invoice->uuid(crc32($this->invoice->getUuid())); |
62 | - $token = $this->getToken(); |
|
62 | + $token = $this->getToken(); |
|
63 | 63 | $this->invoice->transactionId($token['Token']); |
64 | 64 | |
65 | 65 | return $this->invoice->getTransactionId(); |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | private function httpClientInit(): void |
184 | 184 | { |
185 | 185 | $this->client = new Client([ |
186 | - 'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1',], |
|
186 | + 'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1', ], |
|
187 | 187 | 'verify' => false, |
188 | 188 | 'base_uri' => $this->settings->baseUri, |
189 | - 'headers' => ['Content-Type' => 'application/json',], |
|
189 | + 'headers' => ['Content-Type' => 'application/json', ], |
|
190 | 190 | ]); |
191 | 191 | } |
192 | 192 |
@@ -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 | } |
@@ -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 | } |