Commit 92b525d4 by 王昆

gsb

parent 8c9b52c0
...@@ -65,8 +65,13 @@ class BpoSDPJApi { ...@@ -65,8 +65,13 @@ class BpoSDPJApi {
return this.getBaseResult(1002001,"mchtId不存在"); return this.getBaseResult(1002001,"mchtId不存在");
} }
if (!obj.outTradeNo) { if (!obj.outTradeNo) {
return this.getBaseResult(1002001,"outTradeNo不存在"); return this.getBaseResult(1002001,"商户订单号[outTradeNo]不存在");
} }
let otnLen = this.trim(obj.outTradeNo).length;
if (otnLen < 10 || otnLen > 32) {
return this.getBaseResult(1002001,"商户订单号[outTradeNo]长度10-32");
}
if (!obj.amt) { if (!obj.amt) {
return this.getBaseResult(1002001,"请设置申请金额"); return this.getBaseResult(1002001,"请设置申请金额");
} }
...@@ -429,7 +434,7 @@ class BpoSDPJApi { ...@@ -429,7 +434,7 @@ class BpoSDPJApi {
"mchtId": cashInfo.mchtId, "mchtId": cashInfo.mchtId,
"nonceStr": nonceStr, "nonceStr": nonceStr,
"notityUrl": "https://bpohhr.gongsibao.com/api/econtractApi/transferNotify", "notityUrl": "https://bpohhr.gongsibao.com/api/econtractApi/transferNotify",
"outTradeNo": cashInfo.outTradeNo + "abcd1234a2", "outTradeNo": cashInfo.outTradeNo,
"signType": "MD5", "signType": "MD5",
"tradeTime": tradeTime, "tradeTime": tradeTime,
"bizContent": bizContent, "bizContent": bizContent,
...@@ -495,6 +500,65 @@ class BpoSDPJApi { ...@@ -495,6 +500,65 @@ class BpoSDPJApi {
return uuid.join(''); return uuid.join('');
} }
async wxnotify(obj, req) {
console.log("------------- wx-sdpj转账回调 --------------" , obj);
try {
// 1. 获取转账二维码信息
let cashInfo = await this.ccashinfoSve.findOne({
app_id: obj.appId,
mchtId: obj.busiId,
outTradeNo: obj.outTradeNo,
});
if (!cashInfo) {
console.log("------------- wx-sdpj转账回调 cashInfo不存在--------------");
return {code: ""};
}
if (cashInfo.trade_status == "00") {
return {code: "0000"};
}
console.log("------------- wx-sdpj转账回调 cashInfo --------------", cashInfo);
// 获取商户api信息
let api = await this.ecompanybusiSve.findOne({
appId: cashInfo.app_id,
etemplate_id: cashInfo.ecid,
mchtId: cashInfo.mchtId,
});
console.log("------------- wx-sdpj转账回调 api --------------", api);
if (!api) {
console.log("------------- wx-sdpj转账回调 api不存在--------------");
return {code: ""};
}
// 验证签名
let sign = system.getSign(obj, api.key, this.EXCEPT_KEYS);
console.log("------------- wx-sdpj转账回调 签名 --------------", obj.sign, sign);
if (sign != obj.sign) {
console.log("------------- wx-sdpj转账回调 签名错误 --------------");
return {code: ""};
}
// 回调逻辑判断
let respCode = this.trim(obj.respCode);
if (respCode == "00") {
cashInfo.trade_status = "00";
cashInfo.trade_desc = "交易成功";
await cashInfo.save();
return {code: "0000"};
} else if (respCode == "02") {
cashInfo.trade_status = "02";
cashInfo.trade_desc = obj.respDesc || "交易失败";
} else {
}
return {code: ""};
} catch (e) {
console.log(e);
}
}
getSuccessResult(msg = "success", data = {}) { getSuccessResult(msg = "success", data = {}) {
return this.getBaseResult(0, msg, data); return this.getBaseResult(0, msg, data);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment