Refactor testing js file and made more modular.

This commit is contained in:
Patrick Fic
2024-08-15 10:17:11 -07:00
parent 5cf6f47bdc
commit 85c446bc57
3 changed files with 466 additions and 219 deletions

18
Fortellis Notes.md Normal file
View File

@@ -0,0 +1,18 @@
Fortellis Notes
Subscription ID
* Appears to give us a list of all dealerships we have access to, and `apiDmsInfo` contains the integrations that are enabled for that dealership.
* Will likely need to filter based on the DMS ID or something?
* Should store the whole subscription object. Contains department information needed in subsequent calls.
Department ID
* May have multiple departments. Appears that financial stuff goes to Accounting, History will go to Service.
* TODO: How do we handle the multiple departments that may come up.
# Feedback
* Receiving bad request errors, with no details. API errors page doesn't indicate what's wrong.
# API Error
* Not in real time - appaers to be every 3 minutes?

305
fortellis-scratch.js Normal file
View File

@@ -0,0 +1,305 @@
const path = require('path');
const Dinero = require('dinero.js');
const { gql } = require('graphql-request');
const queries = require('./server/graphql-client/queries');
const GraphQLClient = require('graphql-request').GraphQLClient;
const logger = require('./server/utils/logger');
const AxiosLib = require('axios').default;
const axios = AxiosLib.create();
const uuid = require('uuid').v4;
const FORTELLIS_KEY = 'X1FxzLyOk3kjHvMbzdPQXFZShkdbgzuo';
const FORTELLIS_SECRET = '7Yvs0wpQeHcUS5r95ht8pqOaAvBq7dHV';
const FORTELLIS_AUTH_URL = 'https://identity.fortellis.io/oauth2/aus1p1ixy7YL8cMq02p7/v1/token';
const FORTELLIS_URL = 'https://api.fortellis.io';
const SubscriptionID = '5b527d7d-baf3-40bc-adae-e7a541e37363';
let SubscriptionMeta = null;
//const SubscriptionID = "cb59fa04-e53e-4b57-b071-80a48ebc346c";
function sleep(time, callback) {
var stop = new Date().getTime();
while (new Date().getTime() < stop + time) {}
callback();
}
async function GetAuthToken() {
const {
data: { access_token, expires_in, token_type },
} = await axios.post(
FORTELLIS_AUTH_URL,
{},
{
auth: {
username: FORTELLIS_KEY,
password: FORTELLIS_SECRET,
},
params: {
grant_type: 'client_credentials',
scope: 'anonymous',
},
},
);
return access_token;
}
async function FetchSubscriptions() {
const access_token = await GetAuthToken();
try {
const subscriptions = await axios.get(
`https://subscriptions.fortellis.io/v1/solution/subscriptions`,
{
headers: { Authorization: `Bearer ${access_token}` },
},
);
return subscriptions.data.subscriptions;
} catch (error) {
console.log('🚀 ~ FetchSubscriptions ~ error:', error);
}
}
async function GetBulkVendors() {
const departmentIds = (await FetchSubscriptions())
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === 'CDK Drive Async Vendors')?.departments; //Departments are categorized by API name and have an array of departments.
const access_token = await GetAuthToken();
const ReqId = uuid();
try {
//TODO: This is pointing towards the test environment. Need to carefully watch for the production switch.
const Vendors = await axios.get(`https://api.fortellis.io/cdk-test/drive/vendor/v2/bulk`, {
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': departmentIds[0].id,
},
});
//Returns a long poll. Need to wait specified seconds until checking.
console.log(
'🚀 ~ GetBulkVendors ~ Vendors - waiting to execute callback:',
Vendors.data.checkStatusAfterSeconds,
);
sleep(Vendors.data.checkStatusAfterSeconds * 1000, async () => {
const VendorsResult = await axios.get(Vendors.data._links.status.href, {
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': departmentIds[0].id,
},
});
//This may have to check again if it isn't ready.
const VendorsResult2 = await axios.get(VendorsResult.data._links.result.href, {
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': departmentIds[0].id,
},
});
console.log('🚀 ~ sleep ~ VendorsResult2:', VendorsResult2);
});
console.log('🚀 ~ GetBulkVendors ~ Vendors:', ReqId, Vendors.data);
} catch (error) {
console.log('🚀 ~ GetBulkVendors ~ error:', ReqId, error);
}
}
async function FetchVehicles({ SubscriptionID }) {
const access_token = await GetAuthToken();
try {
//This doesn't seem to work as it is for production only.
const Vehicles = await axios.get(`https://api.fortellis.io/cdkdrive/service/v1/vehicles/`, {
headers: { Authorization: `Bearer ${access_token}`, 'Subscription-Id': SubscriptionID },
});
console.log('🚀 ~ FetchVehicles ~ Vehicles:', Vehicles);
return Vehicles.data;
} catch (error) {
console.log('🚀 ~ FetchVehicles ~ error:', error);
}
}
async function PostVehicleServiceHistory() {
const access_token = await GetAuthToken();
const ReqId = uuid();
const departmentIds = (await FetchSubscriptions())
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === 'CDK Drive Async Vendors')?.departments; //Departments are categorized by API name and have an array of departments.
//Need to get a vehicle ID from somewhere.
const vehicles = await FetchVehicles({ SubscriptionID });
try {
//TODO: This is pointing towards the test environment. Need to carefully watch for the production switch.
const Vendors = await axios.post(
`https://api.fortellis.io/cdk-test/drive/post/service-vehicle-history-mgmt/v2/
`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': departmentIds[0].id,
},
},
);
} catch (error) {
console.log('🚀 ~ PostVehicleServiceHistory ~ error:', ReqId, error);
}
}
//PostVehicleServiceHistory();
//GetBulkVendors();
async function GetDepartmentId() {
const departmentIds = await FetchSubscriptions();
console.log('🚀 ~ GetDepartmentId ~ departmentIds:', departmentIds);
const departmentIds2 = departmentIds
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === 'CDK Drive Async Vendors')?.departments; //Departments are categorized by API name and have an array of departments.
return departmentIds[0].id;
}
//////////////////GL WIP Section //////////////////////
async function OrgHelpers() {
console.log('Executing Org Helpers');
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const OrgHelpers = await axios.get(
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/orgHelper`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': DepartmentId,
},
},
);
console.log('🚀 ~ OrgHelpers ~ Data:', OrgHelpers);
return OrgHelpers.data;
} catch (error) {
console.log('🚀 ~ OrgHelpers ~ error:', error);
}
}
async function JournalHelpers({ glCompanyNumber }) {
console.log('Executing Journal Helpers');
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const JournalHelpers = await axios.get(
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/jrnlHelper/${glCompanyNumber}`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': DepartmentId,
},
},
);
console.log('🚀 ~ JournalHelpers ~ Data:', JournalHelpers);
return JournalHelpers.data;
} catch (error) {
console.log('🚀 ~ JournalHelpers ~ error:', error);
}
}
async function GlSalesChain() {
console.log('Executing GL Sales Chain');
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const GlSalesChain = await axios.get(
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/glSalesChain`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': DepartmentId,
},
},
);
console.log('🚀 ~ GlSalesChain ~ Data:', GlSalesChain);
return GlSalesChain.data;
} catch (error) {
console.log('🚀 ~ GlSalesChain ~ error:', error);
}
}
async function GlExpenseAllocation() {
console.log('Executing GL Expense Allocation');
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const GlExpenseAllocation = await axios.get(
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/glExpenseAllocation`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': DepartmentId,
},
},
);
console.log('🚀 ~ GlExpenseAllocation ~ Data:', GlExpenseAllocation);
return GlExpenseAllocation.data;
} catch (error) {
console.log('🚀 ~ GlSalesChain ~ error:', error);
}
}
///EXEC FUNCTIONS
async function PostAccountsGLWIP() {
//const orgHelpers = await OrgHelpers();
//const jrnlHelpers = await JournalHelpers({ glCompanyNumber: orgHelpers[0].coID });
//const glSalesChain = await GlSalesChain();
const glExpenseAllocation = await GlExpenseAllocation();
}
//PostAccountsGLWIP();
async function GetCOA() {
console.log('Executing GetCOA');
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const GetCOA = await axios.get(
`https://api.fortellis.io/cdk-test/drive/chartofaccounts/v2/bulk`,
{
headers: {
Authorization: `Bearer ${access_token}`,
'Subscription-Id': SubscriptionID,
'Request-Id': ReqId,
'Department-Id': DepartmentId,
},
},
);
console.log('🚀 ~ GetCOA ~ Data:', GetCOA);
return GetCOA.data;
} catch (error) {
console.log('🚀 ~ GetCOA ~ error:', error);
}
}
GetCOA();

