From 14798653758c7bb50334e21b669f89df02f14bdb Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Tue, 26 Nov 2024 11:19:01 +0200 Subject: [PATCH] squash Resolves: # Change-type: --- src/models/billing.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/models/billing.ts b/src/models/billing.ts index f953faaa6..4592cefce 100644 --- a/src/models/billing.ts +++ b/src/models/billing.ts @@ -276,7 +276,9 @@ const getBillingModel = function ( * @function * @memberof balena.models.billing * - * @param {(String|Number)} organization - handle (string) or id (number) of the target organization. + * @param {Object} setupIntentParams - an object containing the parameters for the setup intent creation + * @param {(String|Number)} extraParams.organization - handle (string) or id (number) of the target organization. + * @param {(String|undefined)} [extraParams.'g-recaptcha-response'] - the captcha response * * @fulfil {Object} - partial stripe setup intent object * @returns {Promise} @@ -286,9 +288,13 @@ const getBillingModel = function ( * console.log(setupIntent); * }); */ - createSetupIntent: async ( - organization: string | number, - ): Promise<{ + createSetupIntent: async ({ + organization, + ...extraParams + }: { + organization: string | number; + 'g-recaptcha-response'?: string; + }): Promise<{ id: string; client_secret: string; }> => { @@ -298,6 +304,7 @@ const getBillingModel = function ( method: 'POST', url: `/billing/v1/account/${orgId}/setup-intent`, baseUrl: apiUrl, + body: extraParams, }); return body; },