@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | Events::dispatch(Events::API_REQUESTING, new Events\ApiRequesting('Alipay', '', self::$instance->getBaseUri(), $data)); |
127 | 127 | |
128 | - $data = array_filter($data, function ($value) { |
|
128 | + $data = array_filter($data, function($value) { |
|
129 | 129 | return ($value == '' || is_null($value)) ? false : true; |
130 | 130 | }); |
131 | 131 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected static function processingApiResult($data, $result): Collection |
156 | 156 | { |
157 | - $method = str_replace('.', '_', $data['method']).'_response'; |
|
157 | + $method = str_replace('.', '_', $data['method']) . '_response'; |
|
158 | 158 | |
159 | 159 | if (!isset($result['sign']) || $result[$method]['code'] != '10000') { |
160 | 160 | throw new GatewayException( |
161 | - 'Get Alipay API Error:'.$result[$method]['msg'].($result[$method]['sub_code'] ?? ''), |
|
161 | + 'Get Alipay API Error:' . $result[$method]['msg'] . ($result[$method]['sub_code'] ?? ''), |
|
162 | 162 | $result |
163 | 163 | ); |
164 | 164 | } |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | if (Str::endsWith($privateKey, '.pem')) { |
195 | 195 | $privateKey = openssl_pkey_get_private($privateKey); |
196 | - } else { |
|
197 | - $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n". |
|
198 | - wordwrap($privateKey, 64, "\n", true). |
|
196 | + }else { |
|
197 | + $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
198 | + wordwrap($privateKey, 64, "\n", true) . |
|
199 | 199 | "\n-----END RSA PRIVATE KEY-----"; |
200 | 200 | } |
201 | 201 | |
@@ -231,16 +231,15 @@ discard block |
||
231 | 231 | |
232 | 232 | if (Str::endsWith($publicKey, '.pem')) { |
233 | 233 | $publicKey = openssl_pkey_get_public($publicKey); |
234 | - } else { |
|
235 | - $publicKey = "-----BEGIN PUBLIC KEY-----\n". |
|
236 | - wordwrap($publicKey, 64, "\n", true). |
|
234 | + }else { |
|
235 | + $publicKey = "-----BEGIN PUBLIC KEY-----\n" . |
|
236 | + wordwrap($publicKey, 64, "\n", true) . |
|
237 | 237 | "\n-----END PUBLIC KEY-----"; |
238 | 238 | } |
239 | 239 | |
240 | 240 | $sign = $sign ?? $data['sign']; |
241 | 241 | |
242 | - $toVerify = $sync ? mb_convert_encoding(json_encode($data, JSON_UNESCAPED_UNICODE), 'gb2312', 'utf-8') : |
|
243 | - self::getSignContent($data, true); |
|
242 | + $toVerify = $sync ? mb_convert_encoding(json_encode($data, JSON_UNESCAPED_UNICODE), 'gb2312', 'utf-8') : self::getSignContent($data, true); |
|
244 | 243 | |
245 | 244 | return openssl_verify($toVerify, base64_decode($sign), $publicKey, OPENSSL_ALGO_SHA256) === 1; |
246 | 245 | } |
@@ -264,10 +263,10 @@ discard block |
||
264 | 263 | $stringToBeSigned = ''; |
265 | 264 | foreach ($data as $k => $v) { |
266 | 265 | if ($verify && $k != 'sign' && $k != 'sign_type') { |
267 | - $stringToBeSigned .= $k.'='.$v.'&'; |
|
266 | + $stringToBeSigned .= $k . '=' . $v . '&'; |
|
268 | 267 | } |
269 | 268 | if (!$verify && $v !== '' && !is_null($v) && $k != 'sign' && '@' != substr($v, 0, 1)) { |
270 | - $stringToBeSigned .= $k.'='.$v.'&'; |
|
269 | + $stringToBeSigned .= $k . '=' . $v . '&'; |
|
271 | 270 | } |
272 | 271 | } |
273 | 272 |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | $this->payload['biz_content'] = json_encode($params); |
127 | 127 | |
128 | - $gateway = get_class($this).'\\'.Str::studly($gateway).'Gateway'; |
|
128 | + $gateway = get_class($this) . '\\' . Str::studly($gateway) . 'Gateway'; |
|
129 | 129 | |
130 | 130 | if (class_exists($gateway)) { |
131 | 131 | return $this->makePay($gateway); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $type = $type === true ? 'refund' : 'transfer'; |
196 | 196 | } |
197 | 197 | |
198 | - $gateway = get_class($this).'\\'.Str::studly($type).'Gateway'; |
|
198 | + $gateway = get_class($this) . '\\' . Str::studly($type) . 'Gateway'; |
|
199 | 199 | |
200 | 200 | if (!class_exists($gateway) || !is_callable([$gateway, 'find'])) { |
201 | 201 | throw new GatewayException("{$gateway} Done Not Exist Or Done Not Has FIND Method"); |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $app = new $gateway(); |
341 | 341 | |
342 | 342 | if ($app instanceof GatewayInterface) { |
343 | - return $app->pay($this->gateway, array_filter($this->payload, function ($value) { |
|
343 | + return $app->pay($this->gateway, array_filter($this->payload, function($value) { |
|
344 | 344 | return $value !== '' && !is_null($value); |
345 | 345 | })); |
346 | 346 | } |