This commit is contained in:
xl
2024-06-03 11:41:26 +08:00
parent 561b105d31
commit 1ff0203511
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -53,14 +53,14 @@ class WxV3PaymentNotify extends SmallProgram
*/
public function verify(RequestInterface $request): bool
{
$platformPublicKeyInstance = $this->rsaFrom($this->payConfig->pay->wx->mchCert, KEY_TYPE_PUBLIC);
$platformPublicKeyInstance = $this->rsaFrom($this->payConfig->pay->wx->mchKey, KEY_TYPE_PUBLIC);
$inWechatpaySignature = $request->getHeaderLine('wechatpay-signature'); // 请根据实际情况获取
$inWechatpayTimestamp = $request->getHeaderLine('wechatpay-timestamp'); // 请根据实际情况获取
$inWechatpayNonce = $request->getHeaderLine('wechatpay-nonce'); // 请根据实际情况获取
$inBody = $request->getBody()->getContents(); // 请根据实际情况获取,例如: file_get_contents('php://input');
$timeOffsetStatus = 300 >= abs(time() - (int)$inWechatpayTimestamp);
$verifiedStatus = $this->notifyVerify(
$this->lineFeed([$inWechatpayTimestamp, $inWechatpayNonce, $inBody]),
$this->lineFeed($inWechatpayTimestamp, $inWechatpayNonce, $inBody),
$inWechatpaySignature,
$platformPublicKeyInstance);
if (!$timeOffsetStatus || !$verifiedStatus) {
+1 -1
View File
@@ -137,7 +137,7 @@ trait WxV3PaymentTait
{
$payConfig = $this->getPayConfig();
$mch_private_key = openssl_get_privatekey(file_get_contents($payConfig->pay->wx->mchKey));
$mch_private_key = openssl_get_privatekey(file_get_contents($payConfig->pay->wx->mchCert));
openssl_sign($body, $raw_sign, $mch_private_key, 'sha256WithRSAEncryption');
return base64_encode($raw_sign);