Files
bodyshop/server/rr/rr-constants.js

51 lines
2.0 KiB
JavaScript

/**
* STAR-only constants for Reynolds & Reynolds (Rome/RCI)
* Used by rr-helpers.js to build and send SOAP requests.
*/
exports.RR_NS = Object.freeze({
SOAP_ENV: "http://schemas.xmlsoap.org/soap/envelope/",
SOAP_ENC: "http://schemas.xmlsoap.org/soap/encoding/",
XSD: "http://www.w3.org/2001/XMLSchema",
XSI: "http://www.w3.org/2001/XMLSchema-instance",
WSSE: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
WSU: "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd",
STAR_TRANSPORT: "http://www.starstandards.org/webservices/2005/10/transport",
STAR_BUSINESS: "http://www.starstandards.org/STAR"
});
const RR_STAR_SOAP_ACTION = "http://www.starstandards.org/webservices/2005/10/transport/ProcessMessage";
exports.RR_SOAP_ACTION = RR_STAR_SOAP_ACTION;
const RR_SOAP_HEADERS = {
"Content-Type": "text/xml; charset=utf-8",
SOAPAction: RR_STAR_SOAP_ACTION
};
// All STAR-supported actions (mapped to Mustache templates)
exports.RR_ACTIONS = Object.freeze({
CombinedSearch: { template: "CombinedSearch" },
GetAdvisors: { template: "GetAdvisors" },
GetParts: { template: "GetParts" },
InsertCustomer: { template: "InsertCustomer" },
InsertServiceVehicle: { template: "InsertServiceVehicle" },
CreateRepairOrder: { template: "CreateRepairOrder" },
UpdateCustomer: { template: "UpdateCustomer" },
UpdateRepairOrder: { template: "UpdateRepairOrder" }
});
// Base config loader (environment-driven)
exports.getBaseRRConfig = function getBaseRRConfig() {
return {
baseUrl: process.env.RR_BASE_URL,
username: process.env.RR_USERNAME,
password: process.env.RR_PASSWORD,
ppsysId: process.env.RR_PPSYSID, // optional legacy identifier
dealerNumber: process.env.RR_DEALER_NUMBER,
storeNumber: process.env.RR_STORE_NUMBER,
branchNumber: process.env.RR_BRANCH_NUMBER || "01",
wssePasswordType: process.env.RR_WSSE_PASSWORD_TYPE || "Text",
timeout: Number(process.env.RR_TIMEOUT_MS || 30000)
};
};