2021-09-15 01:07:02 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
import {
|
|
|
|
getSearchFilters,
|
|
|
|
} from './GenericFunctions';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const orderOperations: INodeProperties[] = [
|
2021-09-15 01:07:02 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2021-09-15 01:07:02 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'order',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Cancel',
|
|
|
|
value: 'cancel',
|
|
|
|
description: 'Cancel an order',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Cancel an order',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get an order',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get an order',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Get All',
|
|
|
|
value: 'getAll',
|
|
|
|
description: 'Get all orders',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get all orders',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Ship',
|
|
|
|
value: 'ship',
|
|
|
|
description: 'Ship an order',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Ship an order',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'cancel',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2021-09-15 01:07:02 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const orderFields: INodeProperties[] = [
|
2021-09-15 01:07:02 -07:00
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* order:cancel */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Order ID',
|
|
|
|
name: 'orderId',
|
|
|
|
type: 'string',
|
|
|
|
required: true,
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'order',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'cancel',
|
|
|
|
'get',
|
|
|
|
'ship',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* order:getAll */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'order',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'order',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'getAll',
|
|
|
|
],
|
|
|
|
returnAll: [
|
|
|
|
false,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 10,
|
|
|
|
},
|
|
|
|
default: 5,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-09-15 01:07:02 -07:00
|
|
|
},
|
|
|
|
...getSearchFilters(
|
|
|
|
'order',
|
|
|
|
'getOrderAttributes',
|
|
|
|
'getOrderAttributes',
|
|
|
|
),
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|