feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / Merges and adjustments

This commit is contained in:
Dave
2025-11-26 15:37:34 -05:00
parent f1bad01cec
commit fa7da3cad0
6 changed files with 73 additions and 23 deletions

View File

@@ -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}`;
};