diff --git a/packages/nodes-base/nodes/Stripe/Stripe.node.ts b/packages/nodes-base/nodes/Stripe/Stripe.node.ts index 06eb3577ab..6127f1fe16 100644 --- a/packages/nodes-base/nodes/Stripe/Stripe.node.ts +++ b/packages/nodes-base/nodes/Stripe/Stripe.node.ts @@ -255,7 +255,7 @@ export class Stripe implements INodeType { // charge: getAll // ---------------------------------- - responseData = await handleListing.call(this, resource); + responseData = await handleListing.call(this, resource, i); } else if (operation === 'update') { @@ -313,7 +313,7 @@ export class Stripe implements INodeType { // coupon: getAll // ---------------------------------- - responseData = await handleListing.call(this, resource); + responseData = await handleListing.call(this, resource, i); } @@ -374,7 +374,7 @@ export class Stripe implements INodeType { qs.email = filters.email; } - responseData = await handleListing.call(this, resource, qs); + responseData = await handleListing.call(this, resource, i, qs); } else if (operation === 'update') { diff --git a/packages/nodes-base/nodes/Stripe/descriptions/TokenDescription.ts b/packages/nodes-base/nodes/Stripe/descriptions/TokenDescription.ts index 591a438dd0..ae454bf79c 100644 --- a/packages/nodes-base/nodes/Stripe/descriptions/TokenDescription.ts +++ b/packages/nodes-base/nodes/Stripe/descriptions/TokenDescription.ts @@ -43,6 +43,16 @@ export const tokenFields = [ value: 'cardToken', }, ], + displayOptions: { + show: { + resource: [ + 'token', + ], + operation: [ + 'create', + ], + }, + }, }, { displayName: 'Card Number', diff --git a/packages/nodes-base/nodes/Stripe/helpers.ts b/packages/nodes-base/nodes/Stripe/helpers.ts index c7ec812a4a..cbf163bb60 100644 --- a/packages/nodes-base/nodes/Stripe/helpers.ts +++ b/packages/nodes-base/nodes/Stripe/helpers.ts @@ -154,19 +154,25 @@ export async function loadResource( export async function handleListing( this: IExecuteFunctions, resource: string, + i: number, qs: IDataObject = {}, ) { + const returnData: IDataObject[] = []; let responseData; - responseData = await stripeApiRequest.call(this, 'GET', `/${resource}s`, qs, {}); - responseData = responseData.data; + const returnAll = this.getNodeParameter('returnAll', i) as boolean; + const limit = this.getNodeParameter('limit', i, 0) as number; - const returnAll = this.getNodeParameter('returnAll', 0) as boolean; + do { + responseData = await stripeApiRequest.call(this, 'GET', `/${resource}s`, {}, qs); + returnData.push(...responseData.data); - if (!returnAll) { - const limit = this.getNodeParameter('limit', 0) as number; - responseData = responseData.slice(0, limit); - } + if (!returnAll && returnData.length >= limit) { + return returnData.slice(0, limit); + } - return responseData; + qs.starting_after = returnData[returnData.length - 1].id; + } while (responseData.has_more); + + return returnData; }