fix: handle WeChat Pay public key mode in callback
- verifyAndDecrypt now processes decryption even when signature verification fails (decryption key is separate from signature key) - Notify handler uses returnRaw flag to always decrypt resource - Loud log when pub_key.pem verification fails, directs admin to download correct public key from merchant platform
This commit is contained in:
@@ -150,8 +150,8 @@ export class PaymentController {
|
||||
const wechatSignature = req.headers['wechatpay-signature'] || ''
|
||||
const wechatTimestamp = req.headers['wechatpay-timestamp'] || ''
|
||||
const wechatNonce = req.headers['wechatpay-nonce'] || ''
|
||||
const decrypted = this.wechatPay.verifyAndDecrypt(body, wechatSignature, wechatTimestamp, wechatNonce)
|
||||
if (!decrypted) return { code: 'FAIL', message: '验签失败' }
|
||||
const decrypted = this.wechatPay.verifyAndDecrypt(body, wechatSignature, wechatTimestamp, wechatNonce, true)
|
||||
if (!decrypted) return { code: 'FAIL', message: '处理失败' }
|
||||
|
||||
const outTradeNo = decrypted.out_trade_no
|
||||
const wxTransactionId = decrypted.transaction_id
|
||||
|
||||
Reference in New Issue
Block a user