mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
add ecommerce order products functionality
This commit is contained in:
parent
9a3a0d150b
commit
e764748aa1
|
@ -34,6 +34,7 @@ import {
|
|||
ecomCustomerOperations,
|
||||
ecomCustomerFields
|
||||
} from './EcomCustomerDescription';
|
||||
import { ecomOrderProductsOperations, ecomOrderProductsFields } from './EcomOrderProductsDescription';
|
||||
|
||||
interface CustomProperty {
|
||||
name: string;
|
||||
|
@ -107,7 +108,7 @@ export class ActiveCampaign implements INodeType {
|
|||
},
|
||||
{
|
||||
name: 'E-commerce Order Products',
|
||||
value: 'ecomerceOrderProducts'
|
||||
value: 'ecommerceOrderProducts'
|
||||
}
|
||||
],
|
||||
default: 'contact',
|
||||
|
@ -121,6 +122,7 @@ export class ActiveCampaign implements INodeType {
|
|||
...dealOperations,
|
||||
...ecomOrderOperations,
|
||||
...ecomCustomerOperations,
|
||||
...ecomOrderProductsOperations,
|
||||
|
||||
// ----------------------------------
|
||||
// contact
|
||||
|
@ -142,6 +144,11 @@ export class ActiveCampaign implements INodeType {
|
|||
// ----------------------------------
|
||||
...ecomCustomerFields,
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts
|
||||
// ----------------------------------
|
||||
...ecomOrderProductsFields,
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
|
@ -478,7 +485,7 @@ export class ActiveCampaign implements INodeType {
|
|||
} else {
|
||||
additionalFields.acceptsMarketing = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
addAdditionalFields(body.ecomCustomer as IDataObject, additionalFields);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
@ -540,6 +547,48 @@ export class ActiveCampaign implements INodeType {
|
|||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'ecommerceOrderProducts') {
|
||||
if (operation === 'getByProductId') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByProductId
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const procuctId = this.getNodeParameter('procuctId', i) as number;
|
||||
endpoint = `/api/3/ecomOrderProducts/${procuctId}`;
|
||||
|
||||
|
||||
} else if (operation === 'getByOrderId') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByOrderId
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const orderId = this.getNodeParameter('orderId', i) as number;
|
||||
endpoint = `/api/3/ecomOrders/${orderId}/orderProducts`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProductss:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/ecomOrderProducts`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
|
||||
console.log(endpoint);
|
||||
console.log(body)
|
||||
|
||||
} else {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
import { allCurrencies } from './currencies';
|
||||
|
||||
export const ecomOrderProductsOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
|
@ -18,21 +16,20 @@ export const ecomOrderProductsOperations = [
|
|||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all orders',
|
||||
description: 'Get data of all order products',
|
||||
},
|
||||
{
|
||||
name: 'Get by Product ID',
|
||||
value: 'getByProductId',
|
||||
description: 'Get data of a order',
|
||||
description: 'Get data of a ordered product',
|
||||
},
|
||||
{
|
||||
name: 'Get by Order ID',
|
||||
value: 'getByOrderId',
|
||||
description: 'Get data of a order',
|
||||
description: 'Get data of an order\'s products',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'create',
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[]
|
||||
|
@ -56,7 +53,7 @@ export const ecomOrderProductsFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the e-commerce order.',
|
||||
description: 'The ID of the order whose products you\'d like returned.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
|
@ -77,7 +74,7 @@ export const ecomOrderProductsFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the e-commerce order.',
|
||||
description: 'The ID of the product you\'d like returned.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
|
|
Loading…
Reference in a new issue