Execute Liquiloans Transaction Script
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

67 lines
2.3 KiB

'use strict'
const request = require("request");
const constants = require('../utils/consts');
const db = require('../utils/db_config');
const crypto = require('crypto');
const { getCurrentDateTime } = require("./helper");
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');
}
let arrayGetList = ["2509295", "2509", "2820644", "437290"]
function getHashCode(req) {
// console.log(`368907||${getCurrentDateTime()}`, "DKDDODKOODDOK");
const inputString_GetInvestorDashboard = `${req}||${getCurrentDateTime()}`;
const key = "27E6A91CEE689";
const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key);
return hash_GetInvestorDashboard
}
const createLiquiloanInvestor = async (req, res) => {
var promiseArray = [];
for (let i = 0; i < arrayGetList.length; i++) {
promiseArray.push(new Promise((resolve, reject) => {
var options = {
method: 'POST',
url: 'https://supply-integration.liquiloans.com/api/v2/GetInvestmentSummary',
headers: {
'Content-Type': 'application/json',
'Cookie': 'AWSALB=9yK+sr19KPz9dgL+OcWl2hZ9MOhLlvF9PtNolmRnkviHh01CvjlIWH44NtfjIziyJFwnhrn3+JNhztFLJis+Ijq971nXr5QQVJBxId1uvjZyqKSl/6oFuidGkloW; AWSALBCORS=9yK+sr19KPz9dgL+OcWl2hZ9MOhLlvF9PtNolmRnkviHh01CvjlIWH44NtfjIziyJFwnhrn3+JNhztFLJis+Ijq971nXr5QQVJBxId1uvjZyqKSl/6oFuidGkloW'
},
body: JSON.stringify({
"investor_id": arrayGetList[i],
"timestamp": getCurrentDateTime(),
"checksum": getHashCode(arrayGetList[i]),
"mid": "M00201"
})
};
request(options, function (error, response, body) {
if (error) reject(error);
else resolve(body)
})
}))
}
console.log(await Promise.all(promiseArray));
}
// const createLiquiloanInvestor = (req, res) => {
// for (let i = 0; i < arrayGetList.length; i++) {
// const element = arrayGetList[i];
// main(element, element.length)
// }
// res.se
// }
module.exports = {
createLiquiloanInvestor
}

Powered by TurnKey Linux.