first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,478 @@
import { capitalCase } from 'change-case';
import omit from 'lodash/omit';
import pickBy from 'lodash/pickBy';
import { NodeApiError } from 'n8n-workflow';
import type {
IDataObject,
IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
INodeExecutionData,
INodePropertyOptions,
IRequestOptions,
JsonObject,
} from 'n8n-workflow';
import type { CustomField, GeneralAddress, Ref } from './descriptions/Shared.interface';
import type { DateFieldsUi, Option, QuickBooksOAuth2Credentials, TransactionReport } from './types';
/**
* Make an authenticated API request to QuickBooks.
*/
export async function quickBooksApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
qs: IDataObject,
body: IDataObject,
option: IDataObject = {},
): Promise<any> {
const resource = this.getNodeParameter('resource', 0) as string;
const operation = this.getNodeParameter('operation', 0) as string;
let isDownload = false;
if (['estimate', 'invoice', 'payment'].includes(resource) && operation === 'get') {
isDownload = this.getNodeParameter('download', 0) as boolean;
}
const productionUrl = 'https://quickbooks.api.intuit.com';
const sandboxUrl = 'https://sandbox-quickbooks.api.intuit.com';
const credentials = await this.getCredentials<QuickBooksOAuth2Credentials>('quickBooksOAuth2Api');
const options: IRequestOptions = {
headers: {
'user-agent': 'n8n',
},
method,
uri: `${credentials.environment === 'sandbox' ? sandboxUrl : productionUrl}${endpoint}`,
qs,
body,
json: !isDownload,
};
if (!Object.keys(body).length) {
delete options.body;
}
if (!Object.keys(qs).length) {
delete options.qs;
}
if (Object.keys(option)) {
Object.assign(options, option);
}
if (isDownload) {
options.headers!.Accept = 'application/pdf';
}
if (resource === 'invoice' && operation === 'send') {
options.headers!['Content-Type'] = 'application/octet-stream';
}
if (
(resource === 'invoice' && (operation === 'void' || operation === 'delete')) ||
(resource === 'payment' && (operation === 'void' || operation === 'delete'))
) {
options.headers!['Content-Type'] = 'application/json';
}
try {
return await this.helpers.requestOAuth2.call(this, 'quickBooksOAuth2Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
async function getCount(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
qs: IDataObject,
): Promise<any> {
const responseData = await quickBooksApiRequest.call(this, method, endpoint, qs, {});
return responseData.QueryResponse.totalCount;
}
/**
* Make an authenticated API request to QuickBooks and return all results.
*/
export async function quickBooksApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
qs: IDataObject,
body: IDataObject,
resource: string,
): Promise<any> {
let responseData;
let startPosition = 1;
const maxResults = 1000;
const returnData: IDataObject[] = [];
const maxCountQuery = {
query: `SELECT COUNT(*) FROM ${resource}`,
} as IDataObject;
const maxCount = await getCount.call(this, method, endpoint, maxCountQuery);
const originalQuery = qs.query as string;
do {
qs.query = `${originalQuery} MAXRESULTS ${maxResults} STARTPOSITION ${startPosition}`;
responseData = await quickBooksApiRequest.call(this, method, endpoint, qs, body);
try {
const nonResource = originalQuery.split(' ')?.pop();
if (nonResource === 'CreditMemo' || nonResource === 'Term' || nonResource === 'TaxCode') {
returnData.push(...(responseData.QueryResponse[nonResource] as IDataObject[]));
} else {
returnData.push(...(responseData.QueryResponse[capitalCase(resource)] as IDataObject[]));
}
} catch (error) {
return [];
}
startPosition += maxResults;
} while (maxCount > returnData.length);
return returnData;
}
/**
* Handles a QuickBooks listing by returning all items or up to a limit.
*/
export async function handleListing(
this: IExecuteFunctions,
i: number,
endpoint: string,
resource: string,
): Promise<any> {
let responseData;
const qs = {
query: `SELECT * FROM ${resource}`,
} as IDataObject;
const returnAll = this.getNodeParameter('returnAll', i);
const filters = this.getNodeParameter('filters', i);
if (filters.query) {
qs.query += ` ${filters.query}`;
}
if (returnAll) {
return await quickBooksApiRequestAllItems.call(this, 'GET', endpoint, qs, {}, resource);
} else {
const limit = this.getNodeParameter('limit', i);
qs.query += ` MAXRESULTS ${limit}`;
responseData = await quickBooksApiRequest.call(this, 'GET', endpoint, qs, {});
responseData = responseData.QueryResponse[capitalCase(resource)];
return responseData;
}
}
/**
* Get the SyncToken required for delete and void operations in QuickBooks.
*/
export async function getSyncToken(
this: IExecuteFunctions,
i: number,
companyId: string,
resource: string,
) {
const resourceId = this.getNodeParameter(`${resource}Id`, i);
const getEndpoint = `/v3/company/${companyId}/${resource}/${resourceId}`;
const propertyName = capitalCase(resource);
const {
[propertyName]: { SyncToken },
} = await quickBooksApiRequest.call(this, 'GET', getEndpoint, {}, {});
return SyncToken;
}
/**
* Get the reference and SyncToken required for update operations in QuickBooks.
*/
export async function getRefAndSyncToken(
this: IExecuteFunctions,
i: number,
companyId: string,
resource: string,
ref: string,
) {
const resourceId = this.getNodeParameter(`${resource}Id`, i);
const endpoint = `/v3/company/${companyId}/${resource}/${resourceId}`;
const responseData = await quickBooksApiRequest.call(this, 'GET', endpoint, {}, {});
return {
ref: responseData[capitalCase(resource)][ref],
syncToken: responseData[capitalCase(resource)].SyncToken,
};
}
/**
* Populate node items with binary data.
*/
export async function handleBinaryData(
this: IExecuteFunctions,
items: INodeExecutionData[],
i: number,
companyId: string,
resource: string,
resourceId: string,
) {
const binaryProperty = this.getNodeParameter('binaryProperty', i);
const fileName = this.getNodeParameter('fileName', i) as string;
const endpoint = `/v3/company/${companyId}/${resource}/${resourceId}/pdf`;
const data = await quickBooksApiRequest.call(this, 'GET', endpoint, {}, {}, { encoding: null });
items[i].binary = items[i].binary ?? {};
items[i].binary[binaryProperty] = await this.helpers.prepareBinaryData(data as Buffer);
items[i].binary[binaryProperty].fileName = fileName;
items[i].binary[binaryProperty].fileExtension = 'pdf';
return items;
}
export async function loadResource(this: ILoadOptionsFunctions, resource: string) {
const returnData: INodePropertyOptions[] = [];
const qs = {
query: `SELECT * FROM ${resource}`,
} as IDataObject;
const {
oauthTokenData: {
callbackQueryString: { realmId },
},
} = await this.getCredentials<QuickBooksOAuth2Credentials>('quickBooksOAuth2Api');
const endpoint = `/v3/company/${realmId}/query`;
const resourceItems = await quickBooksApiRequestAllItems.call(
this,
'GET',
endpoint,
qs,
{},
resource,
);
if (resource === 'preferences') {
const {
SalesFormsPrefs: { CustomField },
} = resourceItems[0];
const customFields = CustomField[1].CustomField;
for (const customField of customFields) {
const length = customField.Name.length;
returnData.push({
name: customField.StringValue,
value: customField.Name.charAt(length - 1),
});
}
return returnData;
}
resourceItems.forEach((resourceItem: { DisplayName: string; Name: string; Id: string }) => {
returnData.push({
name: resourceItem.DisplayName || resourceItem.Name || `Memo ${resourceItem.Id}`,
value: resourceItem.Id,
});
});
return returnData;
}
/**
* Populate the `Line` property in a request body.
*/
export function processLines(this: IExecuteFunctions, lines: IDataObject[], resource: string) {
lines.forEach((line) => {
if (resource === 'bill') {
if (line.DetailType === 'AccountBasedExpenseLineDetail') {
line.AccountBasedExpenseLineDetail = {
AccountRef: {
value: line.accountId,
},
};
delete line.accountId;
} else if (line.DetailType === 'ItemBasedExpenseLineDetail') {
line.ItemBasedExpenseLineDetail = {
ItemRef: {
value: line.itemId,
},
};
delete line.itemId;
}
} else if (resource === 'estimate') {
if (line.DetailType === 'SalesItemLineDetail') {
line.SalesItemLineDetail = {
ItemRef: {
value: line.itemId,
},
TaxCodeRef: {
value: line.TaxCodeRef,
},
};
delete line.itemId;
delete line.TaxCodeRef;
}
} else if (resource === 'invoice') {
if (line.DetailType === 'SalesItemLineDetail') {
line.SalesItemLineDetail = {
ItemRef: {
value: line.itemId,
},
TaxCodeRef: {
value: line.TaxCodeRef,
},
Qty: line.Qty,
};
if (line.Qty === undefined) {
delete (line.SalesItemLineDetail as IDataObject).Qty;
}
delete line.itemId;
delete line.TaxCodeRef;
delete line.Qty;
}
}
});
return lines;
}
/**
* Populate update fields or additional fields into a request body.
*/
export function populateFields(
this: IExecuteFunctions,
body: IDataObject,
fields: IDataObject,
resource: string,
) {
Object.entries(fields).forEach(([key, value]) => {
if (resource === 'bill') {
if (key.endsWith('Ref')) {
const { details } = value as { details: Ref };
body[key] = {
name: details.name,
value: details.value,
};
} else {
body[key] = value;
}
} else if (['customer', 'employee', 'vendor'].includes(resource)) {
if (key === 'BillAddr') {
const { details } = value as { details: GeneralAddress };
body.BillAddr = pickBy(details, (detail) => detail !== '');
} else if (key === 'PrimaryEmailAddr') {
body.PrimaryEmailAddr = {
Address: value,
};
} else if (key === 'PrimaryPhone') {
body.PrimaryPhone = {
FreeFormNumber: value,
};
} else {
body[key] = value;
}
} else if (resource === 'estimate' || resource === 'invoice') {
if (key === 'BillAddr' || key === 'ShipAddr') {
const { details } = value as { details: GeneralAddress };
body[key] = pickBy(details, (detail) => detail !== '');
} else if (key === 'BillEmail') {
body.BillEmail = {
Address: value,
};
} else if (key === 'CustomFields') {
const { Field } = value as { Field: CustomField[] };
body.CustomField = Field;
const length = (body.CustomField as CustomField[]).length;
for (let i = 0; i < length; i++) {
//@ts-ignore
body.CustomField[i].Type = 'StringType';
}
} else if (key === 'CustomerMemo') {
body.CustomerMemo = {
value,
};
} else if (key.endsWith('Ref')) {
const { details } = value as { details: Ref };
body[key] = {
name: details.name,
value: details.value,
};
} else if (key === 'TotalTax') {
body.TxnTaxDetail = {
TotalTax: value,
};
} else {
body[key] = value;
}
} else if (resource === 'payment') {
body[key] = value;
}
});
return body;
}
export const toOptions = (option: string) => ({ name: option, value: option });
export const splitPascalCase = (word: string) => {
return word.match(/($[a-z])|[A-Z][^A-Z]+/g)!.join(' ');
};
export const toDisplayName = ({ name, value }: Option): INodePropertyOptions => {
return { name: splitPascalCase(name), value };
};
export function adjustTransactionDates(transactionFields: IDataObject & DateFieldsUi): IDataObject {
const dateFieldKeys = [
'dateRangeCustom',
'dateRangeDueCustom',
'dateRangeModificationCustom',
'dateRangeCreationCustom',
] as const;
if (dateFieldKeys.every((dateField) => !transactionFields[dateField])) {
return transactionFields;
}
let adjusted = omit(transactionFields, dateFieldKeys) as IDataObject;
dateFieldKeys.forEach((dateFieldKey) => {
const dateField = transactionFields[dateFieldKey];
if (dateField) {
Object.entries(dateField[`${dateFieldKey}Properties`]).map(
([key, value]) => (dateField[`${dateFieldKey}Properties`][key] = value.split('T')[0]),
);
adjusted = {
...adjusted,
...dateField[`${dateFieldKey}Properties`],
};
}
});
return adjusted;
}
export function simplifyTransactionReport(transactionReport: TransactionReport) {
const columns = transactionReport.Columns.Column.map((column) => column.ColType);
const rows = transactionReport.Rows.Row.map((row) => row.ColData.map((i) => i.value));
const simplified = [];
for (const row of rows) {
const transaction: { [key: string]: string } = {};
for (let i = 0; i < row.length; i++) {
transaction[columns[i]] = row[i];
}
simplified.push(transaction);
}
return simplified;
}
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.quickbooks",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Finance & Accounting"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/quickbooks/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.quickbooks/"
}
]
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,170 @@
{
"type": "object",
"properties": {
"APAccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DocNumber": {
"type": "string"
},
"domain": {
"type": "string"
},
"DueDate": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"AccountBasedExpenseLineDetail": {
"type": "object",
"properties": {
"AccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"BillableStatus": {
"type": "string"
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
},
"Description": {
"type": "string"
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
},
"ItemBasedExpenseLineDetail": {
"type": "object",
"properties": {
"BillableStatus": {
"type": "string"
},
"ItemRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"Qty": {
"type": "integer"
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
},
"LineNum": {
"type": "integer"
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"SalesTermRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
},
"VendorRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
},
"version": 1
}
@@ -0,0 +1,81 @@
{
"type": "object",
"properties": {
"Active": {
"type": "boolean"
},
"Balance": {
"type": "integer"
},
"BalanceWithJobs": {
"type": "integer"
},
"BillWithParent": {
"type": "boolean"
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DefaultTaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"DisplayName": {
"type": "string"
},
"domain": {
"type": "string"
},
"FullyQualifiedName": {
"type": "string"
},
"Id": {
"type": "string"
},
"IsProject": {
"type": "boolean"
},
"Job": {
"type": "boolean"
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PreferredDeliveryMethod": {
"type": "string"
},
"PrintOnCheckName": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Taxable": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,75 @@
{
"type": "object",
"properties": {
"Active": {
"type": "boolean"
},
"BillWithParent": {
"type": "boolean"
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DefaultTaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"DisplayName": {
"type": "string"
},
"domain": {
"type": "string"
},
"FullyQualifiedName": {
"type": "string"
},
"Id": {
"type": "string"
},
"IsProject": {
"type": "boolean"
},
"Job": {
"type": "boolean"
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PreferredDeliveryMethod": {
"type": "string"
},
"PrintOnCheckName": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Taxable": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,123 @@
{
"type": "object",
"properties": {
"Active": {
"type": "boolean"
},
"BillAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"BillWithParent": {
"type": "boolean"
},
"CompanyName": {
"type": "string"
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DisplayName": {
"type": "string"
},
"domain": {
"type": "string"
},
"FullyQualifiedName": {
"type": "string"
},
"Id": {
"type": "string"
},
"Job": {
"type": "boolean"
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PreferredDeliveryMethod": {
"type": "string"
},
"PrimaryEmailAddr": {
"type": "object",
"properties": {
"Address": {
"type": "string"
}
}
},
"PrimaryPhone": {
"type": "object",
"properties": {
"FreeFormNumber": {
"type": "string"
}
}
},
"PrintOnCheckName": {
"type": "string"
},
"ShipAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Taxable": {
"type": "boolean"
}
},
"version": 1
}
@@ -0,0 +1,215 @@
{
"type": "object",
"properties": {
"AllowIPNPayment": {
"type": "boolean"
},
"AllowOnlineACHPayment": {
"type": "boolean"
},
"AllowOnlineCreditCardPayment": {
"type": "boolean"
},
"AllowOnlinePayment": {
"type": "boolean"
},
"ApplyTaxAfterDiscount": {
"type": "boolean"
},
"BillAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Lat": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Long": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomField": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DefinitionId": {
"type": "string"
},
"Name": {
"type": "string"
},
"Type": {
"type": "string"
}
}
}
},
"DocNumber": {
"type": "string"
},
"domain": {
"type": "string"
},
"DueDate": {
"type": "string"
},
"EmailStatus": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
},
"LineNum": {
"type": "integer"
},
"SalesItemLineDetail": {
"type": "object",
"properties": {
"ItemAccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"ItemRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastModifiedByRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PrintStatus": {
"type": "string"
},
"ShipFromAddr": {
"type": "object",
"properties": {
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Line2": {
"type": "string"
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,266 @@
{
"type": "object",
"properties": {
"AllowIPNPayment": {
"type": "boolean"
},
"AllowOnlineACHPayment": {
"type": "boolean"
},
"AllowOnlineCreditCardPayment": {
"type": "boolean"
},
"AllowOnlinePayment": {
"type": "boolean"
},
"ApplyTaxAfterDiscount": {
"type": "boolean"
},
"BillAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"BillEmail": {
"type": "object",
"properties": {
"Address": {
"type": "string"
}
}
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomField": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DefinitionId": {
"type": "string"
},
"Name": {
"type": "string"
},
"Type": {
"type": "string"
}
}
}
},
"DocNumber": {
"type": "string"
},
"domain": {
"type": "string"
},
"DueDate": {
"type": "string"
},
"EmailStatus": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
},
"LineNum": {
"type": "integer"
},
"SalesItemLineDetail": {
"type": "object",
"properties": {
"ItemAccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"ItemRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastModifiedByRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PrintStatus": {
"type": "string"
},
"SalesTermRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"ShipAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
},
"TxnTaxDetail": {
"type": "object",
"properties": {
"TaxLine": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DetailType": {
"type": "string"
},
"TaxLineDetail": {
"type": "object",
"properties": {
"PercentBased": {
"type": "boolean"
},
"TaxRateRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
},
"version": 1
}
@@ -0,0 +1,260 @@
{
"type": "object",
"properties": {
"AllowIPNPayment": {
"type": "boolean"
},
"AllowOnlineACHPayment": {
"type": "boolean"
},
"AllowOnlineCreditCardPayment": {
"type": "boolean"
},
"AllowOnlinePayment": {
"type": "boolean"
},
"ApplyTaxAfterDiscount": {
"type": "boolean"
},
"BillAddr": {
"type": "object",
"properties": {
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Line2": {
"type": "string"
},
"Line3": {
"type": "string"
}
}
},
"BillEmail": {
"type": "object",
"properties": {
"Address": {
"type": "string"
}
}
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerMemo": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomField": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DefinitionId": {
"type": "string"
},
"Name": {
"type": "string"
},
"Type": {
"type": "string"
}
}
}
},
"DocNumber": {
"type": "string"
},
"domain": {
"type": "string"
},
"DueDate": {
"type": "string"
},
"EmailStatus": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
},
"LineNum": {
"type": "integer"
},
"SalesItemLineDetail": {
"type": "object",
"properties": {
"ItemRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PrintStatus": {
"type": "string"
},
"SalesTermRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"ShipAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line1": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
},
"TxnTaxDetail": {
"type": "object",
"properties": {
"TaxLine": {
"type": "array",
"items": {
"type": "object",
"properties": {
"DetailType": {
"type": "string"
},
"TaxLineDetail": {
"type": "object",
"properties": {
"PercentBased": {
"type": "boolean"
},
"TaxRateRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
},
"TxnTaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
},
"version": 1
}
@@ -0,0 +1,158 @@
{
"type": "object",
"properties": {
"AllowIPNPayment": {
"type": "boolean"
},
"AllowOnlineACHPayment": {
"type": "boolean"
},
"AllowOnlineCreditCardPayment": {
"type": "boolean"
},
"AllowOnlinePayment": {
"type": "boolean"
},
"ApplyTaxAfterDiscount": {
"type": "boolean"
},
"BillEmail": {
"type": "object",
"properties": {
"Address": {
"type": "string"
}
}
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DeliveryInfo": {
"type": "object",
"properties": {
"DeliveryTime": {
"type": "string"
},
"DeliveryType": {
"type": "string"
}
}
},
"DocNumber": {
"type": "string"
},
"domain": {
"type": "string"
},
"DueDate": {
"type": "string"
},
"EmailStatus": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Description": {
"type": "string"
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
},
"LineNum": {
"type": "integer"
},
"SalesItemLineDetail": {
"type": "object",
"properties": {
"ItemRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PrintStatus": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,67 @@
{
"type": "object",
"properties": {
"Active": {
"type": "boolean"
},
"DeferredRevenue": {
"type": "boolean"
},
"Description": {
"type": "string"
},
"domain": {
"type": "string"
},
"FullyQualifiedName": {
"type": "string"
},
"Id": {
"type": "string"
},
"IncomeAccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"Name": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Taxable": {
"type": "boolean"
},
"TrackQtyOnHand": {
"type": "boolean"
},
"Type": {
"type": "string"
},
"UnitPrice": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,61 @@
{
"type": "object",
"properties": {
"Active": {
"type": "boolean"
},
"Description": {
"type": "string"
},
"domain": {
"type": "string"
},
"FullyQualifiedName": {
"type": "string"
},
"Id": {
"type": "string"
},
"IncomeAccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"Name": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Taxable": {
"type": "boolean"
},
"TrackQtyOnHand": {
"type": "boolean"
},
"Type": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,146 @@
{
"type": "object",
"properties": {
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DepositToAccountRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"domain": {
"type": "string"
},
"ExchangeRate": {
"type": "integer"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"LineEx": {
"type": "object",
"properties": {
"any": {
"type": "array",
"items": {
"type": "object",
"properties": {
"declaredType": {
"type": "string"
},
"globalScope": {
"type": "boolean"
},
"name": {
"type": "string"
},
"nil": {
"type": "boolean"
},
"scope": {
"type": "string"
},
"typeSubstituted": {
"type": "boolean"
},
"value": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PaymentMethodRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"PaymentRefNum": {
"type": "string"
},
"ProcessPayment": {
"type": "boolean"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
},
"UnappliedAmt": {
"type": "integer"
}
},
"version": 1
}
@@ -0,0 +1,151 @@
{
"type": "object",
"properties": {
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"CustomerRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DepositToAccountRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"domain": {
"type": "string"
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"LineEx": {
"type": "object",
"properties": {
"any": {
"type": "array",
"items": {
"type": "object",
"properties": {
"declaredType": {
"type": "string"
},
"globalScope": {
"type": "boolean"
},
"name": {
"type": "string"
},
"nil": {
"type": "boolean"
},
"scope": {
"type": "string"
},
"typeSubstituted": {
"type": "boolean"
},
"value": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Value": {
"type": "string"
}
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
}
}
}
},
"LinkedTxn": {
"type": "array",
"items": {
"type": "object",
"properties": {
"TxnId": {
"type": "string"
},
"TxnType": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PaymentMethodRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
},
"ProcessPayment": {
"type": "boolean"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,157 @@
{
"type": "object",
"properties": {
"AccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"Credit": {
"type": "boolean"
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"domain": {
"type": "string"
},
"EntityRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"Id": {
"type": "string"
},
"Line": {
"type": "array",
"items": {
"type": "object",
"properties": {
"AccountBasedExpenseLineDetail": {
"type": "object",
"properties": {
"AccountRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"BillableStatus": {
"type": "string"
},
"TaxCodeRef": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
},
"DetailType": {
"type": "string"
},
"Id": {
"type": "string"
}
}
}
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"PaymentType": {
"type": "string"
},
"PurchaseEx": {
"type": "object",
"properties": {
"any": {
"type": "array",
"items": {
"type": "object",
"properties": {
"declaredType": {
"type": "string"
},
"globalScope": {
"type": "boolean"
},
"name": {
"type": "string"
},
"nil": {
"type": "boolean"
},
"scope": {
"type": "string"
},
"typeSubstituted": {
"type": "boolean"
},
"value": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Value": {
"type": "string"
}
}
}
}
}
}
}
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"TxnDate": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,33 @@
{
"type": "object",
"properties": {
"account_name": {
"type": "string"
},
"doc_num": {
"type": "string"
},
"is_no_post": {
"type": "string"
},
"memo": {
"type": "string"
},
"name": {
"type": "string"
},
"other_account": {
"type": "string"
},
"subt_nat_amount": {
"type": "string"
},
"tx_date": {
"type": "string"
},
"txn_type": {
"type": "string"
}
},
"version": 3
}
@@ -0,0 +1,130 @@
{
"type": "object",
"properties": {
"AcctNum": {
"type": "string"
},
"Active": {
"type": "boolean"
},
"BillAddr": {
"type": "object",
"properties": {
"City": {
"type": "string"
},
"CountrySubDivisionCode": {
"type": "string"
},
"Id": {
"type": "string"
},
"Lat": {
"type": "string"
},
"Line1": {
"type": "string"
},
"Long": {
"type": "string"
},
"PostalCode": {
"type": "string"
}
}
},
"CompanyName": {
"type": "string"
},
"CurrencyRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"DisplayName": {
"type": "string"
},
"domain": {
"type": "string"
},
"FamilyName": {
"type": "string"
},
"Fax": {
"type": "object",
"properties": {
"FreeFormNumber": {
"type": "string"
}
}
},
"GivenName": {
"type": "string"
},
"Id": {
"type": "string"
},
"MetaData": {
"type": "object",
"properties": {
"CreateTime": {
"type": "string"
},
"LastUpdatedTime": {
"type": "string"
}
}
},
"Mobile": {
"type": "object",
"properties": {
"FreeFormNumber": {
"type": "string"
}
}
},
"PrimaryEmailAddr": {
"type": "object",
"properties": {
"Address": {
"type": "string"
}
}
},
"PrimaryPhone": {
"type": "object",
"properties": {
"FreeFormNumber": {
"type": "string"
}
}
},
"PrintOnCheckName": {
"type": "string"
},
"sparse": {
"type": "boolean"
},
"SyncToken": {
"type": "string"
},
"Vendor1099": {
"type": "boolean"
},
"WebAddr": {
"type": "object",
"properties": {
"URI": {
"type": "string"
}
}
}
},
"version": 1
}
@@ -0,0 +1,75 @@
import type { IExecuteFunctions } from 'n8n-workflow';
import { processLines } from '../GenericFunctions';
describe('processLines', () => {
const mockExecuteFunctions: Partial<IExecuteFunctions> = {
getNodeParameter: jest.fn(),
};
test('should process AccountBasedExpenseLineDetail for bill resource', () => {
const lines = [{ DetailType: 'AccountBasedExpenseLineDetail', accountId: '123' }];
const result = processLines.call(mockExecuteFunctions as IExecuteFunctions, lines, 'bill');
expect(result).toEqual([
{
DetailType: 'AccountBasedExpenseLineDetail',
AccountBasedExpenseLineDetail: { AccountRef: { value: '123' } },
},
]);
});
test('should process ItemBasedExpenseLineDetail for bill resource', () => {
const lines = [{ DetailType: 'ItemBasedExpenseLineDetail', itemId: '456' }];
const result = processLines.call(mockExecuteFunctions as IExecuteFunctions, lines, 'bill');
expect(result).toEqual([
{
DetailType: 'ItemBasedExpenseLineDetail',
ItemBasedExpenseLineDetail: { ItemRef: { value: '456' } },
},
]);
});
test('should process SalesItemLineDetail for estimate resource', () => {
const lines = [{ DetailType: 'SalesItemLineDetail', itemId: '789', TaxCodeRef: 'TAX1' }];
const result = processLines.call(mockExecuteFunctions as IExecuteFunctions, lines, 'estimate');
expect(result).toEqual([
{
DetailType: 'SalesItemLineDetail',
SalesItemLineDetail: { ItemRef: { value: '789' }, TaxCodeRef: { value: 'TAX1' } },
},
]);
});
test('should process SalesItemLineDetail for invoice resource with Qty', () => {
const lines = [
{ DetailType: 'SalesItemLineDetail', itemId: '101', TaxCodeRef: 'TAX2', Qty: 10 },
];
const result = processLines.call(mockExecuteFunctions as IExecuteFunctions, lines, 'invoice');
expect(result).toEqual([
{
DetailType: 'SalesItemLineDetail',
SalesItemLineDetail: { ItemRef: { value: '101' }, TaxCodeRef: { value: 'TAX2' }, Qty: 10 },
},
]);
});
test('should process SalesItemLineDetail for invoice resource without Qty', () => {
const lines = [{ DetailType: 'SalesItemLineDetail', itemId: '202', TaxCodeRef: 'TAX3' }];
const result = processLines.call(mockExecuteFunctions as IExecuteFunctions, lines, 'invoice');
expect(result).toEqual([
{
DetailType: 'SalesItemLineDetail',
SalesItemLineDetail: { ItemRef: { value: '202' }, TaxCodeRef: { value: 'TAX3' } },
},
]);
});
});
@@ -0,0 +1,88 @@
import type { INodeProperties } from 'n8n-workflow';
export const billAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Accounts Payable Account',
name: 'APAccountRef',
placeholder: 'Add APA Fields',
description: 'Accounts Payable account to which the bill will be credited',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'ID',
name: 'value',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Balance',
name: 'Balance',
description: 'The balance reflecting any payments made against the transaction',
type: 'string',
default: '',
},
{
displayName: 'Due Date',
name: 'DueDate',
description: 'Date when the payment of the transaction is due',
type: 'dateTime',
default: '',
},
{
displayName: 'Sales Term',
name: 'SalesTermRef',
description: 'Sales term associated with the transaction',
placeholder: 'Add Sales Term Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
},
{
displayName: 'ID',
name: 'value',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Total Amount',
name: 'TotalAmt',
description: 'Total amount of the transaction',
type: 'number',
default: 0,
},
{
displayName: 'Transaction Date',
name: 'TxnDate',
description: 'Date when the transaction occurred',
type: 'dateTime',
default: '',
},
];
@@ -0,0 +1,287 @@
import type { INodeProperties } from 'n8n-workflow';
import { billAdditionalFieldsOptions } from './BillAdditionalFieldsOptions';
export const billOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create a bill',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a bill',
},
{
name: 'Get',
value: 'get',
action: 'Get a bill',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many bills',
},
{
name: 'Update',
value: 'update',
action: 'Update a bill',
},
],
displayOptions: {
show: {
resource: ['bill'],
},
},
},
];
export const billFields: INodeProperties[] = [
// ----------------------------------
// bill: create
// ----------------------------------
{
displayName: 'For Vendor Name or ID',
name: 'VendorRef',
type: 'options',
required: true,
description:
'The ID of the vendor who the bill is for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
default: [],
typeOptions: {
loadOptionsMethod: 'getVendors',
},
displayOptions: {
show: {
resource: ['bill'],
operation: ['create'],
},
},
},
{
displayName: 'Line',
name: 'Line',
type: 'collection',
placeholder: 'Add Line Item Property',
description: 'Individual line item of a transaction',
typeOptions: {
multipleValues: true,
},
default: {},
displayOptions: {
show: {
resource: ['bill'],
operation: ['create'],
},
},
options: [
{
displayName: 'Account ID',
name: 'accountId',
type: 'string',
default: '',
},
{
displayName: 'Amount',
name: 'Amount',
description: 'Monetary amount of the line item',
type: 'number',
default: 0,
},
{
displayName: 'Description',
name: 'Description',
description: 'Textual description of the line item',
type: 'string',
default: '',
},
{
displayName: 'Detail Type',
name: 'DetailType',
type: 'options',
default: 'ItemBasedExpenseLineDetail',
options: [
{
name: 'Account-Based Expense Line Detail',
value: 'AccountBasedExpenseLineDetail',
},
{
name: 'Item-Based Expense Line Detail',
value: 'ItemBasedExpenseLineDetail',
},
],
},
{
displayName: 'Item Name or ID',
name: 'itemId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
displayName: 'Position',
name: 'LineNum',
description: 'Position of the line item relative to others',
type: 'number',
default: 1,
},
],
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['bill'],
operation: ['create'],
},
},
options: billAdditionalFieldsOptions,
},
// ----------------------------------
// bill: delete
// ----------------------------------
{
displayName: 'Bill ID',
name: 'billId',
type: 'string',
required: true,
default: '',
description: 'The ID of the bill to delete',
displayOptions: {
show: {
resource: ['bill'],
operation: ['delete'],
},
},
},
// ----------------------------------
// bill: get
// ----------------------------------
{
displayName: 'Bill ID',
name: 'billId',
type: 'string',
required: true,
default: '',
description: 'The ID of the bill to retrieve',
displayOptions: {
show: {
resource: ['bill'],
operation: ['get'],
},
},
},
// ----------------------------------
// bill: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['bill'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['bill'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting bills. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['bill'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// bill: update
// ----------------------------------
{
displayName: 'Bill ID',
name: 'billId',
type: 'string',
required: true,
default: '',
description: 'The ID of the bill to update',
displayOptions: {
show: {
resource: ['bill'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['bill'],
operation: ['update'],
},
},
// filter out fields that cannot be updated
options: billAdditionalFieldsOptions.filter(
(property) => property.name !== 'TotalAmt' && property.name !== 'Balance',
),
},
];
@@ -0,0 +1,153 @@
import type { INodeProperties } from 'n8n-workflow';
export const customerAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Active',
name: 'Active',
description: 'Whether the customer is currently enabled for use by QuickBooks',
type: 'boolean',
default: true,
},
{
displayName: 'Balance',
name: 'Balance',
description: 'Open balance amount or amount unpaid by the customer',
type: 'string',
default: '',
},
{
displayName: 'Balance With Jobs',
name: 'BalanceWithJobs',
description: 'Cumulative open balance amount for the customer (or job) and all its sub-jobs',
type: 'number',
default: 0,
},
{
displayName: 'Billing Address',
name: 'BillAddr',
placeholder: 'Add Billing Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Bill With Parent',
name: 'BillWithParent',
description: 'Whether to bill this customer together with its parent',
type: 'boolean',
default: false,
},
{
displayName: 'Company Name',
name: 'CompanyName',
type: 'string',
default: '',
},
{
displayName: 'Family Name',
name: 'FamilyName',
type: 'string',
default: '',
},
{
displayName: 'Fully Qualified Name',
name: 'FullyQualifiedName',
type: 'string',
default: '',
},
{
displayName: 'Given Name',
name: 'GivenName',
type: 'string',
default: '',
},
{
displayName: 'Preferred Delivery Method',
name: 'PreferredDeliveryMethod',
type: 'options',
default: 'Print',
options: [
{
name: 'Print',
value: 'Print',
},
{
name: 'Email',
value: 'Email',
},
{
name: 'None',
value: 'None',
},
],
},
{
displayName: 'Primary Email Address',
name: 'PrimaryEmailAddr',
type: 'string',
default: '',
},
{
displayName: 'Primary Phone',
name: 'PrimaryPhone',
type: 'string',
default: '',
},
{
displayName: 'Print-On-Check Name',
name: 'PrintOnCheckName',
description: 'Name of the customer as printed on a check',
type: 'string',
default: '',
},
{
displayName: 'Taxable',
name: 'Taxable',
description: 'Whether transactions for this customer are taxable',
type: 'boolean',
default: false,
},
];
@@ -0,0 +1,184 @@
import type { INodeProperties } from 'n8n-workflow';
import { customerAdditionalFieldsOptions } from './CustomerAdditionalFieldsOptions';
export const customerOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create a customer',
},
{
name: 'Get',
value: 'get',
action: 'Get a customer',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many customers',
},
{
name: 'Update',
value: 'update',
action: 'Update a customer',
},
],
displayOptions: {
show: {
resource: ['customer'],
},
},
},
];
export const customerFields: INodeProperties[] = [
// ----------------------------------
// customer: create
// ----------------------------------
{
displayName: 'Display Name',
name: 'displayName',
type: 'string',
required: true,
default: '',
description: 'The display name of the customer to create',
displayOptions: {
show: {
resource: ['customer'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['customer'],
operation: ['create'],
},
},
options: customerAdditionalFieldsOptions,
},
// ----------------------------------
// customer: get
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'The ID of the customer to retrieve',
displayOptions: {
show: {
resource: ['customer'],
operation: ['get'],
},
},
},
// ----------------------------------
// customer: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['customer'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['customer'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting customers. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['customer'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// customer: update
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'The ID of the customer to update',
displayOptions: {
show: {
resource: ['customer'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['customer'],
operation: ['update'],
},
},
options: customerAdditionalFieldsOptions,
},
];
@@ -0,0 +1,93 @@
import type { INodeProperties } from 'n8n-workflow';
export const employeeAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Active',
name: 'Active',
description: 'Whether the employee is currently enabled for use by QuickBooks',
type: 'boolean',
default: false,
},
{
displayName: 'Billable Time',
name: 'BillableTime',
type: 'boolean',
default: false,
},
{
displayName: 'Display Name',
name: 'DisplayName',
type: 'string',
default: '',
},
{
displayName: 'Billing Address',
name: 'BillAddr',
placeholder: 'Add Billing Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Primary Phone',
name: 'PrimaryPhone',
type: 'string',
default: '',
},
{
displayName: 'Print-On-Check Name',
name: 'PrintOnCheckName',
description: 'Name of the employee as printed on a check',
type: 'string',
default: '',
},
{
displayName: 'Social Security Number',
name: 'SSN',
type: 'string',
default: '',
},
];
@@ -0,0 +1,194 @@
import type { INodeProperties } from 'n8n-workflow';
import { employeeAdditionalFieldsOptions } from './EmployeeAdditionalFieldsOptions';
export const employeeOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create an employee',
},
{
name: 'Get',
value: 'get',
action: 'Get an employee',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many employees',
},
{
name: 'Update',
value: 'update',
action: 'Update an employee',
},
],
displayOptions: {
show: {
resource: ['employee'],
},
},
},
];
export const employeeFields: INodeProperties[] = [
// ----------------------------------
// employee: create
// ----------------------------------
{
displayName: 'Family Name',
name: 'FamilyName',
type: 'string',
default: '',
displayOptions: {
show: {
resource: ['employee'],
operation: ['create'],
},
},
},
{
displayName: 'Given Name',
name: 'GivenName',
type: 'string',
default: '',
displayOptions: {
show: {
resource: ['employee'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['employee'],
operation: ['create'],
},
},
options: employeeAdditionalFieldsOptions,
},
// ----------------------------------
// employee: get
// ----------------------------------
{
displayName: 'Employee ID',
name: 'employeeId',
type: 'string',
required: true,
default: '',
description: 'The ID of the employee to retrieve',
displayOptions: {
show: {
resource: ['employee'],
operation: ['get'],
},
},
},
// ----------------------------------
// employee: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['employee'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['employee'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting employees. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['employee'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// employee: update
// ----------------------------------
{
displayName: 'Employee ID',
name: 'employeeId',
type: 'string',
required: true,
default: '',
description: 'The ID of the employee to update',
displayOptions: {
show: {
resource: ['employee'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['employee'],
operation: ['update'],
},
},
options: employeeAdditionalFieldsOptions,
},
];
@@ -0,0 +1,231 @@
import type { INodeProperties } from 'n8n-workflow';
export const estimateAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Apply Tax After Discount',
name: 'ApplyTaxAfterDiscount',
type: 'boolean',
default: false,
},
{
displayName: 'Billing Address',
name: 'BillAddr',
placeholder: 'Add Billing Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Billing Email',
name: 'BillEmail',
description: 'E-mail address to which the estimate will be sent',
type: 'string',
default: '',
},
{
displayName: 'Custom Fields',
name: 'CustomFields',
placeholder: 'Add Custom Fields',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
default: {},
options: [
{
displayName: 'Field',
name: 'Field',
values: [
{
displayName: 'Field Definition Name or ID',
name: 'DefinitionId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCustomFields',
},
default: '',
description:
'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
name: 'StringValue',
type: 'string',
default: '',
description: 'Value of the field to set',
},
],
},
],
},
{
displayName: 'Customer Memo',
name: 'CustomerMemo',
description:
'User-entered message to the customer. This message is visible to end user on their transactions.',
type: 'string',
default: '',
},
{
displayName: 'Document Number',
name: 'DocNumber',
description: 'Reference number for the transaction',
type: 'string',
default: '',
},
{
displayName: 'Email Status',
name: 'EmailStatus',
type: 'options',
default: 'NotSet',
options: [
{
name: 'Not Set',
value: 'NotSet',
},
{
name: 'Need To Send',
value: 'NeedToSend',
},
{
name: 'Email Sent',
value: 'EmailSent',
},
],
},
{
displayName: 'Print Status',
name: 'PrintStatus',
type: 'options',
default: 'NotSet',
options: [
{
name: 'Not Set',
value: 'NotSet',
},
{
name: 'Need To Print',
value: 'NeedToPrint',
},
{
name: 'PrintComplete',
value: 'PrintComplete',
},
],
},
{
displayName: 'Shipping Address',
name: 'ShipAddr',
placeholder: 'Add Shippping Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Total Amount',
name: 'TotalAmt',
description: 'Total amount of the transaction',
type: 'number',
default: 0,
},
{
displayName: 'Transaction Date',
name: 'TxnDate',
description: 'Date when the transaction occurred',
type: 'dateTime',
default: '',
},
{
displayName: 'Total Tax',
name: 'TotalTax',
description: 'Total amount of tax incurred',
type: 'number',
default: 0,
},
];
@@ -0,0 +1,371 @@
import type { INodeProperties } from 'n8n-workflow';
import { estimateAdditionalFieldsOptions } from './EstimateAdditionalFieldsOptions';
export const estimateOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create an estimate',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete an estimate',
},
{
name: 'Get',
value: 'get',
action: 'Get an estimate',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many estimates',
},
{
name: 'Send',
value: 'send',
action: 'Send an estimate',
},
{
name: 'Update',
value: 'update',
action: 'Update an estimate',
},
],
displayOptions: {
show: {
resource: ['estimate'],
},
},
},
];
export const estimateFields: INodeProperties[] = [
// ----------------------------------
// estimate: create
// ----------------------------------
{
displayName: 'For Customer Name or ID',
name: 'CustomerRef',
type: 'options',
required: true,
description:
'The ID of the customer who the estimate is for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
default: [],
typeOptions: {
loadOptionsMethod: 'getCustomers',
},
displayOptions: {
show: {
resource: ['estimate'],
operation: ['create'],
},
},
},
{
displayName: 'Line',
name: 'Line',
type: 'collection',
placeholder: 'Add Line Item Property',
description: 'Individual line item of a transaction',
typeOptions: {
multipleValues: true,
},
default: {},
displayOptions: {
show: {
resource: ['estimate'],
operation: ['create'],
},
},
options: [
{
displayName: 'Amount',
name: 'Amount',
description: 'Monetary amount of the line item',
type: 'number',
default: 0,
},
{
displayName: 'Description',
name: 'Description',
description: 'Textual description of the line item',
type: 'string',
default: '',
},
{
displayName: 'Detail Type',
name: 'DetailType',
type: 'options',
default: 'SalesItemLineDetail',
options: [
{
name: 'Sales Item Line Detail',
value: 'SalesItemLineDetail',
},
],
},
{
displayName: 'Item Name or ID',
name: 'itemId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
displayName: 'Position',
name: 'LineNum',
description: 'Position of the line item relative to others',
type: 'number',
default: 1,
},
{
displayName: 'Tax Code Ref Name or ID',
name: 'TaxCodeRef',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getTaxCodeRefs',
},
},
],
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['estimate'],
operation: ['create'],
},
},
options: estimateAdditionalFieldsOptions,
},
// ----------------------------------
// estimate: delete
// ----------------------------------
{
displayName: 'Estimate ID',
name: 'estimateId',
type: 'string',
required: true,
default: '',
description: 'The ID of the estimate to delete',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['delete'],
},
},
},
// ----------------------------------
// estimate: get
// ----------------------------------
{
displayName: 'Estimate ID',
name: 'estimateId',
type: 'string',
required: true,
default: '',
description: 'The ID of the estimate to retrieve',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['get'],
},
},
},
{
displayName: 'Download',
name: 'download',
type: 'boolean',
required: true,
default: false,
description: 'Whether to download the estimate as a PDF file',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['get'],
},
},
},
{
displayName: 'Put Output File in Field',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
hint: 'The name of the output binary field to put the file in',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['get'],
download: [true],
},
},
},
{
displayName: 'File Name',
name: 'fileName',
type: 'string',
required: true,
default: '',
placeholder: 'data.pdf',
description: 'Name of the file that will be downloaded',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['get'],
download: [true],
},
},
},
// ----------------------------------
// estimate: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['estimate'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting estimates. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['estimate'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// estimate: send
// ----------------------------------
{
displayName: 'Estimate ID',
name: 'estimateId',
type: 'string',
required: true,
default: '',
description: 'The ID of the estimate to send',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['send'],
},
},
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
required: true,
default: '',
description: 'The email of the recipient of the estimate',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['send'],
},
},
},
// ----------------------------------
// estimate: update
// ----------------------------------
{
displayName: 'Estimate ID',
name: 'estimateId',
type: 'string',
required: true,
default: '',
description: 'The ID of the estimate to update',
displayOptions: {
show: {
resource: ['estimate'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['estimate'],
operation: ['update'],
},
},
// filter out fields that cannot be updated
options: estimateAdditionalFieldsOptions.filter(
(property) => property.name !== 'TotalAmt' && property.name !== 'TotalTax',
),
},
];
@@ -0,0 +1,187 @@
import type { INodeProperties } from 'n8n-workflow';
export const invoiceAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Balance',
name: 'Balance',
description: 'The balance reflecting any payments made against the transaction',
type: 'number',
default: 0,
},
{
displayName: 'Billing Address',
name: 'BillAddr',
placeholder: 'Add Billing Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Billing Email',
name: 'BillEmail',
description: 'E-mail address to which the invoice will be sent',
type: 'string',
default: '',
},
{
displayName: 'Customer Memo',
name: 'CustomerMemo',
description:
'User-entered message to the customer. This message is visible to end user on their transactions.',
type: 'string',
default: '',
},
{
displayName: 'Custom Fields',
name: 'CustomFields',
placeholder: 'Add Custom Fields',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
default: {},
options: [
{
displayName: 'Field',
name: 'Field',
values: [
{
displayName: 'Field Definition Name or ID',
name: 'DefinitionId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCustomFields',
},
default: '',
description:
'ID of the field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
name: 'StringValue',
type: 'string',
default: '',
description: 'Value of the field to set',
},
],
},
],
},
{
displayName: 'Document Number',
name: 'DocNumber',
description: 'Reference number for the transaction',
type: 'string',
default: '',
},
{
displayName: 'Due Date',
name: 'DueDate',
description: 'Date when the payment of the transaction is due',
type: 'dateTime',
default: '',
},
{
displayName: 'Email Status',
name: 'EmailStatus',
type: 'options',
default: 'NotSet',
options: [
{
name: 'Not Set',
value: 'NotSet',
},
{
name: 'Need To Send',
value: 'NeedToSend',
},
{
name: 'Email Sent',
value: 'EmailSent',
},
],
},
{
displayName: 'Print Status',
name: 'PrintStatus',
type: 'options',
default: 'NotSet',
options: [
{
name: 'Not Set',
value: 'NotSet',
},
{
name: 'Need To Print',
value: 'NeedToPrint',
},
{
name: 'PrintComplete',
value: 'PrintComplete',
},
],
},
{
displayName: 'Shipping Address',
name: 'ShipAddr',
type: 'string',
default: '',
},
{
displayName: 'Total Amount',
name: 'TotalAmt',
description: 'Total amount of the transaction',
type: 'number',
default: 0,
},
{
displayName: 'Transaction Date',
name: 'TxnDate',
description: 'Date when the transaction occurred',
type: 'dateTime',
default: '',
},
];
@@ -0,0 +1,401 @@
import type { INodeProperties } from 'n8n-workflow';
import { invoiceAdditionalFieldsOptions } from './InvoiceAdditionalFieldsOptions';
export const invoiceOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create an invoice',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete an invoice',
},
{
name: 'Get',
value: 'get',
action: 'Get an invoice',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many invoices',
},
{
name: 'Send',
value: 'send',
action: 'Send an invoice',
},
{
name: 'Update',
value: 'update',
action: 'Update an invoice',
},
{
name: 'Void',
value: 'void',
action: 'Void an invoice',
},
],
displayOptions: {
show: {
resource: ['invoice'],
},
},
},
];
export const invoiceFields: INodeProperties[] = [
// ----------------------------------
// invoice: create
// ----------------------------------
{
displayName: 'For Customer Name or ID',
name: 'CustomerRef',
type: 'options',
required: true,
description:
'The ID of the customer who the invoice is for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
default: [],
typeOptions: {
loadOptionsMethod: 'getCustomers',
},
displayOptions: {
show: {
resource: ['invoice'],
operation: ['create'],
},
},
},
{
displayName: 'Line',
name: 'Line',
type: 'collection',
placeholder: 'Add Line Item Property',
description: 'Individual line item of a transaction',
typeOptions: {
multipleValues: true,
},
default: {},
displayOptions: {
show: {
resource: ['invoice'],
operation: ['create'],
},
},
options: [
{
displayName: 'Amount',
name: 'Amount',
description: 'Monetary amount of the line item',
type: 'number',
default: 0,
},
{
displayName: 'Description',
name: 'Description',
description: 'Textual description of the line item',
type: 'string',
default: '',
},
{
displayName: 'Detail Type',
name: 'DetailType',
type: 'options',
default: 'SalesItemLineDetail',
options: [
{
name: 'Sales Item Line Detail',
value: 'SalesItemLineDetail',
},
],
},
{
displayName: 'Item Name or ID',
name: 'itemId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
displayName: 'Position',
name: 'LineNum',
description: 'Position of the line item relative to others',
type: 'number',
default: 1,
},
{
displayName: 'Tax Code Ref Name or ID',
name: 'TaxCodeRef',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: [],
typeOptions: {
loadOptionsMethod: 'getTaxCodeRefs',
},
},
{
displayName: 'Quantity',
name: 'Qty',
description: 'Number of units of the line item',
type: 'number',
default: 0,
},
],
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['invoice'],
operation: ['create'],
},
},
options: invoiceAdditionalFieldsOptions,
},
// ----------------------------------
// invoice: delete
// ----------------------------------
{
displayName: 'Invoice ID',
name: 'invoiceId',
type: 'string',
required: true,
default: '',
description: 'The ID of the invoice to delete',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['delete'],
},
},
},
// ----------------------------------
// invoice: get
// ----------------------------------
{
displayName: 'Invoice ID',
name: 'invoiceId',
type: 'string',
required: true,
default: '',
description: 'The ID of the invoice to retrieve',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['get'],
},
},
},
{
displayName: 'Download',
name: 'download',
type: 'boolean',
required: true,
default: false,
description: 'Whether to download the invoice as a PDF file',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['get'],
},
},
},
{
displayName: 'Put Output File in Field',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
hint: 'The name of the output binary field to put the file in',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['get'],
download: [true],
},
},
},
{
displayName: 'File Name',
name: 'fileName',
type: 'string',
required: true,
default: '',
placeholder: 'data.pdf',
description: 'Name of the file that will be downloaded',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['get'],
download: [true],
},
},
},
// ----------------------------------
// invoice: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['invoice'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting invoices. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['invoice'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// invoice: send
// ----------------------------------
{
displayName: 'Invoice ID',
name: 'invoiceId',
type: 'string',
required: true,
default: '',
description: 'The ID of the invoice to send',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['send'],
},
},
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
required: true,
default: '',
description: 'The email of the recipient of the invoice',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['send'],
},
},
},
// ----------------------------------
// invoice: void
// ----------------------------------
{
displayName: 'Invoice ID',
name: 'invoiceId',
type: 'string',
required: true,
default: '',
description: 'The ID of the invoice to void',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['void'],
},
},
},
// ----------------------------------
// invoice: update
// ----------------------------------
{
displayName: 'Invoice ID',
name: 'invoiceId',
type: 'string',
required: true,
default: '',
description: 'The ID of the invoice to update',
displayOptions: {
show: {
resource: ['invoice'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['invoice'],
operation: ['update'],
},
},
// filter out fields that cannot be updated
options: invoiceAdditionalFieldsOptions.filter(
(property) => property.name !== 'TotalAmt' && property.name !== 'Balance',
),
},
];
@@ -0,0 +1,107 @@
import type { INodeProperties } from 'n8n-workflow';
export const itemOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Get',
value: 'get',
action: 'Get an item',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many items',
},
],
displayOptions: {
show: {
resource: ['item'],
},
},
},
];
export const itemFields: INodeProperties[] = [
// ----------------------------------
// item: get
// ----------------------------------
{
displayName: 'Item ID',
name: 'itemId',
type: 'string',
required: true,
default: '',
description: 'The ID of the item to retrieve',
displayOptions: {
show: {
resource: ['item'],
operation: ['get'],
},
},
},
// ----------------------------------
// item: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['item'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['item'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting items. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['item'],
operation: ['getAll'],
},
},
},
];
@@ -0,0 +1,11 @@
import type { INodeProperties } from 'n8n-workflow';
export const paymentAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Transaction Date',
name: 'TxnDate',
description: 'Date when the transaction occurred',
type: 'dateTime',
default: '',
},
];
@@ -0,0 +1,330 @@
import type { INodeProperties } from 'n8n-workflow';
import { paymentAdditionalFieldsOptions } from './PaymentAdditionalFieldsOptions';
export const paymentOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create a payment',
},
{
name: 'Delete',
value: 'delete',
action: 'Delete a payment',
},
{
name: 'Get',
value: 'get',
action: 'Get a payment',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many payments',
},
{
name: 'Send',
value: 'send',
action: 'Send a payment',
},
{
name: 'Update',
value: 'update',
action: 'Update a payment',
},
{
name: 'Void',
value: 'void',
action: 'Void a payment',
},
],
displayOptions: {
show: {
resource: ['payment'],
},
},
},
];
export const paymentFields: INodeProperties[] = [
// ----------------------------------
// payment: create
// ----------------------------------
{
displayName: 'For Customer Name or ID',
name: 'CustomerRef',
type: 'options',
required: true,
description:
'The ID of the customer who the payment is for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
default: [],
typeOptions: {
loadOptionsMethod: 'getCustomers',
},
displayOptions: {
show: {
resource: ['payment'],
operation: ['create'],
},
},
},
{
displayName: 'Total Amount',
name: 'TotalAmt',
description: 'Total amount of the transaction',
type: 'number',
default: 0,
displayOptions: {
show: {
resource: ['payment'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['payment'],
operation: ['create'],
},
},
options: paymentAdditionalFieldsOptions,
},
// ----------------------------------
// payment: delete
// ----------------------------------
{
displayName: 'Payment ID',
name: 'paymentId',
type: 'string',
required: true,
default: '',
description: 'The ID of the payment to delete',
displayOptions: {
show: {
resource: ['payment'],
operation: ['delete'],
},
},
},
// ----------------------------------
// payment: get
// ----------------------------------
{
displayName: 'Payment ID',
name: 'paymentId',
type: 'string',
required: true,
default: '',
description: 'The ID of the payment to retrieve',
displayOptions: {
show: {
resource: ['payment'],
operation: ['get'],
},
},
},
{
displayName: 'Download',
name: 'download',
type: 'boolean',
required: true,
default: false,
description: 'Whether to download estimate as PDF file',
displayOptions: {
show: {
resource: ['payment'],
operation: ['get'],
},
},
},
{
displayName: 'Put Output File in Field',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
hint: 'The name of the output binary field to put the file in',
displayOptions: {
show: {
resource: ['payment'],
operation: ['get'],
download: [true],
},
},
},
{
displayName: 'File Name',
name: 'fileName',
type: 'string',
required: true,
default: '',
placeholder: 'data.pdf',
description: 'Name of the file that will be downloaded',
displayOptions: {
show: {
resource: ['payment'],
operation: ['get'],
download: [true],
},
},
},
// ----------------------------------
// payment: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['payment'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['payment'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting payments. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['payment'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// payment: send
// ----------------------------------
{
displayName: 'Payment ID',
name: 'paymentId',
type: 'string',
required: true,
default: '',
description: 'The ID of the payment to send',
displayOptions: {
show: {
resource: ['payment'],
operation: ['send'],
},
},
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
required: true,
default: '',
description: 'The email of the recipient of the payment',
displayOptions: {
show: {
resource: ['payment'],
operation: ['send'],
},
},
},
// ----------------------------------
// payment: void
// ----------------------------------
{
displayName: 'Payment ID',
name: 'paymentId',
type: 'string',
required: true,
default: '',
description: 'The ID of the payment to void',
displayOptions: {
show: {
resource: ['payment'],
operation: ['void'],
},
},
},
// ----------------------------------
// payment: update
// ----------------------------------
{
displayName: 'Payment ID',
name: 'paymentId',
type: 'string',
required: true,
default: '',
description: 'The ID of the payment to update',
displayOptions: {
show: {
resource: ['payment'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['payment'],
operation: ['update'],
},
},
options: paymentAdditionalFieldsOptions,
},
];
@@ -0,0 +1,107 @@
import type { INodeProperties } from 'n8n-workflow';
export const purchaseOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Get',
value: 'get',
action: 'Get a purchase',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many purchases',
},
],
displayOptions: {
show: {
resource: ['purchase'],
},
},
},
];
export const purchaseFields: INodeProperties[] = [
// ----------------------------------
// purchase: get
// ----------------------------------
{
displayName: 'Purchase ID',
name: 'purchaseId',
type: 'string',
required: true,
default: '',
description: 'The ID of the purchase to retrieve',
displayOptions: {
show: {
resource: ['purchase'],
operation: ['get'],
},
},
},
// ----------------------------------
// purchase: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['purchase'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['purchase'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting purchases. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['purchase'],
operation: ['getAll'],
},
},
},
];
@@ -0,0 +1,48 @@
export interface BillingAddress {
Line4: string;
Line3: string;
Line2: string;
Line1: string;
Long: string;
Lat: string;
}
export interface BillEmail {
Address: string;
}
export interface CustomField {
DefinitionId: string;
Name: string;
}
export interface CustomerMemo {
value: string;
}
export interface GeneralAddress {
City: string;
Line1: string;
PostalCode: string;
Lat: string;
Long: string;
CountrySubDivisionCode: string;
}
export interface LinkedTxn {
TxnId: string;
TxnType: string;
}
export interface PrimaryEmailAddr {
Address: string;
}
export interface PrimaryPhone {
FreeFormNumber: string;
}
export interface Ref {
value: string;
name?: string;
}
@@ -0,0 +1,388 @@
import type { INodeProperties } from 'n8n-workflow';
import {
GROUP_BY_OPTIONS,
PAYMENT_METHODS,
PREDEFINED_DATE_RANGES,
SOURCE_ACCOUNT_TYPES,
TRANSACTION_REPORT_COLUMNS,
TRANSACTION_TYPES,
} from './constants';
import { toDisplayName, toOptions } from '../../GenericFunctions';
export const transactionOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'getReport',
options: [
{
name: 'Get Report',
value: 'getReport',
action: 'Get a report',
},
],
displayOptions: {
show: {
resource: ['transaction'],
},
},
},
];
export const transactionFields: INodeProperties[] = [
// ----------------------------------
// transaction: getReport
// ----------------------------------
{
displayName: 'Simplify',
name: 'simple',
type: 'boolean',
displayOptions: {
show: {
resource: ['transaction'],
operation: ['getReport'],
},
},
default: true,
description: 'Whether to return a simplified version of the response instead of the raw data',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['transaction'],
operation: ['getReport'],
},
},
options: [
{
displayName: 'Accounts Payable Paid',
name: 'appaid',
type: 'options',
default: 'All',
options: ['All', 'Paid', 'Unpaid'].map(toOptions),
},
{
displayName: 'Accounts Receivable Paid',
name: 'arpaid',
type: 'options',
default: 'All',
options: ['All', 'Paid', 'Unpaid'].map(toOptions),
},
{
displayName: 'Cleared Status',
name: 'cleared',
type: 'options',
default: 'Reconciled',
options: ['Cleared', 'Uncleared', 'Reconciled', 'Deposited'].map(toOptions),
},
{
displayName: 'Columns',
name: 'columns',
type: 'multiOptions',
default: [],
description: 'Columns to return',
options: TRANSACTION_REPORT_COLUMNS,
},
{
displayName: 'Customer Names or IDs',
name: 'customer',
type: 'multiOptions',
default: [],
description:
'Customer to filter results by. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getCustomers',
},
},
{
displayName: 'Date Range (Custom)',
name: 'dateRangeCustom',
placeholder: 'Add Date Range',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Date Range Properties',
name: 'dateRangeCustomProperties',
values: [
{
displayName: 'Start Date',
name: 'start_date',
type: 'dateTime',
default: '',
description: 'Start date of the date range to filter results by',
},
{
displayName: 'End Date',
name: 'end_date',
type: 'dateTime',
default: '',
description: 'End date of the date range to filter results by',
},
],
},
],
},
{
displayName: 'Date Range (Predefined)',
name: 'date_macro',
type: 'options',
default: 'This Month',
description: 'Predefined date range to filter results by',
options: PREDEFINED_DATE_RANGES.map(toOptions),
},
{
displayName: 'Date Range for Creation Date (Custom)',
name: 'dateRangeCreationCustom',
placeholder: 'Add Creation Date Range',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Creation Date Range Properties',
name: 'dateRangeCreationCustomProperties',
values: [
{
displayName: 'Start Creation Date',
name: 'start_createdate',
type: 'dateTime',
default: '',
description: 'Start date of the account creation date range to filter results by',
},
{
displayName: 'End Creation Date',
name: 'end_createdate',
type: 'dateTime',
default: '',
description: 'End date of the account creation date range to filter results by',
},
],
},
],
},
{
displayName: 'Date Range for Creation Date (Predefined)',
name: 'createdate_macro',
type: 'options',
default: 'This Month',
options: PREDEFINED_DATE_RANGES.map(toOptions),
description: 'Predefined report account creation date range',
},
{
displayName: 'Date Range for Due Date (Custom)',
name: 'dateRangeDueCustom',
placeholder: 'Add Due Date Range',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Due Date Range Properties',
name: 'dateRangeDueCustomProperties',
values: [
{
displayName: 'Start Due Date',
name: 'start_duedate',
type: 'dateTime',
default: '',
description: 'Start date of the due date range to filter results by',
},
{
displayName: 'End Due Date',
name: 'end_duedate',
type: 'dateTime',
default: '',
description: 'End date of the due date range to filter results by',
},
],
},
],
},
{
displayName: 'Date Range for Due Date (Predefined)',
name: 'duedate_macro',
type: 'options',
default: 'This Month',
description: 'Predefined due date range to filter results by',
options: PREDEFINED_DATE_RANGES.map(toOptions),
},
{
displayName: 'Date Range for Modification Date (Custom)',
name: 'dateRangeModificationCustom',
placeholder: 'Add Modification Date Range',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Modification Date Range Properties',
name: 'dateRangeModificationCustomProperties',
values: [
{
displayName: 'Start Modification Date',
name: 'start_moddate',
type: 'dateTime',
default: '',
description:
'Start date of the account modification date range to filter results by',
},
{
displayName: 'End Modification Date',
name: 'end_moddate',
type: 'dateTime',
default: '',
description: 'End date of the account modification date range to filter results by',
},
],
},
],
},
{
displayName: 'Date Range for Modification Date (Predefined)',
name: 'moddate_macro',
type: 'options',
default: 'This Month',
description: 'Predefined account modifiction date range to filter results by',
options: PREDEFINED_DATE_RANGES.map(toOptions),
},
{
displayName: 'Department Names or IDs',
name: 'department',
type: 'multiOptions',
default: [],
description:
'Department to filter results by. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getDepartments',
},
},
{
displayName: 'Document Number',
name: 'docnum',
type: 'string',
default: '',
description: 'Transaction document number to filter results by',
},
{
displayName: 'Group By',
name: 'group_by',
default: 'Account',
type: 'options',
description: 'Transaction field to group results by',
options: GROUP_BY_OPTIONS.map(toOptions),
},
{
displayName: 'Memo Names or IDs',
name: 'memo',
type: 'multiOptions',
default: [],
description:
'Memo to filter results by. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getMemos',
},
},
{
displayName: 'Payment Method',
name: 'payment_Method',
type: 'options',
default: 'Cash',
description: 'Payment method to filter results by',
options: PAYMENT_METHODS.map(toOptions),
},
{
displayName: 'Printed Status',
name: 'printed',
type: 'options',
default: 'Printed',
description: 'Printed state to filter results by',
options: [
{
name: 'Printed',
value: 'Printed',
},
{
name: 'To Be Printed',
value: 'To_be_printed',
},
],
},
{
displayName: 'Quick Zoom URL',
name: 'qzurl',
type: 'boolean',
default: true,
description: 'Whether Quick Zoom URL information should be generated',
},
{
displayName: 'Sort By',
name: 'sort_by',
type: 'options',
default: 'account_name',
description: 'Column to sort results by',
options: TRANSACTION_REPORT_COLUMNS,
},
{
displayName: 'Sort Order',
name: 'sort_order',
type: 'options',
default: 'Ascend',
options: ['Ascend', 'Descend'].map(toOptions),
},
{
displayName: 'Source Account Type',
name: 'source_account_type',
default: 'Bank',
type: 'options',
description: 'Account type to filter results by',
options: SOURCE_ACCOUNT_TYPES.map(toOptions).map(toDisplayName),
},
{
displayName: 'Term Names or IDs',
name: 'term',
type: 'multiOptions',
default: [],
description:
'Term to filter results by. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getTerms',
},
},
{
displayName: 'Transaction Amount',
name: 'bothamount',
type: 'number',
default: 0,
typeOptions: {
numberPrecision: 2,
},
description: 'Monetary amount to filter results by',
},
{
displayName: 'Transaction Type',
name: 'transaction_type',
type: 'options',
default: 'CreditCardCharge',
description: 'Transaction type to filter results by',
options: TRANSACTION_TYPES.map(toOptions).map(toDisplayName),
},
{
displayName: 'Vendor Names or IDs',
name: 'vendor',
type: 'multiOptions',
default: [],
description:
'Vendor to filter results by. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getVendors',
},
},
],
},
];
@@ -0,0 +1,204 @@
export const PREDEFINED_DATE_RANGES = [
'Today',
'Yesterday',
'This Week',
'Last Week',
'This Week-to-Date',
'Last Week-to-Date',
'Next Week',
'Next 4 Weeks',
'This Month',
'Last Month',
'This Month-to-Date',
'Last Month-to-Date',
'Next Month',
'This Fiscal Quarter',
'Last Fiscal Quarter',
'This Fiscal Quarter-to-Date',
'Last Fiscal Quarter-to-Date',
'Next Fiscal Quarter',
'This Fiscal Year',
'Last Fiscal Year',
'This Fiscal Year-to-Date',
'Last Fiscal Year-to-Date',
'Next Fiscal Year',
];
export const TRANSACTION_REPORT_COLUMNS = [
{
name: 'Account Name',
value: 'account_name',
},
{
name: 'Created By',
value: 'create_by',
},
{
name: 'Create Date',
value: 'create_date',
},
{
name: 'Customer Message',
value: 'cust_msg',
},
{
name: 'Department Name',
value: 'dept_name',
},
{
name: 'Due Date',
value: 'due_date',
},
{
name: 'Document Number',
value: 'doc_num',
},
{
name: 'Invoice Date',
value: 'inv_date',
},
{
name: 'Is Account Payable Paid',
value: 'is_ap_paid',
},
{
name: 'Is Cleared',
value: 'is_cleared',
},
{
name: 'Last Modified By',
value: 'last_mod_by',
},
{
name: 'Memo',
value: 'memo',
},
{
name: 'Name',
value: 'name',
},
{
name: 'Other Account',
value: 'other_account',
},
{
name: 'Payment Method',
value: 'pmt_mthod',
},
{
name: 'Posting',
value: 'is_no_post',
},
{
name: 'Printed Status',
value: 'printed',
},
{
name: 'Sales Customer 1',
value: 'sales_cust1',
},
{
name: 'Sales Customer 2',
value: 'sales_cust2',
},
{
name: 'Sales Customer 3',
value: 'sales_cust3',
},
{
name: 'Term Name',
value: 'term_name',
},
{
name: 'Tracking Number',
value: 'tracking_num',
},
{
name: 'Transaction Date',
value: 'tx_date',
},
{
name: 'Transaction Type',
value: 'txn_type',
},
];
export const PAYMENT_METHODS = [
'American Express',
'Cash',
'Check',
'Dinners Club',
'Discover',
'Master Card',
'Visa',
];
export const TRANSACTION_TYPES = [
'Bill',
'BillPaymentCheck',
'BillPaymentCreditCard',
'BillableCharge',
'CashPurchase',
'Charge',
'Check',
'Credit',
'CreditCardCharge',
'CreditCardCredit',
'CreditMemo',
'CreditRefund',
'Deposit',
'Estimate',
'GlobalTaxAdjustment',
'GlobalTaxPayment',
'InventoryQuantityAdjustment',
'Invoice',
'JournalEntry',
'PurchaseOrder',
'ReceivePayment',
'SalesReceipt',
'Service Tax Defer',
'Service Tax Gross Adjustment',
'Service Tax Partial Utilisation',
'Service Tax Refund',
'Service Tax Reversal',
'Statement',
'TimeActivity',
'Transfer',
'VendorCredit',
];
export const SOURCE_ACCOUNT_TYPES = [
'AccountsPayable',
'AccountsReceivable',
'Bank',
'CostOfGoodsSold',
'CreditCard',
'Equity',
'Expense',
'FixedAsset',
'Income',
'LongTermLiability',
'NonPosting',
'OtherAsset',
'OtherCurrentAsset',
'OtherCurrentLiability',
'OtherExpense',
'OtherIncome',
];
export const GROUP_BY_OPTIONS = [
'Account',
'Customer',
'Day',
'Employee',
'Location',
'Month',
'Name',
'None',
'Payment Method',
'Quarter',
'Transaction Type',
'Vendor',
'Week',
'Year',
];
@@ -0,0 +1,120 @@
import type { INodeProperties } from 'n8n-workflow';
export const vendorAdditionalFieldsOptions: INodeProperties[] = [
{
displayName: 'Account Number',
name: 'AcctNum',
type: 'string',
default: '',
},
{
displayName: 'Active',
name: 'Active',
description: 'Whether the employee is currently enabled for use by QuickBooks',
type: 'boolean',
default: false,
},
{
displayName: 'Balance',
name: 'Balance',
description: 'The balance reflecting any payments made against the transaction',
type: 'number',
default: 0,
},
{
displayName: 'Billing Address',
name: 'BillAddr',
placeholder: 'Add Billing Address Fields',
type: 'fixedCollection',
default: {},
options: [
{
displayName: 'Details',
name: 'details',
values: [
{
displayName: 'City',
name: 'City',
type: 'string',
default: '',
},
{
displayName: 'Line 1',
name: 'Line1',
type: 'string',
default: '',
},
{
displayName: 'Postal Code',
name: 'PostalCode',
type: 'string',
default: '',
},
{
displayName: 'Latitude',
name: 'Lat',
type: 'string',
default: '',
},
{
displayName: 'Longitude',
name: 'Long',
type: 'string',
default: '',
},
{
displayName: 'Country Subdivision Code',
name: 'CountrySubDivisionCode',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Company Name',
name: 'CompanyName',
type: 'string',
default: '',
},
{
displayName: 'Family Name',
name: 'FamilyName',
type: 'string',
default: '',
},
{
displayName: 'Given Name',
name: 'GivenName',
type: 'string',
default: '',
},
{
displayName: 'Primary Email Address',
name: 'PrimaryEmailAddr',
type: 'string',
default: '',
},
{
displayName: 'Primary Phone',
name: 'PrimaryPhone',
type: 'string',
default: '',
},
{
displayName: 'Print-On-Check Name',
name: 'PrintOnCheckName',
description: 'Name of the vendor as printed on a check',
type: 'string',
default: '',
},
{
displayName: 'Vendor 1099',
name: 'Vendor1099',
description:
'Whether the vendor is an independent contractor, given a 1099-MISC form at the end of the year',
type: 'boolean',
default: false,
},
];
@@ -0,0 +1,184 @@
import type { INodeProperties } from 'n8n-workflow';
import { vendorAdditionalFieldsOptions } from './VendorAdditionalFieldsOptions';
export const vendorOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
action: 'Create a vendor',
},
{
name: 'Get',
value: 'get',
action: 'Get a vendor',
},
{
name: 'Get Many',
value: 'getAll',
action: 'Get many vendors',
},
{
name: 'Update',
value: 'update',
action: 'Update a vendor',
},
],
displayOptions: {
show: {
resource: ['vendor'],
},
},
},
];
export const vendorFields: INodeProperties[] = [
// ----------------------------------
// vendor: create
// ----------------------------------
{
displayName: 'Display Name',
name: 'displayName',
type: 'string',
required: true,
default: '',
description: 'The display name of the vendor to create',
displayOptions: {
show: {
resource: ['vendor'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['vendor'],
operation: ['create'],
},
},
options: vendorAdditionalFieldsOptions,
},
// ----------------------------------
// vendor: get
// ----------------------------------
{
displayName: 'Vendor ID',
name: 'vendorId',
type: 'string',
required: true,
default: '',
description: 'The ID of the vendor to retrieve',
displayOptions: {
show: {
resource: ['vendor'],
operation: ['get'],
},
},
},
// ----------------------------------
// vendor: getAll
// ----------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['vendor'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
maxValue: 1000,
},
displayOptions: {
show: {
resource: ['vendor'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
placeholder: "WHERE Metadata.LastUpdatedTime > '2021-01-01'",
description:
'The condition for selecting vendors. See the <a href="https://developer.intuit.com/app/developer/qbo/docs/develop/explore-the-quickbooks-online-api/data-queries">guide</a> for supported syntax.',
},
],
displayOptions: {
show: {
resource: ['vendor'],
operation: ['getAll'],
},
},
},
// ----------------------------------
// vendor: update
// ----------------------------------
{
displayName: 'Vendor ID',
name: 'vendorId',
type: 'string',
required: true,
default: '',
description: 'The ID of the vendor to update',
displayOptions: {
show: {
resource: ['vendor'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
required: true,
displayOptions: {
show: {
resource: ['vendor'],
operation: ['update'],
},
},
options: vendorAdditionalFieldsOptions,
},
];
@@ -0,0 +1,10 @@
export * from './Bill/BillDescription';
export * from './Customer/CustomerDescription';
export * from './Employee/EmployeeDescription';
export * from './Estimate/EstimateDescription';
export * from './Invoice/InvoiceDescription';
export * from './Item/ItemDescription';
export * from './Payment/PaymentDescription';
export * from './Vendor/VendorDescription';
export * from './Purchase/PurchaseDescription';
export * from './Transaction/TransactionDescription';
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2500 2500"><circle cx="1250" cy="1250" r="1250" fill="#2ca01c"/><path fill="#fff" d="M301.3 1249.6c.1 282.6 228 512.4 510.6 514.9h72.3v-188.9h-72.3c-175.2 47.8-355.9-55.5-403.6-230.7-.4-1.4-.7-2.8-1.1-4.2-49.1-177.5 53.7-361.4 230.6-412.5h36.1a322 322 0 0 1 137.5 0H987v1002.9c-.9 106.1 84.4 192.9 190.5 193.9V729.6H813c-284.6 1.5-514 233.4-512.5 518v.1zm1387.5-519.8h-72.3v198.9h72.3c174.8-47.7 355.1 55.3 402.8 230 .4 1.3.7 2.7 1.1 4 48.8 176.9-53.7 360.1-229.9 411.1h-36.1a322 322 0 0 1-137.5 0h-175.6V571c.9-106.1-84.4-192.9-190.5-193.9v1397.4h364.5c287.1-4.5 516.2-240.8 511.8-527.9-4.4-280.8-230.9-507.4-511.8-511.8z"/></svg>

After

Width:  |  Height:  |  Size: 684 B

@@ -0,0 +1,49 @@
import type { IDataObject } from 'n8n-workflow';
export type QuickBooksOAuth2Credentials = {
environment: 'production' | 'sandbox';
oauthTokenData: {
callbackQueryString: {
realmId: string;
};
};
};
export type DateFieldsUi = Partial<{
dateRangeCustom: DateFieldUi;
dateRangeDueCustom: DateFieldUi;
dateRangeModificationCustom: DateFieldUi;
dateRangeCreationCustom: DateFieldUi;
}>;
type DateFieldUi = {
[key: string]: {
[key: string]: string;
};
};
export type TransactionFields = Partial<{
columns: string[];
memo: string[];
term: string[];
customer: string[];
vendor: string[];
}> &
DateFieldsUi &
IDataObject;
export type Option = { name: string; value: string };
export type TransactionReport = {
Columns: {
Column: Array<{
ColTitle: string;
ColType: string;
}>;
};
Rows: {
Row: Array<{
ColData: Array<{ value: string }>;
}>;
};
};