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 CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||
import { DMS_MAP } from "../../utils/dmsUtils";
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
|
||||
/**
|
||||
* CDK-like DMS post form:
|
||||
@@ -46,6 +47,14 @@ export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }
|
||||
const { t } = useTranslation();
|
||||
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(
|
||||
() => ({
|
||||
story: `${t("jobs.labels.dms.defaultstory", {
|
||||
@@ -205,7 +214,7 @@ export default function CdkLikePostForm({ bodyshop, socket, job, logsRef, mode }
|
||||
<Row gutter={[16, 12]}>
|
||||
<Col span={24}>
|
||||
<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>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
@@ -136,11 +136,7 @@ async function GetFortellisMakes(req, cdk_dealerid) {
|
||||
}
|
||||
});
|
||||
|
||||
logger.log("fortellis-replace-makes-models-response", "ERROR", req.user.email, null, {
|
||||
cdk_dealerid,
|
||||
xml: result
|
||||
});
|
||||
return result.data;
|
||||
return result.data?.data;
|
||||
} catch (error) {
|
||||
logger.log("fortellis-replace-makes-models-error", "ERROR", req.user.email, null, {
|
||||
cdk_dealerid,
|
||||
@@ -166,14 +162,17 @@ exports.fortellis = async function ReloadFortellisMakes(req, res) {
|
||||
|
||||
//Insert the new ones.
|
||||
|
||||
|
||||
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 {
|
||||
bodyshopid,
|
||||
makecode: i.makeCode,
|
||||
modelcode: i.modelCode,
|
||||
make: i.makeFullName,
|
||||
model: i.modelFullName
|
||||
makecode: i.make,
|
||||
modelcode: i.model,
|
||||
make: i.fullMakeName,
|
||||
model: i.fullModelName
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
@@ -249,14 +249,14 @@ async function MakeFortellisCall({
|
||||
socket?.recordid,
|
||||
{
|
||||
wsmessage: "",//message,
|
||||
curl: error.config.curl.curlCommand,
|
||||
reqid: error.request.headers["Request-Id"] || null,
|
||||
subscriptionId: error.request.headers["Subscription-Id"] || null,
|
||||
curl: error?.config.curlCommand,
|
||||
reqid: error.config?.headers["Request-Id"] || null,
|
||||
subscriptionId: error.config?.headers["Subscription-Id"] || null,
|
||||
},
|
||||
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: {
|
||||
url: isProduction
|
||||
? "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",
|
||||
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"),
|
||||
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"),
|
||||
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,
|
||||
referenceNumber: JobData.bodyshop.cdk_configuration.cashierid
|
||||
referenceNumber: JobData.ro_number.match(/\d+/g)[0]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user