q-koa 13.8.39 → 13.8.40
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
|
|
@@ -1715,11 +1692,6 @@ exports.union_notify = async (ctx) => {
|
|
|
1715
1692
|
exports.notify = async (ctx) => {
|
|
1716
1693
|
const { app } = getAppByCtx(ctx)
|
|
1717
1694
|
const result = ctx.request.xmlBody
|
|
1718
|
-
// TODO: 临时观察日志,上线后删除
|
|
1719
|
-
app.service.log.push({
|
|
1720
|
-
app,
|
|
1721
|
-
message: `微信支付回调notify报文: ${JSON.stringify(result || {})}`,
|
|
1722
|
-
})
|
|
1723
1695
|
if (!result || !result.xml) return sendWxFail(ctx, 'INVALID_BODY')
|
|
1724
1696
|
|
|
1725
1697
|
// ===== 微信 V2 回调验签 + mch_id 匹配 =====
|
|
@@ -1994,11 +1966,6 @@ const getRefundResultJson = async ({ req_info, app_key }) => {
|
|
|
1994
1966
|
exports.refund_notify = async (ctx) => {
|
|
1995
1967
|
const { app } = getAppByCtx(ctx)
|
|
1996
1968
|
const result = ctx.request.xmlBody
|
|
1997
|
-
// TODO: 临时观察日志,上线后删除
|
|
1998
|
-
app.service.log.push({
|
|
1999
|
-
app,
|
|
2000
|
-
message: `微信退款回调refund_notify报文: ${JSON.stringify(result || {})}`,
|
|
2001
|
-
})
|
|
2002
1969
|
if (!result || !result.xml) return sendWxFail(ctx, 'INVALID_BODY')
|
|
2003
1970
|
|
|
2004
1971
|
const pay_config = ctx.params.sub || 'weixin_pay'
|