fix: 5 critical payment issues from code review
1. Move notify route before authMiddleware (WeChat callback has no JWT) 2. Add await to verifyNotifySignature call (was fire-and-forget) 3. Remove dangerous verify fallback — all signature failures now throw 4. Payment sync polls 3x before giving up, never redirects to success page unless confirmed paid 5. Production guard enforces all WX_MCH_* env vars on startup
这个提交包含在:
+2
-4
@@ -142,10 +142,8 @@ async function verifyNotifySignature(headers, rawBody) {
|
||||
throw new Error('notify signature verification failed')
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('unknown platform certificate') !== -1 || err.message.indexOf('signature verification') !== -1) {
|
||||
throw err
|
||||
}
|
||||
console.error('[WXPAY] platform cert verification fallback:', err.message)
|
||||
console.error('[WXPAY] signature verification failed:', err.message)
|
||||
throw err
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户