2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-08-25 01:50:39 -07:00
2021-12-03 00:44:16 -08:00
export const paymentOperations : INodeProperties [ ] = [
2020-08-25 01:50:39 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-08-25 01:50:39 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
options : [
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-08-25 01:50:39 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many payments' ,
2022-09-08 08:10:13 -07:00
action : 'Get many payments' ,
2020-08-25 01:50:39 -07:00
} ,
{
name : 'Reschedule' ,
value : 'reschedule' ,
2022-05-06 14:01:25 -07:00
description : 'Reschedule payment' ,
2022-07-10 13:50:51 -07:00
action : 'Reschedule a payment' ,
2020-10-22 06:46:03 -07:00
} ,
2020-08-25 01:50:39 -07:00
] ,
default : 'getAll' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-08-25 01:50:39 -07:00
2021-12-03 00:44:16 -08:00
export const paymentFields : INodeProperties [ ] = [
2020-08-25 01:51:16 -07:00
/* -------------------------------------------------------------------------- */
/* payment:getAll */
/* -------------------------------------------------------------------------- */
2020-08-25 01:50:39 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'payment' ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'payment' ] ,
returnAll : [ false ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
operation : [ 'getAll' ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
} ,
{
2020-08-25 01:51:16 -07:00
displayName : 'Additional Fields' ,
2020-08-25 01:50:39 -07:00
name : 'additionalFieldsJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
operation : [ 'getAll' ] ,
jsonParameters : [ true ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Attributes in JSON form' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
operation : [ 'getAll' ] ,
jsonParameters : [ false ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Date From' ,
name : 'from' ,
type : 'dateTime' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'Payment starting from date' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Date To' ,
name : 'to' ,
type : 'dateTime' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'Payment up until date' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Is Paid' ,
name : 'isPaid' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether payment is paid' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Plan ID' ,
name : 'plan' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filter: The product/plan ID (single or comma-separated values)' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Subscription ID' ,
name : 'subscriptionId' ,
type : 'number' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A specific user subscription ID' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'State' ,
name : 'state' ,
type : 'options' ,
default : 'active' ,
2022-08-17 08:50:24 -07:00
description :
'Filter: The user subscription status. Returns all active, past_due, trialing and paused subscription plans if not specified.' ,
2020-08-25 01:50:39 -07:00
options : [
{
name : 'Active' ,
2020-10-22 06:46:03 -07:00
value : 'active' ,
2020-08-25 01:50:39 -07:00
} ,
{
name : 'Past Due' ,
2020-10-22 06:46:03 -07:00
value : 'past_due' ,
2020-08-25 01:50:39 -07:00
} ,
{
name : 'Paused' ,
2020-10-22 06:46:03 -07:00
value : 'paused' ,
2020-08-25 01:50:39 -07:00
} ,
{
name : 'Trialing' ,
2020-10-22 06:46:03 -07:00
value : 'trialing' ,
2020-08-25 01:50:39 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-25 01:50:39 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'One Off Charge' ,
2020-08-25 01:50:39 -07:00
name : 'isOneOffCharge' ,
type : 'boolean' ,
default : false ,
} ,
] ,
} ,
2020-08-25 01:51:16 -07:00
/* -------------------------------------------------------------------------- */
/* payment:reschedule */
/* -------------------------------------------------------------------------- */
2020-08-25 01:50:39 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Payment Name or ID' ,
2020-08-25 01:50:39 -07:00
name : 'paymentId' ,
type : 'options' ,
typeOptions : {
2023-04-12 06:46:11 -07:00
loadOptionsMethod : 'getPayments' ,
2020-08-25 01:50:39 -07:00
} ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
operation : [ 'reschedule' ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'The upcoming subscription payment ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2020-08-25 01:50:39 -07:00
} ,
{
displayName : 'Date' ,
name : 'date' ,
type : 'dateTime' ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'payment' ] ,
operation : [ 'reschedule' ] ,
2020-08-25 01:50:39 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Date you want to move the payment to' ,
2020-08-25 01:50:39 -07:00
} ,
2021-12-03 00:44:16 -08:00
] ;