feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / Merges and adjustments
This commit is contained in:
@@ -70,3 +70,26 @@ export const isWssMode = (mode) => {
|
||||
*/
|
||||
export const bodyshopHasDmsKey = (bodyshop) =>
|
||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid;
|
||||
|
||||
/**
|
||||
* Resolve RR OpCode from bodyshop.rr_configuration.defaults
|
||||
* Is Duplicated on server/rr/rr-utils.js
|
||||
* @param bodyshop
|
||||
* @returns {`${string}${string}${string}`}
|
||||
*/
|
||||
export const resolveRROpCodeFromBodyshop = (bodyshop) => {
|
||||
if (!bodyshop) throw new Error("bodyshop is required");
|
||||
|
||||
const cfg = bodyshop?.rr_configuration || {};
|
||||
const defaults = cfg?.defaults || {};
|
||||
|
||||
const prefix = (defaults.prefix ?? "").toString().trim();
|
||||
const base = (defaults.base ?? "").toString().trim();
|
||||
const suffix = (defaults.suffix ?? "").toString().trim();
|
||||
|
||||
if (!prefix && !base && !suffix) {
|
||||
throw new Error("No RR OpCode parts found in bodyshop configuration");
|
||||
}
|
||||
|
||||
return `${prefix}${base}${suffix}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user