@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $this->payload['biz_content'] = json_encode($params); |
143 | 143 | |
144 | - $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway'; |
|
144 | + $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway'; |
|
145 | 145 | |
146 | 146 | if (class_exists($gateway)) { |
147 | 147 | return $this->makePay($gateway); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function find($order, string $type = 'wap'): Collection |
204 | 204 | { |
205 | - $gateway = get_class($this).'\\'.Str::studly($type).'Gateway'; |
|
205 | + $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway'; |
|
206 | 206 | |
207 | 207 | if (!class_exists($gateway) || !is_callable([new $gateway(), 'find'])) { |
208 | 208 | throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method"); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $app = new $gateway(); |
390 | 390 | |
391 | 391 | if ($app instanceof GatewayInterface) { |
392 | - return $app->pay($this->gateway, array_filter($this->payload, function ($value) { |
|
392 | + return $app->pay($this->gateway, array_filter($this->payload, function($value) { |
|
393 | 393 | return '' !== $value && !is_null($value); |
394 | 394 | })); |
395 | 395 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | Events::dispatch(new Events\MethodCalled( |
428 | 428 | 'Alipay', |
429 | - 'extend - '.$method, |
|
429 | + 'extend - ' . $method, |
|
430 | 430 | $this->gateway, |
431 | 431 | is_array($customize) ? $customize : $customize->toArray() |
432 | 432 | )); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $this->payload = array_merge($this->payload, $params); |
149 | 149 | |
150 | - $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway'; |
|
150 | + $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway'; |
|
151 | 151 | |
152 | 152 | if (class_exists($gateway)) { |
153 | 153 | return $this->makePay($gateway); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | unset($this->payload['spbill_create_ip']); |
213 | 213 | } |
214 | 214 | |
215 | - $gateway = get_class($this).'\\'.Str::studly($type).'Gateway'; |
|
215 | + $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway'; |
|
216 | 216 | |
217 | 217 | if (!class_exists($gateway) || !is_callable([new $gateway(), 'find'])) { |
218 | 218 | throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method"); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | ); |
356 | 356 | |
357 | 357 | if (is_array($result)) { |
358 | - throw new GatewayException('Get Wechat API Error: '.$result['return_msg'], $result); |
|
358 | + throw new GatewayException('Get Wechat API Error: ' . $result['return_msg'], $result); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | return $result; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $app = new $gateway(); |
378 | 378 | |
379 | 379 | if ($app instanceof GatewayInterface) { |
380 | - return $app->pay($this->gateway, array_filter($this->payload, function ($value) { |
|
380 | + return $app->pay($this->gateway, array_filter($this->payload, function($value) { |
|
381 | 381 | return '' !== $value && !is_null($value); |
382 | 382 | })); |
383 | 383 | } |
@@ -71,13 +71,13 @@ |
||
71 | 71 | protected function buildPayHtml($endpoint, $payload, $method = 'POST'): Response |
72 | 72 | { |
73 | 73 | if ('GET' === strtoupper($method)) { |
74 | - return RedirectResponse::create($endpoint.'&'.http_build_query($payload)); |
|
74 | + return RedirectResponse::create($endpoint . '&' . http_build_query($payload)); |
|
75 | 75 | } |
76 | 76 | |
77 | - $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='".$method."'>"; |
|
77 | + $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='" . $method . "'>"; |
|
78 | 78 | foreach ($payload as $key => $val) { |
79 | 79 | $val = str_replace("'", ''', $val); |
80 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
80 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
81 | 81 | } |
82 | 82 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
83 | 83 | $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>"; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | Events::dispatch(new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data)); |
145 | 145 | |
146 | - $data = array_filter($data, function ($value) { |
|
146 | + $data = array_filter($data, function($value) { |
|
147 | 147 | return ('' == $value || is_null($value)) ? false : true; |
148 | 148 | }); |
149 | 149 | |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | |
176 | 176 | if (Str::endsWith($privateKey, '.pem')) { |
177 | 177 | $privateKey = openssl_pkey_get_private( |
178 | - Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey |
|
178 | + Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://' . $privateKey |
|
179 | 179 | ); |
180 | - } else { |
|
181 | - $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
182 | - wordwrap($privateKey, 64, "\n", true). |
|
180 | + }else { |
|
181 | + $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
182 | + wordwrap($privateKey, 64, "\n", true) . |
|
183 | 183 | "\n-----END RSA PRIVATE KEY-----"; |
184 | 184 | } |
185 | 185 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | $publicKey = file_get_contents($publicKey); |
222 | 222 | } elseif (Str::endsWith($publicKey, '.pem')) { |
223 | 223 | $publicKey = openssl_pkey_get_public( |
224 | - Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://'.$publicKey |
|
224 | + Str::startsWith($publicKey, 'file://') ? $publicKey : 'file://' . $publicKey |
|
225 | 225 | ); |
226 | - } else { |
|
227 | - $publicKey = "-----BEGIN PUBLIC KEY-----\n". |
|
228 | - wordwrap($publicKey, 64, "\n", true). |
|
226 | + }else { |
|
227 | + $publicKey = "-----BEGIN PUBLIC KEY-----\n" . |
|
228 | + wordwrap($publicKey, 64, "\n", true) . |
|
229 | 229 | "\n-----END PUBLIC KEY-----"; |
230 | 230 | } |
231 | 231 | |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | $stringToBeSigned = ''; |
260 | 260 | foreach ($data as $k => $v) { |
261 | 261 | if ($verify && 'sign' != $k && 'sign_type' != $k) { |
262 | - $stringToBeSigned .= $k.'='.$v.'&'; |
|
262 | + $stringToBeSigned .= $k . '=' . $v . '&'; |
|
263 | 263 | } |
264 | 264 | if (!$verify && '' !== $v && !is_null($v) && 'sign' != $k && '@' != substr($v, 0, 1)) { |
265 | - $stringToBeSigned .= $k.'='.$v.'&'; |
|
265 | + $stringToBeSigned .= $k . '=' . $v . '&'; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -338,12 +338,12 @@ discard block |
||
338 | 338 | */ |
339 | 339 | protected static function processingApiResult($data, $result): Collection |
340 | 340 | { |
341 | - $method = str_replace('.', '_', $data['method']).'_response'; |
|
341 | + $method = str_replace('.', '_', $data['method']) . '_response'; |
|
342 | 342 | |
343 | 343 | if (!isset($result['sign']) || '10000' != $result[$method]['code']) { |
344 | 344 | throw new GatewayException( |
345 | - 'Get Alipay API Error:'.$result[$method]['msg']. |
|
346 | - (isset($result[$method]['sub_code']) ? (' - '.$result[$method]['sub_code']) : ''), |
|
345 | + 'Get Alipay API Error:' . $result[$method]['msg'] . |
|
346 | + (isset($result[$method]['sub_code']) ? (' - ' . $result[$method]['sub_code']) : ''), |
|
347 | 347 | $result |
348 | 348 | ); |
349 | 349 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $_issuer = implode(',', array_reverse($issuer_arr)); |
459 | 459 | if (strpos($_certdata['serialNumber'], '0x') === 0) { |
460 | 460 | $serialNumber = self::bchexdec($_certdata['serialNumber']); |
461 | - } else { |
|
461 | + }else { |
|
462 | 462 | $serialNumber = $_certdata['serialNumber']; |
463 | 463 | } |
464 | 464 | $md5_arr[] = md5($_issuer . $serialNumber); |