@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | $url = Pay::MODE_SERVICE === (get_wechat_config($params)['mode'] ?? null) ? $this->getPartnerUri($rocket) : $this->getUri($rocket); |
64 | 64 | |
65 | - return 0 === strpos($url, 'http') ? $url : (get_wechat_base_uri($params).$url); |
|
65 | + return 0 === strpos($url, 'http') ? $url : (get_wechat_base_uri($params) . $url); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | protected function getHeaders(): array |
@@ -37,11 +37,11 @@ |
||
37 | 37 | $subMchId = $payload->get('sub_mchid', $config['sub_mch_id'] ?? ''); |
38 | 38 | |
39 | 39 | if (!is_null($payload->get('refund_id'))) { |
40 | - return 'v3/ecommerce/refunds/id/'.$payload->get('refund_id').'?sub_mchid='.$subMchId; |
|
40 | + return 'v3/ecommerce/refunds/id/' . $payload->get('refund_id') . '?sub_mchid=' . $subMchId; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!is_null($payload->get('out_refund_no'))) { |
44 | - return 'v3/ecommerce/refunds/out-refund-no/'.$payload->get('out_refund_no').'?sub_mchid='.$subMchId; |
|
44 | + return 'v3/ecommerce/refunds/out-refund-no/' . $payload->get('out_refund_no') . '?sub_mchid=' . $subMchId; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | throw new InvalidParamsException(Exception::MISSING_NECESSARY_PARAMS); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $publicKey = $config['wechat_public_cert_path'][$serialNo] ?? null; |
50 | 50 | |
51 | 51 | if (empty($publicKey)) { |
52 | - throw new InvalidParamsException(Exception::WECHAT_SERIAL_NO_NOT_FOUND, 'Wechat serial no not found: '.$serialNo); |
|
52 | + throw new InvalidParamsException(Exception::WECHAT_SERIAL_NO_NOT_FOUND, 'Wechat serial no not found: ' . $serialNo); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return $publicKey; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $result = $this->getCertSn($ssl['issuer'] ?? [], $ssl['serialNumber'] ?? ''); |
118 | 118 | |
119 | - Pay::get(ConfigInterface::class)->set('alipay.'.$tenant.'.app_public_cert_sn', $result); |
|
119 | + Pay::get(ConfigInterface::class)->set('alipay.' . $tenant . '.app_public_cert_sn', $result); |
|
120 | 120 | |
121 | 121 | return $result; |
122 | 122 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
149 | - $ssl = openssl_x509_parse($cert.'-----END CERTIFICATE-----'); |
|
149 | + $ssl = openssl_x509_parse($cert . '-----END CERTIFICATE-----'); |
|
150 | 150 | |
151 | 151 | if (false === $ssl) { |
152 | 152 | throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Invalid alipay_root_cert'); |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | $detail = $this->formatCert($ssl); |
156 | 156 | |
157 | 157 | if ('sha1WithRSAEncryption' == $detail['signatureTypeLN'] || 'sha256WithRSAEncryption' == $detail['signatureTypeLN']) { |
158 | - $sn .= $this->getCertSn($detail['issuer'], $detail['serialNumber']).'_'; |
|
158 | + $sn .= $this->getCertSn($detail['issuer'], $detail['serialNumber']) . '_'; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | 162 | $result = substr($sn, 0, -1); |
163 | 163 | |
164 | - Pay::get(ConfigInterface::class)->set('alipay.'.$tenant.'.alipay_root_cert_sn', $result); |
|
164 | + Pay::get(ConfigInterface::class)->set('alipay.' . $tenant . '.alipay_root_cert_sn', $result); |
|
165 | 165 | |
166 | 166 | return $result; |
167 | 167 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | protected function getCertSn(array $issuer, string $serialNumber): string |
170 | 170 | { |
171 | 171 | return md5( |
172 | - $this->array2string(array_reverse($issuer)).$serialNumber |
|
172 | + $this->array2string(array_reverse($issuer)) . $serialNumber |
|
173 | 173 | ); |
174 | 174 | } |
175 | 175 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $string = []; |
179 | 179 | |
180 | 180 | foreach ($array as $key => $value) { |
181 | - $string[] = $key.'='.$value; |
|
181 | + $string[] = $key . '=' . $value; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | return implode(',', $string); |
@@ -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 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | return file_get_contents($key); |
62 | 62 | } |
63 | 63 | |
64 | - return "-----BEGIN RSA PRIVATE KEY-----\n". |
|
65 | - wordwrap($key, 64, "\n", true). |
|
64 | + return "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
65 | + wordwrap($key, 64, "\n", true) . |
|
66 | 66 | "\n-----END RSA PRIVATE KEY-----"; |
67 | 67 | } |
68 | 68 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $sign = $message->getHeaderLine('Wechatpay-Signature'); |
167 | 167 | $body = (string) $message->getBody(); |
168 | 168 | |
169 | - $content = $timestamp."\n".$random."\n".$body."\n"; |
|
169 | + $content = $timestamp . "\n" . $random . "\n" . $body . "\n"; |
|
170 | 170 | $public = get_wechat_config($params)['wechat_public_cert_path'][$wechatSerial] ?? null; |
171 | 171 | |
172 | 172 | if (empty($sign)) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $wechatConfig = get_wechat_config($params); |
224 | 224 | |
225 | 225 | Pay::get(ConfigInterface::class)->set( |
226 | - 'wechat.'.get_tenant($params).'.wechat_public_cert_path', |
|
226 | + 'wechat.' . get_tenant($params) . '.wechat_public_cert_path', |
|
227 | 227 | ((array) ($wechatConfig['wechat_public_cert_path'] ?? [])) + ($certs ?? []), |
228 | 228 | ); |
229 | 229 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | get_wechat_sign($params, $contents), |
80 | 80 | ); |
81 | 81 | |
82 | - return 'WECHATPAY2-SHA256-RSA2048 '.$auth; |
|
82 | + return 'WECHATPAY2-SHA256-RSA2048 ' . $auth; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | |
96 | 96 | $uri = $request->getUri(); |
97 | 97 | |
98 | - return $request->getMethod()."\n". |
|
99 | - $uri->getPath().(empty($uri->getQuery()) ? '' : '?'.$uri->getQuery())."\n". |
|
100 | - $timestamp."\n". |
|
101 | - $random."\n". |
|
102 | - $this->payloadToString($rocket->getPayload())."\n"; |
|
98 | + return $request->getMethod() . "\n" . |
|
99 | + $uri->getPath() . (empty($uri->getQuery()) ? '' : '?' . $uri->getQuery()) . "\n" . |
|
100 | + $timestamp . "\n" . |
|
101 | + $random . "\n" . |
|
102 | + $this->payloadToString($rocket->getPayload()) . "\n"; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | protected function payloadToString(?Collection $payload): string |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'sub_mchid' => $payload->get('sub_mchid', $config['sub_mch_id'] ?? null), |
57 | 57 | ]; |
58 | 58 | |
59 | - $subAppId = $payload->get('sub_appid', $config['sub_'.$configKey] ?? null); |
|
59 | + $subAppId = $payload->get('sub_appid', $config['sub_' . $configKey] ?? null); |
|
60 | 60 | if (!empty($subAppId)) { |
61 | 61 | $result['sub_appid'] = $subAppId; |
62 | 62 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | protected function getConfigKey(array $params): string |
69 | 69 | { |
70 | - $key = ($params['_type'] ?? 'mp').'_app_id'; |
|
70 | + $key = ($params['_type'] ?? 'mp') . '_app_id'; |
|
71 | 71 | if ('app_app_id' === $key) { |
72 | 72 | $key = 'app_id'; |
73 | 73 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function getPlugins(array $params): array |
21 | 21 | { |
22 | - $typeMethod = Str::camel($params['_type'] ?? 'default').'Plugins'; |
|
22 | + $typeMethod = Str::camel($params['_type'] ?? 'default') . 'Plugins'; |
|
23 | 23 | |
24 | 24 | if (isset($params['out_request_no'])) { |
25 | 25 | return $this->refundPlugins(); |