@@ -121,7 +121,7 @@ |
||
121 | 121 | * @author yansongda <[email protected]> |
122 | 122 | * |
123 | 123 | * @param string $gateway |
124 | - * @param array $params |
|
124 | + * @param string $params |
|
125 | 125 | * |
126 | 126 | * @throws InvalidGatewayException |
127 | 127 | * |
@@ -135,7 +135,7 @@ |
||
135 | 135 | |
136 | 136 | $this->payload = array_merge($this->payload, $params); |
137 | 137 | |
138 | - $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway'; |
|
138 | + $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway'; |
|
139 | 139 | |
140 | 140 | if (class_exists($gateway)) { |
141 | 141 | return $this->makePay($gateway); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | unset($payload['appid'], $payload['trade_type'], |
39 | - $payload['notify_url'], $payload['spbill_create_ip']); |
|
39 | + $payload['notify_url'], $payload['spbill_create_ip']); |
|
40 | 40 | |
41 | 41 | $payload['sign'] = Support::generateSign($payload); |
42 | 42 |
@@ -30,8 +30,8 @@ |
||
30 | 30 | |
31 | 31 | $data = $this->preOrder($payload); |
32 | 32 | |
33 | - $url = is_null(Support::getInstance()->return_url) ? $data->mweb_url : $data->mweb_url. |
|
34 | - '&redirect_url='.urlencode(Support::getInstance()->return_url); |
|
33 | + $url = is_null(Support::getInstance()->return_url) ? $data->mweb_url : $data->mweb_url . |
|
34 | + '&redirect_url=' . urlencode(Support::getInstance()->return_url); |
|
35 | 35 | |
36 | 36 | return RedirectResponse::create($url); |
37 | 37 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public static function requestApi($endpoint, $data, $cert = false): Collection |
138 | 138 | { |
139 | - Log::debug('Request To Wechat Api', [self::getInstance()->getBaseUri().$endpoint, $data]); |
|
139 | + Log::debug('Request To Wechat Api', [self::getInstance()->getBaseUri() . $endpoint, $data]); |
|
140 | 140 | |
141 | 141 | $result = self::getInstance()->post( |
142 | 142 | $endpoint, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | if (!isset($result['return_code']) || $result['return_code'] != 'SUCCESS' || $result['result_code'] != 'SUCCESS') { |
154 | 154 | throw new GatewayException( |
155 | - 'Get Wechat API Error:'.($result['return_msg'] ?? $result['retmsg']).($result['err_code_des'] ?? ''), |
|
155 | + 'Get Wechat API Error:' . ($result['return_msg'] ?? $result['retmsg']) . ($result['err_code_des'] ?? ''), |
|
156 | 156 | $result, |
157 | 157 | 20000 |
158 | 158 | ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $payload['appid'] = self::getInstance()->getConfig($type, ''); |
192 | 192 | |
193 | 193 | if (self::getInstance()->getConfig('mode', Wechat::MODE_NORMAL) === Wechat::MODE_SERVICE) { |
194 | - $payload['sub_appid'] = self::getInstance()->getConfig('sub_'.$type, ''); |
|
194 | + $payload['sub_appid'] = self::getInstance()->getConfig('sub_' . $type, ''); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | unset($payload['trade_type'], $payload['type']); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | ksort($data); |
227 | 227 | |
228 | - $string = md5(self::getSignContent($data).'&key='.$key); |
|
228 | + $string = md5(self::getSignContent($data) . '&key=' . $key); |
|
229 | 229 | |
230 | 230 | Log::debug('Wechat Generate Sign Before UPPER', [$data, $string]); |
231 | 231 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $buff = ''; |
247 | 247 | |
248 | 248 | foreach ($data as $k => $v) { |
249 | - $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k.'='.$v.'&' : ''; |
|
249 | + $buff .= ($k != 'sign' && $v != '' && !is_array($v)) ? $k . '=' . $v . '&' : ''; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | Log::debug('Wechat Generate Sign Content Before Trim', [$data, $buff]); |
@@ -294,8 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | $xml = '<xml>'; |
296 | 296 | foreach ($data as $key => $val) { |
297 | - $xml .= is_numeric($val) ? '<'.$key.'>'.$val.'</'.$key.'>' : |
|
298 | - '<'.$key.'><![CDATA['.$val.']]></'.$key.'>'; |
|
297 | + $xml .= is_numeric($val) ? '<' . $key . '>' . $val . '</' . $key . '>' : '<' . $key . '><![CDATA[' . $val . ']]></' . $key . '>'; |
|
299 | 298 | } |
300 | 299 | $xml .= '</xml>'; |
301 | 300 | |
@@ -382,7 +381,7 @@ discard block |
||
382 | 381 | $type = 'appid'; |
383 | 382 | break; |
384 | 383 | default: |
385 | - $type = $type.'_id'; |
|
384 | + $type = $type . '_id'; |
|
386 | 385 | } |
387 | 386 | |
388 | 387 | return $type; |
@@ -36,7 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | unset($payload['appid'], $payload['trade_type'], |
39 | - $payload['notify_url'], $payload['spbill_create_ip']); |
|
39 | + $payload['notify_url'], $payload['spbill_create_ip']); |
|
40 | 40 | |
41 | 41 | $payload['sign'] = Support::generateSign($payload); |
42 | 42 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | 'appId' => !$this->payRequestUseSubAppId ? $payload['appid'] : $payload['sub_appid'], |
38 | 38 | 'timeStamp' => strval(time()), |
39 | 39 | 'nonceStr' => Str::random(), |
40 | - 'package' => 'prepay_id='.$this->preOrder($payload)->prepay_id, |
|
40 | + 'package' => 'prepay_id=' . $this->preOrder($payload)->prepay_id, |
|
41 | 41 | 'signType' => 'MD5', |
42 | 42 | ]; |
43 | 43 | $pay_request['paySign'] = Support::generateSign($pay_request); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | $this->payload['biz_content'] = json_encode($params); |
125 | 125 | |
126 | - $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway'; |
|
126 | + $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway'; |
|
127 | 127 | |
128 | 128 | if (class_exists($gateway)) { |
129 | 129 | return $this->makePay($gateway); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $app = new $gateway(); |
333 | 333 | |
334 | 334 | if ($app instanceof GatewayInterface) { |
335 | - return $app->pay($this->gateway, array_filter($this->payload, function ($value) { |
|
335 | + return $app->pay($this->gateway, array_filter($this->payload, function($value) { |
|
336 | 336 | return $value !== '' && !is_null($value); |
337 | 337 | })); |
338 | 338 | } |
@@ -47,10 +47,10 @@ |
||
47 | 47 | */ |
48 | 48 | protected function buildPayHtml($endpoint, $payload): Response |
49 | 49 | { |
50 | - $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$endpoint."' method='POST'>"; |
|
50 | + $sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='" . $endpoint . "' method='POST'>"; |
|
51 | 51 | foreach ($payload as $key => $val) { |
52 | 52 | $val = str_replace("'", ''', $val); |
53 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
53 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
54 | 54 | } |
55 | 55 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
56 | 56 | $sHtml .= "<script>document.forms['alipaysubmit'].submit();</script>"; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | protected function create($method): GatewayApplicationInterface |
75 | 75 | { |
76 | - $gateway = __NAMESPACE__.'\\Gateways\\'.Str::studly($method); |
|
76 | + $gateway = __NAMESPACE__ . '\\Gateways\\' . Str::studly($method); |
|
77 | 77 | |
78 | 78 | if (class_exists($gateway)) { |
79 | 79 | return self::make($gateway); |