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
这个提交包含在:
Guoguo
2026-05-18 03:16:44 -07:00
父节点 e9681cdd21
当前提交 731122064b
修改 5 个文件,包含 38 行新增28 行删除
+1 -1
查看文件
@@ -9,7 +9,7 @@ async function handleNotify(req, res) {
const rawBody = typeof req.body === 'string' ? req.body : (Buffer.isBuffer(req.body) ? req.body.toString('utf8') : JSON.stringify(req.body))
const parsed = typeof req.body === 'object' && !Buffer.isBuffer(req.body) ? req.body : JSON.parse(rawBody)
wxpay.verifyNotifySignature(req.headers, rawBody)
await wxpay.verifyNotifySignature(req.headers, rawBody)
const result = wxpay.decryptNotifyResource(parsed.resource)