Passed
Pull Request — master (#220)
by
unknown
02:36
created
src/Drivers/Irankish/Irankish.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1');
109 109
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
172 172
         curl_setopt($ch, CURLOPT_HTTPHEADER, array(
173 173
             'Content-Type: application/json',
174
-            'Content-Length: ' . strlen($dataString)
174
+            'Content-Length: '.strlen($dataString)
175 175
         ));
176 176
         curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1');
177 177
 
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
             930 => 'کد ملی ارائه شده نا معتبر می باشد)Tokenization('
267 267
         ];
268 268
         if (array_key_exists($status, $translations)) {
269
-            throw new InvalidPaymentException($translations[$status], (int)$status);
269
+            throw new InvalidPaymentException($translations[$status], (int) $status);
270 270
         } else {
271
-            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int)$status);
271
+            throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', (int) $status);
272 272
         }
273 273
     }
274 274
 }
Please login to merge, or discard this patch.
src/Drivers/Toman/Toman.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
         $this->base_url = $this->settings->base_url;
34 34
         $this->shop_slug = $this->settings->shop_slug;
35 35
         $this->auth_code = $this->settings->auth_code;
36
-        $this->code = $this->shop_slug . ':' . $this->auth_code;
37
-        $this->auth_token  = base64_encode($this->code);
36
+        $this->code = $this->shop_slug.':'.$this->auth_code;
37
+        $this->auth_token = base64_encode($this->code);
38 38
     }
39 39
 
40 40
     // Purchase the invoice, save its transactionId and finaly return it.
41 41
     public function purchase()
