WIP Get Makes
This commit is contained in:
@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -18,15 +19,26 @@ export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakesRefetch);
|
|||||||
export function DmsCdkMakesRefetch({ currentUser, bodyshop }) {
|
export function DmsCdkMakesRefetch({ currentUser, bodyshop }) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const {
|
||||||
|
treatments: { Fortellis }
|
||||||
|
} = useSplitTreatments({
|
||||||
|
attributes: {},
|
||||||
|
names: ["Fortellis"],
|
||||||
|
splitKey: bodyshop.imexshopid
|
||||||
|
});
|
||||||
|
|
||||||
if (!currentUser.email.includes("@imex.")) return null;
|
if (!currentUser.email.includes("@imex.")) return null;
|
||||||
|
|
||||||
const handleRefetch = async () => {
|
const handleRefetch = async () => {
|
||||||
setLoading(true);
|
try {
|
||||||
await axios.post("/cdk/getvehicles", {
|
setLoading(true);
|
||||||
cdk_dealerid: bodyshop.cdk_dealerid,
|
await axios.post(`cdk${Fortellis.treatment === "on" ? "/fortellis" : ""}/getvehicles`, {
|
||||||
bodyshopid: bodyshop.id
|
cdk_dealerid: bodyshop.cdk_dealerid,
|
||||||
});
|
bodyshopid: bodyshop.id
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -225,8 +225,13 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
|||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLogs([]);
|
setLogs([]);
|
||||||
socket.disconnect();
|
if (Fortellis.treatment === "on") {
|
||||||
socket.connect();
|
wsssocket.disconnect();
|
||||||
|
wsssocket.connect();
|
||||||
|
} else {
|
||||||
|
socket.disconnect();
|
||||||
|
socket.connect();
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Reconnect
|
Reconnect
|
||||||
|
|||||||
@@ -5,6 +5,12 @@ const CdkWsdl = require("./cdk-wsdl").default;
|
|||||||
const logger = require("../utils/logger");
|
const logger = require("../utils/logger");
|
||||||
|
|
||||||
const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
||||||
|
const {
|
||||||
|
MakeFortellisCall,
|
||||||
|
FortellisActions,
|
||||||
|
GetAuthToken,
|
||||||
|
GetDepartmentId
|
||||||
|
} = require("../fortellis/fortellis-helpers");
|
||||||
|
|
||||||
// exports.default = async function (socket, cdk_dealerid) {
|
// exports.default = async function (socket, cdk_dealerid) {
|
||||||
// try {
|
// try {
|
||||||
@@ -105,3 +111,85 @@ async function GetCdkMakes(req, cdk_dealerid) {
|
|||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function GetFortellisMakes(req, cdk_dealerid) {
|
||||||
|
logger.log("fortellis-replace-makes-models", "DEBUG", req.user.email, null, {
|
||||||
|
cdk_dealerid
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const result = await MakeFortellisCall({
|
||||||
|
...FortellisActions.GetMakeModel,
|
||||||
|
headers: {},
|
||||||
|
redisHelpers: {
|
||||||
|
setSessionTransactionData: () => {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
getSessionTransactionData: () => {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
socket: { emit: () => null },
|
||||||
|
jobid: null,
|
||||||
|
body: {},
|
||||||
|
SubscriptionObject: {
|
||||||
|
SubscriptionID: cdk_dealerid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.log("fortellis-replace-makes-models-response", "ERROR", req.user.email, null, {
|
||||||
|
cdk_dealerid,
|
||||||
|
xml: result
|
||||||
|
});
|
||||||
|
return result.data;
|
||||||
|
} catch (error) {
|
||||||
|
logger.log("fortellis-replace-makes-models-error", "ERROR", req.user.email, null, {
|
||||||
|
cdk_dealerid,
|
||||||
|
error
|
||||||
|
});
|
||||||
|
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.fortellis = async function ReloadFortellisMakes(req, res) {
|
||||||
|
const { bodyshopid, cdk_dealerid } = req.body;
|
||||||
|
try {
|
||||||
|
//Query all CDK Models
|
||||||
|
const newList = await GetFortellisMakes(req, cdk_dealerid);
|
||||||
|
|
||||||
|
const BearerToken = req.BearerToken;
|
||||||
|
const client = req.userGraphQLClient;
|
||||||
|
|
||||||
|
const deleteResult = await client
|
||||||
|
.setHeaders({ Authorization: BearerToken })
|
||||||
|
.request(queries.DELETE_ALL_DMS_VEHICLES, {});
|
||||||
|
|
||||||
|
//Insert the new ones.
|
||||||
|
|
||||||
|
const insertResult = await client.setHeaders({ Authorization: BearerToken }).request(queries.INSERT_DMS_VEHICLES, {
|
||||||
|
vehicles: newList.map((i) => {
|
||||||
|
return {
|
||||||
|
bodyshopid,
|
||||||
|
makecode: i.makeCode,
|
||||||
|
modelcode: i.modelCode,
|
||||||
|
make: i.makeFullName,
|
||||||
|
model: i.modelFullName
|
||||||
|
};
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
logger.log("cdk-replace-makes-models-success", "DEBUG", req.user.email, null, {
|
||||||
|
cdk_dealerid,
|
||||||
|
count: newList.length
|
||||||
|
});
|
||||||
|
|
||||||
|
res.sendStatus(200);
|
||||||
|
} catch (error) {
|
||||||
|
logger.log("cdk-replace-makes-models-error", "ERROR", req.user.email, null, {
|
||||||
|
cdk_dealerid,
|
||||||
|
error: error.message,
|
||||||
|
stack: error.stack
|
||||||
|
});
|
||||||
|
res.status(500).json(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ const logger = require("../utils/logger");
|
|||||||
const uuid = require("uuid").v4;
|
const uuid = require("uuid").v4;
|
||||||
const AxiosLib = require("axios").default;
|
const AxiosLib = require("axios").default;
|
||||||
const axios = AxiosLib.create();
|
const axios = AxiosLib.create();
|
||||||
const axiosCurlirize = require('axios-curlirize').default;
|
const axiosCurlirize = require("axios-curlirize").default;
|
||||||
|
|
||||||
// Custom error class for Fortellis API errors
|
// Custom error class for Fortellis API errors
|
||||||
class FortellisApiError extends Error {
|
class FortellisApiError extends Error {
|
||||||
constructor(message, details) {
|
constructor(message, details) {
|
||||||
super(message);
|
super(message);
|
||||||
this.name = 'FortellisApiError';
|
this.name = "FortellisApiError";
|
||||||
this.reqId = details.reqId;
|
this.reqId = details.reqId;
|
||||||
this.url = details.url;
|
this.url = details.url;
|
||||||
this.apiName = details.apiName;
|
this.apiName = details.apiName;
|
||||||
@@ -63,12 +63,14 @@ async function GetAuthToken() {
|
|||||||
return access_token;
|
return access_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function FetchSubscriptions({ redisHelpers, socket, jobid }) {
|
async function FetchSubscriptions({ redisHelpers, socket, jobid, SubscriptionObject }) {
|
||||||
try {
|
try {
|
||||||
const { setSessionTransactionData, getSessionTransactionData } = redisHelpers;
|
const { setSessionTransactionData, getSessionTransactionData } = redisHelpers;
|
||||||
|
|
||||||
//Get Subscription ID from Transaction Envelope
|
//Get Subscription ID from Transaction Envelope
|
||||||
const { SubscriptionID } = await getSessionTransactionData(socket.id, getTransactionType(jobid), `txEnvelope`);
|
const { SubscriptionID } = SubscriptionObject
|
||||||
|
? SubscriptionObject
|
||||||
|
: await getSessionTransactionData(socket.id, getTransactionType(jobid), `txEnvelope`);
|
||||||
if (!SubscriptionID) {
|
if (!SubscriptionID) {
|
||||||
throw new Error("Subscription ID not found in transaction envelope.");
|
throw new Error("Subscription ID not found in transaction envelope.");
|
||||||
}
|
}
|
||||||
@@ -89,13 +91,15 @@ async function FetchSubscriptions({ redisHelpers, socket, jobid }) {
|
|||||||
headers: { Authorization: `Bearer ${access_token}` }
|
headers: { Authorization: `Bearer ${access_token}` }
|
||||||
});
|
});
|
||||||
const SubscriptionMeta = subscriptions.data.subscriptions.find((s) => s.subscriptionId === SubscriptionID);
|
const SubscriptionMeta = subscriptions.data.subscriptions.find((s) => s.subscriptionId === SubscriptionID);
|
||||||
await setSessionTransactionData(
|
if (setSessionTransactionData) {
|
||||||
socket.id,
|
await setSessionTransactionData(
|
||||||
getTransactionType(jobid),
|
socket.id,
|
||||||
FortellisCacheEnums.SubscriptionMeta,
|
getTransactionType(jobid),
|
||||||
SubscriptionMeta,
|
FortellisCacheEnums.SubscriptionMeta,
|
||||||
defaultFortellisTTL
|
SubscriptionMeta,
|
||||||
);
|
defaultFortellisTTL
|
||||||
|
);
|
||||||
|
}
|
||||||
return SubscriptionMeta;
|
return SubscriptionMeta;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -111,16 +115,10 @@ async function GetDepartmentId({ apiName, debug = false, SubscriptionMeta }) {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
console.log("API Names & Departments ");
|
console.log("API Names & Departments ");
|
||||||
console.log("===========");
|
console.log("===========");
|
||||||
console.log(
|
console.log(JSON.stringify(SubscriptionMeta.apiDmsInfo, null, 4));
|
||||||
JSON.stringify(
|
|
||||||
SubscriptionMeta.apiDmsInfo,
|
|
||||||
null,
|
|
||||||
4
|
|
||||||
)
|
|
||||||
);
|
|
||||||
console.log("===========");
|
console.log("===========");
|
||||||
}
|
}
|
||||||
//TODO: Verify how to select the correct department.
|
//TODO: Verify how to select the correct department.
|
||||||
const departmentIds2 = SubscriptionMeta.apiDmsInfo //Get the subscription object.
|
const departmentIds2 = SubscriptionMeta.apiDmsInfo //Get the subscription object.
|
||||||
.find((info) => info.name === apiName)?.departments; //Departments are categorized by API name and have an array of departments.
|
.find((info) => info.name === apiName)?.departments; //Departments are categorized by API name and have an array of departments.
|
||||||
|
|
||||||
@@ -140,6 +138,7 @@ async function MakeFortellisCall({
|
|||||||
jobid,
|
jobid,
|
||||||
redisHelpers,
|
redisHelpers,
|
||||||
socket,
|
socket,
|
||||||
|
SubscriptionObject //This is used because of the get make models to bypass all of the redis calls.
|
||||||
}) {
|
}) {
|
||||||
const { setSessionTransactionData, getSessionTransactionData } = redisHelpers;
|
const { setSessionTransactionData, getSessionTransactionData } = redisHelpers;
|
||||||
|
|
||||||
@@ -148,7 +147,7 @@ async function MakeFortellisCall({
|
|||||||
if (debug) logger.log(`Executing ${type} to ${fullUrl}`);
|
if (debug) logger.log(`Executing ${type} to ${fullUrl}`);
|
||||||
const ReqId = uuid();
|
const ReqId = uuid();
|
||||||
const access_token = await GetAuthToken();
|
const access_token = await GetAuthToken();
|
||||||
const SubscriptionMeta = await FetchSubscriptions({ redisHelpers, socket, jobid });
|
const SubscriptionMeta = await FetchSubscriptions({ redisHelpers, socket, jobid, SubscriptionObject });
|
||||||
const DepartmentId = await GetDepartmentId({ apiName, debug, SubscriptionMeta });
|
const DepartmentId = await GetDepartmentId({ apiName, debug, SubscriptionMeta });
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
@@ -168,7 +167,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,
|
||||||
...DepartmentId && { "Department-Id": DepartmentId },
|
...(DepartmentId && { "Department-Id": DepartmentId }),
|
||||||
...headers
|
...headers
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -283,54 +282,61 @@ const FortellisActions = {
|
|||||||
type: "get",
|
type: "get",
|
||||||
apiName: "Service Vehicle - Query Vehicles"
|
apiName: "Service Vehicle - Query Vehicles"
|
||||||
},
|
},
|
||||||
|
GetMakeModel: {
|
||||||
|
url: isProduction
|
||||||
|
? "https://api.fortellis.io/cdk/drive/makemodel/v2/bulk"
|
||||||
|
: "https://api.fortellis.io/cdk-test/drive/makemodel/v2",
|
||||||
|
type: "get",
|
||||||
|
apiName: "CDK Drive Get Make Model Lite"
|
||||||
|
},
|
||||||
GetVehicleId: {
|
GetVehicleId: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/vehicle-ids/" //Request path params of vins
|
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/vehicle-ids/" //Request path params of vins
|
||||||
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/vehicle-ids/",
|
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/vehicle-ids/",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Post Service Vehicle",
|
apiName: "CDK Drive Post Service Vehicle"
|
||||||
},
|
},
|
||||||
GetVehicleById: {
|
GetVehicleById: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/" //Request path params of vehicleId
|
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/" //Request path params of vehicleId
|
||||||
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Post Service Vehicle",
|
apiName: "CDK Drive Post Service Vehicle"
|
||||||
},
|
},
|
||||||
QueryCustomerByName: {
|
QueryCustomerByName: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/customerpost/v1/search"
|
? "https://api.fortellis.io/cdk/drive/customerpost/v1/search"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/search",
|
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/search",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Post Customer",
|
apiName: "CDK Drive Post Customer"
|
||||||
},
|
},
|
||||||
ReadCustomer: {
|
ReadCustomer: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/customerpost/v1/" //Customer ID is request param.
|
? "https://api.fortellis.io/cdk/drive/customerpost/v1/" //Customer ID is request param.
|
||||||
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
|
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Post Customer",
|
apiName: "CDK Drive Post Customer"
|
||||||
},
|
},
|
||||||
CreateCustomer: {
|
CreateCustomer: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/customerpost/v1/"
|
? "https://api.fortellis.io/cdk/drive/customerpost/v1/"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
|
: "https://api.fortellis.io/cdk-test/drive/customerpost/v1/",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Customer",
|
apiName: "CDK Drive Post Customer"
|
||||||
},
|
},
|
||||||
InsertVehicle: {
|
InsertVehicle: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
|
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Service Vehicle",
|
apiName: "CDK Drive Post Service Vehicle"
|
||||||
},
|
},
|
||||||
UpdateVehicle: {
|
UpdateVehicle: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
|
? "https://api.fortellis.io/cdk/drive/service-vehicle-mgmt/v2/"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
: "https://api.fortellis.io/cdk-test/drive/service-vehicle-mgmt/v2/",
|
||||||
type: "put",
|
type: "put",
|
||||||
apiName: "CDK Drive Post Service Vehicle",
|
apiName: "CDK Drive Post Service Vehicle"
|
||||||
},
|
},
|
||||||
GetCOA: {
|
GetCOA: {
|
||||||
type: "get",
|
type: "get",
|
||||||
@@ -343,37 +349,36 @@ 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 Accounting 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 Accounting 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 Accounting GL"
|
||||||
},
|
},
|
||||||
QueryErrorWip: {
|
QueryErrorWip: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/glpost/errWIP"
|
? "https://api.fortellis.io/cdk/drive/glpost/errWIP"
|
||||||
: "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 Accounting GL"
|
||||||
},
|
},
|
||||||
ServiceHistoryInsert: {
|
ServiceHistoryInsert: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/post/service-vehicle-history-mgmt/v2/"
|
? "https://api.fortellis.io/cdk/drive/post/service-vehicle-history-mgmt/v2/"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/post/service-vehicle-history-mgmt/v2/",
|
: "https://api.fortellis.io/cdk-test/drive/post/service-vehicle-history-mgmt/v2/",
|
||||||
type: "post",
|
type: "post",
|
||||||
apiName: "CDK Drive Post Service Vehicle History",
|
apiName: "CDK Drive Post Service Vehicle History"
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const FortellisCacheEnums = {
|
const FortellisCacheEnums = {
|
||||||
@@ -391,7 +396,7 @@ const FortellisCacheEnums = {
|
|||||||
DMSTransHeader: "DMSTransHeader",
|
DMSTransHeader: "DMSTransHeader",
|
||||||
transWips: "transWips",
|
transWips: "transWips",
|
||||||
DmsBatchTxnPost: "DmsBatchTxnPost",
|
DmsBatchTxnPost: "DmsBatchTxnPost",
|
||||||
DMSVehHistory: "DMSVehHistory",
|
DMSVehHistory: "DMSVehHistory"
|
||||||
};
|
};
|
||||||
|
|
||||||
function constructFullUrl({ url, pathParams = "", requestSearchParams = [] }) {
|
function constructFullUrl({ url, pathParams = "", requestSearchParams = [] }) {
|
||||||
@@ -403,8 +408,6 @@ function constructFullUrl({ url, pathParams = "", requestSearchParams = [] }) {
|
|||||||
return fullUrl;
|
return fullUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
GetAuthToken,
|
GetAuthToken,
|
||||||
FortellisCacheEnums,
|
FortellisCacheEnums,
|
||||||
@@ -412,5 +415,6 @@ module.exports = {
|
|||||||
FortellisActions,
|
FortellisActions,
|
||||||
getTransactionType,
|
getTransactionType,
|
||||||
defaultFortellisTTL,
|
defaultFortellisTTL,
|
||||||
FortellisApiError
|
FortellisApiError,
|
||||||
|
GetDepartmentId
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -318,8 +318,11 @@ async function FortellisSelectedCustomer({ socket, redisHelpers, selectedCustome
|
|||||||
"ERROR",
|
"ERROR",
|
||||||
`DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
`DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
||||||
);
|
);
|
||||||
await InsertFailedExportLog({ socket, JobData, error: `DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}` });
|
await InsertFailedExportLog({
|
||||||
|
socket,
|
||||||
|
JobData,
|
||||||
|
error: `DMS Batch Return code was not successful: ${DMSBatchTxn.rtnCode} - ${DMSBatchTxn.sendline}`
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkSelectedCustomer.${ error } `);
|
// CdkBase.createLogEvent(socket, "ERROR", `Error encountered in CdkSelectedCustomer.${ error } `);
|
||||||
@@ -654,7 +657,7 @@ async function InsertDmsVehicle({ socket, redisHelpers, JobData, txEnvelope, DMS
|
|||||||
jobid: JobData.id,
|
jobid: JobData.id,
|
||||||
body: {
|
body: {
|
||||||
dealer: {
|
dealer: {
|
||||||
company: JobData.bodyshop.cdk_configuration.srcco || "77",
|
//company: JobData.bodyshop.cdk_configuration.srcco || "77",
|
||||||
// "dealNumber": "",
|
// "dealNumber": "",
|
||||||
// "dealerAssignedNumber": "82268",
|
// "dealerAssignedNumber": "82268",
|
||||||
// "dealerDefined1": "2WDSP",
|
// "dealerDefined1": "2WDSP",
|
||||||
@@ -1018,13 +1021,12 @@ async function InsertDmsStartWip({ socket, redisHelpers, JobData }) {
|
|||||||
// "rtnCode": "",
|
// "rtnCode": "",
|
||||||
// "sendline": "",
|
// "sendline": "",
|
||||||
// "groupName": "",
|
// "groupName": "",
|
||||||
"srcCo": JobData.bodyshop.cdk_configuration.srcco,
|
srcCo: JobData.bodyshop.cdk_configuration.srcco,
|
||||||
"srcJrnl": txEnvelope.journal,
|
srcJrnl: txEnvelope.journal,
|
||||||
"transID": "",
|
transID: "",
|
||||||
"userID": "csr" || JobData.bodyshop.cdk_configuration.cashierid,
|
userID: "csr" || JobData.bodyshop.cdk_configuration.cashierid,
|
||||||
"userName": "BSMS"
|
userName: "BSMS"
|
||||||
},
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -1238,8 +1240,7 @@ async function QueryDmsErrWip({ socket, redisHelpers, JobData }) {
|
|||||||
socket,
|
socket,
|
||||||
jobid: JobData.id,
|
jobid: JobData.id,
|
||||||
requestPathParams: DMSTransHeader.transID,
|
requestPathParams: DMSTransHeader.transID,
|
||||||
body: {
|
body: {}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -1252,11 +1253,13 @@ async function QueryDmsErrWip({ socket, redisHelpers, JobData }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function DeleteDmsWip({ socket, redisHelpers, JobData }) {
|
async function DeleteDmsWip({ socket, redisHelpers, JobData }) {
|
||||||
|
|
||||||
let DMSTransHeader;
|
let DMSTransHeader;
|
||||||
try {
|
try {
|
||||||
DMSTransHeader = await redisHelpers.getSessionTransactionData(socket.id, getTransactionType(JobData.id), FortellisCacheEnums.DMSTransHeader);
|
DMSTransHeader = await redisHelpers.getSessionTransactionData(
|
||||||
|
socket.id,
|
||||||
|
getTransactionType(JobData.id),
|
||||||
|
FortellisCacheEnums.DMSTransHeader
|
||||||
|
);
|
||||||
|
|
||||||
const result = await MakeFortellisCall({
|
const result = await MakeFortellisCall({
|
||||||
...FortellisActions.PostBatchWip,
|
...FortellisActions.PostBatchWip,
|
||||||
@@ -1265,8 +1268,8 @@ async function DeleteDmsWip({ socket, redisHelpers, JobData }) {
|
|||||||
socket,
|
socket,
|
||||||
jobid: JobData.id,
|
jobid: JobData.id,
|
||||||
body: {
|
body: {
|
||||||
"opCode": "D",
|
opCode: "D",
|
||||||
"transID": DMSTransHeader.transID
|
transID: DMSTransHeader.transID
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ const withUserGraphQLClientMiddleware = require("../middleware/withUserGraphQLCl
|
|||||||
router.use(validateFirebaseIdTokenMiddleware);
|
router.use(validateFirebaseIdTokenMiddleware);
|
||||||
|
|
||||||
router.post("/getvehicles", withUserGraphQLClientMiddleware, cdkGetMake.default);
|
router.post("/getvehicles", withUserGraphQLClientMiddleware, cdkGetMake.default);
|
||||||
|
router.post("/fortellis/getvehicles", withUserGraphQLClientMiddleware, cdkGetMake.fortellis);
|
||||||
router.post("/calculate-allocations", withUserGraphQLClientMiddleware, cdkCalculateAllocations.defaultRoute);
|
router.post("/calculate-allocations", withUserGraphQLClientMiddleware, cdkCalculateAllocations.defaultRoute);
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user