feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration -Dedupe
This commit is contained in:
@@ -160,36 +160,8 @@ async function rrGetAdvisors(bodyshop, args = {}) {
|
||||
return res?.data ?? res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parts lookup (graceful if the underlying lib exposes a different name)
|
||||
* @param bodyshop
|
||||
* @param args - common fields like { partNumber, description, make, model, year }
|
||||
*/
|
||||
async function rrGetParts(bodyshop, args = {}) {
|
||||
const { client, opts } = buildClientAndOpts(bodyshop);
|
||||
const payload = {
|
||||
partNumber: args.partNumber ?? args.partNo ?? args.number ?? undefined,
|
||||
description: args.description ?? undefined,
|
||||
make: args.make ?? undefined,
|
||||
model: args.model ?? undefined,
|
||||
year: args.year ?? undefined
|
||||
};
|
||||
|
||||
// Try common method names. If none exist, return an empty list to avoid crashes.
|
||||
if (typeof client.getParts === "function") {
|
||||
const res = await client.getParts(payload, opts);
|
||||
return res?.data ?? res;
|
||||
}
|
||||
if (typeof client.getPartNumbers === "function") {
|
||||
const res = await client.getPartNumbers(payload, opts);
|
||||
return res?.data ?? res;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
rrCombinedSearch,
|
||||
rrGetAdvisors,
|
||||
rrGetParts,
|
||||
buildClientAndOpts
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user