probe42ApiEndpointChanges:GWM
This commit is contained in:
parent
5104638810
commit
aca57a7fd7
@ -94,30 +94,38 @@ exports.MenuList = async (req, res) => {
|
|||||||
Entities.create({ "losid":Pro42Datavalue.loginNo,"pan":Pro42Datavalue.pan,"cin":cin_number,"bizname":Pro42Datavalue.entityName,"entity_type":Pro42Datavalue.entityType,"probe42_data_status":1,"is_verified":0,"createdby":Pro42Datavalue.createdby})
|
Entities.create({ "losid":Pro42Datavalue.loginNo,"pan":Pro42Datavalue.pan,"cin":cin_number,"bizname":Pro42Datavalue.entityName,"entity_type":Pro42Datavalue.entityType,"probe42_data_status":1,"is_verified":0,"createdby":Pro42Datavalue.createdby})
|
||||||
.then(Entitydata => {
|
.then(Entitydata => {
|
||||||
logMsg.info("entity created , data:"+Entitydata);
|
logMsg.info("entity created , data:"+Entitydata);
|
||||||
const cin = Entitydata.dataValues.cin;
|
|
||||||
if(cin != "")
|
|
||||||
|
|
||||||
|
if(Entitydata.dataValues.entity_type == 'COMPANY' || (Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) == 'LLP'))
|
||||||
{
|
{
|
||||||
|
|
||||||
const entityid = Entitydata.dataValues.id;
|
|
||||||
if(Entitydata.dataValues.entity_type == 'PROPRIETORSHIP')
|
const cin = Entitydata.dataValues.cin;
|
||||||
|
if(cin == "" || cin == null)
|
||||||
{
|
{
|
||||||
// create skeleton here
|
entity_identify_number = Entitydata.dataValues.pan;
|
||||||
financialControllerHelper.createSkeleton(losid,entityid);
|
entity_identify_number_type = 'pan';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entity_identify_number = Entitydata.dataValues.cin;
|
||||||
|
if(Entitydata.dataValues.entity_type == 'COMPANY')
|
||||||
|
{
|
||||||
|
entity_identify_number_type = 'cin';
|
||||||
|
}else if(Entitydata.dataValues.entity_type == 'PARTNERSHIP' && Entitydata.dataValues.bizname.slice(-3) == 'LLP')
|
||||||
|
{
|
||||||
|
entity_identify_number_type = 'llp';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// processInstanceId = camundaHelper.startFinancialsProcessInstance(Entitydata.dataValues.losid,Entitydata.dataValues.pan,user);
|
|
||||||
// processInstanceId.then(function(InstanceId){
|
|
||||||
// console.log("startFinancialsProcessInstance data");
|
|
||||||
// console.log(InstanceId);
|
|
||||||
// Entities.update({ "process_instance_id":InstanceId },{ where: { id: entityid }}).then(processInstanceIdData =>{
|
|
||||||
// // resolve here
|
|
||||||
// if (key === array.length -1) { resolve(); } }).catch(err=>{ logMsg.info("camunda process_instance_id creation for entity_id= "+entityid); });
|
|
||||||
// });
|
|
||||||
|
|
||||||
// call and get financial year wise data for entity (probe42 api call)
|
// call and get financial year wise data for entity (probe42 api call)
|
||||||
financials_data_api_response = ApiCallHelper.probe42ApiCall(cin);
|
financials_data_api_response = ApiCallHelper.probe42ApiCall(entity_identify_number,entity_identify_number_type);
|
||||||
financials_data_api_response.then(function(result){
|
financials_data_api_response.then(function(result){
|
||||||
if(result == false)
|
if(result == false)
|
||||||
{
|
{
|
||||||
@ -125,9 +133,12 @@ exports.MenuList = async (req, res) => {
|
|||||||
financialControllerHelper.createSkeleton(losid,entityid);
|
financialControllerHelper.createSkeleton(losid,entityid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if(result.financials.length > 0)
|
||||||
{
|
{
|
||||||
//filter lineitems from api responce and construct to needed format
|
//filter lineitems from api responce and construct to needed format
|
||||||
lineItem_data = Probe42DataMappingHelper.lineItemFetching(result);
|
lineItem_data = Probe42DataMappingHelper.lineItemFetching(result.financials);
|
||||||
lineItem_data.then(function(lineItem_result){
|
lineItem_data.then(function(lineItem_result){
|
||||||
|
|
||||||
//create financial table and entityfinyear table record here
|
//create financial table and entityfinyear table record here
|
||||||
@ -143,7 +154,7 @@ exports.MenuList = async (req, res) => {
|
|||||||
var SkeletonInsert = new Promise((resolve, reject) => {
|
var SkeletonInsert = new Promise((resolve, reject) => {
|
||||||
let fin_data_array = [];
|
let fin_data_array = [];
|
||||||
ItemsmasterData.forEach( (itemvalue , index , itemvaluearray) => {
|
ItemsmasterData.forEach( (itemvalue , index , itemvaluearray) => {
|
||||||
fin_data_obj = { "entity_id":Entityfinyearsdata.dataValues.entityid,"st_type":Entityfinyearsdata.dataValues.st_type,"itemid":itemvalue.dataValues.id,"fy":Entityfinyearsdata.dataValues.FY,"value":0,"is_active":1,"createdby":4}
|
fin_data_obj = { "entity_id":Entityfinyearsdata.dataValues.entityid,"st_type":Entityfinyearsdata.dataValues.st_type,"itemid":itemvalue.dataValues.id,"fy":Entityfinyearsdata.dataValues.FY,"value":0,"is_active":1}
|
||||||
fin_data_array.push(fin_data_obj);
|
fin_data_array.push(fin_data_obj);
|
||||||
if (index === itemvaluearray.length -1) { resolve(fin_data_array); }
|
if (index === itemvaluearray.length -1) { resolve(fin_data_array); }
|
||||||
})
|
})
|
||||||
@ -170,10 +181,19 @@ exports.MenuList = async (req, res) => {
|
|||||||
|
|
||||||
});//end of line item foreach
|
});//end of line item foreach
|
||||||
});//end of lineItem filter from api response helper call
|
});//end of lineItem filter from api response helper call
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// create skeleton here
|
||||||
|
financialControllerHelper.createSkeleton(losid,entityid);
|
||||||
|
|
||||||
|
// resolve here
|
||||||
|
if (key === array.length -1) { resolve(); }
|
||||||
|
}
|
||||||
} // end of probe42 api responce success else condition
|
} // end of probe42 api responce success else condition
|
||||||
});//end of probe42 api call
|
});//end of probe42 api call
|
||||||
} else {
|
} else {
|
||||||
console.log(Entitydata.dataValues.bizname.slice(-3));
|
|
||||||
if(Entitydata.dataValues.entity_type == 'PROPRIETORSHIP')
|
if(Entitydata.dataValues.entity_type == 'PROPRIETORSHIP')
|
||||||
{
|
{
|
||||||
// create skeleton here
|
// create skeleton here
|
||||||
@ -184,7 +204,7 @@ exports.MenuList = async (req, res) => {
|
|||||||
}
|
}
|
||||||
// resolve here
|
// resolve here
|
||||||
if (key === array.length -1) { resolve(); }
|
if (key === array.length -1) { resolve(); }
|
||||||
logMsg.info("CIN no not exist for losid = "+losid+" and entity name ="+Entitydata.dataValues.bizname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -221,21 +241,7 @@ exports.MenuList = async (req, res) => {
|
|||||||
let Time = 2000;
|
let Time = 2000;
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
//EntitiesData.forEach((value, key)=>{
|
|
||||||
// Time = Time + 500;
|
|
||||||
// instancesid = value.dataValues.process_instance_id;
|
|
||||||
// taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
|
||||||
// taskid.then(function(result){
|
|
||||||
// Time = Time + 500;
|
|
||||||
// formVariable = camundaHelper.financialsFormVariables(result);
|
|
||||||
// formVariable.then(function(form_result){
|
|
||||||
// formVariableResult = JSON.parse(form_result);
|
|
||||||
// if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status =JSON.parse(form_result); }
|
|
||||||
// obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
|
|
||||||
// data.push(obj_data);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
//}); // end of EntitiesData foreach
|
|
||||||
|
|
||||||
for(const value of EntitiesData)
|
for(const value of EntitiesData)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,14 +11,17 @@ REDIRECTION_PASSWORD = process.env.REDIRECTION_PASSWORD
|
|||||||
REDIRECTION_APPLICATION_NAME = process.env.REDIRECTION_APPLICATION_NAME
|
REDIRECTION_APPLICATION_NAME = process.env.REDIRECTION_APPLICATION_NAME
|
||||||
|
|
||||||
|
|
||||||
function probe42ApiCall(cin) {
|
function probe42ApiCall(entity_identify_number,entity_identify_number_type) {
|
||||||
try {
|
try {
|
||||||
const probe_url = PROBE42_URL + "companycomprehensivedetails";
|
|
||||||
|
var type ="";
|
||||||
|
const probe_url = PROBE42_URL + "GetCompanyLlpComprehensiveDetailshttps";
|
||||||
const myJSONObject = {
|
const myJSONObject = {
|
||||||
"UserId": PROBE42_USER_ID,
|
"UserId": PROBE42_USER_ID,
|
||||||
"Password": PROBE42_PASSWORD,
|
"Password": PROBE42_PASSWORD,
|
||||||
"ApplicationName": PROBE42_APPLICATION_NAME,
|
"ApplicationName": PROBE42_APPLICATION_NAME,
|
||||||
"Cin": cin
|
"Cin_Llpin_Or_Pan": entity_identify_number,
|
||||||
|
"Identifier_type" : entity_identify_number_type
|
||||||
};
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
@ -29,7 +32,7 @@ function probe42ApiCall(cin) {
|
|||||||
}, function (error, response, body) {
|
}, function (error, response, body) {
|
||||||
if (body != undefined) {
|
if (body != undefined) {
|
||||||
if (response.statusCode == 200 && body.hasOwnProperty("data") && body.data.financials.length != 0) {
|
if (response.statusCode == 200 && body.hasOwnProperty("data") && body.data.financials.length != 0) {
|
||||||
financial_data = body.data.financials;
|
financial_data = body.data;
|
||||||
resolve(financial_data);
|
resolve(financial_data);
|
||||||
} else { resolve(false); }
|
} else { resolve(false); }
|
||||||
} else { resolve(false); }
|
} else { resolve(false); }
|
||||||
|
|||||||
@ -110,7 +110,7 @@ const { logMsg } = require('../services/logger.js');
|
|||||||
Entityfinyear.update({ probe42_data_status : 1 } , {where : {entityid:entityid , FY :fy}})
|
Entityfinyear.update({ probe42_data_status : 1 } , {where : {entityid:entityid , FY :fy}})
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
logMsg.info("Probe42 data updated for EntityId = "+entityid+" Year = "+fy);
|
logMsg.info("Probe42 data updated for EntityId = "+entityid+" Year = "+fy);
|
||||||
Entityfinyear.findAll({where : {entityid:300},rew:true})
|
Entityfinyear.findAll({where : {entityid:entityid},rew:true})
|
||||||
.then(async (EntityfinyearData) =>{
|
.then(async (EntityfinyearData) =>{
|
||||||
let count = 0;
|
let count = 0;
|
||||||
for(const value of EntityfinyearData)
|
for(const value of EntityfinyearData)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user