2021-04-29 02:56:19 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
import {
|
|
|
|
billingAddress,
|
2021-06-01 03:22:50 -07:00
|
|
|
makeCustomFieldsFixedCollection,
|
2021-04-29 02:56:19 -07:00
|
|
|
makeGetAllFields,
|
2021-05-10 02:11:11 -07:00
|
|
|
makeProductDetails,
|
2021-04-29 02:56:19 -07:00
|
|
|
shippingAddress,
|
|
|
|
} from './SharedFields';
|
|
|
|
|
|
|
|
export const quoteOperations = [
|
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
},
|
2021-05-31 02:01:13 -07:00
|
|
|
{
|
|
|
|
name: 'Upsert',
|
|
|
|
value: 'upsert',
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
description: 'Operation to perform',
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|
|
|
|
|
|
|
|
export const quoteFields = [
|
|
|
|
// ----------------------------------------
|
2021-05-31 02:01:13 -07:00
|
|
|
// quote: create + upsert
|
2021-04-29 02:56:19 -07:00
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Subject',
|
|
|
|
name: 'subject',
|
|
|
|
description: 'Subject or title of the quote.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
2021-05-31 02:01:13 -07:00
|
|
|
'upsert',
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-06-01 02:21:55 -07:00
|
|
|
makeProductDetails('quote'),
|
2021-04-29 02:56:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
2021-05-31 02:01:13 -07:00
|
|
|
'upsert',
|
2021-04-29 02:56:19 -07:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Adjustment',
|
|
|
|
name: 'Adjustment',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Adjustment in the grand total, if any.',
|
|
|
|
},
|
|
|
|
billingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Carrier',
|
|
|
|
name: 'Carrier',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Currency',
|
|
|
|
name: 'Currency',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Symbol of the currency in which revenue is generated.',
|
|
|
|
},
|
2021-06-01 03:22:50 -07:00
|
|
|
makeCustomFieldsFixedCollection('quote'),
|
2021-04-29 02:56:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Description',
|
|
|
|
name: 'Description',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Exchange Rate',
|
|
|
|
name: 'Exchange_Rate',
|
2021-05-07 04:19:01 -07:00
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Exchange rate of the default currency to the home currency.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Grand Total',
|
|
|
|
name: 'Grand_Total',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product after deducting tax and discounts.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Quote Stage',
|
|
|
|
name: 'Quote_Stage',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
shippingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Sub Total',
|
|
|
|
name: 'Sub_Total',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product excluding tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tax',
|
|
|
|
name: 'Tax',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount as the sum of sales tax and value-added tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Team',
|
|
|
|
name: 'Team',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Team for whom the quote is created.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Terms and Conditions',
|
|
|
|
name: 'Terms_and_Conditions',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Terms and conditions associated with the quote.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Valid Till',
|
|
|
|
name: 'Valid_Till',
|
2021-05-09 14:57:53 -07:00
|
|
|
type: 'dateTime',
|
2021-04-29 02:56:19 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Date until when the quote is valid.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// quote: delete
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Quote ID',
|
|
|
|
name: 'quoteId',
|
|
|
|
description: 'ID of the quote to delete.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'delete',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// quote: get
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Quote ID',
|
|
|
|
name: 'quoteId',
|
|
|
|
description: 'ID of the quote to retrieve.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'get',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// quote: getAll
|
|
|
|
// ----------------------------------------
|
|
|
|
...makeGetAllFields('quote'),
|
|
|
|
|
|
|
|
// ----------------------------------------
|
|
|
|
// quote: update
|
|
|
|
// ----------------------------------------
|
|
|
|
{
|
|
|
|
displayName: 'Quote ID',
|
|
|
|
name: 'quoteId',
|
|
|
|
description: 'ID of the quote to update.',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Update Fields',
|
|
|
|
name: 'updateFields',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'quote',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'update',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Adjustment',
|
|
|
|
name: 'Adjustment',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Adjustment in the grand total, if any.',
|
|
|
|
},
|
|
|
|
billingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Carrier',
|
|
|
|
name: 'Carrier',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Currency',
|
|
|
|
name: 'Currency',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Symbol of the currency in which revenue is generated.',
|
|
|
|
},
|
2021-06-01 03:22:50 -07:00
|
|
|
makeCustomFieldsFixedCollection('quote'),
|
2021-04-29 02:56:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Description',
|
|
|
|
name: 'Description',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Exchange Rate',
|
|
|
|
name: 'Exchange_Rate',
|
2021-05-07 04:19:01 -07:00
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Exchange rate of the default currency to the home currency.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Grand Total',
|
|
|
|
name: 'Grand_Total',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product after deducting tax and discounts.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Quote Stage',
|
|
|
|
name: 'Quote_Stage',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
shippingAddress,
|
|
|
|
{
|
|
|
|
displayName: 'Sub Total',
|
|
|
|
name: 'Sub_Total',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Total amount for the product excluding tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Subject',
|
|
|
|
name: 'Subject',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Subject or title of the quote.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tax',
|
|
|
|
name: 'Tax',
|
|
|
|
type: 'number',
|
2021-05-09 14:57:53 -07:00
|
|
|
default: 0,
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 0,
|
|
|
|
},
|
2021-04-29 02:56:19 -07:00
|
|
|
description: 'Tax amount as the sum of sales tax and value-added tax.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Team',
|
|
|
|
name: 'Team',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Team for whom the quote is created.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Terms and Conditions',
|
|
|
|
name: 'Terms_and_Conditions',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Terms and conditions associated with the quote.',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Valid Till',
|
|
|
|
name: 'Valid_Till',
|
2021-05-09 14:57:53 -07:00
|
|
|
type: 'dateTime',
|
2021-04-29 02:56:19 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Date until when the quote is valid.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
] as INodeProperties[];
|