Additional fortellis changes.
This commit is contained in:
@@ -167,6 +167,8 @@ async function MakeFortellisCall({
|
|||||||
Authorization: `Bearer ${access_token}`,
|
Authorization: `Bearer ${access_token}`,
|
||||||
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
||||||
"Request-Id": ReqId,
|
"Request-Id": ReqId,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
...(DepartmentId && { "Department-Id": DepartmentId }),
|
...(DepartmentId && { "Department-Id": DepartmentId }),
|
||||||
...headers
|
...headers
|
||||||
}
|
}
|
||||||
@@ -178,6 +180,7 @@ async function MakeFortellisCall({
|
|||||||
Authorization: `Bearer ${access_token}`,
|
Authorization: `Bearer ${access_token}`,
|
||||||
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
||||||
"Request-Id": ReqId,
|
"Request-Id": ReqId,
|
||||||
|
Accept: "application/json",
|
||||||
"Department-Id": DepartmentId,
|
"Department-Id": DepartmentId,
|
||||||
...headers
|
...headers
|
||||||
}
|
}
|
||||||
@@ -189,6 +192,8 @@ async function MakeFortellisCall({
|
|||||||
Authorization: `Bearer ${access_token}`,
|
Authorization: `Bearer ${access_token}`,
|
||||||
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
"Subscription-Id": SubscriptionMeta.subscriptionId,
|
||||||
"Request-Id": ReqId,
|
"Request-Id": ReqId,
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
"Department-Id": DepartmentId,
|
"Department-Id": DepartmentId,
|
||||||
...headers
|
...headers
|
||||||
}
|
}
|
||||||
@@ -349,28 +354,28 @@ const FortellisActions = {
|
|||||||
? "https://api.fortellis.io/cdk/drive/glpost/startWIP"
|
? "https://api.fortellis.io/cdk/drive/glpost/startWIP"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/glpost/startWIP",
|
: "https://api.fortellis.io/cdk-test/drive/glpost/startWIP",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Accounting GL"
|
apiName: "CDK Drive Post Accounts GL"
|
||||||
},
|
},
|
||||||
TranBatchWip: {
|
TranBatchWip: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/glpost/transBatchWIP"
|
? "https://api.fortellis.io/cdk/drive/glpost/transBatchWIP"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/glpost/transBatchWIP",
|
: "https://api.fortellis.io/cdk-test/drive/glpost/transBatchWIP",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Accounting GL"
|
apiName: "CDK Drive Post Accounts GL"
|
||||||
},
|
},
|
||||||
PostBatchWip: {
|
PostBatchWip: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/glpost/postBatchWIP"
|
? "https://api.fortellis.io/cdk/drive/glpost/postBatchWIP"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/glpost/postBatchWIP",
|
: "https://api.fortellis.io/cdk-test/drive/glpost/postBatchWIP",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Accounting GL"
|
apiName: "CDK Drive Post Accounts GL"
|
||||||
},
|
},
|
||||||
QueryErrorWip: {
|
QueryErrorWip: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/glpost/errWIP"
|
? "https://api.fortellis.io/cdk/drive/glpost/errWIP/" //Get requests should have the trailing slash/
|
||||||
: "https://api.fortellis.io/cdk-test/drive/glpost/errWIP",
|
: "https://api.fortellis.io/cdk-test/drive/glpost/errWIP/",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Post Accounting GL"
|
apiName: "CDK Drive Post Accounts GL"
|
||||||
},
|
},
|
||||||
ServiceHistoryInsert: {
|
ServiceHistoryInsert: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
|
|||||||
@@ -252,16 +252,16 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
|
|||||||
|
|
||||||
CreateFortellisLogEvent(socket, "DEBUG", `{5.1} Creating Transaction with ID ${DMSTransHeader.transID}`);
|
CreateFortellisLogEvent(socket, "DEBUG", `{5.1} Creating Transaction with ID ${DMSTransHeader.transID}`);
|
||||||
|
|
||||||
const DMSBatchTxn = await InsertDmsBatchWip({ socket, redisHelpers, JobData });
|
// const DMSBatchTxn = await InsertDmsBatchWip({ socket, redisHelpers, JobData });
|
||||||
await setSessionTransactionData(
|
// await setSessionTransactionData(
|
||||||
socket.id,
|
// socket.id,
|
||||||
getTransactionType(jobid),
|
// getTransactionType(jobid),
|
||||||
FortellisCacheEnums.DMSBatchTxn,
|
// FortellisCacheEnums.DMSBatchTxn,
|
||||||
DMSBatchTxn,
|
// DMSBatchTxn,
|
||||||
defaultFortellisTTL
|
// defaultFortellisTTL
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (DMSBatchTxn.rtnCode === "0") {
|
if (DMSTransHeader.rtnCode === "0") {
|
||||||
CreateFortellisLogEvent(socket, "DEBUG", `{6} Attempting to post Transaction with ID ${DMSTransHeader.transID}`);
|
CreateFortellisLogEvent(socket, "DEBUG", `{6} Attempting to post Transaction with ID ${DMSTransHeader.transID}`);
|
||||||
|
|
||||||
const DmsBatchTxnPost = await PostDmsBatchWip({ socket, redisHelpers, JobData });
|
const DmsBatchTxnPost = await PostDmsBatchWip({ socket, redisHelpers, JobData });
|
||||||
@@ -298,34 +298,36 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
|
|||||||
|
|
||||||
const DmsError = await QueryDmsErrWip({ socket, redisHelpers, JobData });
|
const DmsError = await QueryDmsErrWip({ socket, redisHelpers, JobData });
|
||||||
// //Delete the transaction
|
// //Delete the transaction
|
||||||
CreateFortellisLogEvent(socket, "DEBUG", `{{ 6.2 } Deleting Transaction ID ${socket.DMSTransHeader.transID}`);
|
CreateFortellisLogEvent(socket, "DEBUG", `{{ 6.2 } Deleting Transaction ID ${DMSTransHeader.transID}`);
|
||||||
|
|
||||||
const DmsBatchTxnDelete = await DeleteDmsWip({ socket, redisHelpers, JobData });
|
const DmsBatchTxnDelete = await DeleteDmsWip({ socket, redisHelpers, JobData });
|
||||||
|
|
||||||
DmsError.errMsg
|
DmsError.errMsg.map(
|
||||||
.split("|")
|
(e) =>
|
||||||
.map(
|
e !== null &&
|
||||||
(e) =>
|
e !== "" &&
|
||||||
e !== null &&
|
CreateFortellisLogEvent(socket, "ERROR", `Error(s) encountered in posting transaction.${e} `)
|
||||||
e !== "" &&
|
);
|
||||||
CreateFortellisLogEvent(socket, "ERROR", `Error(s) encountered in posting transaction.${e} `)
|
await InsertFailedExportLog({
|
||||||
);
|
socket,
|
||||||
|
JobData,
|
||||||
|
error: DmsError.errMsg
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Posting transaction failed.
|
//Creating transaction failed.
|
||||||
CreateFortellisLogEvent(
|
CreateFortellisLogEvent(
|
||||||
socket,
|
socket,
|
||||||
"ERROR",
|
"ERROR",
|
||||||
`DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
`DMS Batch Return code was not successful: ${DMSTransHeader.rtnCode} - ${DMSTransHeader.sendline}`
|
||||||
);
|
);
|
||||||
await InsertFailedExportLog({
|
await InsertFailedExportLog({
|
||||||
socket,
|
socket,
|
||||||
JobData,
|
JobData,
|
||||||
error: `DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
error: `DMS Batch Return code was not successful: ${DMSTransHeader.rtnCode} - ${DMSTransHeader.sendline}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkSelectedCustomer.${ error } `);
|
|
||||||
CreateFortellisLogEvent(socket, "ERROR", `Error in FortellisSelectedCustomer - ${error} `, {
|
CreateFortellisLogEvent(socket, "ERROR", `Error in FortellisSelectedCustomer - ${error} `, {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
stack: error.stack,
|
stack: error.stack,
|
||||||
@@ -1013,19 +1015,33 @@ async function InsertDmsStartWip({ socket, redisHelpers, JobData }) {
|
|||||||
socket,
|
socket,
|
||||||
jobid: JobData.id,
|
jobid: JobData.id,
|
||||||
body: {
|
body: {
|
||||||
acctgDate: moment().tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
|
// acctgDate: moment().tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
|
||||||
desc: txEnvelope.story && txEnvelope.story.replace(replaceSpecialRegex, ""),
|
// desc: txEnvelope.story && txEnvelope.story.replace(replaceSpecialRegex, ""),
|
||||||
docType: "10",
|
// docType: "10",
|
||||||
|
// m13Flag: "0",
|
||||||
|
// refer: JobData.ro_number,
|
||||||
|
// // "rtnCode": "",
|
||||||
|
// // "sendline": "",
|
||||||
|
// // "groupName": "",
|
||||||
|
// srcCo: JobData.bodyshop.cdk_configuration.srcco,
|
||||||
|
// srcJrnl: txEnvelope.journal,
|
||||||
|
// transID: "",
|
||||||
|
// userID: "partprgm" || JobData.bodyshop.cdk_configuration.cashierid,
|
||||||
|
// userName: "PROGRAM, PARTNER"
|
||||||
|
|
||||||
|
acctgDate: "2025-07-07",
|
||||||
|
desc: "DOCUMENT DESC. OPTIONAL REQUIREMENT",
|
||||||
|
docType: "3",
|
||||||
m13Flag: "0",
|
m13Flag: "0",
|
||||||
refer: JobData.ro_number,
|
refer: "707MISC01",
|
||||||
// "rtnCode": "",
|
rtnCode: "",
|
||||||
// "sendline": "",
|
sendline: "",
|
||||||
// "groupName": "",
|
groupName: "",
|
||||||
srcCo: JobData.bodyshop.cdk_configuration.srcco,
|
srcCo: "77",
|
||||||
srcJrnl: txEnvelope.journal,
|
srcJrnl: "80",
|
||||||
transID: "",
|
transID: "",
|
||||||
userID: "csr" || JobData.bodyshop.cdk_configuration.cashierid,
|
userID: "partprgm",
|
||||||
userName: "BSMS"
|
userName: "PROGRAM, PARTNER"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -1211,7 +1227,8 @@ async function PostDmsBatchWip({ socket, redisHelpers, JobData }) {
|
|||||||
jobid: JobData.id,
|
jobid: JobData.id,
|
||||||
body: {
|
body: {
|
||||||
opCode: "P",
|
opCode: "P",
|
||||||
transID: DMSTransHeader.transID
|
transID: DMSTransHeader.transID,
|
||||||
|
transWipReqList: await GenerateTransWips({ socket, redisHelpers, JobData })
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user