n8n/packages/nodes-base/nodes/Paddle/CouponDescription.ts

869 lines
15 KiB
TypeScript
Raw Normal View History

import {
INodeProperties,
} from 'n8n-workflow';
export const couponOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'coupon',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a coupon.',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get all coupons.',
},
{
name: 'Update',
value: 'update',
description: 'Update a coupon.',
},
],
default: 'create',
description: 'The operation to perform.',
},
];
export const couponFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* coupon:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Coupon Type',
name: 'couponType',
type: 'options',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
default: 'checkout',
description: 'Either product (valid for specified products or subscription plans) or checkout (valid for any checkout).',
options: [
{
name: 'Checkout',
2020-10-22 06:46:03 -07:00
value: 'checkout',
},
{
name: 'Product',
2020-10-22 06:46:03 -07:00
value: 'product',
},
2020-10-22 06:46:03 -07:00
],
},
{
displayName: 'Product IDs',
name: 'productIds',
type: 'multiOptions',
typeOptions: {
loadOptionsMethod: 'getProducts',
},
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
couponType: [
'product',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
refactor: Apply `eslint-plugin-n8n-nodes-base` autofixable rules (#3174) * :zap: Initial setup * :shirt: Update `.eslintignore` * :shirt: Autofix node-param-default-missing (#3173) * :fire: Remove duplicate key * :shirt: Add exceptions * :package: Update package-lock.json * :shirt: Apply `node-class-description-inputs-wrong-trigger-node` (#3176) * :shirt: Apply `node-class-description-inputs-wrong-regular-node` (#3177) * :shirt: Apply `node-class-description-outputs-wrong` (#3178) * :shirt: Apply `node-execute-block-double-assertion-for-items` (#3179) * :shirt: Apply `node-param-default-wrong-for-collection` (#3180) * :shirt: Apply node-param-default-wrong-for-boolean (#3181) * Autofixed default missing * Autofixed booleans, worked well * :zap: Fix params * :rewind: Undo exempted autofixes * :package: Update package-lock.json * :shirt: Apply node-class-description-missing-subtitle (#3182) * :zap: Fix missing comma * :shirt: Apply `node-param-default-wrong-for-fixed-collection` (#3184) * :shirt: Add exception for `node-class-description-missing-subtitle` * :shirt: Apply `node-param-default-wrong-for-multi-options` (#3185) * :shirt: Apply `node-param-collection-type-unsorted-items` (#3186) * Missing coma * :shirt: Apply `node-param-default-wrong-for-simplify` (#3187) * :shirt: Apply `node-param-description-comma-separated-hyphen` (#3190) * :shirt: Apply `node-param-description-empty-string` (#3189) * :shirt: Apply `node-param-description-excess-inner-whitespace` (#3191) * Rule looks good * Add whitespace rule in eslint config * :zao: fix * :shirt: Apply `node-param-description-identical-to-display-name` (#3193) * :shirt: Apply `node-param-description-missing-for-ignore-ssl-issues` (#3195) * :rewind: Revert ":zao: fix" This reverts commit ef8a76f3dfedffd1bdccf3178af8a8d90cf5a55c. * :shirt: Apply `node-param-description-missing-for-simplify` (#3196) * :shirt: Apply `node-param-description-missing-final-period` (#3194) * Rule working as intended * Add rule to eslint * :shirt: Apply node-param-description-missing-for-return-all (#3197) * :zap: Restore `lintfix` command Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: agobrech <ael.gobrecht@gmail.com> Co-authored-by: Michael Kret <michael.k@radency.com>
2022-04-22 09:29:51 -07:00
default: [],
description: 'Comma-separated list of product IDs. Required if coupon_type is product.',
required: true,
},
{
displayName: 'Discount Type',
name: 'discountType',
type: 'options',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
default: 'flat',
description: 'Either flat or percentage.',
options: [
{
name: 'Flat',
2020-10-22 06:46:03 -07:00
value: 'flat',
},
{
name: 'Percentage',
2020-10-22 06:46:03 -07:00
value: 'percentage',
},
2020-10-22 06:46:03 -07:00
],
},
{
displayName: 'Discount Amount Currency',
name: 'discountAmount',
type: 'number',
default: 1,
description: 'Discount amount in currency.',
typeOptions: {
2020-10-22 06:46:03 -07:00
minValue: 1,
},
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
discountType: [
'flat',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
},
{
displayName: 'Discount Amount %',
name: 'discountAmount',
type: 'number',
default: 1,
description: 'Discount amount in percentage.',
typeOptions: {
minValue: 1,
2020-10-22 06:46:03 -07:00
maxValue: 100,
},
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
discountType: [
'percentage',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
},
{
displayName: 'Currency',
name: 'currency',
type: 'options',
default: 'EUR',
description: 'The currency must match the balance currency specified in your account.',
options: [
{
name: 'ARS',
2020-10-22 06:46:03 -07:00
value: 'ARS',
},
{
name: 'AUD',
2020-10-22 06:46:03 -07:00
value: 'AUD',
},
{
name: 'BRL',
2020-10-22 06:46:03 -07:00
value: 'BRL',
},
{
name: 'CAD',
2020-10-22 06:46:03 -07:00
value: 'CAD',
},
{
name: 'CHF',
2020-10-22 06:46:03 -07:00
value: 'CHF',
},
{
name: 'CNY',
2020-10-22 06:46:03 -07:00
value: 'CNY',
},
{
name: 'CZK',
2020-10-22 06:46:03 -07:00
value: 'CZK',
},
{
name: 'DKK',
2020-10-22 06:46:03 -07:00
value: 'DKK',
},
{
name: 'EUR',
2020-10-22 06:46:03 -07:00
value: 'EUR',
},
{
name: 'GBP',
2020-10-22 06:46:03 -07:00
value: 'GBP',
},
{
name: 'HKD',
2020-10-22 06:46:03 -07:00
value: 'HKD',
},
{
name: 'HUF',
2020-10-22 06:46:03 -07:00
value: 'HUF',
},
{
name: 'INR',
2020-10-22 06:46:03 -07:00
value: 'INR',
},
{
name: 'JPY',
2020-10-22 06:46:03 -07:00
value: 'JPY',
},
{
name: 'KRW',
2020-10-22 06:46:03 -07:00
value: 'KRW',
},
{
name: 'MXN',
2020-10-22 06:46:03 -07:00
value: 'MXN',
},
{
name: 'NOK',
2020-10-22 06:46:03 -07:00
value: 'NOK',
},
{
name: 'NZD',
2020-10-22 06:46:03 -07:00
value: 'NZD',
},
{
name: 'PLN',
2020-10-22 06:46:03 -07:00
value: 'PLN',
},
{
name: 'RUB',
2020-10-22 06:46:03 -07:00
value: 'RUB',
},
{
name: 'SEK',
2020-10-22 06:46:03 -07:00
value: 'SEK',
},
{
name: 'SGD',
2020-10-22 06:46:03 -07:00
value: 'SGD',
},
{
name: 'THB',
2020-10-22 06:46:03 -07:00
value: 'THB',
},
{
name: 'TWD',
2020-10-22 06:46:03 -07:00
value: 'TWD',
},
{
name: 'USD',
2020-10-22 06:46:03 -07:00
value: 'USD',
},
{
name: 'ZAR',
2020-10-22 06:46:03 -07:00
value: 'ZAR',
},
],
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`create`,
],
discountType: [
'flat',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
},
{
displayName: 'JSON Parameters',
name: 'jsonParameters',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'create',
],
},
},
},
{
displayName: ' Additional Fields',
name: 'additionalFieldsJson',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'create',
],
jsonParameters: [
true,
],
},
},
description: `Attributes in JSON form.`,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'create',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
default: {},
options: [
{
displayName: 'Allowed Uses',
name: 'allowedUses',
type: 'number',
default: 1,
description: 'Number of times a coupon can be used in a checkout. This will be set to 999,999 by default, if not specified.',
},
{
displayName: 'Coupon Code',
name: 'couponCode',
type: 'string',
default: '',
description: 'Will be randomly generated if not specified.',
},
{
displayName: 'Coupon Prefix',
name: 'couponPrefix',
type: 'string',
default: '',
description: 'Prefix for generated codes. Not valid if coupon_code is specified.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'Description of the coupon. This will be displayed in the Seller Dashboard.',
},
{
displayName: 'Expires',
name: 'expires',
type: 'dateTime',
default: '',
description: 'The coupon will expire on the date at 00:00:00 UTC.',
},
{
displayName: 'Group',
name: 'group',
type: 'string',
typeOptions: {
minValue: 1,
2020-10-22 06:46:03 -07:00
maxValue: 50,
},
default: '',
description: 'The name of the coupon group this coupon should be assigned to.',
},
{
displayName: 'Number of Coupons',
name: 'numberOfCoupons',
type: 'number',
default: 1,
description: 'Number of coupons to generate. Not valid if coupon_code is specified.',
},
{
displayName: 'Recurring',
name: 'recurring',
type: 'boolean',
default: false,
description: 'If the coupon is used on subscription products, this indicates whether the discount should apply to recurring payments after the initial purchase.',
},
],
},
/* -------------------------------------------------------------------------- */
/* coupon:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Product ID',
name: 'productId',
type: 'string',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`getAll`,
],
},
},
default: '',
required: true,
description: 'The specific product/subscription ID.',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'coupon',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'coupon',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 500,
},
default: 100,
description: 'How many results to return.',
},
/* -------------------------------------------------------------------------- */
/* coupon:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Update by',
name: 'updateBy',
type: 'options',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
`update`,
],
jsonParameters: [
false,
],
},
},
default: 'couponCode',
description: 'Either flat or percentage.',
options: [
{
name: 'Coupon Code',
2020-10-22 06:46:03 -07:00
value: 'couponCode',
},
{
name: 'Group',
2020-10-22 06:46:03 -07:00
value: 'group',
},
2020-10-22 06:46:03 -07:00
],
},
{
displayName: 'Coupon Code',
name: 'couponCode',
type: 'string',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
'update',
],
updateBy: [
2020-10-22 06:46:03 -07:00
'couponCode',
],
jsonParameters: [
false,
],
},
},
default: '',
description: 'Identify the coupon to update',
},
{
displayName: 'Group',
name: 'group',
type: 'string',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
2020-10-22 06:46:03 -07:00
'update',
],
updateBy: [
2020-10-22 06:46:03 -07:00
'group',
],
jsonParameters: [
false,
],
},
},
default: '',
description: 'The name of the group of coupons you want to update.',
},
{
displayName: 'JSON Parameters',
name: 'jsonParameters',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'update',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFieldsJson',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
},
default: '',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'update',
],
jsonParameters: [
true,
],
},
},
description: `Attributes in JSON form.`,
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
resource: [
'coupon',
],
operation: [
'update',
],
jsonParameters: [
2020-10-22 06:46:03 -07:00
false,
],
},
},
default: {},
options: [
{
displayName: 'Allowed Uses',
name: 'allowedUses',
type: 'number',
default: 1,
description: 'Number of times a coupon can be used in a checkout. This will be set to 999,999 by default, if not specified.',
},
{
displayName: 'Discount',
name: 'discount',
type: 'fixedCollection',
refactor: Apply `eslint-plugin-n8n-nodes-base` autofixable rules (#3174) * :zap: Initial setup * :shirt: Update `.eslintignore` * :shirt: Autofix node-param-default-missing (#3173) * :fire: Remove duplicate key * :shirt: Add exceptions * :package: Update package-lock.json * :shirt: Apply `node-class-description-inputs-wrong-trigger-node` (#3176) * :shirt: Apply `node-class-description-inputs-wrong-regular-node` (#3177) * :shirt: Apply `node-class-description-outputs-wrong` (#3178) * :shirt: Apply `node-execute-block-double-assertion-for-items` (#3179) * :shirt: Apply `node-param-default-wrong-for-collection` (#3180) * :shirt: Apply node-param-default-wrong-for-boolean (#3181) * Autofixed default missing * Autofixed booleans, worked well * :zap: Fix params * :rewind: Undo exempted autofixes * :package: Update package-lock.json * :shirt: Apply node-class-description-missing-subtitle (#3182) * :zap: Fix missing comma * :shirt: Apply `node-param-default-wrong-for-fixed-collection` (#3184) * :shirt: Add exception for `node-class-description-missing-subtitle` * :shirt: Apply `node-param-default-wrong-for-multi-options` (#3185) * :shirt: Apply `node-param-collection-type-unsorted-items` (#3186) * Missing coma * :shirt: Apply `node-param-default-wrong-for-simplify` (#3187) * :shirt: Apply `node-param-description-comma-separated-hyphen` (#3190) * :shirt: Apply `node-param-description-empty-string` (#3189) * :shirt: Apply `node-param-description-excess-inner-whitespace` (#3191) * Rule looks good * Add whitespace rule in eslint config * :zao: fix * :shirt: Apply `node-param-description-identical-to-display-name` (#3193) * :shirt: Apply `node-param-description-missing-for-ignore-ssl-issues` (#3195) * :rewind: Revert ":zao: fix" This reverts commit ef8a76f3dfedffd1bdccf3178af8a8d90cf5a55c. * :shirt: Apply `node-param-description-missing-for-simplify` (#3196) * :shirt: Apply `node-param-description-missing-final-period` (#3194) * Rule working as intended * Add rule to eslint * :shirt: Apply node-param-description-missing-for-return-all (#3197) * :zap: Restore `lintfix` command Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com> Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: agobrech <ael.gobrecht@gmail.com> Co-authored-by: Michael Kret <michael.k@radency.com>
2022-04-22 09:29:51 -07:00
default: {},
options: [
{
displayName: 'Discount Properties',
name: 'discountProperties',
values: [
{
displayName: 'Currency',
name: 'currency',
type: 'options',
default: 'EUR',
description: 'The currency must match the balance currency specified in your account.',
displayOptions: {
show: {
discountType: [
'flat',
],
},
},
options: [
{
name: 'ARS',
2020-10-22 06:46:03 -07:00
value: 'ARS',
},
{
name: 'AUD',
2020-10-22 06:46:03 -07:00
value: 'AUD',
},
{
name: 'BRL',
2020-10-22 06:46:03 -07:00
value: 'BRL',
},
{
name: 'CAD',
2020-10-22 06:46:03 -07:00
value: 'CAD',
},
{
name: 'CHF',
2020-10-22 06:46:03 -07:00
value: 'CHF',
},
{
name: 'CNY',
2020-10-22 06:46:03 -07:00
value: 'CNY',
},
{
name: 'CZK',
2020-10-22 06:46:03 -07:00
value: 'CZK',
},
{
name: 'DKK',
2020-10-22 06:46:03 -07:00
value: 'DKK',
},
{
name: 'EUR',
2020-10-22 06:46:03 -07:00
value: 'EUR',
},
{
name: 'GBP',
2020-10-22 06:46:03 -07:00
value: 'GBP',
},
{
name: 'HKD',
2020-10-22 06:46:03 -07:00
value: 'HKD',
},
{
name: 'HUF',
2020-10-22 06:46:03 -07:00
value: 'HUF',
},
{
name: 'INR',
2020-10-22 06:46:03 -07:00
value: 'INR',
},
{
name: 'JPY',
2020-10-22 06:46:03 -07:00
value: 'JPY',
},
{
name: 'KRW',
2020-10-22 06:46:03 -07:00
value: 'KRW',
},
{
name: 'MXN',
2020-10-22 06:46:03 -07:00
value: 'MXN',
},
{
name: 'NOK',
2020-10-22 06:46:03 -07:00
value: 'NOK',
},
{
name: 'NZD',
2020-10-22 06:46:03 -07:00
value: 'NZD',
},
{
name: 'PLN',
2020-10-22 06:46:03 -07:00
value: 'PLN',
},
{
name: 'RUB',
2020-10-22 06:46:03 -07:00
value: 'RUB',
},
{
name: 'SEK',
2020-10-22 06:46:03 -07:00
value: 'SEK',
},
{
name: 'SGD',
2020-10-22 06:46:03 -07:00
value: 'SGD',
},
{
name: 'THB',
2020-10-22 06:46:03 -07:00
value: 'THB',
},
{
name: 'TWD',
2020-10-22 06:46:03 -07:00
value: 'TWD',
},
{
name: 'USD',
2020-10-22 06:46:03 -07:00
value: 'USD',
},
{
name: 'ZAR',
2020-10-22 06:46:03 -07:00
value: 'ZAR',
},
],
},
{
displayName: 'Discount Amount Currency',
name: 'discountAmount',
type: 'number',
default: '',
description: 'Discount amount.',
displayOptions: {
show: {
discountType: [
'flat',
],
},
},
typeOptions: {
2020-10-22 06:46:03 -07:00
minValue: 0,
},
},
{
displayName: 'Discount Amount Percentage',
name: 'discountAmount',
type: 'number',
default: '',
description: 'Discount amount.',
displayOptions: {
show: {
discountType: [
'percentage',
],
},
},
typeOptions: {
minValue: 0,
2020-10-22 06:46:03 -07:00
maxValue: 100,
},
},
{
displayName: 'Discount Type',
name: 'discountType',
type: 'options',
default: 'flat',
description: 'Either flat or percentage.',
options: [
{
name: 'Flat',
2020-10-22 06:46:03 -07:00
value: 'flat',
},
{
name: 'Percentage',
2020-10-22 06:46:03 -07:00
value: 'percentage',
},
2020-10-22 06:46:03 -07:00
],
},
],
},
],
},
{
displayName: 'Expires',
name: 'expires',
type: 'dateTime',
default: '',
description: 'The coupon will expire on the date at 00:00:00 UTC.',
},
{
displayName: 'New Coupon Code',
name: 'newCouponCode',
type: 'string',
default: '',
description: 'New code to rename the coupon to.',
},
{
displayName: 'New Group Name',
name: 'newGroup',
type: 'string',
typeOptions: {
minValue: 1,
2020-10-22 06:46:03 -07:00
maxValue: 50,
},
default: '',
description: 'New group name to move coupon to.',
},
{
displayName: 'Product IDs',
name: 'productIds',
type: 'string',
default: '',
description: 'Comma-separated list of products e.g. 499531,1234,123546. If blank then remove associated products.',
},
{
displayName: 'Recurring',
name: 'recurring',
type: 'boolean',
default: false,
description: 'If the coupon is used on subscription products, this indicates whether the discount should apply to recurring payments after the initial purchase.',
},
],
},
];