@@ -75,7 +75,7 @@ |
||
75 | 75 | 'wxappid' => $config[$wechatTypeKey] ?? '', |
76 | 76 | 'mch_id' => $config['mch_id'] ?? '', |
77 | 77 | 'sub_mch_id' => $payload->get('sub_mch_id', $config['sub_mch_id'] ?? ''), |
78 | - 'msgappid' => $config['sub_'.$wechatTypeKey], |
|
78 | + 'msgappid' => $config['sub_' . $wechatTypeKey], |
|
79 | 79 | ]; |
80 | 80 | } |
81 | 81 | } |
@@ -28,14 +28,14 @@ |
||
28 | 28 | |
29 | 29 | $destination = $rocket->getDestination(); |
30 | 30 | $payload = $rocket->getPayload(); |
31 | - $resultKey = str_replace('.', '_', $payload->get('method')).'_response'; |
|
31 | + $resultKey = str_replace('.', '_', $payload->get('method')) . '_response'; |
|
32 | 32 | |
33 | 33 | if (should_do_http_request($rocket->getDirection()) && $destination instanceof Collection) { |
34 | 34 | $sign = $destination->get('sign', ''); |
35 | 35 | $response = $destination->get($resultKey, $destination->all()); |
36 | 36 | |
37 | 37 | if (empty($sign) && '10000' !== ($response['code'] ?? 'null')) { |
38 | - throw new InvalidResponseException(Exception::RESPONSE_BUSINESS_CODE_WRONG, '支付宝网关响应异常: '.($response['sub_msg'] ?? $response['msg'] ?? '未知错误,请查看支付宝原始响应'), $rocket->getDestination()); |
|
38 | + throw new InvalidResponseException(Exception::RESPONSE_BUSINESS_CODE_WRONG, '支付宝网关响应异常: ' . ($response['sub_msg'] ?? $response['msg'] ?? '未知错误,请查看支付宝原始响应'), $rocket->getDestination()); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $rocket->setDestination(new Collection(array_merge( |
@@ -50,8 +50,8 @@ |
||
50 | 50 | ->setPayload(array_merge( |
51 | 51 | [ |
52 | 52 | '_method' => 'POST', |
53 | - '_url' => 'v3/pay/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
54 | - '_service_url' => 'v3/pay/partner/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
53 | + '_url' => 'v3/pay/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
54 | + '_service_url' => 'v3/pay/partner/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
55 | 55 | ], |
56 | 56 | $data ?? $this->normal($config) |
57 | 57 | )); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @throws InvalidParamsException |
53 | 53 | * @throws ServiceNotFoundException |
54 | 54 | */ |
55 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket |
|
55 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket |
|
56 | 56 | { |
57 | - $plugin = '\Yansongda\Pay\Shortcut\Alipay\\'.Str::studly($shortcut).'Shortcut'; |
|
57 | + $plugin = '\Yansongda\Pay\Shortcut\Alipay\\' . Str::studly($shortcut) . 'Shortcut'; |
|
58 | 58 | |
59 | 59 | return Artful::shortcut($plugin, ...$params); |
60 | 60 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @throws ContainerException |
64 | 64 | * @throws InvalidParamsException |
65 | 65 | */ |
66 | - public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket |
|
66 | + public function pay(array $plugins, array $params): null | Collection | MessageInterface | Rocket |
|
67 | 67 | { |
68 | 68 | return Artful::artful($plugins, $params); |
69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @throws InvalidParamsException |
74 | 74 | * @throws ServiceNotFoundException |
75 | 75 | */ |
76 | - public function query(array $order): Collection|Rocket |
|
76 | + public function query(array $order): Collection | Rocket |
|
77 | 77 | { |
78 | 78 | Event::dispatch(new MethodCalled('alipay', __METHOD__, $order, null)); |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @throws InvalidParamsException |
86 | 86 | * @throws ServiceNotFoundException |
87 | 87 | */ |
88 | - public function cancel(array $order): Collection|Rocket |
|
88 | + public function cancel(array $order): Collection | Rocket |
|
89 | 89 | { |
90 | 90 | Event::dispatch(new MethodCalled('alipay', __METHOD__, $order, null)); |
91 | 91 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @throws InvalidParamsException |
98 | 98 | * @throws ServiceNotFoundException |
99 | 99 | */ |
100 | - public function close(array $order): Collection|Rocket |
|
100 | + public function close(array $order): Collection | Rocket |
|
101 | 101 | { |
102 | 102 | Event::dispatch(new MethodCalled('alipay', __METHOD__, $order, null)); |
103 | 103 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @throws InvalidParamsException |
110 | 110 | * @throws ServiceNotFoundException |
111 | 111 | */ |
112 | - public function refund(array $order): Collection|Rocket |
|
112 | + public function refund(array $order): Collection | Rocket |
|
113 | 113 | { |
114 | 114 | Event::dispatch(new MethodCalled('alipay', __METHOD__, $order, null)); |
115 | 115 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @throws ContainerException |
121 | 121 | * @throws InvalidParamsException |
122 | 122 | */ |
123 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
123 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection |
|
124 | 124 | { |
125 | 125 | $request = $this->getCallbackParams($contents); |
126 | 126 | |
@@ -143,15 +143,14 @@ discard block |
||
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection |
|
146 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection |
|
147 | 147 | { |
148 | 148 | if (is_array($contents)) { |
149 | 149 | return Collection::wrap($contents); |
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($contents instanceof ServerRequestInterface) { |
153 | - return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : |
|
154 | - $contents->getParsedBody()); |
|
153 | + return Collection::wrap('GET' === $contents->getMethod() ? $contents->getQueryParams() : $contents->getParsedBody()); |
|
155 | 154 | } |
156 | 155 | |
157 | 156 | $request = ServerRequest::fromGlobals(); |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @throws InvalidParamsException |
50 | 50 | * @throws ServiceNotFoundException |
51 | 51 | */ |
52 | - public function __call(string $shortcut, array $params): null|Collection|MessageInterface|Rocket |
|
52 | + public function __call(string $shortcut, array $params): null | Collection | MessageInterface | Rocket |
|
53 | 53 | { |
54 | - $plugin = '\Yansongda\Pay\Shortcut\Unipay\\'.Str::studly($shortcut).'Shortcut'; |
|
54 | + $plugin = '\Yansongda\Pay\Shortcut\Unipay\\' . Str::studly($shortcut) . 'Shortcut'; |
|
55 | 55 | |
56 | 56 | return Artful::shortcut($plugin, ...$params); |
57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @throws ContainerException |
61 | 61 | * @throws InvalidParamsException |
62 | 62 | */ |
63 | - public function pay(array $plugins, array $params): null|Collection|MessageInterface|Rocket |
|
63 | + public function pay(array $plugins, array $params): null | Collection | MessageInterface | Rocket |
|
64 | 64 | { |
65 | 65 | return Artful::artful($plugins, $params); |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @throws InvalidParamsException |
71 | 71 | * @throws ServiceNotFoundException |
72 | 72 | */ |
73 | - public function query(array $order): Collection|Rocket |
|
73 | + public function query(array $order): Collection | Rocket |
|
74 | 74 | { |
75 | 75 | Event::dispatch(new MethodCalled('unipay', __METHOD__, $order, null)); |
76 | 76 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @throws InvalidParamsException |
83 | 83 | * @throws ServiceNotFoundException |
84 | 84 | */ |
85 | - public function cancel(array $order): Collection|Rocket |
|
85 | + public function cancel(array $order): Collection | Rocket |
|
86 | 86 | { |
87 | 87 | Event::dispatch(new MethodCalled('unipay', __METHOD__, $order, null)); |
88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * @throws InvalidParamsException |
94 | 94 | */ |
95 | - public function close(array $order): Collection|Rocket |
|
95 | + public function close(array $order): Collection | Rocket |
|
96 | 96 | { |
97 | 97 | throw new InvalidParamsException(Exception::PARAMS_METHOD_NOT_SUPPORTED, '参数异常: 银联不支持 close API'); |
98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @throws InvalidParamsException |
103 | 103 | * @throws ServiceNotFoundException |
104 | 104 | */ |
105 | - public function refund(array $order): Collection|Rocket |
|
105 | + public function refund(array $order): Collection | Rocket |
|
106 | 106 | { |
107 | 107 | Event::dispatch(new MethodCalled('unipay', __METHOD__, $order, null)); |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @throws ContainerException |
114 | 114 | * @throws InvalidParamsException |
115 | 115 | */ |
116 | - public function callback(null|array|ServerRequestInterface $contents = null, ?array $params = null): Collection|Rocket |
|
116 | + public function callback(null | array | ServerRequestInterface $contents = null, ?array $params = null): Collection | Rocket |
|
117 | 117 | { |
118 | 118 | $request = $this->getCallbackParams($contents); |
119 | 119 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ); |
140 | 140 | } |
141 | 141 | |
142 | - protected function getCallbackParams(null|array|ServerRequestInterface $contents = null): Collection |
|
142 | + protected function getCallbackParams(null | array | ServerRequestInterface $contents = null): Collection |
|
143 | 143 | { |
144 | 144 | if (is_array($contents)) { |
145 | 145 | return Collection::wrap($contents); |
@@ -49,8 +49,8 @@ |
||
49 | 49 | $rocket->setDirection(OriginResponseDirection::class) |
50 | 50 | ->setPayload(array_merge( |
51 | 51 | [ |
52 | - '_url' => 'v3/pay/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
53 | - '_service_url' => 'v3/pay/partner/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
52 | + '_url' => 'v3/pay/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
53 | + '_service_url' => 'v3/pay/partner/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
54 | 54 | '_method' => 'POST', |
55 | 55 | ], |
56 | 56 | $data ?? $this->normal($config) |
@@ -50,8 +50,8 @@ |
||
50 | 50 | ->setPayload(array_merge( |
51 | 51 | [ |
52 | 52 | '_method' => 'POST', |
53 | - '_url' => 'v3/pay/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
54 | - '_service_url' => 'v3/pay/partner/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
53 | + '_url' => 'v3/pay/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
54 | + '_service_url' => 'v3/pay/partner/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
55 | 55 | ], |
56 | 56 | $data ?? $this->normal($config) |
57 | 57 | )); |
@@ -50,8 +50,8 @@ |
||
50 | 50 | ->setPayload(array_merge( |
51 | 51 | [ |
52 | 52 | '_method' => 'POST', |
53 | - '_url' => 'v3/pay/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
54 | - '_service_url' => 'v3/pay/partner/transactions/out-trade-no/'.$outTradeNo.'/close', |
|
53 | + '_url' => 'v3/pay/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
54 | + '_service_url' => 'v3/pay/partner/transactions/out-trade-no/' . $outTradeNo . '/close', |
|
55 | 55 | ], |
56 | 56 | $data ?? $this->normal($config) |
57 | 57 | )); |
@@ -44,8 +44,8 @@ |
||
44 | 44 | $rocket->setDirection(OriginResponseDirection::class) |
45 | 45 | ->mergePayload([ |
46 | 46 | '_method' => 'POST', |
47 | - '_url' => 'v3/combine-transactions/out-trade-no/'.$combineOutTradeNo.'/close', |
|
48 | - '_service_url' => 'v3/combine-transactions/out-trade-no/'.$combineOutTradeNo.'/close', |
|
47 | + '_url' => 'v3/combine-transactions/out-trade-no/' . $combineOutTradeNo . '/close', |
|
48 | + '_service_url' => 'v3/combine-transactions/out-trade-no/' . $combineOutTradeNo . '/close', |
|
49 | 49 | 'combine_appid' => $payload->get('combine_appid', $config[get_wechat_type_key($params)] ?? ''), |
50 | 50 | ]) |
51 | 51 | ->exceptPayload('combine_out_trade_no'); |