@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | $requestResult = $this->jibit->paymentRequest($this->invoice->getAmount(), $this->invoice->getUuid(), $this->invoice->getDetail('mobile'), $this->settings->callbackUrl); |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - if (! empty($requestResult['pspSwitchingUrl'])) { |
|
| 60 | + if (!empty($requestResult['pspSwitchingUrl'])) { |
|
| 61 | 61 | $this->paymentUrl = $requestResult['pspSwitchingUrl']; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if (! empty($requestResult['errors'])) { |
|
| 65 | - $errMsgs = array_map(function ($err) { |
|
| 64 | + if (!empty($requestResult['errors'])) { |
|
| 65 | + $errMsgs = array_map(function($err) { |
|
| 66 | 66 | return $err['code']; |
| 67 | 67 | }, $requestResult['errors']); |
| 68 | 68 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $requestResult = $this->jibit->paymentVerify($purchaseId); |
| 105 | 105 | |
| 106 | - if (! empty($requestResult['status']) && $requestResult['status'] === 'SUCCESSFUL') { |
|
| 106 | + if (!empty($requestResult['status']) && $requestResult['status'] === 'SUCCESSFUL') { |
|
| 107 | 107 | $order = $this->jibit->getOrderById($purchaseId); |
| 108 | 108 | |
| 109 | 109 | $receipt = new Receipt('jibit', $purchaseId); |
@@ -124,8 +124,8 @@ |
||
| 124 | 124 | 'apiPaymentUrl' => 'https://napi.jibit.ir/ppg/v3', |
| 125 | 125 | 'apiKey' => '', |
| 126 | 126 | 'secretKey' => '', |
| 127 | - // You can change the token storage path in Laravel like this |
|
| 128 | - // 'tokenStoragePath' => function_exists('storage_path') ? storage_path('jibit/') : 'jibit/' |
|
| 127 | + // You can change the token storage path in Laravel like this |
|
| 128 | + // 'tokenStoragePath' => function_exists('storage_path') ? storage_path('jibit/') : 'jibit/' |
|
| 129 | 129 | 'tokenStoragePath' => 'jibit/', |
| 130 | 130 | 'callbackUrl' => 'http://yoursite.com/path/to', |
| 131 | 131 | 'description' => 'payment using jibit', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function getOrderById($id) |
| 106 | 106 | { |
| 107 | - return $this->callCurl('/purchases?purchaseId=' . $id, [], true, 0, 'GET'); |
|
| 107 | + return $this->callCurl('/purchases?purchaseId='.$id, [], true, 0, 'GET'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (!empty($result['accessToken'])) { |
| 154 | - $this->cache->set('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60); |
|
| 154 | + $this->cache->set('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60); |
|
| 155 | 155 | $this->cache->set('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60); |
| 156 | 156 | |
| 157 | - $this->setAccessToken('Bearer ' . $result['accessToken']); |
|
| 157 | + $this->setAccessToken('Bearer '.$result['accessToken']); |
|
| 158 | 158 | $this->setRefreshToken($result['refreshToken']); |
| 159 | 159 | |
| 160 | 160 | return 'ok'; |
@@ -184,15 +184,15 @@ discard block |
||
| 184 | 184 | $accessToken = $this->getAccessToken(); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - $ch = curl_init($this->baseUrl . $url); |
|
| 187 | + $ch = curl_init($this->baseUrl.$url); |
|
| 188 | 188 | curl_setopt($ch, CURLOPT_USERAGENT, 'Jibit.class Rest Api'); |
| 189 | 189 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); |
| 190 | 190 | curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); |
| 191 | 191 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 192 | 192 | curl_setopt($ch, CURLOPT_HTTPHEADER, [ |
| 193 | 193 | 'Content-Type: application/json', |
| 194 | - 'Authorization: ' . $accessToken, |
|
| 195 | - 'Content-Length: ' . strlen($jsonData) |
|
| 194 | + 'Authorization: '.$accessToken, |
|
| 195 | + 'Content-Length: '.strlen($jsonData) |
|
| 196 | 196 | ]); |
| 197 | 197 | |
| 198 | 198 | $result = curl_exec($ch); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | curl_close($ch); |
| 202 | 202 | |
| 203 | 203 | if ($err) { |
| 204 | - throw new PurchaseFailedException('cURL Error #:' . $err); |
|
| 204 | + throw new PurchaseFailedException('cURL Error #:'.$err); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | if (empty($result['errors'])) { |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | throw new PurchaseFailedException('Token generation encoutered an error.'); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (! empty($result['accessToken'])) { |
|
| 275 | - $this->cache->set('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60); |
|
| 274 | + if (!empty($result['accessToken'])) { |
|
| 275 | + $this->cache->set('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60); |
|
| 276 | 276 | $this->cache->set('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60); |
| 277 | 277 | |
| 278 | - $this->setAccessToken('Bearer ' . $result['accessToken']); |
|
| 278 | + $this->setAccessToken('Bearer '.$result['accessToken']); |
|
| 279 | 279 | $this->setRefreshToken($result['refreshToken']); |
| 280 | 280 | |
| 281 | 281 | return 'ok'; |
@@ -296,6 +296,6 @@ discard block |
||
| 296 | 296 | $this->generateToken(); |
| 297 | 297 | $data = []; |
| 298 | 298 | |
| 299 | - return $this->callCurl('/purchases/' . $purchaseId . '/verify', $data, true, 0, 'GET'); |
|
| 299 | + return $this->callCurl('/purchases/'.$purchaseId.'/verify', $data, true, 0, 'GET'); |
|
| 300 | 300 | } |
| 301 | 301 | } |