Fortellis certification updates.
This commit is contained in:
@@ -26,6 +26,7 @@ import DmsCdkMakesRefetch from "../dms-cdk-makes/dms-cdk-makes.refetch.component
|
|||||||
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
import DateTimePicker from "../form-date-time-picker/form-date-time-picker.component.jsx";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
import { DMS_MAP } from "../../utils/dmsUtils";
|
import { DMS_MAP } from "../../utils/dmsUtils";
|
||||||
|
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CDK-like DMS post form:
|
* CDK-like DMS post form:
|
||||||
@@ -46,6 +47,14 @@ export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [, /*unused*/ setTick] = useState(0); // handy if you need a forceUpdate later
|
const [, /*unused*/ setTick] = useState(0); // handy if you need a forceUpdate later
|
||||||
|
|
||||||
|
const {
|
||||||
|
treatments: { Fortellis }
|
||||||
|
} = useSplitTreatments({
|
||||||
|
attributes: {},
|
||||||
|
names: ["Fortellis"],
|
||||||
|
splitKey: bodyshop.imexshopid
|
||||||
|
});
|
||||||
|
|
||||||
const initialValues = useMemo(
|
const initialValues = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
story: `${t("jobs.labels.dms.defaultstory", {
|
story: `${t("jobs.labels.dms.defaultstory", {
|
||||||
@@ -205,7 +214,7 @@ export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }
|
|||||||
<Row gutter={[16, 12]}>
|
<Row gutter={[16, 12]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Form.Item name="story" label={t("jobs.fields.dms.story")} rules={[{ required: true }]}>
|
<Form.Item name="story" label={t("jobs.fields.dms.story")} rules={[{ required: true }]}>
|
||||||
<Input.TextArea maxLength={240} />
|
<Input.TextArea maxLength={Fortellis.treatment === "on" ? 40 : 240} showCount/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -136,11 +136,7 @@ async function GetFortellisMakes(req, cdk_dealerid) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.log("fortellis-replace-makes-models-response", "ERROR", req.user.email, null, {
|
return result.data?.data;
|
||||||
cdk_dealerid,
|
|
||||||
xml: result
|
|
||||||
});
|
|
||||||
return result.data;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.log("fortellis-replace-makes-models-error", "ERROR", req.user.email, null, {
|
logger.log("fortellis-replace-makes-models-error", "ERROR", req.user.email, null, {
|
||||||
cdk_dealerid,
|
cdk_dealerid,
|
||||||
@@ -166,14 +162,17 @@ exports.fortellis = async function ReloadFortellisMakes(req, res) {
|
|||||||
|
|
||||||
//Insert the new ones.
|
//Insert the new ones.
|
||||||
|
|
||||||
|
|
||||||
const insertResult = await client.setHeaders({ Authorization: BearerToken }).request(queries.INSERT_DMS_VEHICLES, {
|
const insertResult = await client.setHeaders({ Authorization: BearerToken }).request(queries.INSERT_DMS_VEHICLES, {
|
||||||
vehicles: newList.map((i) => {
|
//Below filtering is requried due to schema requirements.
|
||||||
|
//Does not make sense for there to be empty entries, but leaving in to prevent prod issues.
|
||||||
|
vehicles: newList.filter(i => i.make && i.model && i.make !== '' && i.model !== '' && i.fullMakeName && i.fullModelName && i.fullMakeName !== '' && i.fullModelName !== '').map((i) => {
|
||||||
return {
|
return {
|
||||||
bodyshopid,
|
bodyshopid,
|
||||||
makecode: i.makeCode,
|
makecode: i.make,
|
||||||
modelcode: i.modelCode,
|
modelcode: i.model,
|
||||||
make: i.makeFullName,
|
make: i.fullMakeName,
|
||||||
model: i.modelFullName
|
model: i.fullModelName
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -249,14 +249,14 @@ async function MakeFortellisCall({
|
|||||||
socket?.recordid,
|
socket?.recordid,
|
||||||
{
|
{
|
||||||
wsmessage: "",//message,
|
wsmessage: "",//message,
|
||||||
curl: error.config.curl.curlCommand,
|
curl: error?.config.curlCommand,
|
||||||
reqid: error.request.headers["Request-Id"] || null,
|
reqid: error.config?.headers["Request-Id"] || null,
|
||||||
subscriptionId: error.request.headers["Subscription-Id"] || null,
|
subscriptionId: error.config?.headers["Subscription-Id"] || null,
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
throw new FortellisApiError(`Fortellis API call failed for ${apiName}: ${error.message}`, errorDetails);
|
throw new FortellisApiError(`Fortellis API call failed for ${apiName}: ${error.message} | ${errorDetails?.errorData?.message}`, errorDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ const FortellisActions = {
|
|||||||
GetMakeModel: {
|
GetMakeModel: {
|
||||||
url: isProduction
|
url: isProduction
|
||||||
? "https://api.fortellis.io/cdk/drive/makemodel/v2/bulk"
|
? "https://api.fortellis.io/cdk/drive/makemodel/v2/bulk"
|
||||||
: "https://api.fortellis.io/cdk-test/drive/makemodel/v2",
|
: "https://api.fortellis.io/cdk-test/drive/makemodel/v2/bulk",
|
||||||
type: "get",
|
type: "get",
|
||||||
apiName: "CDK Drive Get Make Model Lite"
|
apiName: "CDK Drive Get Make Model Lite"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -968,9 +968,9 @@ async function InsertServiceVehicleHistory({ socket, redisHelpers, JobData }) {
|
|||||||
openTime: moment(JobData.actual_in).tz(JobData.bodyshop.timezone).format("HH:mm:ss"),
|
openTime: moment(JobData.actual_in).tz(JobData.bodyshop.timezone).format("HH:mm:ss"),
|
||||||
closeDate: moment(JobData.invoice_date).tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
|
closeDate: moment(JobData.invoice_date).tz(JobData.bodyshop.timezone).format("YYYY-MM-DD"),
|
||||||
closeTime: moment(JobData.invoice_date).tz(JobData.bodyshop.timezone).format("HH:mm:ss"),
|
closeTime: moment(JobData.invoice_date).tz(JobData.bodyshop.timezone).format("HH:mm:ss"),
|
||||||
comments: txEnvelope.story, // has to be between 0 and 40.
|
comments: txEnvelope.story?.slice(0, 40), // has to be between 0 and 40.
|
||||||
cashierId: JobData.bodyshop.cdk_configuration.cashierid,
|
cashierId: JobData.bodyshop.cdk_configuration.cashierid,
|
||||||
referenceNumber: JobData.bodyshop.cdk_configuration.cashierid
|
referenceNumber: JobData.ro_number.match(/\d+/g)[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user