n8n/packages/nodes-base/nodes/Stripe/descriptions/CustomerCardDescription.ts

161 lines
2.7 KiB
TypeScript
Raw Normal View History

:sparkles: Add Stripe regular node (#1470) * :tada: Register node * :art: Add SVG icon * :zap: Add preliminary node stub * :zap: Add resource description stubs * :art: Fix SVG size and position * :zap: Implement charge operations * :zap: Implement customer operations * :art: Apply cosmetic changes * :zap: Fix customer address fields * :zap: Add stub and fields for invoice * :zap: Add invoice item stubs * :zap: Implement source operations * :zap: Reduce scope per feedback * :zap: Add continueOnFail functionality * :art: Prettify error thrown * :fire: Remove unused resource * :zap: Replace source in card with token * :hammer: Remove logging * :wrench: Fix shipping address in charge:create * :wrench: Load update fields for charge:update * :zap: Implement token:create to ease testing * :zap: Simplify card token fields * :zap: Update description parameters * :wrench: Fix field adjusters * :zap: Remove unused source options * :wrench: Fix shipping fields adjuster * :fire: Remove PNG icon * :fire: Remove logging * :hammer: Reorder address fields * :bug: Fix shipping field in charge:update * :lipstick: Apply cosmetic change * :zap: Small improvements * :zap: Fix lintings in main file * :zap: Lint all descriptions * :zap: Add target="_blank" attribute * :zap: Fix various lintings for charge * :zap: Fix lintings for coupon * :zap: Fix lintings for customer * :zap: Fix lintings for source * :zap: Fix lintings for token * :zap: Reorder address fields * :zap: Fix casing in credentials * :hammer: Place recipient name above address in shipping * :zap: Remove references to string in descriptions * :zap: Apply minor renamings * :fire: Remove logging * :hammer: Simplify error handling * :zap: Fix indentation * :zap: Move cardFields to root level for Token creation Co-authored-by: ricardo <ricardoespinoza105@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2021-07-10 04:15:14 -07:00
import {
INodeProperties,
} from 'n8n-workflow';
export const customerCardOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
default: 'get',
description: 'Operation to perform',
options: [
{
name: 'Add',
value: 'add',
description: 'Add a customer card',
},
{
name: 'Get',
value: 'get',
description: 'Get a customer card',
},
{
name: 'Remove',
value: 'remove',
description: 'Remove a customer card',
},
],
displayOptions: {
show: {
resource: [
'customerCard',
],
},
},
},
] as INodeProperties[];
export const customerCardFields = [
// ----------------------------------
// customerCard: add
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'ID of the customer to be associated with this card',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'add',
],
},
},
},
{
displayName: 'Card Token',
name: 'token',
type: 'string',
required: true,
default: '',
placeholder: 'tok_1IMfKdJhRTnqS5TKQVG1LI9o',
description: 'Token representing sensitive card information',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'add',
],
},
},
},
// ----------------------------------
// customerCard: remove
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'ID of the customer whose card to remove',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'remove',
],
},
},
},
{
displayName: 'Card ID',
name: 'cardId',
type: 'string',
required: true,
default: '',
description: 'ID of the card to remove',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'remove',
],
},
},
},
// ----------------------------------
// customerCard: get
// ----------------------------------
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
required: true,
default: '',
description: 'ID of the customer whose card to retrieve',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'get',
],
},
},
},
{
displayName: 'Source ID',
name: 'sourceId',
type: 'string',
required: true,
default: '',
description: 'ID of the source to retrieve',
displayOptions: {
show: {
resource: [
'customerCard',
],
operation: [
'get',
],
},
},
},
] as INodeProperties[];