Browse Source

fix - P2P_Liquiloans_Inv_Transactions request id, an res send ie 3 program halts

pull/1/head
khanshanawaz10 1 year ago
parent
commit
d502d49f11
2 changed files with 20 additions and 12 deletions
  1. +6
    -2
      controller/getInvestmentSummary/index.js
  2. +14
    -10
      controller/getTransactionById/index.js

+ 6
- 2
controller/getInvestmentSummary/index.js View File

@ -31,7 +31,12 @@ const fetchAllInvestorId = async (sendId) => {
}
}
const getAllInvestorId = async () => {
const getAllInvestorId = ((req, res) => {
getAllInvestorIdFun();
res.send("in procress");
})
const getAllInvestorIdFun = async () => {
let allInvestorId = await db.liquiloansInvestors.findAll({
attributes: ['investor_id']
});
@ -130,7 +135,6 @@ const getUrlAndStore = async (callsData) => {
if (summary?.length) {
await db.investorSummary.bulkCreate(summary);
}
console.log("Success getInvestment summary");
}
catch (err) {
errorLogStatus(err, "nodeJs_liquiloan_getUrlAndStore")


+ 14
- 10
controller/getTransactionById/index.js View File

@ -21,8 +21,13 @@ function getHashCode(investor_id, request_id) {
}
const getReqAndInvId = ((req, res) => {
getReqAndInvIdFun();
res.send("in procress");
})
//get Request_Id and Investor_Id....
const getReqAndInvId = async () => {
const getReqAndInvIdFun = async () => {
let allInvestorId = await db.investorSummary.findAll({
attributes: ['investor_id', 'request_id']
});
@ -37,9 +42,9 @@ const fetchReqAndInvId = async (sendId) => {
let checkInvestorId = data[i].investor_id;
let checkRequestId = data[i].request_id;
if (checkInvestorId && checkRequestId) {
setTimeout(() => {
getTransactionById(checkInvestorId, checkRequestId)
}, 10);
// setTimeout(() => {
await getTransactionById(checkInvestorId, checkRequestId)
// }, 10);
}
}
}
@ -61,12 +66,12 @@ const getTransactionById = (checkInvestorId, checkRequestId) => {
request_id: checkRequestId.toString()
})
};
request(options, function (error, response) {
request(options, async function (error, response) {
if (error) throw new Error(error);
if (response.body) {
setTimeout(() => {
fetchTransactionId(response.body);
}, 10);
// setTimeout(() => {
await fetchTransactionId(response.body);
// }, 10);
}
});
} catch (err) {
@ -105,8 +110,7 @@ const fetchTransactionId = async (data) => {
item.ext_transaction_date = trnId.ext_transaction_date,
item.source_payment = trnId.source_payment,
item.last_updatedAt = getCurrentDateTime()
let isRecordPresent = await getInvTransIdQuery(item);
let isRecordPresent = await getInvTransIdQuery(item.request_id);
if (isRecordPresent.length) {
await db.transactionById.update(item, {
where: {


Loading…
Cancel
Save

Powered by TurnKey Linux.