2020-09-18 00:42:01 -07:00
import {
INodeProperties ,
2021-01-13 11:20:30 -08:00
} from 'n8n-workflow' ;
2019-11-03 03:47:36 -08:00
2020-09-18 00:42:01 -07:00
import {
allCurrencies ,
} from './currencies' ;
import {
activeCampaignDefaultGetAllProperties ,
} from './GenericFunctions' ;
2019-11-03 03:47:36 -08:00
2021-12-03 00:44:16 -08:00
export const ecomOrderOperations : INodeProperties [ ] = [
2019-11-07 01:50:02 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-11-07 01:50:02 -08:00
displayOptions : {
show : {
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a order' ,
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a order' ,
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get data of a order' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get data of all orders' ,
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a order' ,
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2019-11-03 03:47:36 -08:00
2021-12-03 00:44:16 -08:00
export const ecomOrderFields : INodeProperties [ ] = [
2019-11-07 01:50:02 -08:00
// ----------------------------------
// ecommerceOrder:create
// ----------------------------------
{
displayName : 'External ID' ,
name : 'externalid' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED.' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'External Checkout ID' ,
2019-11-07 01:50:02 -08:00
name : 'externalcheckoutid' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Order Source' ,
2019-11-07 01:50:02 -08:00
name : 'source' ,
type : 'number' ,
default : 0 ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The order source code (0 - will not trigger automations, 1 - will trigger automations)' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Customer Email' ,
name : 'email' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The email address of the customer who placed the order' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Total Price' ,
2019-11-07 01:50:02 -08:00
name : 'totalPrice' ,
type : 'number' ,
default : 0 ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
description : 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Order Currency' ,
2019-11-07 01:50:02 -08:00
name : 'currency' ,
type : 'options' ,
default : 'eur' ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
options : allCurrencies ,
2022-05-06 14:01:25 -07:00
description : 'The currency of the order (3-digit ISO code, e.g., "USD")' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Connection ID' ,
name : 'connectionid' ,
type : 'number' ,
default : 0 ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the connection from which this order originated' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Customer ID' ,
name : 'customerid' ,
type : 'number' ,
default : 0 ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the customer associated with this order' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Creation Date' ,
name : 'externalCreatedDate' ,
type : 'dateTime' ,
default : '' ,
required : true ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The date the order was placed' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Abandoning Date' ,
name : 'abandonedDate' ,
type : 'dateTime' ,
default : '' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
description : 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.' ,
} ,
{
displayName : 'Products' ,
name : 'orderProducts' ,
type : 'collection' ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add product' ,
} ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'create' ,
2019-11-07 01:50:02 -08:00
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
default : { } ,
description : 'All ordered products' ,
placeholder : 'Add product field' ,
options : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'The name of the product' ,
} ,
{
displayName : 'Price' ,
name : 'price' ,
type : 'number' ,
default : 0 ,
description : 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.' ,
} ,
{
displayName : 'Product Quantity' ,
name : 'quantity' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The quantity ordered' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Product External ID' ,
2019-11-07 01:50:02 -08:00
name : 'externalid' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the product in the external service' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Product Category' ,
name : 'category' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The category of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'SKU' ,
name : 'sku' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The SKU for the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The description of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Image URL' ,
name : 'imageUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'An Image URL that displays an image of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Product URL' ,
name : 'productUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A URL linking to the product in your store' ,
2019-11-07 01:50:02 -08:00
} ,
] ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Shipping Amount' ,
name : 'shippingAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total shipping amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
{
displayName : 'Tax Amount' ,
name : 'taxAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total tax amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Discount Amount' ,
name : 'discountAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total discount amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Order URL' ,
name : 'orderUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The URL for the order in the external service' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'External Updated Date' ,
2019-11-07 01:50:02 -08:00
name : 'externalUpdatedDate' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The date the order was updated' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Shipping Method' ,
name : 'shippingMethod' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The shipping method of the order' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Order Number' ,
name : 'orderNumber' ,
type : 'string' ,
default : '' ,
description : 'The order number. This can be different than the externalid.' ,
} ,
2019-11-03 03:47:36 -08:00
2020-10-22 06:46:03 -07:00
] ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
// ----------------------------------
// ecommerceOrder:update
// ----------------------------------
{
displayName : 'Order ID' ,
name : 'orderId' ,
type : 'number' ,
default : 0 ,
displayOptions : {
show : {
operation : [
'update' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the e-commerce order' ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
{
2022-05-20 14:47:24 -07:00
displayName : 'Update Fields' ,
2019-11-07 01:50:02 -08:00
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'update' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'External ID' ,
name : 'externalid' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED.' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'External Checkout ID' ,
2019-11-07 01:50:02 -08:00
name : 'externalcheckoutid' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Order Source' ,
2019-11-07 01:50:02 -08:00
name : 'source' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The order source code (0 - will not trigger automations, 1 - will trigger automations)' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Customer Email' ,
name : 'email' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The email address of the customer who placed the order' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Total Price' ,
2019-11-07 01:50:02 -08:00
name : 'totalPrice' ,
type : 'number' ,
default : 0 ,
description : 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Order Currency' ,
2019-11-07 01:50:02 -08:00
name : 'currency' ,
type : 'options' ,
default : 'eur' ,
options : allCurrencies ,
2022-05-06 14:01:25 -07:00
description : 'The currency of the order (3-digit ISO code, e.g., "USD")' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Connection ID' ,
name : 'connectionid' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the connection from which this order originated' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Customer ID' ,
name : 'customerid' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the customer associated with this order' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Creation Date' ,
name : 'externalupdatedDate' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The date the order was placed' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Abandoning Date' ,
name : 'abandonedDate' ,
type : 'dateTime' ,
default : '' ,
description : 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.' ,
} ,
{
displayName : 'Shipping Amount' ,
name : 'shippingAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total shipping amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
{
displayName : 'Tax Amount' ,
name : 'taxAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total tax amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Discount Amount' ,
name : 'discountAmount' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The total discount amount for the order in cents' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Order URL' ,
name : 'orderUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The URL for the order in the external service' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'External Updated Date' ,
2019-11-07 01:50:02 -08:00
name : 'externalUpdatedDate' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The date the order was updated' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Shipping Method' ,
name : 'shippingMethod' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The shipping method of the order' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Order Number' ,
name : 'orderNumber' ,
type : 'string' ,
default : '' ,
description : 'The order number. This can be different than the externalid.' ,
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
{
displayName : 'Products' ,
name : 'orderProducts' ,
type : 'collection' ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add product' ,
} ,
default : { } ,
description : 'All ordered products' ,
placeholder : 'Add product field' ,
options : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'The name of the product' ,
} ,
{
displayName : 'Price' ,
name : 'price' ,
type : 'number' ,
default : 0 ,
description : 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.' ,
} ,
{
displayName : 'Product Quantity' ,
name : 'quantity' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The quantity ordered' ,
2019-11-07 01:50:02 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Product External ID' ,
2019-11-07 01:50:02 -08:00
name : 'externalid' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the product in the external service' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Product Category' ,
name : 'category' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The category of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'SKU' ,
name : 'sku' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The SKU for the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The description of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Image URL' ,
name : 'imageUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'An Image URL that displays an image of the product' ,
2019-11-07 01:50:02 -08:00
} ,
{
displayName : 'Product URL' ,
name : 'productUrl' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A URL linking to the product in your store' ,
2019-11-07 01:50:02 -08:00
} ,
] ,
} ,
2019-11-03 03:47:36 -08:00
2020-10-22 06:46:03 -07:00
] ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
// ----------------------------------
// ecommerceOrder:delete
// ----------------------------------
{
displayName : 'Order ID' ,
name : 'orderId' ,
type : 'number' ,
default : 0 ,
displayOptions : {
show : {
operation : [
'delete' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the e-commerce order' ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
// ----------------------------------
// ecommerceOrder:get
// ----------------------------------
{
displayName : 'Order ID' ,
name : 'orderId' ,
type : 'number' ,
default : 0 ,
displayOptions : {
show : {
operation : [
'get' ,
] ,
resource : [
'ecommerceOrder' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the e-commerce order' ,
2019-11-07 01:50:02 -08:00
} ,
2019-11-03 03:47:36 -08:00
2019-11-07 01:50:02 -08:00
// ----------------------------------
// ecommerceOrder:getAll
// ----------------------------------
2020-09-18 00:42:01 -07:00
. . . activeCampaignDefaultGetAllProperties ( 'ecommerceOrder' , 'getAll' ) ,
2021-12-03 00:44:16 -08:00
] ;