WIP Fortellis.

This commit is contained in:
Patrick Fic
2025-04-25 11:58:38 -07:00
parent e2b4b408ed
commit 19ce1c66ad
7 changed files with 895 additions and 414 deletions

View File

@@ -175,6 +175,17 @@ async function MakeFortellisCall({
}
});
break;
case "put":
result = await axios.put(fullUrl, body, {
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionMeta.subscriptionId,
"Request-Id": ReqId,
"Department-Id": DepartmentId,
...headers
}
});
break;
}
if (debug) {
@@ -266,6 +277,34 @@ const FortellisActions = {
type: "get",
apiName: "CDK Drive Post Customer",
},
ReadCustomer: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/customerpost/v1/" //Customer ID is request param.
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
type: "get",
apiName: "CDK Drive Post Customer",
},
CreateCustomer: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/customerpost/v1/"
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
type: "post",
apiName: "CDK Drive Post Customer",
},
InsertVehicle: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
type: "post",
apiName: "CDK Drive Post Service Vehicle",
},
UpdateVehicle: {
url: isProduction
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
type: "put",
apiName: "CDK Drive Post Customer",
},
GetCOA: {
type: "get",
apiName: "CDK Drive Post Accounts GL WIP",
@@ -277,7 +316,14 @@ const FortellisActions = {
const FortellisCacheEnums = {
txEnvelope: "txEnvelope",
SubscriptionMeta: "SubscriptionMeta",
DepartmentId: "DepartmentId"
DepartmentId: "DepartmentId",
JobData: "JobData",
DMSVid: "DMSVid",
DMSVeh: "DMSVeh",
DMSVehCustomer: "DMSVehCustomer",
DMSCustList: "DMSCustList",
DMSCust: "DMSCust",
selectedCustomerId: "selectedCustomerId",
};
function constructFullUrl({ url, pathParams = "", requestSearchParams = [] }) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
const { admin } = require("../firebase/firebase-handler");
const FortellisJobExport = require("../fortellis/fortellis").default;
const { FortellisJobExport, FortellisSelectedCustomer } = require("../fortellis/fortellis");
const FortellisLogger = require("../fortellis/fortellis-logger");
const redisSocketEvents = ({
@@ -272,6 +272,33 @@ const redisSocketEvents = ({
});
}
});
socket.on("fortellis-selected-customer", async ({ jobid, selectedCustomerId }) => {
try {
await FortellisSelectedCustomer({
socket,
redisHelpers: {
setSessionData,
getSessionData,
addUserSocketMapping,
removeUserSocketMapping,
refreshUserSocketTTL,
getUserSocketMappingByBodyshop,
setSessionTransactionData,
getSessionTransactionData,
clearSessionTransactionData
},
ioHelpers: { getBodyshopRoom, getBodyshopConversationRoom },
jobid,
selectedCustomerId
});
} catch (error) {
FortellisLogger(socket, "error", `Error during Fortellis export : ${error.message}`);
logger.log("fortellis-selectd-customer-error", "error", null, null, {
message: error.message,
stack: error.stack
});
}
});
};
// Call Handlers