q-koa 13.8.39 → 13.8.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1539,12 +1539,6 @@ exports.union_notify = async (ctx) => {
|
|
|
1539
1539
|
try {
|
|
1540
1540
|
const notifyData = ctx.request.body
|
|
1541
1541
|
|
|
1542
|
-
// TODO: 临时观察日志,上线后删除
|
|
1543
|
-
app.service.log.push({
|
|
1544
|
-
app,
|
|
1545
|
-
message: `通联融合回调union_notify报文: ${JSON.stringify(notifyData || {})}`,
|
|
1546
|
-
})
|
|
1547
|
-
|
|
1548
1542
|
if (!notifyData || typeof notifyData !== 'object') {
|
|
1549
1543
|
ctx.status = 400
|
|
1550
1544
|
ctx.body = 'FAIL'
|
|
@@ -1588,17 +1582,6 @@ exports.union_notify = async (ctx) => {
|
|
|
1588
1582
|
}
|
|
1589
1583
|
|
|
1590
1584
|
if (hasSign) {
|
|
1591
|
-
// 生成签名原文用于诊断日志(跟 validateUnionNotifySign 内 build 保持一致)
|
|
1592
|
-
const paramsForSignStr = { ...notifyData }
|
|
1593
|
-
delete paramsForSignStr.sign
|
|
1594
|
-
const sortedKeysForSign = Object.keys(paramsForSignStr).sort()
|
|
1595
|
-
let diagsignStr = ''
|
|
1596
|
-
for (const k of sortedKeysForSign) {
|
|
1597
|
-
const v = paramsForSignStr[k]
|
|
1598
|
-
if (v === undefined || v === null || v === '') continue
|
|
1599
|
-
if (diagsignStr) diagsignStr += '&'
|
|
1600
|
-
diagsignStr += `${k}=${v}`
|
|
1601
|
-
}
|
|
1602
1585
|
const signOk = validateUnionNotifySign({
|
|
1603
1586
|
notifyData,
|
|
1604
1587
|
signType: rawSignType,
|
|
@@ -1607,15 +1590,9 @@ exports.union_notify = async (ctx) => {
|
|
|
1607
1590
|
fallbackPlatformPublicKey: UNION_PROD_PLATFORM_PUBLIC_KEY,
|
|
1608
1591
|
})
|
|
1609
1592
|
if (!signOk) {
|
|
1610
|
-
// ===== 诊断信息:帮助定位到底是 publicKey 错、签名串错、还是配置根本没拿到值 =====
|
|
1611
|
-
const keyTypeInfo = union_publicKey
|
|
1612
|
-
? (String(union_publicKey).includes('-----BEGIN')
|
|
1613
|
-
? `pem-with-head,len=${String(union_publicKey).length},head=${String(union_publicKey).slice(0, 24)}`
|
|
1614
|
-
: `pem-body-only,len=${String(union_publicKey).length},head=${String(union_publicKey).slice(0, 24)}`)
|
|
1615
|
-
: 'NULL/UNDEFINED'
|
|
1616
1593
|
app.service.log.push({
|
|
1617
1594
|
app,
|
|
1618
|
-
message:
|
|
1595
|
+
message: `通联回调验签失败(type=${rawSignType}): ${JSON.stringify(notifyData)}`,
|
|
1619
1596
|
})
|
|
1620
1597
|
ctx.body = 'FAIL'
|
|
1621
1598
|
return
|
|
@@ -1693,9 +1670,11 @@ exports.union_notify = async (ctx) => {
|
|
|
1693
1670
|
})
|
|
1694
1671
|
}
|
|
1695
1672
|
} else if (trxcode !== 'VSP683') {
|
|
1673
|
+
// 非 VSP683(扫码支付/条码/小程序支付类、退款类)且不在 VSP501/VSP503/VSP681/VSP682/VSP684 名单里:
|
|
1674
|
+
// 只记录业务指标,不打印完整报文(避免日志爆且涉及 openid/敏感字段)。
|
|
1696
1675
|
app.service.log.push({
|
|
1697
1676
|
app,
|
|
1698
|
-
message:
|
|
1677
|
+
message: `通联回调未处理trxcode=${trxcode} cusorderid=${cusorderid} trxid=${trxid} trxamt=${trxamt} trxstatus=${trxstatus}`,
|
|
1699
1678
|
})
|
|
1700
1679
|
}
|
|
1701
1680
|
} else {
|
|
@@ -1715,11 +1694,6 @@ exports.union_notify = async (ctx) => {
|
|
|
1715
1694
|
exports.notify = async (ctx) => {
|
|
1716
1695
|
const { app } = getAppByCtx(ctx)
|
|
1717
1696
|
const result = ctx.request.xmlBody
|
|
1718
|
-
// TODO: 临时观察日志,上线后删除
|
|
1719
|
-
app.service.log.push({
|
|
1720
|
-
app,
|
|
1721
|
-
message: `微信支付回调notify报文: ${JSON.stringify(result || {})}`,
|
|
1722
|
-
})
|
|
1723
1697
|
if (!result || !result.xml) return sendWxFail(ctx, 'INVALID_BODY')
|
|
1724
1698
|
|
|
1725
1699
|
// ===== 微信 V2 回调验签 + mch_id 匹配 =====
|
|
@@ -1994,11 +1968,6 @@ const getRefundResultJson = async ({ req_info, app_key }) => {
|
|
|
1994
1968
|
exports.refund_notify = async (ctx) => {
|
|
1995
1969
|
const { app } = getAppByCtx(ctx)
|
|
1996
1970
|
const result = ctx.request.xmlBody
|
|
1997
|
-
// TODO: 临时观察日志,上线后删除
|
|
1998
|
-
app.service.log.push({
|
|
1999
|
-
app,
|
|
2000
|
-
message: `微信退款回调refund_notify报文: ${JSON.stringify(result || {})}`,
|
|
2001
|
-
})
|
|
2002
1971
|
if (!result || !result.xml) return sendWxFail(ctx, 'INVALID_BODY')
|
|
2003
1972
|
|
|
2004
1973
|
const pay_config = ctx.params.sub || 'weixin_pay'
|