feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint
This commit is contained in:
@@ -14,16 +14,13 @@ async function exportJobToRR(args) {
|
||||
const log = RRLogger(socket, { ns: "rr-export" });
|
||||
|
||||
if (!bodyshop) throw new Error("exportJobToRR: bodyshop is required");
|
||||
|
||||
if (!job) throw new Error("exportJobToRR: job is required");
|
||||
|
||||
if (advisorNo == null || String(advisorNo).trim() === "") {
|
||||
throw new Error("exportJobToRR: advisorNo is required for RR");
|
||||
}
|
||||
|
||||
// Resolve customer number (accept multiple shapes)
|
||||
const selected = selectedCustomer?.customerNo;
|
||||
|
||||
const selected = selectedCustomer?.customerNo || selectedCustomer?.custNo;
|
||||
if (!selected) throw new Error("exportJobToRR: selectedCustomer.custNo/customerNo is required");
|
||||
|
||||
const { client, opts } = buildClientAndOpts(bodyshop);
|
||||
@@ -43,7 +40,6 @@ async function exportJobToRR(args) {
|
||||
let svId = null;
|
||||
if (!existing?.dmsRepairOrderId) {
|
||||
try {
|
||||
// Provide both customerNo and custNo for safety
|
||||
const svRes = await ensureRRServiceVehicle({
|
||||
bodyshop,
|
||||
job,
|
||||
@@ -58,10 +54,10 @@ async function exportJobToRR(args) {
|
||||
}
|
||||
}
|
||||
|
||||
// Build RO payload (now includes both customerNo & custNo; advisorNo & advNo)
|
||||
// Build RO payload (now includes DeptType/departmentType + variants)
|
||||
const payload = buildRRRepairOrderPayload({
|
||||
job,
|
||||
selectedCustomer: { customerNo: String(selected) },
|
||||
selectedCustomer: { customerNo: String(selected), custNo: String(selected) },
|
||||
advisorNo: String(advisorNo)
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user