Reviewed-on: https://git.nivesh.com:443/akhilesh.chandak/P2P_Liquiloan_Script/pulls/1master
| @ -0,0 +1,13 @@ | |||||
| const db = require("../../utils/db_config"); | |||||
| const { getCurrentDateTime } = require("../helper"); | |||||
| function errorLogStatus(error = null, funName = null) { | |||||
| let query = `INSERT INTO providentialadvisory.dbo.User_log | |||||
| (client_code, request, status, response, created_date, created_by, api_name, Open_Close_Status, IPAddress, DeviceId, [Source], Header) | |||||
| VALUES('', '${error}','', '', '${getCurrentDateTime()}', '', '${funName}', '', '', '', '', '')`; | |||||
| return db.sequelize.query(query, { type: db.sequelize.QueryTypes.INSERT }); | |||||
| } | |||||
| module.exports = { | |||||
| errorLogStatus | |||||
| } | |||||
| @ -1,16 +0,0 @@ | |||||
| 'use strict' | |||||
| const request = require("request"); | |||||
| const constants = require('../utils/consts'); | |||||
| const db = require('../utils/db_config'); | |||||
| const createLiquiloanInvestor = (req, res) => { | |||||
| res.send("in process"); | |||||
| } | |||||
| module.exports = { | |||||
| createLiquiloanInvestor | |||||
| } | |||||
| @ -0,0 +1,101 @@ | |||||
| 'use strict' | |||||
| const request = require('request'); | |||||
| const db = require('../../utils/db_config'); | |||||
| const { getCurrentDateTime } = require("../helper"); | |||||
| const { getAllInvestorId } = require('../getInvestmentSummary') | |||||
| const crypto = require('crypto'); | |||||
| const { HASH_KEY } = require('../../utils/consts'); | |||||
| const { getInvestorIdQuery } = require('./query'); | |||||
| const { errorLogStatus } = require('../Errorlog'); | |||||
| function generateHMACSHA256(input, key) { | |||||
| const hmac = crypto.createHmac('sha256', key); | |||||
| hmac.update(input, 'utf8'); | |||||
| return hmac.digest('hex'); | |||||
| } | |||||
| function getHashCode(req) { | |||||
| const inputString_GetInvestorDashboard = `||${getCurrentDateTime()}`; | |||||
| const key = HASH_KEY; | |||||
| const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key); | |||||
| return hash_GetInvestorDashboard | |||||
| } | |||||
| const fetchInvestorDetails = ((req, res) => { | |||||
| getAllInvstorData(); | |||||
| res.send("in procress"); | |||||
| }) | |||||
| const getAllInvstorData = async () => { | |||||
| var options = { | |||||
| method: 'POST', | |||||
| url: 'https://supply-integration.liquiloans.com/api/v2/GetAllInvestors', | |||||
| headers: { | |||||
| 'Content-Type': 'application/json', | |||||
| }, | |||||
| body: JSON.stringify({ | |||||
| mid: "M00201", | |||||
| checksum: getHashCode(), | |||||
| timestamp: getCurrentDateTime(), | |||||
| filter_on: "", | |||||
| filter_data: [] | |||||
| }) | |||||
| }; | |||||
| request(options, function (error, response) { | |||||
| if (error) throw new Error(error); | |||||
| getAllInvstorDataStore(response.body); | |||||
| }); | |||||
| } | |||||
| const getAllInvstorDataStore = async (body) => { | |||||
| try { | |||||
| const records = JSON.parse(body) | |||||
| let item = records?.data | |||||
| let storeData = []; | |||||
| if (item.length) { | |||||
| for (let i = 0; i < item?.length; i++) { | |||||
| let log = await getInvestorIdQuery(item[i].investor_id); | |||||
| if (log == 0) { | |||||
| let data = {}; | |||||
| data.investor_id = item[i].investor_id, | |||||
| data.name = item[i].name, | |||||
| data.entity_type = item[i].entity_type, | |||||
| data.pan = item[i].pan, | |||||
| data.email = item[i].email, | |||||
| data.contact_number = item[i].contact_number, | |||||
| data.ifa_id = item[i].ifa_id, | |||||
| data.created_at = item[i].created_at, | |||||
| data.rm_name = item[i].rm_name, | |||||
| data.last_updatedAt = new Date | |||||
| storeData.push(data); | |||||
| } | |||||
| } | |||||
| await db.liquiloansInvestors.bulkCreate(storeData); | |||||
| } | |||||
| } catch (err) { | |||||
| errorLogStatus(err, "nodeJs_liquiloan_getAllInvstorDataStore") | |||||
| } | |||||
| } | |||||
| // const isInvestorPresent = async (id) => { | |||||
| // try { | |||||
| // await getInvestorIdQuery(id) | |||||
| // } catch (err) { | |||||
| // // console.log("isInvestorPresent", err.message) | |||||
| // errorLogStatus(err, "nodeJs_liquiloan_isInvestorPresent") | |||||
| // } | |||||
| // } | |||||
| module.exports = { | |||||
| fetchInvestorDetails | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| const db = require("../../utils/db_config"); | |||||
| const { errorLogStatus } = require("../Errorlog"); | |||||
| async function getInvestorIdQuery(id) { | |||||
| try { | |||||
| let query = `select * from dbo.P2P_Liquiloans_Investors where investor_id= '${id}'`; | |||||
| return await db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }); | |||||
| } catch (error) { | |||||
| // console.log("isInvestorPresent", err.message) | |||||
| errorLogStatus(error, "nodeJs_liquiloan_isInvestorPresent") | |||||
| } | |||||
| } | |||||
| module.exports = { | |||||
| getInvestorIdQuery | |||||
| } | |||||
| @ -0,0 +1,33 @@ | |||||
| const crypto = require('crypto'); | |||||
| const { HASH_KEY } = require('../utils/consts'); | |||||
| function generateHMACSHA256(input, key) { | |||||
| const hmac = crypto.createHmac('sha256', key); | |||||
| hmac.update(input, 'utf8'); // Ensure input encoding matches C# (UTF-8) | |||||
| return hmac.digest('hex'); | |||||
| } | |||||
| function getHashCode(type) { | |||||
| const inputString = "||2023-11-22 14:57:38"; | |||||
| const inputString_GetInvestorDashboard = "368907||2023-11-22 14:57:38"; | |||||
| const inputString_GetTransactionById = "5151974||368907||2023-11-22 14:57:38"; | |||||
| const key = HASH_KEY; | |||||
| const hash = generateHMACSHA256(inputString, key); | |||||
| const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key); | |||||
| const hash_GetTransactionById = generateHMACSHA256(inputString_GetTransactionById, key); | |||||
| if (type === 1) { | |||||
| return hash | |||||
| } | |||||
| if (type === 2) { | |||||
| return hash_GetInvestorDashboard | |||||
| } | |||||
| if (type === 3) { | |||||
| return hash_GetTransactionById | |||||
| } | |||||
| } | |||||
| module.exports = { | |||||
| getHashCode | |||||
| } | |||||
| @ -0,0 +1,156 @@ | |||||
| 'use strict' | |||||
| const request = require("request"); | |||||
| const db = require('../../utils/db_config'); | |||||
| const crypto = require('crypto'); | |||||
| const { getReqAndInvId } = require('../getTransactionById') | |||||
| const { getCurrentDateTime } = require("../helper"); | |||||
| const { HASH_KEY } = require("../../utils/consts"); | |||||
| const { getInvSummaryIdQuery } = require("./query"); | |||||
| const { errorLogStatus } = require("../Errorlog"); | |||||
| function generateHMACSHA256(input, key) { | |||||
| const hmac = crypto.createHmac('sha256', key); | |||||
| hmac.update(input, 'utf8'); // Ensure input encoding matches C# (UTF-8) | |||||
| return hmac.digest('hex'); | |||||
| } | |||||
| function getHashCode(req) { | |||||
| const inputString_GetInvestorDashboard = `${req}||${getCurrentDateTime()}`; | |||||
| const key = HASH_KEY; | |||||
| const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key); | |||||
| return hash_GetInvestorDashboard | |||||
| } | |||||
| const fetchAllInvestorId = async (sendId) => { | |||||
| let data = JSON.parse(sendId) | |||||
| for (let i = 0; i < data?.length; i++) { | |||||
| await createLiquiloanInvestor(data[i].investor_id, i) | |||||
| } | |||||
| } | |||||
| const getAllInvestorId = ((req, res) => { | |||||
| getAllInvestorIdFun(); | |||||
| res.send("in procress"); | |||||
| }) | |||||
| const getAllInvestorIdFun = async () => { | |||||
| let allInvestorId = await db.liquiloansInvestors.findAll({ | |||||
| attributes: ['investor_id'] | |||||
| }); | |||||
| let sendId = JSON.stringify(allInvestorId, null, 2) | |||||
| fetchAllInvestorId(sendId); | |||||
| }; | |||||
| const createLiquiloanInvestor = (investor_id, index) => { | |||||
| var options = { | |||||
| method: 'POST', | |||||
| url: 'https://supply-integration.liquiloans.com/api/v2/GetInvestmentSummary', | |||||
| headers: { | |||||
| 'Content-Type': 'application/json' | |||||
| }, | |||||
| body: JSON.stringify({ | |||||
| "investor_id": investor_id, | |||||
| "timestamp": getCurrentDateTime(), | |||||
| "checksum": getHashCode(investor_id), | |||||
| "mid": "M00201" | |||||
| }) | |||||
| }; | |||||
| request(options, function (error, response, body) { | |||||
| if (error) throw new Error(error); | |||||
| const data = JSON.parse(body); | |||||
| let pastData = data?.data.past_investments; | |||||
| if (pastData) { | |||||
| getUrlAndStore(pastData); | |||||
| } | |||||
| let currentData = data?.data.current_investments; | |||||
| if (currentData) { | |||||
| getUrlAndStore(currentData); | |||||
| } | |||||
| }); | |||||
| } | |||||
| const getUrlAndStore = async (callsData) => { | |||||
| try { | |||||
| let summary = [] | |||||
| for (let i = 0; i < callsData?.length; i++) { | |||||
| let checkTrnId = await getInvSummaryIdQuery(callsData[i].request_id); | |||||
| if (checkTrnId == 0) { | |||||
| let record = {}; | |||||
| record.transaction_id = callsData[i].transaction_id, | |||||
| record.investor_id = callsData[i].investor_id, | |||||
| record.scheme_id = callsData[i].scheme_id, | |||||
| record.investment_roi = callsData[i].investment_roi, | |||||
| record.return_type = callsData[i].return_type, | |||||
| record.payout_type = callsData[i].payout_type, | |||||
| record.lockin_tenure = callsData[i].lockin_tenure, | |||||
| record.lockin_break = callsData[i].lockin_break, | |||||
| record.last_withdrawal_at = callsData[i].last_withdrawal_at, | |||||
| record.transaction_sub_type = callsData[i].transaction_sub_type, | |||||
| record.investment_status = callsData[i].investment_status, | |||||
| record.parent_investment_id = callsData[i].parent_investment_id, | |||||
| record.master_parent_investment_id = callsData[i].master_parent_investment_id, | |||||
| record.quality_name = callsData[i].quality_name, | |||||
| record.name = callsData[i].name, | |||||
| record.transaction_date = callsData[i].transaction_date, | |||||
| record.invested_amount = callsData[i].invested_amount, | |||||
| record.scheme_name = callsData[i].scheme_name, | |||||
| record.lockin_type = callsData[i].lockin_type, | |||||
| record.display_scheme = callsData[i].display_scheme, | |||||
| record.scheme_details = callsData[i].scheme_details, | |||||
| record.lockin_end_date = callsData[i].lockin_end_date, | |||||
| record.redeemed_principal = callsData[i].redeemed_principal, | |||||
| record.redeemed_erest = callsData[i].redeemed_erest, | |||||
| record.redeemed_erest_with_request = callsData[i].redeemed_erest_with_request, | |||||
| record.total_redemption = callsData[i].total_redemption, | |||||
| record.net_principal_investment = callsData[i].net_principal_investment, | |||||
| record.interest_amount = callsData[i].interest_amount, | |||||
| record.accrued_value = callsData[i].accrued_value, | |||||
| record.withdrawable_balance = callsData[i].withdrawable_balance, | |||||
| record.scheme_closed_date = callsData[i].scheme_closed_date, | |||||
| record.request_id = callsData[i].request_id, | |||||
| record.source = callsData[i].source, | |||||
| record.created_at = getCurrentDateTime() | |||||
| record.last_updatedAt = getCurrentDateTime() | |||||
| summary.push(record); | |||||
| } else { | |||||
| let record = { | |||||
| ...callsData[i], | |||||
| last_updatedAt: getCurrentDateTime() | |||||
| } | |||||
| await db.investorSummary.update(record, { | |||||
| where: { | |||||
| request_id: record.request_id | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | |||||
| if (summary?.length) { | |||||
| await db.investorSummary.bulkCreate(summary); | |||||
| } | |||||
| } | |||||
| catch (err) { | |||||
| errorLogStatus(err, "nodeJs_liquiloan_getUrlAndStore") | |||||
| } | |||||
| } | |||||
| // check is transaction id is present | |||||
| // const isRequestIdPresent = async (id) => { | |||||
| // try { | |||||
| // getInvSummaryIdQuery(id) | |||||
| // } catch (err) { | |||||
| // errorLogStatus(err, "nodeJs_liquiloan_isRequestIdPresent") | |||||
| // } | |||||
| // } | |||||
| module.exports = { | |||||
| getAllInvestorId | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| const db = require("../../utils/db_config"); | |||||
| const { errorLogStatus } = require("../Errorlog"); | |||||
| async function getInvSummaryIdQuery(id) { | |||||
| try { | |||||
| let query = `select * from dbo.P2P_Liquiloans_Inv_Summarys where request_id= '${id}'`; | |||||
| return await db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }); | |||||
| } catch (error) { | |||||
| errorLogStatus(error, "nodeJs_liquiloan_isRequestIdPresent") | |||||
| } | |||||
| } | |||||
| module.exports = { | |||||
| getInvSummaryIdQuery | |||||
| } | |||||
| @ -0,0 +1,141 @@ | |||||
| const request = require('request'); | |||||
| const db = require('../../utils/db_config'); | |||||
| const { getCurrentDateTime } = require("../helper"); | |||||
| const crypto = require('crypto'); | |||||
| const { HASH_KEY } = require('../../utils/consts'); | |||||
| const { getInvTransIdQuery } = require('./query'); | |||||
| const { errorLogStatus } = require('../Errorlog'); | |||||
| function generateHMACSHA256(input, key) { | |||||
| const hmac = crypto.createHmac('sha256', key); | |||||
| hmac.update(input, 'utf8'); | |||||
| return hmac.digest('hex'); | |||||
| } | |||||
| function getHashCode(investor_id, request_id) { | |||||
| const inputString_GetInvestorDashboard = `${request_id}||${investor_id}||${getCurrentDateTime()}`; | |||||
| const key = HASH_KEY; | |||||
| const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key); | |||||
| return hash_GetInvestorDashboard | |||||
| } | |||||
| const getReqAndInvId = ((req, res) => { | |||||
| getReqAndInvIdFun(); | |||||
| res.send("in procress"); | |||||
| }) | |||||
| //get Request_Id and Investor_Id.... | |||||
| const getReqAndInvIdFun = async () => { | |||||
| let allInvestorId = await db.investorSummary.findAll({ | |||||
| attributes: ['investor_id', 'request_id'] | |||||
| }); | |||||
| let sendId = JSON.stringify(allInvestorId, null, 2) | |||||
| fetchReqAndInvId(sendId); | |||||
| } | |||||
| // Send Request_Id and Investor_Id to the getTransactionById fun | |||||
| const fetchReqAndInvId = async (sendId) => { | |||||
| let data = JSON.parse(sendId) | |||||
| for (let i = 0; i < data.length; i++) { | |||||
| let checkInvestorId = data[i].investor_id; | |||||
| let checkRequestId = data[i].request_id; | |||||
| if (checkInvestorId && checkRequestId) { | |||||
| // setTimeout(() => { | |||||
| await getTransactionById(checkInvestorId, checkRequestId) | |||||
| // }, 10); | |||||
| } | |||||
| } | |||||
| } | |||||
| const getTransactionById = (checkInvestorId, checkRequestId) => { | |||||
| try { | |||||
| var options = { | |||||
| method: 'POST', | |||||
| url: 'https://supply-integration.liquiloans.com/api/v2/GetTransactionById', | |||||
| headers: { | |||||
| 'Content-Type': 'application/json' | |||||
| }, | |||||
| body: JSON.stringify({ | |||||
| mid: "M00201", | |||||
| checksum: getHashCode(checkInvestorId, checkRequestId), | |||||
| timestamp: getCurrentDateTime(), | |||||
| investor_id: checkInvestorId.toString(), | |||||
| request_id: checkRequestId.toString() | |||||
| }) | |||||
| }; | |||||
| request(options, async function (error, response) { | |||||
| if (error) throw new Error(error); | |||||
| if (response.body) { | |||||
| // setTimeout(() => { | |||||
| await fetchTransactionId(response.body); | |||||
| // }, 10); | |||||
| } | |||||
| }); | |||||
| } catch (err) { | |||||
| errorLogStatus(err, "nodeJs_liquiloan_getTransactionById") | |||||
| } | |||||
| } | |||||
| const fetchTransactionId = async (data) => { | |||||
| try { | |||||
| let idDetails = JSON.parse(data); | |||||
| let trnId = idDetails.data; | |||||
| let item = {}; | |||||
| item.request_id = trnId.id, | |||||
| item.investor_id = trnId.investor_id, | |||||
| item.amount = trnId.amount, | |||||
| item.transaction_type = trnId.transaction_type, | |||||
| item.transaction_sub_type = trnId.transaction_sub_type, | |||||
| item.withdrawal_method = trnId.withdrawal_method, | |||||
| item.manual_parameters = trnId.manual_parameters, | |||||
| item.old_investment_id = trnId.old_investment_id, | |||||
| item.scheme_id = trnId.scheme_id, | |||||
| item.mode = trnId.mode, | |||||
| item.transaction_id = trnId.transaction_id, | |||||
| item.order_id = trnId.order_id, | |||||
| item.settlement_utr = trnId.settlement_utr, | |||||
| item.transaction_source = trnId.transaction_source, | |||||
| item.approval_status = trnId.approval_status, | |||||
| item.transaction_status = trnId.transaction_status, | |||||
| item.created_at = trnId.created_at, | |||||
| item.authenticated_at = trnId.authenticated_at, | |||||
| item.banking_date = trnId.banking_date, | |||||
| item.execution_date = trnId.execution_date, | |||||
| item.transaction_date = trnId.transaction_date, | |||||
| item.ext_transaction_date = trnId.ext_transaction_date, | |||||
| item.source_payment = trnId.source_payment, | |||||
| item.last_updatedAt = getCurrentDateTime() | |||||
| let isRecordPresent = await getInvTransIdQuery(item.request_id); | |||||
| if (isRecordPresent.length) { | |||||
| await db.transactionById.update(item, { | |||||
| where: { | |||||
| request_id: item.request_id | |||||
| } | |||||
| }); | |||||
| } else { | |||||
| await db.transactionById.create(item); | |||||
| } | |||||
| console.log("done--------->") | |||||
| } catch (err) { | |||||
| errorLogStatus(err, "nodeJs_liquiloan_fetchTransactionId") | |||||
| } | |||||
| } | |||||
| // const handleRecordPresent = async (item) => { | |||||
| // let id = item.request_id; | |||||
| // try { | |||||
| // getInvTransIdQuery(id) | |||||
| // } catch (err) { | |||||
| // errorLogStatus(err, "nodeJs_liquiloan_handleRecordPresent") | |||||
| // } | |||||
| // } | |||||
| module.exports = { | |||||
| getReqAndInvId | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| const db = require("../../utils/db_config"); | |||||
| const { errorLogStatus } = require("../Errorlog"); | |||||
| async function getInvTransIdQuery(id) { | |||||
| try { | |||||
| let query = `select * from dbo.P2P_Liquiloans_Inv_Transactions where request_id= '${id}'`; | |||||
| return await db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }); | |||||
| } catch (error) { | |||||
| errorLogStatus(error, "nodeJs_liquiloan_handleRecordPresent") | |||||
| } | |||||
| } | |||||
| module.exports = { | |||||
| getInvTransIdQuery | |||||
| } | |||||
| @ -0,0 +1,17 @@ | |||||
| const db = require("../utils/db_config"); | |||||
| function getCurrentDateTime() { | |||||
| var date = new Date(); | |||||
| var dateStr = | |||||
| date.getFullYear() + "-" + | |||||
| ("00" + (date.getMonth() + 1)).slice(-2) + "-" + | |||||
| date.getDate() + " " + | |||||
| ("00" + date.getHours()).slice(-2) + ":" + | |||||
| ("00" + date.getMinutes()).slice(-2) + ":" + | |||||
| ("00" + date.getSeconds()).slice(-2); | |||||
| return dateStr | |||||
| } | |||||
| module.exports = { | |||||
| getCurrentDateTime, | |||||
| } | |||||
| @ -0,0 +1,48 @@ | |||||
| module.exports = function (sequelize, DataTypes) { | |||||
| const getInvestorSummary = sequelize.define('P2P_Liquiloans_Inv_Summarys', { | |||||
| transaction_id: { type: DataTypes.INTEGER, allowNull: false, unique: true }, | |||||
| investor_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| scheme_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| investment_roi: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| return_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| payout_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| lockin_tenure: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| lockin_break: { type: DataTypes.STRING, allowNull: true }, | |||||
| last_withdrawal_at: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_sub_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| investment_status: { type: DataTypes.STRING, allowNull: true }, | |||||
| parent_investment_id: { type: DataTypes.STRING, allowNull: true }, | |||||
| master_parent_investment_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| quality_name: { type: DataTypes.STRING, allowNull: true }, | |||||
| name: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| invested_amount: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| scheme_name: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| lockin_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| display_scheme: { type: DataTypes.STRING, allowNull: true }, | |||||
| scheme_details: { type: DataTypes.STRING, allowNull: true }, | |||||
| lockin_end_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| redeemed_principal: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| redeemed_interest: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| redeemed_interest_with_request: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| total_redemption: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| net_principal_investment: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| interest_amount: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| accrued_value: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| withdrawable_balance: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| scheme_closed_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| request_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| source: { type: DataTypes.STRING, allowNull: true }, | |||||
| created_at: { type: DataTypes.STRING, allowNull: true }, | |||||
| last_updatedAt: { type: DataTypes.STRING, allowNull: true }, | |||||
| }, { | |||||
| //freezeTableName: true, // Model tableName will be the same as the model name | |||||
| timestamps: false, | |||||
| //underscored: true | |||||
| } | |||||
| ); | |||||
| return getInvestorSummary | |||||
| }; | |||||
| @ -0,0 +1,38 @@ | |||||
| // P2P_Liquiloans_Inv_Transaction | |||||
| module.exports = function (sequelize, DataTypes) { | |||||
| const liquiloansTransaction = sequelize.define('P2P_Liquiloans_Inv_Transactions', { | |||||
| request_id: { type: DataTypes.INTEGER, allowNull: false, unique: true }, | |||||
| investor_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| amount: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| transaction_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_sub_type: { type: DataTypes.STRING, allowNull: true }, | |||||
| withdrawal_method: { type: DataTypes.STRING, allowNull: true }, | |||||
| manual_parameters: { type: DataTypes.STRING, allowNull: true }, | |||||
| old_investment_id: { type: DataTypes.STRING, allowNull: true }, | |||||
| scheme_id: { type: DataTypes.INTEGER, allowNull: true }, | |||||
| mode: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_id: { type: DataTypes.STRING, allowNull: true }, | |||||
| order_id: { type: DataTypes.STRING, allowNull: true }, | |||||
| settlement_utr: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_source: { type: DataTypes.STRING, allowNull: true }, | |||||
| approval_status: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_status: { type: DataTypes.STRING, allowNull: true }, | |||||
| created_at: { type: DataTypes.STRING, allowNull: true }, | |||||
| authenticated_at: { type: DataTypes.STRING, allowNull: true }, | |||||
| banking_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| execution_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| transaction_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| ext_transaction_date: { type: DataTypes.STRING, allowNull: true }, | |||||
| source_payment: { type: DataTypes.STRING, allowNull: true }, | |||||
| last_updatedAt: { type: DataTypes.STRING, allowNull: true }, | |||||
| }, { | |||||
| timestamps: false, | |||||
| } | |||||
| ); | |||||
| return liquiloansTransaction | |||||
| } | |||||
| @ -1,7 +1,21 @@ | |||||
| const express = require('express'); | const express = require('express'); | ||||
| const { route } = require("express/lib/application"); | |||||
| const { getAllInvestorId } = require('../controller/getInvestmentSummary'); | |||||
| const { fetchInvestorDetails } = require('../controller/getAllInvestor'); | |||||
| const { getReqAndInvId } = require('../controller/getTransactionById'); | |||||
| const router = express.Router(); | const router = express.Router(); | ||||
| router.get("/allInvestor", (req, res) => { | |||||
| fetchInvestorDetails() | |||||
| }) | |||||
| router.get("/getInvestmentSummary", (req, res) => { | |||||
| getAllInvestorId() | |||||
| }) | |||||
| /* GET users listing. */ | |||||
| router.get("/getTransactionId", (req, res) => { | |||||
| getReqAndInvId() | |||||
| }) | |||||
| module.exports = router; | module.exports = router; | ||||
| @ -1,17 +1,36 @@ | |||||
| 'use strict'; | 'use strict'; | ||||
| const cron = require('node-cron'); | const cron = require('node-cron'); | ||||
| const { fetchInvestorDetails } = require('../controller/getAllInvestor'); | |||||
| const { getAllInvestorId } = require('../controller/getInvestmentSummary'); | |||||
| const { getReqAndInvId } = require('../controller/getTransactionById'); | |||||
| const routineFetchInvestors = () => { | |||||
| cron.schedule(process.env.SCHEDULER_RULE_EXOTEL_CALL, () => { | |||||
| console.log("running scheduler"); | |||||
| // recordingController.callExotelRecording(); | |||||
| const routineFetchAllInvestors = () => { | |||||
| cron.schedule(process.env.SCHEDULER_RULE_FETCH_ALL_INVESTOR, () => { | |||||
| console.log("running scheduler routineFetchAllInvestors"); | |||||
| fetchInvestorDetails() | |||||
| }) | |||||
| }; | |||||
| const routineGetInvestmentSummary = () => { | |||||
| cron.schedule(process.env.SCHEDULER_RULE_INVESTMENT_SUMMARY, () => { | |||||
| console.log("running scheduler routineGetInvestmentSummary"); | |||||
| getAllInvestorId() | |||||
| }) | |||||
| }; | |||||
| const routineGetTransactionById = () => { | |||||
| cron.schedule(process.env.SCHEDULER_RULE_TRANS_ID, () => { | |||||
| console.log("running scheduler routineGetTransactionById"); | |||||
| getReqAndInvId() | |||||
| }) | }) | ||||
| }; | }; | ||||
| module.exports = { | module.exports = { | ||||
| routineFetchInvestors, | |||||
| routineFetchAllInvestors, | |||||
| routineGetInvestmentSummary, | |||||
| routineGetTransactionById | |||||
| }; | }; | ||||
Powered by TurnKey Linux.