feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint

This commit is contained in:
Dave
2025-11-05 11:28:14 -05:00
parent f2faa5b686
commit da28fe8592
2 changed files with 6 additions and 4 deletions

View File

@@ -67,6 +67,10 @@ async function ensureRRServiceVehicle({ bodyshop, custNo, job, overrides = {}, s
} }
const payload = buildServiceVehiclePayload({ job, custNo, overrides }); const payload = buildServiceVehiclePayload({ job, custNo, overrides });
console.log("Inserting RR Service Vehicle with payload:");
console.dir({ payload }, { depth: null });
const res = await client.insertServiceVehicle(payload, opts); const res = await client.insertServiceVehicle(payload, opts);
const data = res?.data ?? res; const data = res?.data ?? res;

View File

@@ -40,7 +40,7 @@ const makeVehicleSearchPayloadFromJob = (job) => {
}; };
const makeCustomerSearchPayloadFromJob = (job) => { const makeCustomerSearchPayloadFromJob = (job) => {
const phone = job?.ownr_ph1 || job?.customer?.mobile || job?.customer?.home_phone || job?.customer?.phone; const phone = job?.ownr_ph1 || job?.ownr_ph2;
const d = digitsOnly(phone); const d = digitsOnly(phone);
if (d.length >= 7) return { kind: "phone", phone: d, maxResults: 50 }; if (d.length >= 7) return { kind: "phone", phone: d, maxResults: 50 };
@@ -58,7 +58,7 @@ const makeCustomerSearchPayloadFromJob = (job) => {
return { kind: "name", name: { name: String(company).trim() }, maxResults: 50 }; return { kind: "name", name: { name: String(company).trim() }, maxResults: 50 };
} }
const vin = job?.v_vin || job?.vehicle?.vin || job?.vin; const vin = job?.v_vin;
if (vin) return { kind: "vin", vin: String(vin).trim(), maxResults: 50 }; if (vin) return { kind: "vin", vin: String(vin).trim(), maxResults: 50 };
return null; return null;
@@ -125,9 +125,7 @@ async function getBodyshopForSocket({ bodyshopId, socket }) {
function readAdvisorNo(payload, cached) { function readAdvisorNo(payload, cached) {
const v = const v =
(payload?.txEnvelope?.advisorNo != null && String(payload.txEnvelope.advisorNo)) || (payload?.txEnvelope?.advisorNo != null && String(payload.txEnvelope.advisorNo)) ||
(payload?.txEnvelope?.advNo != null && String(payload.txEnvelope.advNo)) ||
(payload?.advisorNo != null && String(payload.advisorNo)) || (payload?.advisorNo != null && String(payload.advisorNo)) ||
(payload?.advNo != null && String(payload.advNo)) ||
(cached != null && String(cached)) || (cached != null && String(cached)) ||
null; null;
return v && v.trim() !== "" ? v : null; return v && v.trim() !== "" ? v : null;