IO-233 CDK WIP customer changes.
This commit is contained in:
@@ -75,7 +75,9 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
socket.DMSCustList = await QueryDmsCustomerByName(socket, JobData);
|
||||
|
||||
socket.emit("cdk-select-customer", [
|
||||
...(socket.DMSVehCustomer ? [socket.DMSVehCustomer] : []),
|
||||
...(socket.DMSVehCustomer
|
||||
? [{ ...socket.DMSVehCustomer, vinOwner: true }]
|
||||
: []),
|
||||
...socket.DMSCustList,
|
||||
]);
|
||||
} catch (error) {
|
||||
@@ -140,30 +142,24 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
|
||||
);
|
||||
socket.DMSVeh = await UpdateDmsVehicle(socket);
|
||||
}
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{5} Updating Service Vehicle History. ***SKIPPING FOR NOW TO PRESERVE RO NUMBERS ***`
|
||||
);
|
||||
//socket.DMSVehHistory = await InsertServiceVehicleHistory(socket);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{6} Creating Transaction header with Dms Start WIP`
|
||||
`{5} Creating Transaction header with Dms Start WIP`
|
||||
);
|
||||
socket.DMSTransHeader = await InsertDmsStartWip(socket);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{6.1} Creating Transaction with ID ${socket.DMSTransHeader.transID}`
|
||||
`{5.1} Creating Transaction with ID ${socket.DMSTransHeader.transID}`
|
||||
);
|
||||
|
||||
socket.DMSBatchTxn = await InsertDmsBatchWip(socket);
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{7} Attempting to post Transaction with ID ${socket.DMSTransHeader.transID}`
|
||||
`{6} Attempting to post Transaction with ID ${socket.DMSTransHeader.transID}`
|
||||
);
|
||||
socket.DmsBatchTxnPost = await PostDmsBatchWip(socket);
|
||||
if (socket.DmsBatchTxnPost.code === "success") {
|
||||
@@ -171,25 +167,31 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{8} Successfully posted sransaction to DMS.`
|
||||
`{6} Successfully posted sransaction to DMS.`
|
||||
);
|
||||
|
||||
await MarkJobExported(socket, socket.JobData.id);
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{5} Updating Service Vehicle History. ***SKIPPING FOR NOW TO PRESERVE RO NUMBERS ***`
|
||||
);
|
||||
//socket.DMSVehHistory = await InsertServiceVehicleHistory(socket);
|
||||
socket.emit("export-success", socket.JobData.id);
|
||||
} else {
|
||||
//Get the error code
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{7.1} Getting errors for Transaction ID ${socket.DMSTransHeader.transID}`
|
||||
`{6.1} Getting errors for Transaction ID ${socket.DMSTransHeader.transID}`
|
||||
);
|
||||
socket.DmsError = await QueryDmsErrWip(socket);
|
||||
//Delete the transaction
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{7.2} Deleting Transaction ID ${socket.DMSTransHeader.transID}`
|
||||
`{6.2} Deleting Transaction ID ${socket.DMSTransHeader.transID}`
|
||||
);
|
||||
socket.DmsBatchTxnPost = await DeleteDmsWip(socket);
|
||||
//Emit the error in a nice way .
|
||||
@@ -203,7 +205,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"ERROR",
|
||||
r`Error(s) encountered in posting transaction. ${e}`
|
||||
`Error(s) encountered in posting transaction. ${e}`
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -575,7 +577,12 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
|
||||
addressLine: socket.JobData.ownr_addr1,
|
||||
city: socket.JobData.ownr_city,
|
||||
country: null,
|
||||
postalCode: socket.JobData.ownr_zip,
|
||||
postalCode:
|
||||
socket.JobData.ownr_zip &&
|
||||
socket.JobData.ownr_zip //TODO Need to remove for US Based customers.
|
||||
.toUpperCase()
|
||||
.replace(/\W/g, "")
|
||||
.replace(/(...)/, "$1 "),
|
||||
stateOrProvince: socket.JobData.ownr_st,
|
||||
},
|
||||
contactInfo: {
|
||||
@@ -583,6 +590,10 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
|
||||
main: true,
|
||||
value: socket.JobData.ownr_ph1,
|
||||
},
|
||||
email: {
|
||||
desc: socket.JobData.ownr_ea ? "Other" : "CustomerDeclined",
|
||||
value: socket.JobData.ownr_ea ? "Other" : null,
|
||||
},
|
||||
},
|
||||
demographics: null,
|
||||
name1: {
|
||||
@@ -595,6 +606,10 @@ async function InsertDmsCustomer(socket, newCustomerNumber) {
|
||||
suffix: null,
|
||||
title: null,
|
||||
},
|
||||
//TODO - REMOVE THIS AFTER TESTING.
|
||||
...(process.env.NODE_ENV !== "production"
|
||||
? { arStatus: { dealerField1: "Testing" } }
|
||||
: {}),
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ query QUERY_JOBS_FOR_CDK_EXPORT($id: uuid!) {
|
||||
ownr_zip
|
||||
ownr_city
|
||||
ownr_st
|
||||
ownr_ea
|
||||
ins_co_nm
|
||||
job_totals
|
||||
rate_la1
|
||||
|
||||
Reference in New Issue
Block a user