Succesful header creation.
This commit is contained in:
@@ -1,18 +1,341 @@
|
|||||||
Fortellis Notes
|
Fortellis Notes
|
||||||
|
|
||||||
Subscription ID
|
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.
|
|
||||||
|
|
||||||
|
- 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
|
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.
|
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
# GL Wip Posting
|
||||||
|
|
||||||
|
## Org Helper Return Data
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "V",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRITE BACK VMS",
|
||||||
|
"logon": "DEVWB-V"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "F",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRITE BACK F&I SALES",
|
||||||
|
"logon": "DEVWB-FI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "CS",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRITE BACK SERVICE",
|
||||||
|
"logon": "DEVWB-S"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "A",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRITE BACK ACCTG",
|
||||||
|
"logon": "DEVWB-A"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "SL",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRTIE BACK SLS MGMT",
|
||||||
|
"logon": "DEVWB-SL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"acctgLgnID": "DEVWB-A",
|
||||||
|
"applCode": "O",
|
||||||
|
"coID": "77",
|
||||||
|
"companyName": "TEST SYS C187092 DEVWB",
|
||||||
|
"lgnDesc": "DEV WRITE BACK PARTS",
|
||||||
|
"logon": "DEVWB-I"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Journal Helper Return Data
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "32",
|
||||||
|
"jrnlName": "PARTS SALES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "4",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "92",
|
||||||
|
"jrnlName": "YTD ADJUSTMENTS",
|
||||||
|
"jrnlType": "Y",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "3",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "12",
|
||||||
|
"jrnlName": "FLEET SALES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "9",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "57",
|
||||||
|
"jrnlName": "CASH RECEIPTS (OPEN-ITEM)",
|
||||||
|
"jrnlType": "R",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "1",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "93",
|
||||||
|
"jrnlName": "SET UP HISTORY",
|
||||||
|
"jrnlType": "H",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "10",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "88",
|
||||||
|
"jrnlName": "F/S STATISCAL DATA",
|
||||||
|
"jrnlType": "F",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "10",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "58",
|
||||||
|
"jrnlName": "WARRANTY CREDITS",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "3",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "FC",
|
||||||
|
"jrnlName": "FINANCE CHARGE",
|
||||||
|
"jrnlType": "A",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "12",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "94",
|
||||||
|
"jrnlName": "SET UP SCHEDULES",
|
||||||
|
"jrnlType": "C",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "3",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "95",
|
||||||
|
"jrnlName": "SET UP GENERAL LEDGER",
|
||||||
|
"jrnlType": "B",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "3",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "20",
|
||||||
|
"jrnlName": "USED VEHICLE SALES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "9",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "60",
|
||||||
|
"jrnlName": "CASH DISBURSEMENTS",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "2",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "30",
|
||||||
|
"jrnlName": "SERVICE SALES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "7",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "40",
|
||||||
|
"jrnlName": "PAYROLL",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "11",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "15",
|
||||||
|
"jrnlName": "DEALER TRADES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "9",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "70",
|
||||||
|
"jrnlName": "NEW VEHICLE PURCHASES",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "8",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "25",
|
||||||
|
"jrnlName": "USED WHOLESALE",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "9",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "75",
|
||||||
|
"jrnlName": "GENERAL PURCHASES",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "5",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "10",
|
||||||
|
"jrnlName": "NEW VEHICLE SALES",
|
||||||
|
"jrnlType": "S",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "9",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "80",
|
||||||
|
"jrnlName": "GENERAL JOURNAL",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "3",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "11",
|
||||||
|
"jrnlName": "WORK IN PROGRESS",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "10",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "56",
|
||||||
|
"jrnlName": "CASH RECEIPTS (BALANCE FWD)",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "1",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "81",
|
||||||
|
"jrnlName": "STANDARD ENTRIES",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "6",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "51",
|
||||||
|
"jrnlName": "CASH RECEIPTS JOURNAL - EFT",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "10",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "61",
|
||||||
|
"jrnlName": "CASH DISBURSMENTS -EFT",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "10",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"companyNo": "77",
|
||||||
|
"jrnlID": "71",
|
||||||
|
"jrnlName": "USED VEHICLE PURCHASES",
|
||||||
|
"jrnlType": "G",
|
||||||
|
"intercoFlag": "0",
|
||||||
|
"defaultDocType": "8",
|
||||||
|
"errCode": "",
|
||||||
|
"errMsg": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
# Feedback
|
# Feedback
|
||||||
* Receiving bad request errors, with no details. API errors page doesn't indicate what's wrong.
|
|
||||||
|
|
||||||
# API Error
|
- Receiving bad request errors, with no details. API errors page doesn't indicate what's wrong for certain types of error codes.
|
||||||
* Not in real time - appaers to be every 3 minutes?
|
- API Error page works on a several minute delay.
|
||||||
|
|||||||
50
fortellis.js
50
fortellis.js
@@ -64,6 +64,7 @@ async function FetchSubscriptions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetDepartmentId({ apiName, debug = false }) {
|
async function GetDepartmentId({ apiName, debug = false }) {
|
||||||
|
if (!apiName) throw new Error('apiName not provided. Unable to get department without apiName.');
|
||||||
if (debug) {
|
if (debug) {
|
||||||
console.log('API Names & Departments ');
|
console.log('API Names & Departments ');
|
||||||
console.log('===========');
|
console.log('===========');
|
||||||
@@ -140,7 +141,7 @@ async function MakeFortellisCall({
|
|||||||
return result.data;
|
return result.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`ReqID: ${ReqId} Error`, error.response?.data);
|
console.log(`ReqID: ${ReqId} Error`, error.response?.data);
|
||||||
console.log(`ReqID: ${ReqId} Full Error`, JSON.stringify(error, null, 4));
|
//console.log(`ReqID: ${ReqId} Full Error`, JSON.stringify(error, null, 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,21 +150,23 @@ async function GetCOA() {
|
|||||||
await MakeFortellisCall({
|
await MakeFortellisCall({
|
||||||
debug: true,
|
debug: true,
|
||||||
type: 'get',
|
type: 'get',
|
||||||
|
apiName: 'CDK Drive Post Accounts GL WIP',
|
||||||
url: `https://api.fortellis.io/cdk-test/drive/chartofaccounts/v2/bulk`,
|
url: `https://api.fortellis.io/cdk-test/drive/chartofaccounts/v2/bulk`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function StartWIP() {
|
async function StartWIP() {
|
||||||
const TransactionWip = MakeFortellisCall({
|
const TransactionWip = MakeFortellisCall({
|
||||||
url: 'https://api.fortellis.io/cdk-test/drive/glpost/startWIP',
|
url: 'https://api.fortellis.io/cdk-test/drive/glwippost/startWIP',
|
||||||
|
apiName: 'CDK Drive Post Accounts GL WIP',
|
||||||
body: {
|
body: {
|
||||||
acctgDate: '2023-09-26', //job.invoice
|
acctgDate: '2023-09-26', //job.invoice
|
||||||
desc: 'TEST TRANSACTION',
|
desc: 'TEST TRANSACTION',
|
||||||
docType: '3', //pulled from Doc Type workbook
|
docType: '3', //pulled from Doc Type workbook
|
||||||
m13Flag: '0', // Is this a M13 entry. Presumanbly always 0
|
m13Flag: '0', // Is this a M13 entry. Presumanbly always 0
|
||||||
refer: 'RO12345', //Supposed to be a doc reference number. Presumably the RO?
|
refer: 'RO12345', //Supposed to be a doc reference number. Presumably the RO?
|
||||||
srcCo: '1',
|
srcCo: '77',
|
||||||
srcJrnl: '75',
|
srcJrnl: '80',
|
||||||
userID: 'csr', //bodyshop user
|
userID: 'csr', //bodyshop user
|
||||||
userName: 'PROGRAM, PARTNER*ADP', //Can leave blank to have this return to default.
|
userName: 'PROGRAM, PARTNER*ADP', //Can leave blank to have this return to default.
|
||||||
},
|
},
|
||||||
@@ -173,18 +176,39 @@ async function StartWIP() {
|
|||||||
return TransactionWip;
|
return TransactionWip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function InsertBatch({ transID }) {
|
||||||
|
const TransactionWip = MakeFortellisCall({
|
||||||
|
url: 'https://api.fortellis.io/cdk-test/drive/glwippost/transWIP',
|
||||||
|
apiName: 'CDK Drive Post Accounts GL WIP',
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
acct: '',
|
||||||
|
cntl: '',
|
||||||
|
cntl2: null,
|
||||||
|
credtMemoNo: null,
|
||||||
|
postAmt: Math.round(payer.amount * 100),
|
||||||
|
postDesc: '', //Required if required by the DMS setup
|
||||||
|
prod: null, //Productivity Number
|
||||||
|
statCnt: 1, //Auto count, leave as 1.
|
||||||
|
transID: transID,
|
||||||
|
trgtCoID: '77', //Add this to read from the header
|
||||||
|
},
|
||||||
|
],
|
||||||
|
debug: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function DoTheThings() {
|
async function DoTheThings() {
|
||||||
await FetchSubscriptions();
|
await FetchSubscriptions();
|
||||||
//What do we have access to?
|
//What do we have access to?
|
||||||
// console.log('Sub Access : ', SubscriptionMeta.apiDmsInfo.map((i) => i.name).join(', '));
|
console.log('Sub Access : ', SubscriptionMeta.apiDmsInfo.map((i) => i.name).join(', '));
|
||||||
//await GetCOA();
|
await GetCOA();
|
||||||
await MakeFortellisCall({
|
|
||||||
type: 'get',
|
return;
|
||||||
debug: true,
|
|
||||||
apiName: 'CDK Drive Post Accounts GL WIP',
|
//Insert Transactions
|
||||||
url: 'https://api.fortellis.io/cdk-test/drive/glwippost/orgHelper',
|
const TransactionHeader = await StartWIP();
|
||||||
});
|
const BatchResult = await InsertBatch({ transID: TransactionHeader.transID });
|
||||||
//await StartWIP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DoTheThings();
|
DoTheThings();
|
||||||
|
|||||||
Reference in New Issue
Block a user