eee
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user