Completed
Push — master ( 66b6ef...2d082c )
by Songda
01:56
created
src/Gateways/Wechat/Support.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     public static function requestApi($endpoint, $data, $cert = false): Collection
150 150
     {
151
-        Log::debug('Request To Wechat Api', [self::$instance->getBaseUri().$endpoint, $data]);
151
+        Log::debug('Request To Wechat Api', [self::$instance->getBaseUri() . $endpoint, $data]);
152 152
 
153 153
         $result = self::$instance->post(
154 154
             $endpoint,
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
         if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') {
166 166
             throw new GatewayException(
167
-                'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg']).($result['err_code_des'] ?? ''),
167
+                'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg']) . ($result['err_code_des'] ?? ''),
168 168
                 $result,
169 169
                 20000
170 170
             );
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $payload['appid'] = self::$instance->getConfig($type, '');
204 204
 
205 205
         if (self::$instance->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) {
206
-            $payload['sub_appid'] = self::$instance->getConfig('sub_'.$type, '');
206
+            $payload['sub_appid'] = self::$instance->getConfig('sub_' . $type, '');
207 207
         }
208 208
 
209 209
         unset($payload['trade_type'], $payload['type']);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
         ksort($data);
239 239
 
240
-        $string = md5(self::getSignContent($data).'&key='.$key);
240
+        $string = md5(self::getSignContent($data) . '&key=' . $key);
241 241
 
242 242
         Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]);
243 243
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $buff = '';
259 259
 
260 260
         foreach ($data as $k => $v) {
261
-            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : '';
261
+            $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : '';
262 262
         }
263 263
 
264 264
         Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]);
@@ -304,8 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
         $xml = '<xml>';
306 306
         foreach ($data as $key => $val) {
307
-            $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' :
308
-                                       '<'.$key.'><![CDATA['.$val.']]></'.$key.'>';
307
+            $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>';
309 308
         }
310 309
         $xml .= '</xml>';
311 310
 
@@ -376,7 +375,7 @@  discard block
 block discarded – undo
376 375
                 $type = 'appid';
377 376
                 break;
378 377
             default:
379
-                $type = $type.'_id';
378
+                $type = $type . '_id';
380 379
         }
381 380
 
382 381
         return $type;
Please login to merge, or discard this patch.
src/Gateways/Wechat/WapGateway.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
 
30 30
         $mweb_url = $this->preOrder($payload)->get('mweb_url');
31 31
 
32
-        $url = is_null(Support::getInstance()->return_url) ? $mweb_url : $mweb_url.
33
-                        '&redirect_url='.urlencode(Support::getInstance()->return_url);
32
+        $url = is_null(Support::getInstance()->return_url) ? $mweb_url : $mweb_url .
33
+                        '&redirect_url=' . urlencode(Support::getInstance()->return_url);
34 34
 
35 35
         return RedirectResponse::create($url);
36 36
     }
Please login to merge, or discard this patch.
src/Gateways/Wechat/MpGateway.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
             'appId'     => !$this->payRequestUseSubAppId ? $payload['appid'] : $payload['sub_appid'],
37 37
             'timeStamp' => strval(time()),
38 38
             'nonceStr'  => Str::random(),
39
-            'package'   => 'prepay_id='.$this->preOrder($payload)->get('prepay_id'),
39
+            'package'   => 'prepay_id=' . $this->preOrder($payload)->get('prepay_id'),
40 40
             'signType'  => 'MD5',
41 41
         ];
42 42
         $pay_request['paySign'] = Support::generateSign($pay_request);
Please login to merge, or discard this patch.
src/Gateways/Wechat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
         $this->payload = array_merge($this->payload, $params);
146 146
 
147
-        $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway';
147
+        $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway';
148 148
 
149 149
         if (class_exists($gateway)) {
150 150
             return $this->makePay($gateway);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $app = new $gateway();
322 322
 
323 323
         if ($app instanceof GatewayInterface) {
324
-            return $app->pay($this->gateway, array_filter($this->payload, function ($value) {
324
+            return $app->pay($this->gateway, array_filter($this->payload, function($value) {
325 325
                 return $value !== '' && !is_null($value);
326 326
             }));
327 327
         }
Please login to merge, or discard this patch.