Passed
Pull Request — master (#132)
by
unknown
02:18
created
src/Drivers/Zarinpal/Strategies/Normal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
         $transactionId = $this->invoice->getTransactionId();
121 121
         $paymentUrl = $this->getPaymentUrl();
122 122
 
123
-        $payUrl = $paymentUrl . $transactionId;
123
+        $payUrl = $paymentUrl.$transactionId;
124 124
 
125 125
         return $this->redirectWithForm($payUrl, [], 'GET');
126 126
     }
Please login to merge, or discard this patch.
src/Drivers/Etebarino/Etebarino.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     public function __construct(Invoice $invoice, $settings)
37 37
     {
38 38
         $this->invoice($invoice);
39
-        $this->settings = (object)$settings;
39
+        $this->settings = (object) $settings;
40 40
     }
41 41
 
42 42
     /**
Please login to merge, or discard this patch.
src/Drivers/Paystar/Paystar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             'sign' =>
82 82
                 hash_hmac(
83 83
                     'SHA512',
84
-                    $amount . '#' . $order_id . '#' . $callback,
84
+                    $amount.'#'.$order_id.'#'.$callback,
85 85
                     $this->settings->signKey
86 86
                 ),
87 87
         ];
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                     'headers' => [
96 96
                         'Content-Type' => 'application/json',
97 97
                         'Accept' => 'application/json',
98
-                        'Authorization' => 'Bearer ' . $this->settings->gatewayId,
98
+                        'Authorization' => 'Bearer '.$this->settings->gatewayId,
99 99
                     ],
100 100
                     'body' => json_encode($data),
101 101
                 ]
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             'sign' =>
154 154
                 hash_hmac(
155 155
                     'SHA512',
156
-                    $amount . '#' . $refNum . '#' . $cardNumber . '#' . $trackingCode,
156
+                    $amount.'#'.$refNum.'#'.$cardNumber.'#'.$trackingCode,
157 157
                     $this->settings->signKey
158 158
                 ),
159 159
         ];
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 'headers' => [
166 166
                     'Content-Type' => 'application/json',
167 167
                     'Accept' => 'application/json',
168
-                    'Authorization' => 'Bearer ' . $this->settings->gatewayId,
168
+                    'Authorization' => 'Bearer '.$this->settings->gatewayId,
169 169
                 ],
170 170
                 'body' => json_encode($data),
171 171
             ]
Please login to merge, or discard this patch.
src/Drivers/Sepordeh/Sepordeh.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
     }
51 51
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
         $responseBody = mb_strtolower($response->getBody()->getContents());
88 88
         $body = @json_decode($responseBody, true);
89
-        $statusCode = (int)$body['status'];
89
+        $statusCode = (int) $body['status'];
90 90
 
91 91
         if ($statusCode !== 200) {
92 92
             // some error has happened
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $basePayUrl = $this->settings->mode == 'normal' ? $this->settings->apiPaymentUrl
144 144
             : $this->settings->apiDirectPaymentUrl;
145
-        $payUrl =  $basePayUrl . $this->invoice->getTransactionId();
145
+        $payUrl = $basePayUrl.$this->invoice->getTransactionId();
146 146
 
147 147
         return $this->redirectWithForm($payUrl, [], 'GET');
148 148
     }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
         $responseBody = mb_strtolower($response->getBody()->getContents());
179 179
         $body = @json_decode($responseBody, true);
180
-        $statusCode = (int)$body['status'];
180
+        $statusCode = (int) $body['status'];
181 181
 
182 182
         if ($statusCode !== 200) {
183 183
             $message = $body['message'] ?? $this->convertStatusCodeToMessage($statusCode);
Please login to merge, or discard this patch.
src/Drivers/Atipay/Atipay.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
                 $error_message = $r['errorMessage'];
139 139
                 throw new InvalidPaymentException($error_message);
140 140
             } else { //success
141
-                $receipt =  $this->createReceipt($data['referenceNumber']);
141
+                $receipt = $this->createReceipt($data['referenceNumber']);
142 142
                 $receipt->detail([
143 143
                     'referenceNo' => $params['referenceNumber'],
144 144
                     'rrn' => Request::input('rrn'),
Please login to merge, or discard this patch.
src/Drivers/Atipay/Core/fn.atipay.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 define('ATIPAY_URL', 'https://mipg.atipay.net/v1/');
4
-define('ATIPAY_TOKEN_URL', ATIPAY_URL . 'get-token');
5
-define('ATIPAY_REDIRECT_TO_PSP_URL', ATIPAY_URL . 'redirect-to-gateway');
6
-define('ATIPAY_VERIFY_URL', ATIPAY_URL . 'verify-payment');
4
+define('ATIPAY_TOKEN_URL', ATIPAY_URL.'get-token');
5
+define('ATIPAY_REDIRECT_TO_PSP_URL', ATIPAY_URL.'redirect-to-gateway');
6
+define('ATIPAY_VERIFY_URL', ATIPAY_URL.'verify-payment');
7 7
 
8 8
 function fn_atipay_get_token($params)
9 9
 {
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
         if (isset($r['status']) && !empty($r['status'])) {
14 14
             $status = $r['status'];
15 15
             if ($status == 1) {
16
-                $return['success']=1;
17
-                $return['token']=$r['token'];
16
+                $return['success'] = 1;
17
+                $return['token'] = $r['token'];
18 18
             } else {
19
-                $return['success']=0;
20
-                $return['errorMessage']=$r['errorDescription'];
19
+                $return['success'] = 0;
20
+                $return['errorMessage'] = $r['errorDescription'];
21 21
             }
22 22
         } else {
23
-            $return['success']=0;
23
+            $return['success'] = 0;
24 24
             if (isset($r['faMessage']) && !empty($r['faMessage'])) {
25 25
                 $return['errorMessage'] = $r['faMessage'];
26 26
             } else {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             }
29 29
         }
30 30
     } else {
31
-        $return['success']=0;
31
+        $return['success'] = 0;
32 32
         $return['errorMessage'] = "خطا در دریافت اطلاعات توکن پرداخت";
33 33
     }
34 34
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 function _fn_generate_get_token_form($params, $submit_text, $action)
62 62
 {
63
-    $form ="<form action='$action' method='POST' align='center' name='atipay_payment_form_token' id='atipay_payment_form_token' >";
63
+    $form = "<form action='$action' method='POST' align='center' name='atipay_payment_form_token' id='atipay_payment_form_token' >";
64 64
     foreach ($params as $k=>$v) {
65 65
         $form .= "<input type='hidden' value='$v' name='$k' >";
66 66
     }
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
     if (isset($params['state']) && !empty($params['state'])) {
78 78
         $state = $params['state'];
79 79
         if ($state == 'OK') {
80
-            $result['success']=1;
81
-            $result['error']="";
80
+            $result['success'] = 1;
81
+            $result['error'] = "";
82 82
         } else {
83
-            $result['success']=0;
84
-            $result['error']= _fn_return_state_text($state);
83
+            $result['success'] = 0;
84
+            $result['error'] = _fn_return_state_text($state);
85 85
         }
86 86
     } else {
87
-        $result['success']=0;
88
-        $result['error']="خطای نامشخص در پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
87
+        $result['success'] = 0;
88
+        $result['error'] = "خطای نامشخص در پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
89 89
     }
90 90
 
91 91
     return $result;
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
     if ($r) {
99 99
         if (isset($r['amount']) && !empty($r['amount'])) {
100 100
             if ($r['amount'] == $amount) {
101
-                $return['success']=1;
102
-                $return['errorMessage']="";
101
+                $return['success'] = 1;
102
+                $return['errorMessage'] = "";
103 103
             } else {
104
-                $return['success']=0;
105
-                $return['errorMessage']="خطا در تایید مبلغ پرداخت.در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
104
+                $return['success'] = 0;
105
+                $return['errorMessage'] = "خطا در تایید مبلغ پرداخت.در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
106 106
             }
107 107
         } else {
108
-            $return['success']=0;
109
-            $return['errorMessage']="خطا در تایید اطلاعات پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
108
+            $return['success'] = 0;
109
+            $return['errorMessage'] = "خطا در تایید اطلاعات پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
110 110
         }
111 111
     } else {
112
-        $return['success']=0;
112
+        $return['success'] = 0;
113 113
         $return['errorMessage'] = "خطا در تایید نهایی پرداخت. در صورتیکه مبلغی از شما کسر شده باشد، برگشت داده می شود.";
114 114
     }
115 115
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     if ($httpcode == "200") {
184 184
         //nothing YET
185 185
     } else {
186
-        $json= json_encode(array('error'=>'Y'));
186
+        $json = json_encode(array('error'=>'Y'));
187 187
     }
188 188
 
189 189
     return $json;
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     if ($httpcode == "200") {
208 208
         return json_decode($json, true);
209 209
     } else {
210
-        $json = array('error'=>'Y','jsonError'=>$httpcode,'message'=>$httpcode);
210
+        $json = array('error'=>'Y', 'jsonError'=>$httpcode, 'message'=>$httpcode);
211 211
     }
212 212
 
213 213
     return $json;
Please login to merge, or discard this patch.
src/Drivers/Fanavacard/Fanavacard.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -135,15 +135,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $transaction_amount = Request::input('transactionAmount');
94 94
 
95
-        if ($this->invoice->getAmount()*10 == $transaction_amount) {
95
+        if ($this->invoice->getAmount() * 10 == $transaction_amount) {
96 96
             $param = ['Token'=>Request::input('token'), 'RefNum'=>Request::input('RefNum')];
97 97
             $response = $this->client->post($this->settings->apiVerificationUrl, [
98 98
                 'json'=> array_merge(
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             $response_data = json_decode($response->getBody()->getContents());
104 104
             if ($response_data->Result != 'erSucceed') {
105 105
                 throw new InvalidPaymentException($response_data->Result);
106
-            } elseif ($this->invoice->getAmount()*10 != $response_data->Amount) {
106
+            } elseif ($this->invoice->getAmount() * 10 != $response_data->Amount) {
107 107
                 $this->client->post(
108 108
                     $this->settings->apiReverseAmountUrl,
109 109
                     [
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
     private function httpClientInit(): void
183 183
     {
184 184
         $this->client = new Client([
185
-                                       'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1',],
185
+                                       'curl'=>[\CURLOPT_SSL_CIPHER_LIST=>'DEFAULT@SECLEVEL=1', ],
186 186
                                        'verify' => false,
187 187
                                        'base_uri' => $this->settings->baseUri,
188
-                                       'headers' => ['Content-Type' => 'application/json',],
188
+                                       'headers' => ['Content-Type' => 'application/json', ],
189 189
                                    ]);
190 190
     }
191 191
 
Please login to merge, or discard this patch.
config/payment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
             'merchantId' => '', //apiKey
117 117
             'apiSecret' => '',
118 118
             'merchantConfigID' => '',
119
-            'tokenStoragePath' => function_exists('storage_path')?storage_path('jibit/'):'jibit/',
119
+            'tokenStoragePath' => function_exists('storage_path') ?storage_path('jibit/') : 'jibit/',
120 120
             'callbackUrl' => 'http://yoursite.com/path/to',
121 121
             'description' => 'payment using jibit',
122 122
         ],
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitBase.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             'password' => $this->secretKey,
38 38
             'amount' => $amount * 10, //convert to toman
39 39
             'referenceNumber' => $referenceNumber,
40
-            'userIdentifier' => $userIdentifier??"1",
40
+            'userIdentifier' => $userIdentifier ?? "1",
41 41
             'callbackUrl' => $callbackUrl,
42 42
             'currency' => $currency,
43 43
             'description' => $description,
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function getOrderById($id)
55 55
     {
56
-        return  $this->callCurl('/orders/' .$id, [], true, 0, 'GET');
56
+        return  $this->callCurl('/orders/'.$id, [], true, 0, 'GET');
57 57
     }
58 58
 
59 59
     /**
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in refresh token.');
92 92
         }
93 93
         if (!empty($result['accessToken'])) {
94
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
94
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
95 95
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
96
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
96
+            $this->setAccessToken('Bearer '.$result['accessToken']);
97 97
             $this->setRefreshToken($result['refreshToken']);
98 98
             return 'ok';
99 99
         }
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
         if ($haveAuth) {
118 118
             $accessToken = $this->getAccessToken();
119 119
         }
120
-        $ch = curl_init($this->base_url . $url);
120
+        $ch = curl_init($this->base_url.$url);
121 121
         curl_setopt($ch, CURLOPT_USERAGENT, 'Jibit.class Rest Api');
122 122
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
123 123
         curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
124 124
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
125 125
         curl_setopt($ch, CURLOPT_HTTPHEADER, array(
126 126
             'Content-Type: application/json',
127
-            'Authorization: ' . $accessToken,
128
-            'Content-Length: ' . strlen($jsonData)
127
+            'Authorization: '.$accessToken,
128
+            'Content-Length: '.strlen($jsonData)
129 129
         ));
130 130
         $result = curl_exec($ch);
131 131
         $err = curl_error($ch);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         curl_close($ch);
134 134
 
135 135
         if ($err) {
136
-            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:' . $err);
136
+            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:'.$err);
137 137
         }
138 138
         if (empty($result['errors'])) {
139 139
             return $result;
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in generate new token.');
186 186
         }
187 187
         if (!empty($result['accessToken'])) {
188
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
188
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
189 189
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
190
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
190
+            $this->setAccessToken('Bearer '.$result['accessToken']);
191 191
             $this->setRefreshToken($result['refreshToken']);
192 192
             return 'ok';
193 193
         }
@@ -204,6 +204,6 @@  discard block
 block discarded – undo
204 204
         $this->generateToken();
205 205
         $data = [
206 206
         ];
207
-        return $this->callCurl('/orders/' . $refNum . '/verify', $data, true, 0, 'GET');
207
+        return $this->callCurl('/orders/'.$refNum.'/verify', $data, true, 0, 'GET');
208 208
     }
209 209
 }
Please login to merge, or discard this patch.