feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
// server/rr/rr-customers.js
|
||||
// Minimal RR customer create helper (maps dmsRecKey -> custNo for callers)
|
||||
|
||||
const { RRClient } = require("./lib/index.cjs");
|
||||
const { getRRConfigFromBodyshop } = require("./rr-config");
|
||||
const RRLogger = require("./rr-logger");
|
||||
@@ -35,7 +32,7 @@ function buildClientAndOpts(bodyshop) {
|
||||
|
||||
// minimal field extraction
|
||||
function digitsOnly(s) {
|
||||
return String(s || "").replace(/[^\d]/g, "");
|
||||
return String(s || "").replace(/\D/g, "");
|
||||
}
|
||||
|
||||
function buildCustomerPayloadFromJob(job, overrides = {}) {
|
||||
@@ -94,15 +91,7 @@ async function createRRCustomer({ bodyshop, job, overrides = {}, socket }) {
|
||||
const trx = res?.statusBlocks?.transaction;
|
||||
|
||||
// Primary: map dmsRecKey -> custNo
|
||||
let custNo =
|
||||
data?.dmsRecKey ??
|
||||
// legacy fallbacks (if shapes ever change)
|
||||
data?.custNo ??
|
||||
data?.CustNo ??
|
||||
data?.customerNo ??
|
||||
data?.CustomerNo ??
|
||||
data?.customer?.custNo ??
|
||||
data?.Customer?.CustNo;
|
||||
let custNo = data?.dmsRecKey;
|
||||
|
||||
if (!custNo) {
|
||||
log("error", "RR insertCustomer returned no dmsRecKey/custNo", {
|
||||
|
||||
Reference in New Issue
Block a user