@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | if (Str::endsWith($key, ['.crt', '.pem'])) { |
| 63 | 63 | return openssl_pkey_get_private( |
| 64 | - Str::startsWith($key, 'file://') ? $key : 'file://'.$key |
|
| 64 | + Str::startsWith($key, 'file://') ? $key : 'file://' . $key |
|
| 65 | 65 | ); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return "-----BEGIN RSA PRIVATE KEY-----\n". |
|
| 69 | - wordwrap($key, 64, "\n", true). |
|
| 68 | + return "-----BEGIN RSA PRIVATE KEY-----\n" . |
|
| 69 | + wordwrap($key, 64, "\n", true) . |
|
| 70 | 70 | "\n-----END RSA PRIVATE KEY-----"; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | get_wechat_sign($params, $contents), |
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | - return 'WECHATPAY2-SHA256-RSA2048 '.$auth; |
|
| 165 | + return 'WECHATPAY2-SHA256-RSA2048 ' . $auth; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | $sign = $message->getHeaderLine('Wechatpay-Signature'); |
| 217 | 217 | $body = $message->getBody()->getContents(); |
| 218 | 218 | |
| 219 | - $content = $timestamp."\n".$random."\n".$body."\n"; |
|
| 220 | - $public = get_wechat_config($params)->get('wechat_public_cert_path.'.$wechatSerial); |
|
| 219 | + $content = $timestamp . "\n" . $random . "\n" . $body . "\n"; |
|
| 220 | + $public = get_wechat_config($params)->get('wechat_public_cert_path.' . $wechatSerial); |
|
| 221 | 221 | |
| 222 | 222 | if (empty($sign)) { |
| 223 | 223 | throw new InvalidResponseException(Exception::INVALID_RESPONSE_SIGN, '', ['headers' => $message->getHeaders(), 'body' => $body]); |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | $config = get_wechat_config($params); |
| 254 | 254 | |
| 255 | - $publicKey = $config->get('wechat_public_cert_path.'.$serialNo); |
|
| 255 | + $publicKey = $config->get('wechat_public_cert_path.' . $serialNo); |
|
| 256 | 256 | |
| 257 | 257 | if (empty($publicKey)) { |
| 258 | - throw new InvalidParamsException(Exception::WECHAT_SERIAL_NO_NOT_FOUND, 'Wechat serial no not found: '.$serialNo); |
|
| 258 | + throw new InvalidParamsException(Exception::WECHAT_SERIAL_NO_NOT_FOUND, 'Wechat serial no not found: ' . $serialNo); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | if (openssl_public_encrypt($contents, $encrypted, get_public_or_private_cert($publicKey, true), OPENSSL_PKCS1_OAEP_PADDING)) { |
@@ -63,11 +63,11 @@ |
||
| 63 | 63 | |
| 64 | 64 | $uri = $request->getUri(); |
| 65 | 65 | |
| 66 | - return $request->getMethod()."\n". |
|
| 67 | - $uri->getPath().(empty($uri->getQuery()) ? '' : '?'.$uri->getQuery())."\n". |
|
| 68 | - $timestamp."\n". |
|
| 69 | - $random."\n". |
|
| 70 | - $this->payloadToString($rocket->getPayload())."\n"; |
|
| 66 | + return $request->getMethod() . "\n" . |
|
| 67 | + $uri->getPath() . (empty($uri->getQuery()) ? '' : '?' . $uri->getQuery()) . "\n" . |
|
| 68 | + $timestamp . "\n" . |
|
| 69 | + $random . "\n" . |
|
| 70 | + $this->payloadToString($rocket->getPayload()) . "\n"; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | protected function payloadToString(?Collection $payload): string |