WIP Fortellis.
This commit is contained in:
5
_reference/Fortellis Feedback.md
Normal file
5
_reference/Fortellis Feedback.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Fortellis Feedback
|
||||
|
||||
Create Customer
|
||||
https://apidocs.fortellis.io/apis/c5cfb5b3-2013-4870-8645-0379c01ae56b
|
||||
Request Body compoennts do not show on website. Unable to determine which components are required.
|
||||
@@ -17,7 +17,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DmsCustomerSelector);
|
||||
|
||||
export function DmsCustomerSelector({ bodyshop }) {
|
||||
export function DmsCustomerSelector({ bodyshop, jobid }) {
|
||||
const { t } = useTranslation();
|
||||
const [customerList, setcustomerList] = useState([]);
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -38,7 +38,7 @@ export function DmsCustomerSelector({ bodyshop }) {
|
||||
if (Fortellis.treatment === "on") {
|
||||
const handleFortellisSelectCustomer = (customerList, callback) => {
|
||||
setOpen(true);
|
||||
setDmsType("fortellis");
|
||||
setDmsType("cdk");
|
||||
setcustomerList(customerList);
|
||||
};
|
||||
wsssocket.on("fortellis-select-customer", handleFortellisSelectCustomer);
|
||||
@@ -67,7 +67,11 @@ export function DmsCustomerSelector({ bodyshop }) {
|
||||
|
||||
const onUseSelected = () => {
|
||||
setOpen(false);
|
||||
socket.emit(`${dmsType}-selected-customer`, selectedCustomer);
|
||||
if (Fortellis.treatment === "on") {
|
||||
wsssocket.emit(`fortellis-selected-customer`, { selectedCustomerId: selectedCustomer, jobid });
|
||||
} else {
|
||||
socket.emit(`${dmsType}-selected-customer`, selectedCustomer);
|
||||
}
|
||||
setSelectedCustomer(null);
|
||||
};
|
||||
|
||||
|
||||
@@ -72,7 +72,13 @@ export function DmsPostForm({ bodyshop, socket, job, logsRef }) {
|
||||
const handleFinish = (values) => {
|
||||
//TODO: Add this as a split instead.
|
||||
if (Fortellis.treatment === "on") {
|
||||
wsssocket.emit("fortellis-export-job", { jobid: job.id, txEnvelope: values });
|
||||
wsssocket.emit("fortellis-export-job", {
|
||||
jobid: job.id,
|
||||
txEnvelope: {
|
||||
...values,
|
||||
SubscriptionID: "5b527d7d-baf3-40bc-adae-e7a541e37363" //bodyshop.cdk_dealerid
|
||||
}
|
||||
});
|
||||
} else {
|
||||
socket.emit(`${determineDmsType(bodyshop)}-export-job`, {
|
||||
jobid: job.id,
|
||||
|
||||
@@ -201,7 +201,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
<DmsPostForm socket={socket} jobId={jobId} job={data && data.jobs_by_pk} logsRef={logsRef} />
|
||||
</Col>
|
||||
|
||||
<DmsCustomerSelector />
|
||||
<DmsCustomerSelector jobid={jobId} />
|
||||
|
||||
<Col span={24}>
|
||||
<div ref={logsRef}>
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user