Additional Fortellis functionality on delete.
This commit is contained in:
@@ -27,9 +27,6 @@ class FortellisApiError extends Error {
|
||||
}
|
||||
|
||||
axiosCurlirize(axios, (result, err) => {
|
||||
const { command } = result;
|
||||
console.log("*** ~ axiosCurlirize ~ command:", command);
|
||||
|
||||
// if (err) {
|
||||
// use your logger here
|
||||
// } else {
|
||||
@@ -88,7 +85,8 @@ async function FetchSubscriptions({ redisHelpers, socket, jobid, SubscriptionObj
|
||||
} else {
|
||||
const access_token = await GetAuthToken();
|
||||
const subscriptions = await axios.get(`https://subscriptions.fortellis.io/v1/solution/subscriptions`, {
|
||||
headers: { Authorization: `Bearer ${access_token}` }
|
||||
headers: { Authorization: `Bearer ${access_token}` },
|
||||
logRequest: false
|
||||
});
|
||||
const SubscriptionMeta = subscriptions.data.subscriptions.find((s) => s.subscriptionId === SubscriptionID);
|
||||
if (setSessionTransactionData) {
|
||||
@@ -137,7 +135,7 @@ async function MakeFortellisCall({
|
||||
headers = {},
|
||||
body = {},
|
||||
type = "post",
|
||||
debug = true,
|
||||
debug = false,
|
||||
requestPathParams,
|
||||
requestSearchParams = [], //Array of key/value strings like [["key", "value"]]
|
||||
jobid,
|
||||
@@ -209,7 +207,7 @@ async function MakeFortellisCall({
|
||||
|
||||
if (debug) {
|
||||
console.log(`ReqID: ${ReqId} Data`);
|
||||
console.log(JSON.stringify(result.data, null, 4));
|
||||
//console.log(JSON.stringify(result.data, null, 4));
|
||||
}
|
||||
|
||||
if (result.data.checkStatusAfterSeconds) {
|
||||
@@ -221,6 +219,21 @@ async function MakeFortellisCall({
|
||||
departmentIds: DepartmentId
|
||||
});
|
||||
}
|
||||
|
||||
logger.log(
|
||||
"fortellis-log-event-json",
|
||||
"DEBUG",
|
||||
socket?.user?.email,
|
||||
jobid,
|
||||
{
|
||||
requestcurl: result.config.curlCommand,
|
||||
reqid: result.config.headers["Request-Id"] || null,
|
||||
subscriptionId: result.config.headers["Subscription-Id"] || null,
|
||||
resultdata: result.data,
|
||||
resultStatus: result.status
|
||||
},
|
||||
);
|
||||
|
||||
return result.data;
|
||||
} catch (error) {
|
||||
console.log(`ReqID: ${ReqId} Error`, error.response?.data);
|
||||
@@ -236,6 +249,20 @@ async function MakeFortellisCall({
|
||||
originalError: error
|
||||
};
|
||||
|
||||
logger.log(
|
||||
"fortellis-log-event-error",
|
||||
"ERROR",
|
||||
socket?.user?.email,
|
||||
socket?.recordid,
|
||||
{
|
||||
wsmessage: "",//message,
|
||||
curl: error.config.curl.curlCommand,
|
||||
reqid: error.request.headers["Request-Id"] || null,
|
||||
subscriptionId: error.request.headers["Subscription-Id"] || null,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
// CreateFortellisLogEvent(socket, "ERROR", `Error in MakeFortellisCall for ${apiName}: ${error.message}`, {
|
||||
// ...errorDetails,
|
||||
// errorStack: error.stack
|
||||
@@ -376,6 +403,13 @@ const FortellisActions = {
|
||||
type: "post",
|
||||
apiName: "CDK Drive Post Accounts GL"
|
||||
},
|
||||
DeleteTranWip: {
|
||||
url: isProduction
|
||||
? "https://api.fortellis.io/cdk/drive/glpost/postWIP"
|
||||
: "https://api.fortellis.io/cdk-test/drive/glpost/postWIP",
|
||||
type: "post",
|
||||
apiName: "CDK Drive Post Accounts GL"
|
||||
},
|
||||
QueryErrorWip: {
|
||||
url: isProduction
|
||||
? "https://api.fortellis.io/cdk/drive/glpost/errWIP/" //Get requests should have the trailing slash/
|
||||
|
||||
Reference in New Issue
Block a user