42 42
     {
43
-        $url = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals";
43
+        $url = $this->base_url."/users/me/shops/".$this->shop_slug."/deals";
44 44
         $data = $this->settings->data;
45 45
 
46
-        $response =  Http::withHeaders([
46
+        $response = Http::withHeaders([
47 47
             'Authorization' => "Basic {$this->auth_token}",
48 48
             "Content-Type" => 'application/json'
49 49
         ])->post($url, $data);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function pay(): RedirectionForm
63 63
     {
64 64
         $transactionId = $this->invoice->getTransactionId();
65
-        $redirect_url = $this->base_url . '/deals/' . $transactionId . '/redirect';
65
+        $redirect_url = $this->base_url.'/deals/'.$transactionId.'/redirect';
66 66
 
67 67
         return $this->redirectWithForm($redirect_url, [], 'GET');
68 68
     }
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
         $inputs = request()->all();
74 74
 
75 75
         $transactionId = $this->invoice->getTransactionId();
76
-        $verifyUrl = $this->base_url . "/users/me/shops/" . $this->shop_slug . "/deals/" . $transactionId . "/verify";
76
+        $verifyUrl = $this->base_url."/users/me/shops/".$this->shop_slug."/deals/".$transactionId."/verify";
77 77
 
78 78
         if ($inputs['state'] == 'funded') {
79
-            $result =  Http::withHeaders([
79
+            $result = Http::withHeaders([
80 80
                 'Authorization' => "Basic {$this->auth_token}",
81 81
                 "Content-Type" => 'application/json'
82 82
             ])->patch($verifyUrl);
Please login to merge, or discard this patch.
src/Drivers/Fanavacard/Fanavacard.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function __construct(Invoice $invoice, $settings)
47 47
     {
48 48
         $this->invoice($invoice);
49
-        $this->settings = (object)$settings;
49
+        $this->settings = (object) $settings;
50 50
         $this->httpClientInit();
51 51
     }
52 52
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     public function purchase()
61 61
     {
62 62
         $this->invoice->uuid(crc32($this->invoice->getUuid()));
63
-        $token  = $this->getToken();
63
+        $token = $this->getToken();
64 64
         $this->invoice->transactionId($token['Token']);
65 65
 
66 66
         return $this->invoice->getTransactionId();
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
     private function httpClientInit(): void
185 185
     {
186 186
         $this->client = new Client([
187
-                                       'curl'=>[CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1',],
187
+                                       'curl'=>[CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1', ],
188 188
                                        'verify' => false,
189 189
                                        'base_uri' => $this->settings->baseUri,
190
-                                       'headers' => ['Content-Type' => 'application/json',],
190
+                                       'headers' => ['Content-Type' => 'application/json', ],
191 191
                                    ]);
192 192
     }
193 193
 
Please login to merge, or discard this patch.
src/Drivers/Zarinpal/Strategies/Normal.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $transactionId = $this->invoice->getTransactionId();
122 122
         $paymentUrl = $this->getPaymentUrl();
123 123
 
124
-        $payUrl = $paymentUrl . $transactionId;
124
+        $payUrl = $paymentUrl.$transactionId;
125 125
 
126 126
         return $this->redirectWithForm($payUrl, [], 'GET');
127 127
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
         $refId = $result['data']['ref_id'];
165 165
 
166
-        $receipt =  $this->createReceipt($refId);
166
+        $receipt = $this->createReceipt($refId);
167 167
         $receipt->detail([
168 168
             'code' => $result['data']['code'],
169 169
             'message' => $result['data']['message'] ?? null,
Please login to merge, or discard this patch.
src/Drivers/Digipay/Digipay.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function __construct(Invoice $invoice, $settings)
53 53
     {
54 54
         $this->invoice($invoice);
55
-        $this->settings= (object) $settings;
55
+        $this->settings = (object) $settings;
56 56
         $this->client = new Client();
57 57
         $this->oauthToken = $this->oauth();
58 58
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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("خطا در هنگام احراز هویت.");
Please login to merge, or discard this patch.
src/Drivers/Parsian/Parsian.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         $token = Request::input('Token');
108 108
 
109 109
         if ($status != 0 || empty($token)) {
110
-            throw new InvalidPaymentException('تراکنش توسط کاربر کنسل شده است.', (int)$status);
110
+            throw new InvalidPaymentException('تراکنش توسط کاربر کنسل شده است.', (int) $status);
111 111
         }
112 112
 
113 113
         $data = $this->prepareVerificationData();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         $hasWrongRRN = (!isset($result->RRN) || $result->RRN <= 0);
124 124
         if ($hasWrongStatus || $hasWrongRRN) {
125 125
             $message = 'خطا از سمت بانک با کد '.$result->Status.' رخ داده است.';
126
-            throw new InvalidPaymentException($message, (int)$result->Status);
126
+            throw new InvalidPaymentException($message, (int) $result->Status);
127 127
         }
128 128
 
129 129
         return $this->createReceipt($result->RRN);
Please login to merge, or discard this patch.
src/Drivers/Jibit/Jibit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitClient.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Drivers/Paystar/Paystar.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         if (!empty($this->settings->signKey)) {
85 85
             $data['sign'] = hash_hmac(
86 86
                 'SHA512',
87
-                $amount . '#' . $order_id . '#' . $callback,
87
+                $amount.'#'.$order_id.'#'.$callback,
88 88
                 $this->settings->signKey
89 89
             );
90 90
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     'headers' => [
99 99
                         'Content-Type' => 'application/json',
100 100
                         'Accept' => 'application/json',
101
-                        'Authorization' => 'Bearer ' . $this->settings->gatewayId,
101
+                        'Authorization' => 'Bearer '.$this->settings->gatewayId,
102 102
                     ],
103 103
                     'body' => json_encode($data),
104 104
                 ]
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         if (!empty($this->settings->signKey)) {
164 164
             $data['sign'] = hash_hmac(
165 165
                 'SHA512',
166
-                $amount . '#' . $order_id . '#' . $callback,
166
+                $amount.'#'.$order_id.'#'.$callback,
167 167
                 $this->settings->signKey
168 168
             );
169 169
         }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                 'headers' => [
176 176
                     'Content-Type' => 'application/json',
177 177
                     'Accept' => 'application/json',
178
-                    'Authorization' => 'Bearer ' . $this->settings->gatewayId,
178
+                    'Authorization' => 'Bearer '.$this->settings->gatewayId,
179 179
                 ],
180 180
                 'body' => json_encode($data),
181 181
             ]
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $body = json_decode($response->getBody()->getContents());
185 185
 
186 186
         if ($body->status !== 1) {
187
-            throw new InvalidPaymentException($this->translateStatus($body->status), (int)$body->status);
187
+            throw new InvalidPaymentException($this->translateStatus($body->status), (int) $body->status);
188 188
         }
189 189
 
190 190
         return $this->createReceipt($refNum);
Please login to merge, or discard this patch.