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)) {

View File

@@ -30,10 +30,10 @@ insert_permissions:
- created_at
- ded_amt
- g_bett_amt
- supp_amt
- group
- group_verified
- id
- id_pro_nam
- ins_co_nm
- loss_date
- loss_desc
@@ -45,6 +45,7 @@ insert_permissions:
- rates
- requires_reimport
- ro_number
- supp_amt
- totals
- updated_at
- v_age
@@ -66,10 +67,10 @@ select_permissions:
- created_at
- ded_amt
- g_bett_amt
- supp_amt
- group
- group_verified
- id
- id_pro_nam
- ins_co_nm
- loss_date
- loss_desc
@@ -81,6 +82,7 @@ select_permissions:
- rates
- requires_reimport
- ro_number
- supp_amt
- totals
- updated_at
- v_age
@@ -109,10 +111,10 @@ update_permissions:
- created_at
- ded_amt
- g_bett_amt
- supp_amt
- group
- group_verified
- id
- id_pro_nam
- ins_co_nm
- loss_date
- loss_desc
@@ -124,6 +126,7 @@ update_permissions:
- rates
- requires_reimport
- ro_number
- supp_amt
- totals
- updated_at
- v_age

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."jobs" add column "id_pro_nam" text
-- null;

View File

@@ -0,0 +1,2 @@
alter table "public"."jobs" add column "id_pro_nam" text
null;

View File

@@ -3,7 +3,7 @@
"productName": "ImEX RPS",
"author": "ImEX Systems Inc. <support@thinkimex.com>",
"description": "ImEX RPS",
"version": "1.4.2-alpha.4",
"version": "1.4.2-alpha.6",
"main": "electron/main.js",
"homepage": "./",
"dependencies": {

View File

@@ -234,11 +234,12 @@ export const QUERY_JOB_ESTIMATE_SCRUBBER = gql`
ownr_city
ownr_ph1
v_stage
id_pro_nam
supp_amt
g_bett_amt
bodyshop {
id
post_zip
zip_post
phone
}
joblines(order_by: {line_no: asc}) {