feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Expanded Logs / Formatting change

This commit is contained in:
Dave
2025-11-12 17:01:54 -05:00
parent 556cd993b9
commit 90f653c0b7
13 changed files with 444 additions and 254 deletions

View File

@@ -4,14 +4,11 @@ const { ensureRRServiceVehicle } = require("./rr-service-vehicles");
const RRLogger = require("./rr-logger");
/**
* Orchestrate an RR export (assumes custNo already resolved):
* - Ensure service vehicle (create flows)
* - Create or update the Repair Order
*
* NOTE: This function performs the create/update step and returns the RO data.
* "Mark exported" is handled later by the finalize step after cashiering.
* Export a job to Reynolds & Reynolds as a Repair Order (create or update).
* @param args
* @returns {Promise<{success, data: *, roStatus: *, statusBlocks, xml: *, parsed: any, customerNo: string, svId: null, roNo: *}>}
*/
async function exportJobToRR(args) {
const exportJobToRR = async (args) => {
const { bodyshop, job, advisorNo, selectedCustomer, existing, socket } = args || {};
const log = RRLogger(socket, { ns: "rr-export" });
@@ -95,14 +92,14 @@ async function exportJobToRR(args) {
svId,
roNo
};
}
};
/**
* Finalize an RR Repair Order by sending finalUpdate: "Y".
* The caller should pass the canonical `roNo` if available (prefer DMS RO #).
* If not provided, we *safely* fall back to the external (Outsd) RO number.
* @param args
* @returns {Promise<{success, data: *, roStatus: *, statusBlocks, xml: *, parsed: any}>}
*/
async function finalizeRRRepairOrder(args) {
const finalizeRRRepairOrder = async (args) => {
const { bodyshop, job, advisorNo, customerNo, roNo, vin, socket } = args || {};
const log = RRLogger(socket, { ns: "rr-finalize" });
@@ -171,6 +168,6 @@ async function finalizeRRRepairOrder(args) {
xml: rrRes?.xml,
parsed: rrRes?.parsed
};
}
};
module.exports = { exportJobToRR, finalizeRRRepairOrder };