View File

@@ -1,19 +1,22 @@
const path = require("path"); const path = require('path');
const Dinero = require("dinero.js"); const Dinero = require('dinero.js');
const { gql } = require("graphql-request"); const { gql } = require('graphql-request');
const queries = require("./server/graphql-client/queries"); const queries = require('./server/graphql-client/queries');
const GraphQLClient = require("graphql-request").GraphQLClient; const GraphQLClient = require('graphql-request').GraphQLClient;
const logger = require("./server/utils/logger"); const logger = require('./server/utils/logger');
const AxiosLib = require("axios").default; const { header } = require('./server/email/html');
const { Transaction } = require('firebase-admin/firestore');
const AxiosLib = require('axios').default;
const axios = AxiosLib.create(); const axios = AxiosLib.create();
const uuid = require("uuid").v4; const uuid = require('uuid').v4;
const FORTELLIS_KEY = "X1FxzLyOk3kjHvMbzdPQXFZShkdbgzuo"; const FORTELLIS_KEY = 'X1FxzLyOk3kjHvMbzdPQXFZShkdbgzuo';
const FORTELLIS_SECRET = "JPSAqenpF4CT2buD"; const FORTELLIS_SECRET = '7Yvs0wpQeHcUS5r95ht8pqOaAvBq7dHV';
const FORTELLIS_AUTH_URL = "https://identity.fortellis.io/oauth2/aus1p1ixy7YL8cMq02p7/v1/token"; const FORTELLIS_AUTH_URL = 'https://identity.fortellis.io/oauth2/aus1p1ixy7YL8cMq02p7/v1/token';
const FORTELLIS_URL = "https://api.fortellis.io"; const FORTELLIS_URL = 'https://api.fortellis.io';
const SubscriptionID = "5b527d7d-baf3-40bc-adae-e7a541e37363"; const ENVSubscriptionID = '5b527d7d-baf3-40bc-adae-e7a541e37363';
//const SubscriptionID = "cb59fa04-e53e-4b57-b071-80a48ebc346c"; let SubscriptionMeta = null;
//const ENVSubscriptionID = 'cb59fa04-e53e-4b57-b071-80a48ebc346c';
function sleep(time, callback) { function sleep(time, callback) {
var stop = new Date().getTime(); var stop = new Date().getTime();
@@ -21,21 +24,23 @@ function sleep(time, callback) {
callback(); callback();
} }
async function GetAuthToken() { async function GetAuthToken() {
//Done with Authorization Code Flow
//https://docs.fortellis.io/docs/tutorials/solution-integration/authorization-code-flow/
const { const {
data: { access_token, expires_in, token_type } data: { access_token, expires_in, token_type },
} = await axios.post( } = await axios.post(
FORTELLIS_AUTH_URL, FORTELLIS_AUTH_URL,
{}, {},
{ {
auth: { auth: {
username: FORTELLIS_KEY, username: FORTELLIS_KEY,
password: FORTELLIS_SECRET password: FORTELLIS_SECRET,
}, },
params: { params: {
grant_type: "client_credentials", grant_type: 'client_credentials',
scope: "anonymous" scope: 'anonymous',
} },
} },
); );
return access_token; return access_token;
} }
@@ -43,224 +48,143 @@ async function GetAuthToken() {
async function FetchSubscriptions() { async function FetchSubscriptions() {
const access_token = await GetAuthToken(); const access_token = await GetAuthToken();
try { try {
const subscriptions = await axios.get(`https://subscriptions.fortellis.io/v1/solution/subscriptions`, { const subscriptions = await axios.get(
headers: { Authorization: `Bearer ${access_token}` } `https://subscriptions.fortellis.io/v1/solution/subscriptions`,
});
return subscriptions.data.subscriptions;
} catch (error) {
console.log("🚀 ~ FetchSubscriptions ~ error:", error);
}
}
async function GetBulkVendors() {
const departmentIds = (await FetchSubscriptions())
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === "CDK Drive Async Vendors")?.departments; //Departments are categorized by API name and have an array of departments.
const access_token = await GetAuthToken();
const ReqId = uuid();
try {
//TODO: This is pointing towards the test environment. Need to carefully watch for the production switch.
const Vendors = await axios.get(`https://api.fortellis.io/cdk-test/drive/vendor/v2/bulk`, {
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": departmentIds[0].id
}
});
//Returns a long poll. Need to wait specified seconds until checking.
console.log("🚀 ~ GetBulkVendors ~ Vendors - waiting to execute callback:", Vendors.data.checkStatusAfterSeconds);
sleep(Vendors.data.checkStatusAfterSeconds * 1000, async () => {
const VendorsResult = await axios.get(Vendors.data._links.status.href, {
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": departmentIds[0].id
}
});
//This may have to check again if it isn't ready.
const VendorsResult2 = await axios.get(VendorsResult.data._links.result.href, {
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": departmentIds[0].id
}
});
console.log("🚀 ~ sleep ~ VendorsResult2:", VendorsResult2);
});
console.log("🚀 ~ GetBulkVendors ~ Vendors:", ReqId, Vendors.data);
} catch (error) {
console.log("🚀 ~ GetBulkVendors ~ error:", ReqId, error);
}
}
async function FetchVehicles({ SubscriptionID }) {
const access_token = await GetAuthToken();
try {
//This doesn't seem to work as it is for production only.
const Vehicles = await axios.get(`https://api.fortellis.io/cdkdrive/service/v1/vehicles/`, {
headers: { Authorization: `Bearer ${access_token}`, "Subscription-Id": SubscriptionID }
});
console.log("🚀 ~ FetchVehicles ~ Vehicles:", Vehicles);
return Vehicles.data;
} catch (error) {
console.log("🚀 ~ FetchVehicles ~ error:", error);
}
}
async function PostVehicleServiceHistory() {
const access_token = await GetAuthToken();
const ReqId = uuid();
const departmentIds = (await FetchSubscriptions())
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === "CDK Drive Async Vendors")?.departments; //Departments are categorized by API name and have an array of departments.
//Need to get a vehicle ID from somewhere.
const vehicles = await FetchVehicles({ SubscriptionID });
try {
//TODO: This is pointing towards the test environment. Need to carefully watch for the production switch.
const Vendors = await axios.post(
`https://api.fortellis.io/cdk-test/drive/post/service-vehicle-history-mgmt/v2/
`,
{ {
headers: { headers: { Authorization: `Bearer ${access_token}` },
Authorization: `Bearer ${access_token}`, },
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": departmentIds[0].id
}
}
); );
SubscriptionMeta = subscriptions.data.subscriptions.find(
(s) => s.subscriptionId === ENVSubscriptionID,
);
return SubscriptionMeta;
} catch (error) { } catch (error) {
console.log("🚀 ~ PostVehicleServiceHistory ~ error:", ReqId, error); console.log('🚀 ~ FetchSubscriptions ~ error:', error);
} }
} }
//PostVehicleServiceHistory(); async function GetDepartmentId({ apiName, debug = false }) {
//GetBulkVendors(); if (debug) {
console.log('API Names & Departments ');
console.log('===========');
console.log(
JSON.stringify(
SubscriptionMeta.apiDmsInfo.map((a) => ({
name: a.name,
departments: a.departments.map((d) => d.id),
})),
null,
4,
),
);
console.log('===========');
}
const departmentIds2 = SubscriptionMeta.apiDmsInfo //Get the subscription object.
.find((info) => info.name === apiName)?.departments; //Departments are categorized by API name and have an array of departments.
async function GetDepartmentId() { return departmentIds2[0].id;
const departmentIds = (await FetchSubscriptions())
.find((s) => s.subscriptionId === SubscriptionID) //Get the subscription object.
?.apiDmsInfo.find((info) => info.name === "CDK Drive Async Vendors")?.departments; //Departments are categorized by API name and have an array of departments.
return departmentIds[0].id;
} }
//////////////////GL WIP Section //////////////////////
async function OrgHelpers() { async function MakeFortellisCall({
console.log("Executing Org Helpers"); apiName,
url,
headers = {},
body = {},
type = 'post',
debug = false,
}) {
if (debug) console.log(`Executing ${type} to ${url}`);
const ReqId = uuid(); const ReqId = uuid();
const access_token = await GetAuthToken(); const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId(); const DepartmentId = await GetDepartmentId({ apiName, debug });
try { if (debug) {
//This doesn't seem to work as it is for production only. console.log(
const OrgHelpers = await axios.get(`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/orgHelper`, { `ReqID: ${ReqId} | SubscriptionID: ${SubscriptionMeta.subscriptionId} | DepartmentId: ${DepartmentId}`,
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": DepartmentId
}
});
console.log("🚀 ~ OrgHelpers ~ Data:", OrgHelpers);
return OrgHelpers.data;
} catch (error) {
console.log("🚀 ~ OrgHelpers ~ error:", error);
}
}
async function JournalHelpers({ glCompanyNumber }) {
console.log("Executing Journal Helpers");
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try {
//This doesn't seem to work as it is for production only.
const JournalHelpers = await axios.get(
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/jrnlHelper/${glCompanyNumber}`,
{
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": DepartmentId
}
}
); );
console.log("🚀 ~ JournalHelpers ~ Data:", JournalHelpers); console.log(`Body Contents: ${JSON.stringify(body, null, 4)}`);
return JournalHelpers.data;
} catch (error) {
console.log("🚀 ~ JournalHelpers ~ error:", error);
} }
}
async function GlSalesChain() {
console.log("Executing GL Sales Chain");
const ReqId = uuid();
const access_token = await GetAuthToken();
const DepartmentId = await GetDepartmentId();
try { try {
//This doesn't seem to work as it is for production only. let result;
const GlSalesChain = await axios.get( switch (type) {
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/glSalesChain`, case 'post':
{ default:
headers: { result = await axios.post(url, body, {
Authorization: `Bearer ${access_token}`, headers: {
"Subscription-Id": SubscriptionID, Authorization: `Bearer ${access_token}`,
"Request-Id": ReqId, 'Subscription-Id': SubscriptionMeta.subscriptionId,
"Department-Id": DepartmentId 'Request-Id': ReqId,
} 'Department-Id': DepartmentId,
} ...headers,
); },
console.log("🚀 ~ GlSalesChain ~ Data:", GlSalesChain); });
return GlSalesChain.data; break;
} catch (error) { case 'get':
console.log("🚀 ~ GlSalesChain ~ error:", error); result = await axios.get(url, {
} headers: {
} Authorization: `Bearer ${access_token}`,
async function GlExpenseAllocation() { 'Subscription-Id': SubscriptionMeta.subscriptionId,
console.log("Executing GL Expense Allocation"); 'Request-Id': ReqId,
const ReqId = uuid(); 'Department-Id': DepartmentId,
const access_token = await GetAuthToken(); ...headers,
const DepartmentId = await GetDepartmentId(); },
});
break;
}
try { if (debug) {
//This doesn't seem to work as it is for production only. console.log(`ReqID: ${ReqId} Data`);
const GlExpenseAllocation = await axios.get( console.log(JSON.stringify(result.data, null, 4));
`https://api.fortellis.io/cdk-test/drive/businessofficeglwippost/glExpenseAllocation`, }
{ return result.data;
headers: {
Authorization: `Bearer ${access_token}`,
"Subscription-Id": SubscriptionID,
"Request-Id": ReqId,
"Department-Id": DepartmentId
}
}
);
console.log("🚀 ~ GlExpenseAllocation ~ Data:", GlExpenseAllocation);
return GlExpenseAllocation.data;
} catch (error) { } catch (error) {
console.log("🚀 ~ GlSalesChain ~ error:", error); console.log(`ReqID: ${ReqId} Error`, error.response?.data);
console.log(`ReqID: ${ReqId} Full Error`, JSON.stringify(error, null, 4));
} }
} }
///EXEC FUNCTIONS async function GetCOA() {
async function PostAccountsGLWIP() { console.log('Executing GetCOA');
//const orgHelpers = await OrgHelpers(); await MakeFortellisCall({
//const jrnlHelpers = await JournalHelpers({ glCompanyNumber: orgHelpers[0].coID }); debug: true,
type: 'get',
//const glSalesChain = await GlSalesChain(); url: `https://api.fortellis.io/cdk-test/drive/chartofaccounts/v2/bulk`,
const glExpenseAllocation = await GlExpenseAllocation(); });
} }
PostAccountsGLWIP(); async function StartWIP() {
const TransactionWip = MakeFortellisCall({
url: 'https://api.fortellis.io/cdk-test/drive/glpost/startWIP',
body: {
acctgDate: '2023-09-26', //job.invoice
desc: 'TEST TRANSACTION',
docType: '3', //pulled from Doc Type workbook
m13Flag: '0', // Is this a M13 entry. Presumanbly always 0
refer: 'RO12345', //Supposed to be a doc reference number. Presumably the RO?
srcCo: '1',
srcJrnl: '75',
userID: 'csr', //bodyshop user
userName: 'PROGRAM, PARTNER*ADP', //Can leave blank to have this return to default.
},
debug: true,
});
return TransactionWip;
}
async function DoTheThings() {
await FetchSubscriptions();
//What do we have access to?
// console.log('Sub Access : ', SubscriptionMeta.apiDmsInfo.map((i) => i.name).join(', '));
//await GetCOA();
await MakeFortellisCall({
type: 'get',
debug: true,
apiName: 'CDK Drive Post Accounts GL WIP',
url: 'https://api.fortellis.io/cdk-test/drive/glwippost/orgHelper',
});
//await StartWIP();
}
DoTheThings();