Add in ID_PRO_NAM to integration.

This commit is contained in:
Patrick Fic
2025-08-14 09:32:35 -07:00
parent 09ddb85b8b
commit 1de87a4280
7 changed files with 36 additions and 9 deletions

View File

@@ -54,6 +54,7 @@ async function DecodeEstimate(filePath, includeFilePathInReturnJob = false, clos
...(await DecodeLinFile(extensionlessFilePath, close_date)),
...(await DecodePflFile(extensionlessFilePath,)),
...(await DecodePfmFile(extensionlessFilePath,)),
...(await DecodePfhFile(extensionlessFilePath,)),
...(await DecodeStlFile(extensionlessFilePath,)),
...(includeFilePathInReturnJob ? { filePath } : {})
};
@@ -255,6 +256,21 @@ async function DecodeAd2File(extensionlessFilePath) {
}
async function DecodeVehFile(extensionlessFilePath) {
let dbf;
try {
dbf = await DBFFile.open(`${extensionlessFilePath}.PFH`);
} catch (error) {
log.error("Error opening PFH File.", error);
} finally {
if (!dbf) return {};
let records = await dbf.readRecords(1);
return _.pick(records[0], [
"ID_PRO_NAM"
]);
}
}
async function DecodePfhFile(extensionlessFilePath) {
let dbf;
try {
dbf = await DBFFile.open(`${extensionlessFilePath}V.VEH`);

View File

@@ -28,7 +28,8 @@ async function writeJobToLogsFolder(job, fileName) {
}
}
async function ScrubEstimate({ job }) {
//TODO: Fetch these from ImEX Online API.
//These are hard coded as they are not secure values and checking happens based on other values.
//No secret or private information is exposed.
const basicAuthUser = "Imex";
const basicAuthpassword = "Patrick";
const estimateScrubberUrl = "https://insurtechtoolkit.com/api/sendems";
@@ -44,10 +45,11 @@ async function ScrubEstimate({ job }) {
job.sending_entity_id = sendingEntityId;
job.sending_entity_accept_terms_of_use = true;
job.association_switch = "ATAM";
job.rf_zip = "R0G 1Z0";
job.rf_ph1 = "2043792253";
job.rf_zip = job.bodyshop.zip_post;
job.rf_ph1 = job.bodyshop.phone;
job.g_ttl_amt = job.clm_total;
delete job.clm_total;
delete job.bodyshop //Bodyshop has to be passed through the object as we don't have access to the store here.
//Adjust the rates field to be MAT_TYPE instead of MATL_TYPE
if (job.rates && Array.isArray(job.rates)) {
@@ -58,7 +60,6 @@ async function ScrubEstimate({ job }) {
}
});
}
delete job.bodyshop //Bodyshop has to be passed through the object as we don't have access to the store here.
//Lower case the rates & totals
if (job.rates && Array.isArray(job.rates)) {