first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
import { snakeCase } from 'change-case';
|
||||
import { createHash } from 'crypto';
|
||||
import omit from 'lodash/omit';
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { ICouponLine, IFeeLine, ILineItem, IShoppingLine } from './OrderInterface';
|
||||
|
||||
export async function woocommerceApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('wooCommerceApi');
|
||||
|
||||
let options: IRequestOptions = {
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri || `${credentials.url}/wp-json/wc/v3${resource}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (!Object.keys(body as IDataObject).length) {
|
||||
delete options.form;
|
||||
}
|
||||
options = Object.assign({}, options, option);
|
||||
return await this.helpers.requestWithAuthentication.call(this, 'wooCommerceApi', options);
|
||||
}
|
||||
|
||||
export async function woocommerceApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
let uri: string | undefined;
|
||||
query.per_page = 100;
|
||||
do {
|
||||
responseData = await woocommerceApiRequest.call(this, method, endpoint, body, query, uri, {
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
const links = responseData.headers.link.split(',');
|
||||
const nextLink = links.find((link: string) => link.indexOf('rel="next"') !== -1);
|
||||
if (nextLink) {
|
||||
uri = nextLink.split(';')[0].replace(/<(.*)>/, '$1');
|
||||
}
|
||||
returnData.push.apply(returnData, responseData.body as IDataObject[]);
|
||||
} while (responseData.headers.link?.includes('rel="next"'));
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a secret from the credentials
|
||||
*
|
||||
*/
|
||||
export function getAutomaticSecret(credentials: ICredentialDataDecryptedObject) {
|
||||
const data = `${credentials.consumerKey},${credentials.consumerSecret}`;
|
||||
return createHash('md5').update(data).digest('hex');
|
||||
}
|
||||
|
||||
export function setMetadata(data: IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[]) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
//@ts-ignore\
|
||||
if (data[i].metadataUi?.metadataValues) {
|
||||
//@ts-ignore
|
||||
data[i].meta_data = data[i].metadataUi.metadataValues;
|
||||
//@ts-ignore
|
||||
delete data[i].metadataUi;
|
||||
} else {
|
||||
//@ts-ignore
|
||||
delete data[i].metadataUi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function toSnakeCase(
|
||||
data: IShoppingLine[] | IFeeLine[] | ILineItem[] | ICouponLine[] | IDataObject,
|
||||
) {
|
||||
if (!Array.isArray(data)) {
|
||||
data = [data];
|
||||
}
|
||||
let remove = false;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
for (const key of Object.keys(data[i])) {
|
||||
//@ts-ignore
|
||||
if (data[i][snakeCase(key)] === undefined) {
|
||||
remove = true;
|
||||
}
|
||||
//@ts-ignore
|
||||
data[i][snakeCase(key)] = data[i][key];
|
||||
if (remove) {
|
||||
//@ts-ignore
|
||||
delete data[i][key];
|
||||
remove = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function setFields(fieldsToSet: IDataObject, body: IDataObject) {
|
||||
for (const fields in fieldsToSet) {
|
||||
if (fields === 'tags') {
|
||||
body.tags = (fieldsToSet[fields] as string[]).map((tag) => ({ id: parseInt(tag, 10) }));
|
||||
} else {
|
||||
body[snakeCase(fields.toString())] = fieldsToSet[fields];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function adjustMetadata(fields: IDataObject & Metadata) {
|
||||
if (!fields.meta_data) return fields;
|
||||
|
||||
return {
|
||||
...omit(fields, ['meta_data']),
|
||||
meta_data: fields.meta_data.meta_data_fields,
|
||||
};
|
||||
}
|
||||
|
||||
type Metadata = {
|
||||
meta_data?: {
|
||||
meta_data_fields: Array<{ key: string; value: string }>;
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IAddress {
|
||||
first_name?: string;
|
||||
last_name?: string;
|
||||
company?: string;
|
||||
address_1?: string;
|
||||
address_2?: string;
|
||||
city?: string;
|
||||
state?: string;
|
||||
postcode?: string;
|
||||
country?: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
}
|
||||
|
||||
export interface ILineItem {
|
||||
name?: string;
|
||||
product_id?: number;
|
||||
variation_id?: number;
|
||||
quantity?: string;
|
||||
tax_class?: string;
|
||||
subtotal?: string;
|
||||
total?: string;
|
||||
meta_data?: IDataObject;
|
||||
}
|
||||
|
||||
export interface IShoppingLine {
|
||||
method_title?: string;
|
||||
method_id?: number;
|
||||
total?: string;
|
||||
meta_data?: IDataObject;
|
||||
}
|
||||
|
||||
export interface IFeeLine {
|
||||
name?: string;
|
||||
tax_class?: string;
|
||||
tax_status?: string;
|
||||
total?: string;
|
||||
meta_data?: IDataObject;
|
||||
}
|
||||
|
||||
export interface ICouponLine {
|
||||
code?: string;
|
||||
meta_data?: IDataObject;
|
||||
}
|
||||
|
||||
export interface IOrder {
|
||||
[index: string]: any;
|
||||
billing?: IAddress;
|
||||
coupon_lines?: ICouponLine[];
|
||||
currency?: string;
|
||||
customer_id?: number;
|
||||
customer_note?: string;
|
||||
fee_lines?: IFeeLine[];
|
||||
line_items?: ILineItem[];
|
||||
meta_data?: IDataObject[];
|
||||
parent_id?: number;
|
||||
payment_method?: string;
|
||||
payment_method_title?: string;
|
||||
set_paid?: boolean;
|
||||
shipping?: IAddress;
|
||||
shipping_lines?: IShoppingLine[];
|
||||
status?: string;
|
||||
transaction_id?: string;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
import type { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IDimension {
|
||||
height?: string;
|
||||
length?: string;
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export interface IImage {
|
||||
alt?: string;
|
||||
name?: string;
|
||||
src?: string;
|
||||
}
|
||||
|
||||
export interface IProduct {
|
||||
[index: string]:
|
||||
| string
|
||||
| number
|
||||
| string[]
|
||||
| number[]
|
||||
| IDataObject
|
||||
| IDataObject[]
|
||||
| IImage[]
|
||||
| IDimension;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.wooCommerce",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Sales"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/woocommerce/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.woocommerce/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,590 @@
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type IDataObject,
|
||||
type ILoadOptionsFunctions,
|
||||
type INodeExecutionData,
|
||||
type INodePropertyOptions,
|
||||
type INodeType,
|
||||
type INodeTypeDescription,
|
||||
NodeConnectionTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { customerFields, customerOperations } from './descriptions';
|
||||
import {
|
||||
adjustMetadata,
|
||||
setFields,
|
||||
setMetadata,
|
||||
toSnakeCase,
|
||||
woocommerceApiRequest,
|
||||
woocommerceApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { orderFields, orderOperations } from './OrderDescription';
|
||||
import type {
|
||||
IAddress,
|
||||
ICouponLine,
|
||||
IFeeLine,
|
||||
ILineItem,
|
||||
IOrder,
|
||||
IShoppingLine,
|
||||
} from './OrderInterface';
|
||||
import { productFields, productOperations } from './ProductDescription';
|
||||
import type { IDimension, IImage, IProduct } from './ProductInterface';
|
||||
|
||||
export class WooCommerce implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'WooCommerce',
|
||||
name: 'wooCommerce',
|
||||
icon: 'file:wooCommerce.svg',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume WooCommerce API',
|
||||
defaults: {
|
||||
name: 'WooCommerce',
|
||||
},
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
usableAsTool: true,
|
||||
credentials: [
|
||||
{
|
||||
name: 'wooCommerceApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Customer',
|
||||
value: 'customer',
|
||||
},
|
||||
{
|
||||
name: 'Order',
|
||||
value: 'order',
|
||||
},
|
||||
{
|
||||
name: 'Product',
|
||||
value: 'product',
|
||||
},
|
||||
],
|
||||
default: 'product',
|
||||
},
|
||||
...customerOperations,
|
||||
...customerFields,
|
||||
...productOperations,
|
||||
...productFields,
|
||||
...orderOperations,
|
||||
...orderFields,
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the available categories to display them to user so that they can
|
||||
// select them easily
|
||||
async getCategories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const categories = await woocommerceApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/products/categories',
|
||||
{},
|
||||
);
|
||||
for (const category of categories) {
|
||||
const categoryName = category.name;
|
||||
const categoryId = category.id;
|
||||
returnData.push({
|
||||
name: categoryName,
|
||||
value: categoryId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
// Get all the available tags to display them to user so that they can
|
||||
// select them easily
|
||||
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const tags = await woocommerceApiRequestAllItems.call(this, 'GET', '/products/tags', {});
|
||||
for (const tag of tags) {
|
||||
const tagName = tag.name;
|
||||
const tagId = tag.id;
|
||||
returnData.push({
|
||||
name: tagName,
|
||||
value: tagId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'customer') {
|
||||
// **********************************************************************
|
||||
// customer
|
||||
// **********************************************************************
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#customer-properties
|
||||
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------------
|
||||
// customer: create
|
||||
// ----------------------------------------
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#create-a-customer
|
||||
|
||||
const body = {
|
||||
email: this.getNodeParameter('email', i),
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body, adjustMetadata(additionalFields));
|
||||
}
|
||||
|
||||
responseData = await woocommerceApiRequest.call(this, 'POST', '/customers', body);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// customer: delete
|
||||
// ----------------------------------------
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#delete-a-customer
|
||||
|
||||
const customerId = this.getNodeParameter('customerId', i);
|
||||
|
||||
qs.force = true; // required, customers do not support trashing
|
||||
|
||||
const endpoint = `/customers/${customerId}`;
|
||||
responseData = await woocommerceApiRequest.call(this, 'DELETE', endpoint, {}, qs);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// customer: get
|
||||
// ----------------------------------------
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#retrieve-a-customer
|
||||
|
||||
const customerId = this.getNodeParameter('customerId', i);
|
||||
|
||||
const endpoint = `/customers/${customerId}`;
|
||||
responseData = await woocommerceApiRequest.call(this, 'GET', endpoint);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// customer: getAll
|
||||
// ----------------------------------------
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#list-all-customers
|
||||
|
||||
const filters = this.getNodeParameter('filters', i);
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
Object.assign(qs, filters);
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await woocommerceApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/customers',
|
||||
{},
|
||||
{},
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await woocommerceApiRequest.call(this, 'GET', '/customers', {}, qs);
|
||||
}
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// customer: update
|
||||
// ----------------------------------------
|
||||
|
||||
// https://woocommerce.github.io/woocommerce-rest-api-docs/?javascript#update-a-customer
|
||||
|
||||
const body = {} as IDataObject;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
|
||||
if (Object.keys(updateFields).length) {
|
||||
Object.assign(body, adjustMetadata(updateFields));
|
||||
}
|
||||
|
||||
const customerId = this.getNodeParameter('customerId', i);
|
||||
|
||||
const endpoint = `/customers/${customerId}`;
|
||||
responseData = await woocommerceApiRequest.call(this, 'PUT', endpoint, body);
|
||||
}
|
||||
} else if (resource === 'product') {
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IProduct = {
|
||||
name,
|
||||
};
|
||||
|
||||
setFields(additionalFields, body);
|
||||
|
||||
if (additionalFields.categories) {
|
||||
body.categories = (additionalFields.categories as string[]).map((category) => ({
|
||||
id: parseInt(category, 10),
|
||||
})) as unknown as IDataObject[];
|
||||
}
|
||||
|
||||
const images = (this.getNodeParameter('imagesUi', i) as IDataObject)
|
||||
.imagesValues as IImage[];
|
||||
if (images) {
|
||||
body.images = images;
|
||||
}
|
||||
const dimension = (this.getNodeParameter('dimensionsUi', i) as IDataObject)
|
||||
.dimensionsValues as IDimension;
|
||||
if (dimension) {
|
||||
body.dimensions = dimension;
|
||||
}
|
||||
const metadata = (this.getNodeParameter('metadataUi', i) as IDataObject)
|
||||
.metadataValues as IDataObject[];
|
||||
if (metadata) {
|
||||
body.meta_data = metadata;
|
||||
}
|
||||
responseData = await woocommerceApiRequest.call(this, 'POST', '/products', body);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-product
|
||||
if (operation === 'update') {
|
||||
const productId = this.getNodeParameter('productId', i) as string;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
const body: IProduct = {};
|
||||
|
||||
setFields(updateFields, body);
|
||||
|
||||
const images = (this.getNodeParameter('imagesUi', i) as IDataObject)
|
||||
.imagesValues as IImage[];
|
||||
if (images) {
|
||||
body.images = images;
|
||||
}
|
||||
const dimension = (this.getNodeParameter('dimensionsUi', i) as IDataObject)
|
||||
.dimensionsValues as IDimension;
|
||||
if (dimension) {
|
||||
body.dimensions = dimension;
|
||||
}
|
||||
const metadata = (this.getNodeParameter('metadataUi', i) as IDataObject)
|
||||
.metadataValues as IDataObject[];
|
||||
if (metadata) {
|
||||
body.meta_data = metadata;
|
||||
}
|
||||
responseData = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/products/${productId}`,
|
||||
body,
|
||||
);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-product
|
||||
if (operation === 'get') {
|
||||
const productId = this.getNodeParameter('productId', i) as string;
|
||||
responseData = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/products/${productId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.after) {
|
||||
qs.after = options.after as string;
|
||||
}
|
||||
if (options.before) {
|
||||
qs.before = options.before as string;
|
||||
}
|
||||
if (options.category) {
|
||||
qs.category = options.category as string;
|
||||
}
|
||||
if (options.context) {
|
||||
qs.context = options.context as string;
|
||||
}
|
||||
if (options.featured) {
|
||||
qs.featured = options.featured as boolean;
|
||||
}
|
||||
if (options.maxPrice) {
|
||||
qs.max_price = options.maxPrice as string;
|
||||
}
|
||||
if (options.minPrice) {
|
||||
qs.max_price = options.minPrice as string;
|
||||
}
|
||||
if (options.order) {
|
||||
qs.order = options.order as string;
|
||||
}
|
||||
if (options.orderBy) {
|
||||
qs.orderby = options.orderBy as string;
|
||||
}
|
||||
if (options.search) {
|
||||
qs.search = options.search as string;
|
||||
}
|
||||
if (options.sku) {
|
||||
qs.sku = options.sku as string;
|
||||
}
|
||||
if (options.slug) {
|
||||
qs.slug = options.slug as string;
|
||||
}
|
||||
if (options.status) {
|
||||
qs.status = options.status as string;
|
||||
}
|
||||
if (options.stockStatus) {
|
||||
qs.stock_status = options.stockStatus as string;
|
||||
}
|
||||
if (options.tag) {
|
||||
qs.tag = options.tag as string;
|
||||
}
|
||||
if (options.taxClass) {
|
||||
qs.tax_class = options.taxClass as string;
|
||||
}
|
||||
if (options.type) {
|
||||
qs.type = options.type as string;
|
||||
}
|
||||
if (returnAll) {
|
||||
responseData = await woocommerceApiRequestAllItems.call(
|
||||
this,
|
||||
'GET',
|
||||
'/products',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await woocommerceApiRequest.call(this, 'GET', '/products', {}, qs);
|
||||
}
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-product
|
||||
if (operation === 'delete') {
|
||||
const productId = this.getNodeParameter('productId', i) as string;
|
||||
responseData = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/products/${productId}`,
|
||||
{},
|
||||
{ force: true },
|
||||
);
|
||||
}
|
||||
}
|
||||
if (resource === 'order') {
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order
|
||||
if (operation === 'create') {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i);
|
||||
const body: IOrder = {};
|
||||
|
||||
setFields(additionalFields, body);
|
||||
|
||||
const billing = (this.getNodeParameter('billingUi', i) as IDataObject)
|
||||
.billingValues as IAddress;
|
||||
if (billing !== undefined) {
|
||||
body.billing = billing;
|
||||
toSnakeCase(billing as IDataObject);
|
||||
}
|
||||
const shipping = (this.getNodeParameter('shippingUi', i) as IDataObject)
|
||||
.shippingValues as IAddress;
|
||||
if (shipping !== undefined) {
|
||||
body.shipping = shipping;
|
||||
toSnakeCase(shipping as IDataObject);
|
||||
}
|
||||
const couponLines = (this.getNodeParameter('couponLinesUi', i) as IDataObject)
|
||||
.couponLinesValues as ICouponLine[];
|
||||
if (couponLines) {
|
||||
body.coupon_lines = couponLines;
|
||||
setMetadata(couponLines);
|
||||
toSnakeCase(couponLines);
|
||||
}
|
||||
const feeLines = (this.getNodeParameter('feeLinesUi', i) as IDataObject)
|
||||
.feeLinesValues as IFeeLine[];
|
||||
if (feeLines) {
|
||||
body.fee_lines = feeLines;
|
||||
setMetadata(feeLines);
|
||||
toSnakeCase(feeLines);
|
||||
}
|
||||
const lineItems = (this.getNodeParameter('lineItemsUi', i) as IDataObject)
|
||||
.lineItemsValues as ILineItem[];
|
||||
if (lineItems) {
|
||||
body.line_items = lineItems;
|
||||
setMetadata(lineItems);
|
||||
toSnakeCase(lineItems);
|
||||
}
|
||||
const metadata = (this.getNodeParameter('metadataUi', i) as IDataObject)
|
||||
.metadataValues as IDataObject[];
|
||||
if (metadata) {
|
||||
body.meta_data = metadata;
|
||||
}
|
||||
const shippingLines = (this.getNodeParameter('shippingLinesUi', i) as IDataObject)
|
||||
.shippingLinesValues as IShoppingLine[];
|
||||
if (shippingLines) {
|
||||
body.shipping_lines = shippingLines;
|
||||
setMetadata(shippingLines);
|
||||
toSnakeCase(shippingLines);
|
||||
}
|
||||
responseData = await woocommerceApiRequest.call(this, 'POST', '/orders', body);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#update-an-order
|
||||
if (operation === 'update') {
|
||||
const orderId = this.getNodeParameter('orderId', i) as string;
|
||||
const updateFields = this.getNodeParameter('updateFields', i);
|
||||
const body: IOrder = {};
|
||||
|
||||
if (updateFields.currency) {
|
||||
body.currency = updateFields.currency as string;
|
||||
}
|
||||
if (updateFields.customerId) {
|
||||
body.customer_id = parseInt(updateFields.customerId as string, 10);
|
||||
}
|
||||
if (updateFields.customerNote) {
|
||||
body.customer_note = updateFields.customerNote as string;
|
||||
}
|
||||
if (updateFields.parentId) {
|
||||
body.parent_id = parseInt(updateFields.parentId as string, 10);
|
||||
}
|
||||
if (updateFields.paymentMethodId) {
|
||||
body.payment_method = updateFields.paymentMethodId as string;
|
||||
}
|
||||
if (updateFields.paymentMethodTitle) {
|
||||
body.payment_method_title = updateFields.paymentMethodTitle as string;
|
||||
}
|
||||
|
||||
if (updateFields.status) {
|
||||
body.status = updateFields.status as string;
|
||||
}
|
||||
if (updateFields.transactionID) {
|
||||
body.transaction_id = updateFields.transactionID as string;
|
||||
}
|
||||
const billing = (this.getNodeParameter('billingUi', i) as IDataObject)
|
||||
.billingValues as IAddress;
|
||||
if (billing !== undefined) {
|
||||
body.billing = billing;
|
||||
toSnakeCase(billing as IDataObject);
|
||||
}
|
||||
const shipping = (this.getNodeParameter('shippingUi', i) as IDataObject)
|
||||
.shippingValues as IAddress;
|
||||
if (shipping !== undefined) {
|
||||
body.shipping = shipping;
|
||||
toSnakeCase(shipping as IDataObject);
|
||||
}
|
||||
const couponLines = (this.getNodeParameter('couponLinesUi', i) as IDataObject)
|
||||
.couponLinesValues as ICouponLine[];
|
||||
if (couponLines) {
|
||||
body.coupon_lines = couponLines;
|
||||
setMetadata(couponLines);
|
||||
toSnakeCase(couponLines);
|
||||
}
|
||||
const feeLines = (this.getNodeParameter('feeLinesUi', i) as IDataObject)
|
||||
.feeLinesValues as IFeeLine[];
|
||||
if (feeLines) {
|
||||
body.fee_lines = feeLines;
|
||||
setMetadata(feeLines);
|
||||
toSnakeCase(feeLines);
|
||||
}
|
||||
const lineItems = (this.getNodeParameter('lineItemsUi', i) as IDataObject)
|
||||
.lineItemsValues as ILineItem[];
|
||||
if (lineItems) {
|
||||
body.line_items = lineItems;
|
||||
setMetadata(lineItems);
|
||||
toSnakeCase(lineItems);
|
||||
}
|
||||
const metadata = (this.getNodeParameter('metadataUi', i) as IDataObject)
|
||||
.metadataValues as IDataObject[];
|
||||
if (metadata) {
|
||||
body.meta_data = metadata;
|
||||
}
|
||||
const shippingLines = (this.getNodeParameter('shippingLinesUi', i) as IDataObject)
|
||||
.shippingLinesValues as IShoppingLine[];
|
||||
if (shippingLines) {
|
||||
body.shipping_lines = shippingLines;
|
||||
setMetadata(shippingLines);
|
||||
toSnakeCase(shippingLines);
|
||||
}
|
||||
|
||||
responseData = await woocommerceApiRequest.call(this, 'PUT', `/orders/${orderId}`, body);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-an-order
|
||||
if (operation === 'get') {
|
||||
const orderId = this.getNodeParameter('orderId', i) as string;
|
||||
responseData = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/orders/${orderId}`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-orders
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.after) {
|
||||
qs.after = options.after as string;
|
||||
}
|
||||
if (options.before) {
|
||||
qs.before = options.before as string;
|
||||
}
|
||||
if (options.category) {
|
||||
qs.category = options.category as string;
|
||||
}
|
||||
if (options.customer) {
|
||||
qs.customer = parseInt(options.customer as string, 10);
|
||||
}
|
||||
if (options.decimalPoints) {
|
||||
qs.dp = options.decimalPoints as number;
|
||||
}
|
||||
if (options.product) {
|
||||
qs.product = parseInt(options.product as string, 10);
|
||||
}
|
||||
if (options.order) {
|
||||
qs.order = options.order as string;
|
||||
}
|
||||
if (options.orderBy) {
|
||||
qs.orderby = options.orderBy as string;
|
||||
}
|
||||
if (options.search) {
|
||||
qs.search = options.search as string;
|
||||
}
|
||||
if (options.status) {
|
||||
qs.status = options.status as string;
|
||||
}
|
||||
if (returnAll) {
|
||||
responseData = await woocommerceApiRequestAllItems.call(this, 'GET', '/orders', {}, qs);
|
||||
} else {
|
||||
qs.per_page = this.getNodeParameter('limit', i);
|
||||
responseData = await woocommerceApiRequest.call(this, 'GET', '/orders', {}, qs);
|
||||
}
|
||||
}
|
||||
//https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-an-order
|
||||
if (operation === 'delete') {
|
||||
const orderId = this.getNodeParameter('orderId', i) as string;
|
||||
responseData = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/orders/${orderId}`,
|
||||
{},
|
||||
{ force: true },
|
||||
);
|
||||
}
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"node": "n8n-nodes-base.wooCommerceTrigger",
|
||||
"nodeVersion": "1.0",
|
||||
"codexVersion": "1.0",
|
||||
"categories": ["Sales"],
|
||||
"resources": {
|
||||
"credentialDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/credentials/woocommerce/"
|
||||
}
|
||||
],
|
||||
"primaryDocumentation": [
|
||||
{
|
||||
"url": "https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.woocommercetrigger/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import { createHmac } from 'crypto';
|
||||
import type {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
IDataObject,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IWebhookResponseData,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionTypes } from 'n8n-workflow';
|
||||
|
||||
import { getAutomaticSecret, woocommerceApiRequest } from './GenericFunctions';
|
||||
|
||||
export class WooCommerceTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'WooCommerce Trigger',
|
||||
name: 'wooCommerceTrigger',
|
||||
icon: 'file:wooCommerce.svg',
|
||||
group: ['trigger'],
|
||||
version: 1,
|
||||
description: 'Handle WooCommerce events via webhooks',
|
||||
defaults: {
|
||||
name: 'WooCommerce Trigger',
|
||||
},
|
||||
inputs: [],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
name: 'wooCommerceApi',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
{
|
||||
name: 'default',
|
||||
httpMethod: 'POST',
|
||||
responseMode: 'onReceived',
|
||||
path: 'webhook',
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Event',
|
||||
name: 'event',
|
||||
type: 'options',
|
||||
required: true,
|
||||
default: '',
|
||||
options: [
|
||||
{
|
||||
name: 'coupon.created',
|
||||
value: 'coupon.created',
|
||||
},
|
||||
{
|
||||
name: 'coupon.deleted',
|
||||
value: 'coupon.deleted',
|
||||
},
|
||||
{
|
||||
name: 'coupon.updated',
|
||||
value: 'coupon.updated',
|
||||
},
|
||||
{
|
||||
name: 'customer.created',
|
||||
value: 'customer.created',
|
||||
},
|
||||
{
|
||||
name: 'customer.deleted',
|
||||
value: 'customer.deleted',
|
||||
},
|
||||
{
|
||||
name: 'customer.updated',
|
||||
value: 'customer.updated',
|
||||
},
|
||||
{
|
||||
name: 'order.created',
|
||||
value: 'order.created',
|
||||
},
|
||||
{
|
||||
name: 'order.deleted',
|
||||
value: 'order.deleted',
|
||||
},
|
||||
{
|
||||
name: 'order.updated',
|
||||
value: 'order.updated',
|
||||
},
|
||||
{
|
||||
name: 'product.created',
|
||||
value: 'product.created',
|
||||
},
|
||||
{
|
||||
name: 'product.deleted',
|
||||
value: 'product.deleted',
|
||||
},
|
||||
{
|
||||
name: 'product.updated',
|
||||
value: 'product.updated',
|
||||
},
|
||||
],
|
||||
description: 'Determines which resource events the webhook is triggered for',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
webhookMethods = {
|
||||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const currentEvent = this.getNodeParameter('event') as string;
|
||||
const endpoint = '/webhooks';
|
||||
|
||||
const webhooks = await woocommerceApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
endpoint,
|
||||
{},
|
||||
{ status: 'active', per_page: 100 },
|
||||
);
|
||||
|
||||
for (const webhook of webhooks) {
|
||||
if (
|
||||
webhook.status === 'active' &&
|
||||
webhook.delivery_url === webhookUrl &&
|
||||
webhook.topic === currentEvent
|
||||
) {
|
||||
webhookData.webhookId = webhook.id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
const credentials = await this.getCredentials('wooCommerceApi');
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
const secret = getAutomaticSecret(credentials);
|
||||
const endpoint = '/webhooks';
|
||||
const body: IDataObject = {
|
||||
delivery_url: webhookUrl,
|
||||
topic: event,
|
||||
secret,
|
||||
};
|
||||
const { id } = await woocommerceApiRequest.call(this, 'POST', endpoint, body);
|
||||
webhookData.webhookId = id;
|
||||
webhookData.secret = secret;
|
||||
return true;
|
||||
},
|
||||
async delete(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const endpoint = `/webhooks/${webhookData.webhookId}`;
|
||||
try {
|
||||
await woocommerceApiRequest.call(this, 'DELETE', endpoint, {}, { force: true });
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
delete webhookData.webhookId;
|
||||
delete webhookData.secret;
|
||||
return true;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const req = this.getRequestObject();
|
||||
const headerData = this.getHeaderData();
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
if (headerData['x-wc-webhook-id'] === undefined) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const computedSignature = createHmac('sha256', webhookData.secret as string)
|
||||
.update(req.rawBody)
|
||||
.digest('base64');
|
||||
if (headerData['x-wc-webhook-signature'] !== computedSignature) {
|
||||
// Signature is not valid so ignore call
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
workflowData: [this.helpers.returnJsonArray(req.body as IDataObject)],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"avatar_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"billing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_paying_customer": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"role": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"avatar_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"billing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_paying_customer": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"role": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"billing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cart_hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"cart_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_via": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"customer_ip_address": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_user_agent": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"fee_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"line_items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"image": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"product_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"subtotal_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"needs_processing": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"order_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"payment_method": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"prices_include_tax": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"instance_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"method_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"transaction_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,549 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"targetHints": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"billing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cart_hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"cart_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"coupon_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"free_shipping": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"created_via": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"customer_ip_address": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_user_agent": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"fee_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"line_items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"image": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"product_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"subtotal_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"taxes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"needs_payment": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"needs_processing": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"order_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"payment_method": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"prices_include_tax": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"refunds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"reason": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"instance_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"method_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"taxes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"compound": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rate_code": {
|
||||
"type": "string"
|
||||
},
|
||||
"rate_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"shipping_tax_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"transaction_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,528 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"targetHints": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"billing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cart_hash": {
|
||||
"type": "string"
|
||||
},
|
||||
"cart_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"coupon_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_type": {
|
||||
"type": "string"
|
||||
},
|
||||
"free_shipping": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"created_via": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string"
|
||||
},
|
||||
"currency_symbol": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"customer_ip_address": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"customer_user_agent": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"discount_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"fee_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"taxes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"is_editable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"line_items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"image": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"product_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"subtotal_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"taxes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"needs_processing": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"order_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"payment_method": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"payment_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"prices_include_tax": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"refunds": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"reason": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address_1": {
|
||||
"type": "string"
|
||||
},
|
||||
"address_2": {
|
||||
"type": "string"
|
||||
},
|
||||
"city": {
|
||||
"type": "string"
|
||||
},
|
||||
"company": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
},
|
||||
"first_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"postcode": {
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"instance_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"method_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"method_title": {
|
||||
"type": "string"
|
||||
},
|
||||
"taxes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"subtotal": {
|
||||
"type": "string"
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shipping_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"compound": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"display_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_value": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rate_code": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_tax_total": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_total": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"total": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_tax": {
|
||||
"type": "string"
|
||||
},
|
||||
"transaction_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"average_rating": {
|
||||
"type": "string"
|
||||
},
|
||||
"backordered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"backorders": {
|
||||
"type": "string"
|
||||
},
|
||||
"backorders_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"button_text": {
|
||||
"type": "string"
|
||||
},
|
||||
"catalog_visibility": {
|
||||
"type": "string"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_on_sale_from": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_from_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"height": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"download_expiry": {
|
||||
"type": "integer"
|
||||
},
|
||||
"download_limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"downloadable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"external_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"generated_slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"global_unique_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"has_options": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_stock": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"menu_order": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"on_sale": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"permalink": {
|
||||
"type": "string"
|
||||
},
|
||||
"permalink_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"post_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"price": {
|
||||
"type": "string"
|
||||
},
|
||||
"price_html": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchasable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"purchase_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"regular_price": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"reviews_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sale_price": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"shipping_required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping_taxable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"short_description": {
|
||||
"type": "string"
|
||||
},
|
||||
"sku": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"sold_individually": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"stock_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_sales": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"virtual": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"weight": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"targetHints": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"type": "integer"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"visible": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"average_rating": {
|
||||
"type": "string"
|
||||
},
|
||||
"backordered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"backorders": {
|
||||
"type": "string"
|
||||
},
|
||||
"backorders_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"brands": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"button_text": {
|
||||
"type": "string"
|
||||
},
|
||||
"catalog_visibility": {
|
||||
"type": "string"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cross_sell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"default_attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"option": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"height": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"download_expiry": {
|
||||
"type": "integer"
|
||||
},
|
||||
"download_limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"downloadable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"downloads": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"external_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"global_unique_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"has_options": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_stock": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"menu_order": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"on_sale": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"permalink": {
|
||||
"type": "string"
|
||||
},
|
||||
"post_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"price_html": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchasable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"purchase_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"reviews_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sale_price": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"shipping_required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping_taxable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"short_description": {
|
||||
"type": "string"
|
||||
},
|
||||
"sku": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"sold_individually": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"stock_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"upsell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"variations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"virtual": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"weight": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"targetHints": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"type": "integer"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"visible": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"average_rating": {
|
||||
"type": "string"
|
||||
},
|
||||
"backordered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"backorders": {
|
||||
"type": "string"
|
||||
},
|
||||
"backorders_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"brands": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"button_text": {
|
||||
"type": "string"
|
||||
},
|
||||
"catalog_visibility": {
|
||||
"type": "string"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cross_sell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_on_sale_from": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_from_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"default_attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"option": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"height": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"download_expiry": {
|
||||
"type": "integer"
|
||||
},
|
||||
"download_limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"downloadable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"downloads": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"external_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"global_unique_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"grouped_products": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"has_options": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_stock": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"menu_order": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"on_sale": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"permalink": {
|
||||
"type": "string"
|
||||
},
|
||||
"post_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"price_html": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchasable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"purchase_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"related_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"reviews_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"shipping_required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping_taxable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"short_description": {
|
||||
"type": "string"
|
||||
},
|
||||
"sku": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"sold_individually": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"stock_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"upsell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"variations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"virtual": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"weight": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"_links": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"collection": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"self": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"type": "string"
|
||||
},
|
||||
"targetHints": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"type": "integer"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"variation": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"visible": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"average_rating": {
|
||||
"type": "string"
|
||||
},
|
||||
"backordered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"backorders": {
|
||||
"type": "string"
|
||||
},
|
||||
"backorders_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"button_text": {
|
||||
"type": "string"
|
||||
},
|
||||
"catalog_visibility": {
|
||||
"type": "string"
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cross_sell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_on_sale_from": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_from_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to": {
|
||||
"type": "null"
|
||||
},
|
||||
"date_on_sale_to_gmt": {
|
||||
"type": "null"
|
||||
},
|
||||
"default_attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"option": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"dimensions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"height": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "string"
|
||||
},
|
||||
"width": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"download_expiry": {
|
||||
"type": "integer"
|
||||
},
|
||||
"download_limit": {
|
||||
"type": "integer"
|
||||
},
|
||||
"downloadable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"downloads": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"external_url": {
|
||||
"type": "string"
|
||||
},
|
||||
"featured": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"generated_slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"global_unique_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"has_options": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"images": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_created_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified": {
|
||||
"type": "string"
|
||||
},
|
||||
"date_modified_gmt": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"src": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"manage_stock": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"menu_order": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta_data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"key": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"on_sale": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"parent_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"permalink": {
|
||||
"type": "string"
|
||||
},
|
||||
"permalink_template": {
|
||||
"type": "string"
|
||||
},
|
||||
"post_password": {
|
||||
"type": "string"
|
||||
},
|
||||
"price": {
|
||||
"type": "string"
|
||||
},
|
||||
"price_html": {
|
||||
"type": "string"
|
||||
},
|
||||
"purchasable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"purchase_note": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"regular_price": {
|
||||
"type": "string"
|
||||
},
|
||||
"related_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"reviews_allowed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sale_price": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"shipping_class_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"shipping_required": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"shipping_taxable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"short_description": {
|
||||
"type": "string"
|
||||
},
|
||||
"sku": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"sold_individually": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"stock_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tax_class": {
|
||||
"type": "string"
|
||||
},
|
||||
"tax_status": {
|
||||
"type": "string"
|
||||
},
|
||||
"total_sales": {
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"upsell_ids": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"variations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"virtual": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"weight": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"version": 1
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { customerCreateFields, customerUpdateFields } from './shared';
|
||||
|
||||
export const customerOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a customer',
|
||||
action: 'Create a customer',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a customer',
|
||||
action: 'Delete a customer',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a customer',
|
||||
action: 'Get a customer',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many customers',
|
||||
action: 'Get many customers',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a customer',
|
||||
action: 'Update a customer',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
},
|
||||
];
|
||||
|
||||
export const customerFields: INodeProperties[] = [
|
||||
// ----------------------------------------
|
||||
// customer: create
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
customerCreateFields,
|
||||
|
||||
// ----------------------------------------
|
||||
// customer: delete
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
description: 'ID of the customer to delete',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// customer: get
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
description: 'ID of the customer to retrieve',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// customer: getAll
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to return all results or only up to a given limit',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
description: 'Max number of results to return',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'Email address to filter customers by',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort Order',
|
||||
name: 'order',
|
||||
description: 'Order to sort customers in',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Ascending',
|
||||
value: 'asc',
|
||||
},
|
||||
{
|
||||
name: 'Descending',
|
||||
value: 'desc',
|
||||
},
|
||||
],
|
||||
default: 'asc',
|
||||
},
|
||||
{
|
||||
displayName: 'Order By',
|
||||
name: 'orderby',
|
||||
description: 'Field to sort customers by',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'id',
|
||||
},
|
||||
{
|
||||
name: 'Include',
|
||||
value: 'include',
|
||||
},
|
||||
{
|
||||
name: 'Name',
|
||||
value: 'name',
|
||||
},
|
||||
{
|
||||
name: 'Registered Date',
|
||||
value: 'registered_date',
|
||||
},
|
||||
],
|
||||
default: 'id',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------------
|
||||
// customer: update
|
||||
// ----------------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
description: 'ID of the customer to update',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
customerUpdateFields,
|
||||
];
|
||||
@@ -0,0 +1 @@
|
||||
export * from './CustomerDescription';
|
||||
@@ -0,0 +1,185 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
const customerAddressOptions: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'first_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'last_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'company',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Address 1',
|
||||
name: 'address_1',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Address 2',
|
||||
name: 'address_2',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'city',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'state',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Postcode',
|
||||
name: 'postcode',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
const customerUpdateOptions: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Billing Address',
|
||||
name: 'billing',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: customerAddressOptions,
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'first_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'last_name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Metadata',
|
||||
name: 'meta_data',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Metadata Field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Metadata Fields',
|
||||
name: 'meta_data_fields',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/resource': ['customer'],
|
||||
'/operation': ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Shipping Address',
|
||||
name: 'shipping',
|
||||
type: 'collection',
|
||||
default: {},
|
||||
placeholder: 'Add Field',
|
||||
options: customerAddressOptions,
|
||||
},
|
||||
];
|
||||
|
||||
const customerCreateOptions: INodeProperties[] = [
|
||||
...customerUpdateOptions,
|
||||
{
|
||||
displayName: 'Username',
|
||||
name: 'username',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
|
||||
export const customerCreateFields: INodeProperties = {
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: customerCreateOptions,
|
||||
};
|
||||
|
||||
export const customerUpdateFields: INodeProperties = {
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: customerUpdateOptions,
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 28.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 183.6 47.5" style="enable-background:new 0 0 183.6 47.5;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#873EFF;}
|
||||
.st1{fill-rule:evenodd;clip-rule:evenodd;}
|
||||
.st2{fill:#873EFF;}
|
||||
.st3{fill-rule:evenodd;clip-rule:evenodd;fill:#FFFFFF;}
|
||||
.st4{fill:#FFFFFF;}
|
||||
</style>
|
||||
<g>
|
||||
<path class="st0" d="M77.4,0c-4.3,0-7.1,1.4-9.6,6.1L56.4,27.6V8.5c0-5.7-2.7-8.5-7.7-8.5s-7.1,1.7-9.6,6.5L28.3,27.6V8.7
|
||||
c0-6.1-2.5-8.7-8.6-8.7H7.3C2.6,0,0,2.2,0,6.2s2.5,6.4,7.1,6.4h5.1v24.1c0,6.8,4.6,10.8,11.2,10.8s9.6-2.6,12.9-8.7l7.2-13.5v11.4
|
||||
c0,6.7,4.4,10.8,11.1,10.8s9.2-2.3,13-8.7l16.6-28C87.8,4.7,85.3,0,77.3,0C77.3,0,77.3,0,77.4,0z"/>
|
||||
<path class="st0" d="M108.6,0C95,0,84.7,10.1,84.7,23.8s10.4,23.7,23.9,23.7s23.8-10.1,23.9-23.7C132.5,10.1,122.1,0,108.6,0z
|
||||
M108.6,32.9c-5.1,0-8.6-3.8-8.6-9.1s3.5-9.2,8.6-9.2s8.6,3.9,8.6,9.2S113.8,32.9,108.6,32.9z"/>
|
||||
<path class="st0" d="M159.7,0c-13.5,0-23.9,10.1-23.9,23.8s10.4,23.7,23.9,23.7s23.9-10.1,23.9-23.7S173.2,0,159.7,0z M159.7,32.9
|
||||
c-5.2,0-8.5-3.8-8.5-9.1s3.4-9.2,8.5-9.2s8.6,3.9,8.6,9.2S164.9,32.9,159.7,32.9z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user