feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / Merges and adjustments
This commit is contained in:
@@ -182,6 +182,29 @@ const getTransactionType = (jobid) => `rr:${jobid}`;
|
||||
*/
|
||||
const defaultRRTTL = 60 * 60;
|
||||
|
||||
/**
|
||||
* Resolve RR OpCode from bodyshop.rr_configuration.defaults
|
||||
* Is Duplicated on client/src/utils/dmsUtils.js
|
||||
* @param bodyshop
|
||||
* @returns {string}
|
||||
*/
|
||||
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}`;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
RRCacheEnums,
|
||||
defaultRRTTL,
|
||||
@@ -189,5 +212,6 @@ module.exports = {
|
||||
ownersFromVinBlocks,
|
||||
makeVehicleSearchPayloadFromJob,
|
||||
normalizeCustomerCandidates,
|
||||
readAdvisorNo
|
||||
readAdvisorNo,
|
||||
resolveRROpCodeFromBodyshop
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user