n8n/packages/nodes-base/nodes/Stripe/descriptions/SourceDescription.ts
Iván Ovejero 6dcdb30bf4
refactor: Apply more nodelinting rules (#3324)
* ✏️ Alphabetize lint rules

* 🔥 Remove duplicates

*  Update `lintfix` script

* 👕 Apply `node-param-operation-without-no-data-expression` (#3329)

* 👕 Apply `node-param-operation-without-no-data-expression`

* 👕 Add exceptions

* 👕 Apply `node-param-description-weak` (#3328)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-value-duplicate` (#3331)

* 👕 Apply `node-param-description-miscased-json` (#3337)

* 👕 Apply `node-param-display-name-excess-inner-whitespace` (#3335)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-type-options-missing-from-limit` (#3336)

* Rule workig as intended

* ✏️ Uncomment rules

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-name-duplicate` (#3338)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-description-wrong-for-simplify` (#3334)

*  fix

*  exceptions

*  changed rule ignoring from file to line

* 👕 Apply `node-param-resource-without-no-data-expression` (#3339)

* 👕 Apply `node-param-display-name-untrimmed` (#3341)

* 👕 Apply `node-param-display-name-miscased-id` (#3340)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-resource-with-plural-option` (#3342)

* 👕 Apply `node-param-description-wrong-for-upsert` (#3333)

*  fix

*  replaced record with contact in description

*  fix

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* 👕 Apply `node-param-option-description-identical-to-name` (#3343)

* 👕 Apply `node-param-option-name-containing-star` (#3347)

* 👕 Apply `node-param-display-name-wrong-for-update-fields` (#3348)

* 👕 Apply `node-param-option-name-wrong-for-get-all` (#3345)

*  fix

*  exceptions

* 👕 Apply node-param-display-name-wrong-for-simplify (#3344)

* Rule working as intended

* Uncomented other rules

* 👕 Undo and add exceptions

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

*  Alphabetize lint rules

*  Restore `lintfix` script

Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com>
Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
2022-05-20 23:47:24 +02:00

247 lines
4.3 KiB
TypeScript

import {
INodeProperties,
} from 'n8n-workflow';
export const sourceOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
default: 'get',
options: [
{
name: 'Create',
value: 'create',
description: 'Create a source',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a source',
},
{
name: 'Get',
value: 'get',
description: 'Get a source',
},
],
displayOptions: {
show: {
resource: [
'source',
],
},
},
},
];
export const sourceFields: INodeProperties[] = [
// ----------------------------------
// source: create
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'ID of the customer to attach the source to',
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Type',
name: 'type',
type: 'options',
required: true,
default: 'wechat',
description: 'Type of source (payment instrument) to create',
options: [
{
name: 'WeChat',
value: 'wechat',
},
],
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Amount',
name: 'amount',
type: 'number',
default: 0,
description: 'Amount in cents to be collected for this charge, e.g. enter <code>100</code> for $1.00',
typeOptions: {
minValue: 0,
maxValue: 99999999,
},
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Currency',
name: 'currency',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCurrencies',
},
default: '',
description: 'Three-letter ISO currency code, e.g. <code>USD</code> or <code>EUR</code>. It must be a <a href="https://stripe.com/docs/currencies">Stripe-supported currency</a>.',
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'create',
],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'create',
],
},
},
options: [
{
displayName: 'Metadata',
name: 'metadata',
type: 'fixedCollection',
placeholder: 'Add Metadata Item',
description: 'Set of key-value pairs to attach to the source to create',
default: {},
typeOptions: {
multipleValues: true,
},
options: [
{
displayName: 'Metadata Properties',
name: 'metadataProperties',
values: [
{
displayName: 'Key',
name: 'key',
type: 'string',
default: '',
},
{
displayName: 'Value',
name: 'value',
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Statement Descriptor',
name: 'statement_descriptor',
type: 'string',
default: '',
description: 'Arbitrary text to display on the customer\'s statement',
},
],
},
// ----------------------------------
// source: delete
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'ID of the customer whose source to delete',
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'delete',
],
},
},
},
{
displayName: 'Source ID',
name: 'sourceId',
type: 'string',
required: true,
default: '',
description: 'ID of the source to delete',
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'delete',
],
},
},
},
// ----------------------------------
// source: get
// ----------------------------------
{
displayName: 'Source ID',
name: 'sourceId',
type: 'string',
required: true,
default: '',
description: 'ID of the source to retrieve',
displayOptions: {
show: {
resource: [
'source',
],
operation: [
'get',
],
},
},
},
];