@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | $certs['cert_id'] = $ssl['serialNumber'] ?? ''; |
| 33 | 33 | |
| 34 | - Pay::get(ConfigInterface::class)->set('unipay.'.$tenant.'.certs', $certs); |
|
| 34 | + Pay::get(ConfigInterface::class)->set('unipay.' . $tenant . '.certs', $certs); |
|
| 35 | 35 | |
| 36 | 36 | return $certs['cert_id']; |
| 37 | 37 | } |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | |
| 36 | 36 | protected function buildHtml(string $endpoint, array $payload): Response |
| 37 | 37 | { |
| 38 | - $sHtml = "<form id='pay_form' name='pay_form' action='".$endpoint."' method='POST'>"; |
|
| 38 | + $sHtml = "<form id='pay_form' name='pay_form' action='" . $endpoint . "' method='POST'>"; |
|
| 39 | 39 | foreach ($payload as $key => $val) { |
| 40 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
| 40 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
| 41 | 41 | } |
| 42 | 42 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
| 43 | 43 | $sHtml .= "<script>document.forms['pay_form'].submit();</script>"; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $direction = Pay::get($direction); |
| 50 | 50 | |
| 51 | 51 | $direction = is_string($direction) ? Pay::get($direction) : $direction; |
| 52 | - } catch (ContainerException|ServiceNotFoundException) { |
|
| 52 | + } catch (ContainerException | ServiceNotFoundException) { |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if (!$direction instanceof DirectionInterface) { |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | return file_get_contents($key); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - return "-----BEGIN RSA PRIVATE KEY-----\n". |
|
| 74 | - wordwrap($key, 64, "\n", true). |
|
| 73 | + return "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
| 74 | + wordwrap($key, 64, "\n", true) . |
|
| 75 | 75 | "\n-----END RSA PRIVATE KEY-----"; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | return $url; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url; |
|
| 178 | + return Wechat::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | function get_wechat_type_key(array $params): string |
| 196 | 196 | { |
| 197 | - $key = ($params['_type'] ?? 'mp').'_app_id'; |
|
| 197 | + $key = ($params['_type'] ?? 'mp') . '_app_id'; |
|
| 198 | 198 | |
| 199 | 199 | if ('app_app_id' === $key) { |
| 200 | 200 | $key = 'app_id'; |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | $buff = ''; |
| 240 | 240 | |
| 241 | 241 | foreach ($payload as $k => $v) { |
| 242 | - $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k.'='.$v.'&' : ''; |
|
| 242 | + $buff .= ('sign' != $k && '' != $v && !is_array($v)) ? $k . '=' . $v . '&' : ''; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $sign = md5($buff.'key='.$key); |
|
| 245 | + $sign = md5($buff . 'key=' . $key); |
|
| 246 | 246 | |
| 247 | 247 | return $upper ? strtoupper($sign) : $sign; |
| 248 | 248 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @throws InvalidSignException |
| 256 | 256 | * @throws ServiceNotFoundException |
| 257 | 257 | */ |
| 258 | -function verify_wechat_sign(ResponseInterface|ServerRequestInterface $message, array $params): void |
|
| 258 | +function verify_wechat_sign(ResponseInterface | ServerRequestInterface $message, array $params): void |
|
| 259 | 259 | { |
| 260 | 260 | if ($message instanceof ServerRequestInterface && 'localhost' === $message->getUri()->getHost()) { |
| 261 | 261 | return; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $sign = $message->getHeaderLine('Wechatpay-Signature'); |
| 268 | 268 | $body = (string) $message->getBody(); |
| 269 | 269 | |
| 270 | - $content = $timestamp."\n".$random."\n".$body."\n"; |
|
| 270 | + $content = $timestamp . "\n" . $random . "\n" . $body . "\n"; |
|
| 271 | 271 | $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null; |
| 272 | 272 | |
| 273 | 273 | if (empty($sign)) { |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | Pay::get(ConfigInterface::class)->set( |
| 332 | - 'wechat.'.get_tenant($params).'.wechat_public_cert_path', |
|
| 332 | + 'wechat.' . get_tenant($params) . '.wechat_public_cert_path', |
|
| 333 | 333 | ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []), |
| 334 | 334 | ); |
| 335 | 335 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | foreach ($config['wechat_public_cert_path'] as $serialNo => $cert) { |
| 363 | - file_put_contents($path.'/'.$serialNo.'.crt', $cert); |
|
| 363 | + file_put_contents($path . '/' . $serialNo . '.crt', $cert); |
|
| 364 | 364 | } |
| 365 | 365 | } |
| 366 | 366 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | /** |
| 393 | 393 | * @throws DecryptException |
| 394 | 394 | */ |
| 395 | -function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array|string |
|
| 395 | +function decrypt_wechat_resource_aes_256_gcm(string $ciphertext, string $secret, string $nonce, string $associatedData): array | string |
|
| 396 | 396 | { |
| 397 | 397 | $decrypted = openssl_decrypt( |
| 398 | 398 | substr($ciphertext, 0, -Wechat::AUTH_TAG_LENGTH_BYTE), |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $publicKey = $config['wechat_public_cert_path'][$serialNo] ?? null; |
| 454 | 454 | |
| 455 | 455 | if (empty($publicKey)) { |
| 456 | - throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -'.$serialNo); |
|
| 456 | + throw new InvalidParamsException(Exception::PARAMS_WECHAT_SERIAL_NOT_FOUND, '参数异常: 微信公钥序列号为找到 -' . $serialNo); |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | return $publicKey; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | return $url; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL].$url; |
|
| 514 | + return Unipay::URL[$config['mode'] ?? Pay::MODE_NORMAL] . $url; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @throws InvalidParamsException |
| 34 | 34 | * @throws ServiceNotFoundException |
| 35 | 35 | */ |
| 36 | - public function shortcut(string $shortcut, array $params = []): null|Collection|MessageInterface|Rocket |
|
| 36 | + public function shortcut(string $shortcut, array $params = []): null | Collection | MessageInterface | Rocket |
|
| 37 | 37 | { |
| 38 | 38 | if (!class_exists($shortcut) || !in_array(ShortcutInterface::class, class_implements($shortcut))) { |
| 39 | 39 | throw new InvalidParamsException(Exception::PARAMS_SHORTCUT_NOT_FOUND, "参数异常: [{$shortcut}] 未实现 `ShortcutInterface`"); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @throws ContainerException |
| 50 | 50 | * @throws InvalidParamsException |
| 51 | 51 | */ |
| 52 | - public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket |
|
| 52 | + public function pay(array $plugins, array $params): null | Collection | MessageInterface | Rocket |
|
| 53 | 53 | { |
| 54 | 54 | Logger::info('[AbstractProvider] 即将进行 pay 操作', func_get_args()); |
| 55 | 55 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } catch (Throwable $e) { |
| 108 | 108 | Logger::error('[AbstractProvider] 请求支付服务商 API 出错', ['message' => $e->getMessage(), 'rocket' => $rocket->toArray(), 'trace' => $e->getTrace()]); |
| 109 | 109 | |
| 110 | - throw new InvalidResponseException(Exception::REQUEST_RESPONSE_ERROR, '响应异常: 请求支付服务商 API 出错 - '.$e->getMessage(), [], $e); |
|
| 110 | + throw new InvalidResponseException(Exception::REQUEST_RESPONSE_ERROR, '响应异常: 请求支付服务商 API 出错 - ' . $e->getMessage(), [], $e); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | Logger::info('[AbstractProvider] 请求支付服务商 API 成功', ['response' => ['status' => $response->getStatusCode(), 'headers' => $response->getHeaders(), 'body' => (string) $response->getBody()], 'rocket' => $rocket->toArray()]); |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | * @throws InvalidParamsException |
| 56 | 56 | * @throws ServiceNotFoundException |
| 57 | 57 | */ |
| 58 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface |
|
| 58 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface |
|
| 59 | 59 | { |
| 60 | - $plugin = '\\Yansongda\\Pay\\Shortcut\\Wechat\\'.Str::studly($shortcut).'Shortcut'; |
|
| 60 | + $plugin = '\\Yansongda\\Pay\\Shortcut\\Wechat\\' . Str::studly($shortcut) . 'Shortcut'; |
|
| 61 | 61 | |
| 62 | 62 | return $this->shortcut($plugin, ...$params); |
| 63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @throws InvalidParamsException |
| 68 | 68 | * @throws ServiceNotFoundException |
| 69 | 69 | */ |
| 70 | - public function query(array $order): Collection|Rocket |
|
| 70 | + public function query(array $order): Collection | Rocket |
|
| 71 | 71 | { |
| 72 | 72 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 73 | 73 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * @throws InvalidParamsException |
| 79 | 79 | */ |
| 80 | - public function cancel(array $order): Collection|Rocket |
|
| 80 | + public function cancel(array $order): Collection | Rocket |
|
| 81 | 81 | { |
| 82 | 82 | throw new InvalidParamsException(Exception::PARAMS_METHOD_NOT_SUPPORTED, '参数异常: 微信不支持 cancel API'); |
| 83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @throws InvalidParamsException |
| 88 | 88 | * @throws ServiceNotFoundException |
| 89 | 89 | */ |
| 90 | - public function close(array $order): Collection|Rocket |
|
| 90 | + public function close(array $order): Collection | Rocket |
|
| 91 | 91 | { |
| 92 | 92 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @throws InvalidParamsException |
| 102 | 102 | * @throws ServiceNotFoundException |
| 103 | 103 | */ |
| 104 | - public function refund(array $order): Collection|Rocket |
|
| 104 | + public function refund(array $order): Collection | Rocket |
|
| 105 | 105 | { |
| 106 | 106 | Event::dispatch(new Event\MethodCalled('wechat', __METHOD__, $order, null)); |
| 107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @throws ContainerException |
| 113 | 113 | * @throws InvalidParamsException |
| 114 | 114 | */ |
| 115 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket |
|
| 115 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket |
|
| 116 | 116 | { |
| 117 | 117 | $request = $this->getCallbackParams($contents); |
| 118 | 118 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | ); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 145 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): ServerRequestInterface |
|
| 146 | 146 | { |
| 147 | 147 | if (is_array($contents) && isset($contents['body'], $contents['headers'])) { |
| 148 | 148 | return new ServerRequest('POST', 'http://localhost', $contents['headers'], $contents['body']); |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @throws InvalidParamsException |
| 43 | 43 | * @throws ServiceNotFoundException |
| 44 | 44 | */ |
| 45 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket |
|
| 45 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket |
|
| 46 | 46 | { |
| 47 | - $plugin = '\\Yansongda\\Pay\\Shortcut\\Unipay\\'.Str::studly($shortcut).'Shortcut'; |
|
| 47 | + $plugin = '\\Yansongda\\Pay\\Shortcut\\Unipay\\' . Str::studly($shortcut) . 'Shortcut'; |
|
| 48 | 48 | |
| 49 | 49 | return $this->shortcut($plugin, ...$params); |
| 50 | 50 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @throws InvalidParamsException |
| 55 | 55 | * @throws ServiceNotFoundException |
| 56 | 56 | */ |
| 57 | - public function query(array $order): Collection|Rocket |
|
| 57 | + public function query(array $order): Collection | Rocket |
|
| 58 | 58 | { |
| 59 | 59 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 60 | 60 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @throws InvalidParamsException |
| 67 | 67 | * @throws ServiceNotFoundException |
| 68 | 68 | */ |
| 69 | - public function cancel(array $order): Collection|Rocket |
|
| 69 | + public function cancel(array $order): Collection | Rocket |
|
| 70 | 70 | { |
| 71 | 71 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * @throws InvalidParamsException |
| 78 | 78 | */ |
| 79 | - public function close(array $order): Collection|Rocket |
|
| 79 | + public function close(array $order): Collection | Rocket |
|
| 80 | 80 | { |
| 81 | 81 | throw new InvalidParamsException(Exception::PARAMS_METHOD_NOT_SUPPORTED, '参数异常: 银联不支持 close API'); |
| 82 | 82 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @throws InvalidParamsException |
| 87 | 87 | * @throws ServiceNotFoundException |
| 88 | 88 | */ |
| 89 | - public function refund(array $order): Collection|Rocket |
|
| 89 | + public function refund(array $order): Collection | Rocket |
|
| 90 | 90 | { |
| 91 | 91 | Event::dispatch(new Event\MethodCalled('unipay', __METHOD__, $order, null)); |
| 92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @throws ContainerException |
| 98 | 98 | * @throws InvalidParamsException |
| 99 | 99 | */ |
| 100 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket |
|
| 100 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket |
|
| 101 | 101 | { |
| 102 | 102 | $request = $this->getCallbackParams($contents); |
| 103 | 103 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection |
|
| 126 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection |
|
| 127 | 127 | { |
| 128 | 128 | if (is_array($contents)) { |
| 129 | 129 | return Collection::wrap($contents); |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @throws InvalidParamsException |
| 49 | 49 | * @throws ServiceNotFoundException |
| 50 | 50 | */ |
| 51 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket |
|
| 51 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket |
|
| 52 | 52 | { |
| 53 | - $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\'.Str::studly($shortcut).'Shortcut'; |
|
| 53 | + $plugin = '\\Yansongda\\Pay\\Shortcut\\Alipay\\' . Str::studly($shortcut) . 'Shortcut'; |
|
| 54 | 54 | |
| 55 | 55 | return $this->shortcut($plugin, ...$params); |
| 56 | 56 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @throws InvalidParamsException |
| 61 | 61 | * @throws ServiceNotFoundException |
| 62 | 62 | */ |
| 63 | - public function query(array $order): Collection|Rocket |
|
| 63 | + public function query(array $order): Collection | Rocket |
|
| 64 | 64 | { |
| 65 | 65 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 66 | 66 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @throws InvalidParamsException |
| 73 | 73 | * @throws ServiceNotFoundException |
| 74 | 74 | */ |
| 75 | - public function cancel(array $order): Collection|Rocket |
|
| 75 | + public function cancel(array $order): Collection | Rocket |
|
| 76 | 76 | { |
| 77 | 77 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @throws InvalidParamsException |
| 85 | 85 | * @throws ServiceNotFoundException |
| 86 | 86 | */ |
| 87 | - public function close(array $order): Collection|Rocket |
|
| 87 | + public function close(array $order): Collection | Rocket |
|
| 88 | 88 | { |
| 89 | 89 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 90 | 90 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @throws InvalidParamsException |
| 97 | 97 | * @throws ServiceNotFoundException |
| 98 | 98 | */ |
| 99 | - public function refund(array $order): Collection|Rocket |
|
| 99 | + public function refund(array $order): Collection | Rocket |
|
| 100 | 100 | { |
| 101 | 101 | Event::dispatch(new Event\MethodCalled('alipay', __METHOD__, $order, null)); |
| 102 | 102 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @throws ContainerException |
| 108 | 108 | * @throws InvalidParamsException |
| 109 | 109 | */ |
| 110 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 110 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
| 111 | 111 | { |
| 112 | 112 | $request = $this->getCallbackParams($contents); |
| 113 | 113 | |
@@ -130,15 +130,14 @@ discard block |
||
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - protected function getCallbackParams(array|ServerRequestInterface $contents = null): Collection |
|
| 133 | + protected function getCallbackParams(array | ServerRequestInterface $contents = null): Collection |
|
| 134 | 134 | { |
| 135 | 135 | if (is_array($contents)) { |
| 136 | 136 | return Collection::wrap($contents); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if ($contents instanceof ServerRequestInterface) { |
| 140 | - return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : |
|
| 141 | - $contents->getParsedBody()); |
|
| 140 | + return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody()); |
|
| 142 | 141 | } |
| 143 | 142 | |
| 144 | 143 | $request = ServerRequest::fromGlobals(); |
@@ -23,8 +23,7 @@ discard block |
||
| 23 | 23 | $radar = $rocket->getRadar(); |
| 24 | 24 | |
| 25 | 25 | $response = 'GET' === $radar->getMethod() ? |
| 26 | - $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : |
|
| 27 | - $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
| 26 | + $this->buildRedirect($radar->getUri()->__toString(), $rocket->getPayload()) : $this->buildHtml($radar->getUri()->__toString(), $rocket->getPayload()); |
|
| 28 | 27 | |
| 29 | 28 | $rocket->setDestination($response); |
| 30 | 29 | |
@@ -35,7 +34,7 @@ discard block |
||
| 35 | 34 | |
| 36 | 35 | protected function buildRedirect(string $endpoint, Collection $payload): Response |
| 37 | 36 | { |
| 38 | - $url = $endpoint.(!str_contains($endpoint, '?') ? '?' : '&').$payload->query(); |
|
| 37 | + $url = $endpoint . (!str_contains($endpoint, '?') ? '?' : '&') . $payload->query(); |
|
| 39 | 38 | |
| 40 | 39 | $content = sprintf( |
| 41 | 40 | '<!DOCTYPE html> |
@@ -58,10 +57,10 @@ discard block |
||
| 58 | 57 | |
| 59 | 58 | protected function buildHtml(string $endpoint, Collection $payload): Response |
| 60 | 59 | { |
| 61 | - $sHtml = "<form id='alipay_submit' name='alipay_submit' action='".$endpoint."' method='POST'>"; |
|
| 60 | + $sHtml = "<form id='alipay_submit' name='alipay_submit' action='" . $endpoint . "' method='POST'>"; |
|
| 62 | 61 | foreach ($payload->all() as $key => $val) { |
| 63 | 62 | $val = str_replace("'", ''', $val); |
| 64 | - $sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>"; |
|
| 63 | + $sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>"; |
|
| 65 | 64 | } |
| 66 | 65 | $sHtml .= "<input type='submit' value='ok' style='display:none;'></form>"; |
| 67 | 66 | $sHtml .= "<script>document.forms['alipay_submit'].submit();</script>"; |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | $destination = $rocket->getDestination(); |
| 25 | 25 | $payload = $rocket->getPayload(); |
| 26 | - $resultKey = str_replace('.', '_', $payload->get('method')).'_response'; |
|
| 26 | + $resultKey = str_replace('.', '_', $payload->get('method')) . '_response'; |
|
| 27 | 27 | |
| 28 | 28 | if (should_do_http_request($rocket->getDirection()) && $destination instanceof Collection) { |
| 29 | 29 | $rocket->setDestination(new Collection(array_merge( |