Add QuickBooks node (#1365)

* Add OAuth2 credentials

* Adjust credentials params

* Add node to listing

* Add initial node scaffolding

* Remove unused credentials params

* Add customer search with select statement

* Add pagination to customer search

* Add customer creation functionality

* Add customer update functionality

* Small formatting fix

* Adjust property name casing for consistency

* Adjust customer operations for consistency

* Handle large QuickBooks listings

* Add initial estimate resource description

* Add estimate resource retrieval operations

* Refactor customer billing address

* Simplify customer billing address

* Fix casing for customer additional fields

* Adjust types to accommodate loadOptions functions

* Add loadOptions for customers to estimate

* Sort customer update fields alphabetically

* Refactor estimate line into standalone file

* Add stub for PDF retrieval operation

* Add invoice resource description and execute branches

* Implement estimate PDF download functionality

* Place descriptions in their own dir

* Add get and getAll for invoices

* Add send functionality to invoices

* Refactor handling of binary data

* Add invoice voiding functionality

* Add invoice deletion functionality

* Refactor resources into subdirs and add interfaces

* Add get and getAll for bill

* Add payment description

* Add get and getAll for payment

* Make variables in endpoints consistent

* Refactor interfaces for consistency

* Add interface for item resource

* Fill in fields for all resources

* Minor fixes in defaults and descriptions

* Refactor loader

* Add all resources to execute function

* Fix line property duplication

* Add get and getAll for vendor

* Optimize description imports

* Add creation for customer and bill

* Add update operation for bill

* Refactor create and update for customer

* Implement employee create and update

* Implement create and update for estimate

* Make address params more consistent

* Add create and update to payment

* Add item operations

* Add create and delete operations for invoice

* Refactor binary data handler

* Refactor generic functions

* Add create and update operations for vendor

* Fix build

* Fix total amount in bill:update

* Fix balance in bill:update

* Remove currency from bill:update

* Implement reference retrieval in bill:update

* Fix failing params in customer:update

* Fix param in employee:update

* Implement reference retrieval in estimate:update

* Fix failing params in estimate:update

* Fix failing params in invoice:update

* Fix failing param in vendor:update

* Implement reference retrieval in payment:update

* Remove unused interfaces

* Rename line property function

* Remove hared directory

* Refactor reference and sync token retrieval

* Fix line structure in bill:create

* Fix line structure in estimate:create

* Flatten responses

* Refactor line processing

* Remove unused interfaces

* Add endpoint documentation

* Fix payment:void content type

* Fix default for bill line item

* Hide auth URI query parameters

* Hide auth header parameter

* Add switch for credentials environment

* Adjust OAuth2 callback to accommodate realmId

* Retrieve realmId from OAuth2 flow

*  Improvements

* Reposition dividers

* Add IDs to display names of reference fields

* Add estimate:delete and bill:delete

* Load items in lines for bill, estimate and invoice

* Add filename for binary property in PDF download

*  Improvements

* Adjust field description

* Implement estimate:send

* Adjust field description

* Adjust custom field descriptions

* Add missing period to description

*  Minor improvements on QuickBooks-Node

* Add descriptions for bill

* Add descriptions for customer

* Add descriptions for employee

* Add descriptions for estimate

* Add descriptions for invoice

* Add descriptions for payment

* Add descriptions for vendor

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Iván Ovejero
2021-02-13 13:27:08 -03:00
committed by GitHub
parent 24f4d6e277
commit 5baa31b053
23 changed files with 4841 additions and 3 deletions

View File

@@ -0,0 +1,86 @@
export const billAdditionalFieldsOptions = [
{
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: '',
},
];

View File

@@ -0,0 +1,330 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
billAdditionalFieldsOptions,
} from './BillAdditionalFieldsOptions';
export const billOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
displayOptions: {
show: {
resource: [
'bill',
],
},
},
},
] as INodeProperties[];
export const billFields = [
// ----------------------------------
// bill: create
// ----------------------------------
{
displayName: 'For Vendor',
name: 'VendorRef',
type: 'options',
required: true,
description: 'The ID of the vendor who the bill is for.',
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: '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: 'itemId',
type: 'options',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
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: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
{
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: 'Return all results.',
displayOptions: {
show: {
resource: [
'bill',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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'),
},
] as INodeProperties[];

View File

@@ -0,0 +1,151 @@
export const customerAdditionalFieldsOptions = [
{
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: '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,
},
];

View File

@@ -0,0 +1,222 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
customerAdditionalFieldsOptions,
} from './CustomerAdditionalFieldsOptions';
export const customerOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
displayOptions: {
show: {
resource: [
'customer',
],
},
},
},
] as INodeProperties[];
export const customerFields = [
// ----------------------------------
// 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: 'Return all results.',
displayOptions: {
show: {
resource: [
'customer',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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,
},
] as INodeProperties[];

View File

@@ -0,0 +1,91 @@
export const employeeAdditionalFieldsOptions = [
{
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: '',
},
];

View File

@@ -0,0 +1,236 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
employeeAdditionalFieldsOptions,
} from './EmployeeAdditionalFieldsOptions';
export const employeeOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
displayOptions: {
show: {
resource: [
'employee',
],
},
},
},
] as INodeProperties[];
export const employeeFields = [
// ----------------------------------
// 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: 'Return all results.',
displayOptions: {
show: {
resource: [
'employee',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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,
},
] as INodeProperties[];

View File

@@ -0,0 +1,227 @@
export const estimateAdditionalFieldsOptions = [
{
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 ID',
name: 'DefinitionId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCustomFields',
},
default: '',
description: 'ID of the field to set.',
},
{
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,
},
];

View File

@@ -0,0 +1,425 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
estimateAdditionalFieldsOptions,
} from './EstimateAdditionalFieldsOptions';
export const estimateOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Send',
value: 'send',
},
{
name: 'Update',
value: 'update',
},
],
displayOptions: {
show: {
resource: [
'estimate',
],
},
},
},
] as INodeProperties[];
export const estimateFields = [
// ----------------------------------
// estimate: create
// ----------------------------------
{
displayName: 'For Customer',
name: 'CustomerRef',
type: 'options',
required: true,
description: 'The ID of the customer who the estimate is for.',
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: 'Detail Type',
name: 'DetailType',
type: 'options',
default: 'SalesItemLineDetail',
options: [
{
name: 'Sales Item Line Detail',
value: 'SalesItemLineDetail',
},
],
},
{
displayName: 'Item',
name: 'itemId',
type: 'options',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
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: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
{
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: [
'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: 'Download the estimate as a PDF file.',
displayOptions: {
show: {
resource: [
'estimate',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Binary Property',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
description: 'Name of the binary property to which to write to.',
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: 'Return all results.',
displayOptions: {
show: {
resource: [
'estimate',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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',
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'),
},
] as INodeProperties[];

View File

@@ -0,0 +1,183 @@
export const invoiceAdditionalFieldsOptions = [
{
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 ID',
name: 'DefinitionId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCustomFields',
},
default: '',
description: 'ID of the field to set.',
},
{
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: '',
},
];

View File

@@ -0,0 +1,451 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
invoiceAdditionalFieldsOptions
} from './InvoiceAdditionalFieldsOptions';
export const invoiceOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Send',
value: 'send',
},
{
name: 'Update',
value: 'update',
},
{
name: 'Void',
value: 'void',
},
],
displayOptions: {
show: {
resource: [
'invoice',
],
},
},
},
] as INodeProperties[];
export const invoiceFields = [
// ----------------------------------
// invoice: create
// ----------------------------------
{
displayName: 'For Customer',
name: 'CustomerRef',
type: 'options',
required: true,
description: 'The ID of the customer who the invoice is for.',
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: 'Detail Type',
name: 'DetailType',
type: 'options',
default: 'SalesItemLineDetail',
options: [
{
name: 'Sales Item Line Detail',
value: 'SalesItemLineDetail',
},
],
},
{
displayName: 'Item',
name: 'itemId',
type: 'options',
default: [],
typeOptions: {
loadOptionsMethod: 'getItems',
},
},
{
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: '',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
{
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: [
'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: 'Download the invoice as a PDF file.',
displayOptions: {
show: {
resource: [
'invoice',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Binary Property',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
description: 'Name of the binary property to which to write to.',
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: 'Return all results.',
displayOptions: {
show: {
resource: [
'invoice',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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',
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'),
},
] as INodeProperties[];

View File

@@ -0,0 +1,129 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const itemOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
],
displayOptions: {
show: {
resource: [
'item',
],
},
},
},
] as INodeProperties[];
export const itemFields = [
// ----------------------------------
// 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: 'Return all results.',
displayOptions: {
show: {
resource: [
'item',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
displayOptions: {
show: {
resource: [
'item',
],
operation: [
'getAll',
],
},
},
},
] as INodeProperties[];

View File

@@ -0,0 +1,9 @@
export const paymentAdditionalFieldsOptions = [
{
displayName: 'Transaction Date',
name: 'TxnDate',
description: 'Date when the transaction occurred.',
type: 'dateTime',
default: '',
},
];

View File

@@ -0,0 +1,399 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
paymentAdditionalFieldsOptions
} from './PaymentAdditionalFieldsOptions';
export const paymentOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Delete',
value: 'delete',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Send',
value: 'send',
},
{
name: 'Update',
value: 'update',
},
{
name: 'Void',
value: 'void',
},
],
displayOptions: {
show: {
resource: [
'payment',
],
},
},
},
] as INodeProperties[];
export const paymentFields = [
// ----------------------------------
// payment: create
// ----------------------------------
{
displayName: 'For Customer ID',
name: 'CustomerRef',
type: 'options',
required: true,
description: 'The ID of the customer who the payment is for.',
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: 'Download estimate as PDF file',
displayOptions: {
show: {
resource: [
'payment',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Binary Property',
name: 'binaryProperty',
type: 'string',
required: true,
default: 'data',
description: 'Name of the binary property to which to write to.',
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: 'Return all results.',
displayOptions: {
show: {
resource: [
'payment',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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',
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,
},
] as INodeProperties[];

View File

@@ -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;
}

View File

@@ -0,0 +1,117 @@
export const vendorAdditionalFieldsOptions = [
{
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,
},
];

View File

@@ -0,0 +1,222 @@
import {
INodeProperties,
} from 'n8n-workflow';
import {
vendorAdditionalFieldsOptions,
} from './VendorAdditionalFieldsOptions';
export const vendorOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Create',
value: 'create',
},
{
name: 'Get',
value: 'get',
},
{
name: 'Get All',
value: 'getAll',
},
{
name: 'Update',
value: 'update',
},
],
displayOptions: {
show: {
resource: [
'vendor',
],
},
},
},
] as INodeProperties[];
export const vendorFields = [
// ----------------------------------
// 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: 'Return all results.',
displayOptions: {
show: {
resource: [
'vendor',
],
operation: [
'getAll',
],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 5,
description: 'The 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" target="_blank">guide</a> for supported syntax.',
typeOptions: {
alwaysOpenEditWindow: true,
},
},
],
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,
},
] as INodeProperties[];

View File

@@ -0,0 +1,8 @@
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';