|
|
@@ -179,7 +179,7 @@ async function checkPay(orderNum, orderTotal) {
|
|
|
lk.log(`匹配到钱包${w1.channel}余额[${availableMoney}]用来支付订单额[${orderTotal}]`);
|
|
|
let isPass = await inputMyWalletPassword(w1.channel, orderNum, orderTotal);
|
|
|
if (isPass) {
|
|
|
- isPaySuccess = await finalPay(orderNum, orderInfo);
|
|
|
+ isPaySuccess = await finalPay(w1.channel, orderNum, orderInfo);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -206,15 +206,16 @@ async function getOrderEndTime(orderNum) {
|
|
|
headers.Host = "api.gandart.com";
|
|
|
const body = `orderNum=${orderNum}`;
|
|
|
let url = {
|
|
|
- url: `${config.RESALE_API}/resaleManage/getOrderEndTime`,
|
|
|
+ url: `${config.RESALE_API}/resaleManage/resale/getOrderEndTime`,
|
|
|
headers: headers,
|
|
|
body: body
|
|
|
};
|
|
|
- lk.log(`请求订单支付截止时间`);
|
|
|
+ lk.log(`请求订单[${body}]支付截止时间`);
|
|
|
lk.post(url, async (error, _response, data) => {
|
|
|
let ret;
|
|
|
try {
|
|
|
if (error) {
|
|
|
+ lk.log(`获取订单支付截止时间发生错误`);
|
|
|
lk.execFail();
|
|
|
} else {
|
|
|
let info = JSON.parse(data);
|
|
|
@@ -233,6 +234,7 @@ async function getOrderEndTime(orderNum) {
|
|
|
}
|
|
|
});
|
|
|
} catch (e) {
|
|
|
+ lk.log(`获取订单支付截止时间发生错误`);
|
|
|
lk.logErr(e);
|
|
|
resolve();
|
|
|
}
|
|
|
@@ -246,7 +248,7 @@ async function transactionWalletList(orderNum) {
|
|
|
headers.Host = "api.gandart.com";
|
|
|
const body = `orderNum=${orderNum}`;
|
|
|
let url = {
|
|
|
- url: `${config.RESALE_API}/resaleManage/getOrderEndTime`,
|
|
|
+ url: `${config.RESALE_API}/api/market/transactionWalletList`,
|
|
|
headers: headers,
|
|
|
body: body
|
|
|
};
|
|
|
@@ -326,7 +328,7 @@ async function getMyWalletListDetail() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-async function inputMyWalletPassword(walletType, orderNum, orderTotal) {
|
|
|
+async function inputMyWalletPassword(walletName, orderNum, orderTotal) {
|
|
|
let publicKey = await getPublicKey();
|
|
|
if (publicKey) {
|
|
|
let accountPassword = encryptPassword(publicKey, gandartPasswordPlaintext);
|
|
|
@@ -434,14 +436,33 @@ async function confirmPassword(accountPassword) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-async function finalPay(orderNum, orderInfo) {
|
|
|
+function getPayUrlPath(walletName) {
|
|
|
+ let path = `${config.BASE_API}/v2/resaleManage/resale/pay`;
|
|
|
+ switch (walletName) {
|
|
|
+ case 'A':
|
|
|
+ path = `${config.BASE_API}/v2/resaleManage/resale/pay`;
|
|
|
+ break;
|
|
|
+ case 'B':
|
|
|
+ path = `${config.WALLET_API}/v2/wallet/sand/pay`;
|
|
|
+ break;
|
|
|
+ case 'C':
|
|
|
+ path = `${config.WALLET_API}/v2/wallet/kft/pay/kftPay`;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return path;
|
|
|
+}
|
|
|
+
|
|
|
+async function finalPay(walletName, orderNum, orderInfo) {
|
|
|
return new Promise((resolve, _reject) => {
|
|
|
try {
|
|
|
const headers = GCommonGandartHeads;
|
|
|
headers.Host = "api.gandart.com";
|
|
|
const body = `orderNum=${orderNum}&castingId=${orderInfo.castingId}&transactionRecordId=${orderInfo.transactionRecordId}&userId=${orderInfo.userId}`;
|
|
|
+ let path = getPayUrlPath(walletName);
|
|
|
let url = {
|
|
|
- url: `${config.BASE_API}/v2/resaleManage/resale/pay`,
|
|
|
+ url: path,
|
|
|
headers: headers,
|
|
|
body: body
|
|
|
};
|