From aa4873d6770b13a9531572c6fcdea18553643274 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Tue, 27 Aug 2024 14:27:00 +0200 Subject: [PATCH 1/2] feat(payments): add quantity param for create subscription --- package.json | 2 +- src/drive/payments/index.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cf51379..8903bd5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@internxt/sdk", - "version": "1.5.13", + "version": "1.5.14", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", diff --git a/src/drive/payments/index.ts b/src/drive/payments/index.ts index 4e8fc2d..1e8308a 100644 --- a/src/drive/payments/index.ts +++ b/src/drive/payments/index.ts @@ -57,6 +57,7 @@ export class Payments { customerId: string, priceId: string, token: string, + quantity: number, currency?: string, promoCodeId?: string, ): Promise { @@ -66,6 +67,7 @@ export class Payments { customerId, priceId, token, + quantity, currency, promoCodeId, }, From 0f80cbe2f10be8e6c308ebc4d8b13760f7915527 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+masterprog-cmd@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:34:00 +0200 Subject: [PATCH 2/2] feat(payments): send country and companyVatId to create a customer --- src/drive/payments/index.ts | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/drive/payments/index.ts b/src/drive/payments/index.ts index 1e8308a..d5b101a 100644 --- a/src/drive/payments/index.ts +++ b/src/drive/payments/index.ts @@ -34,23 +34,13 @@ export class Payments { this.apiSecurity = apiSecurity; } - private createCustomer(name: string, email: string): Promise<{ customerId: string; token: string }> { - return this.client.post('/create-customer', { name, email }, this.headers()); - } - - public getCustomerId(name: string, email: string): Promise<{ customerId: string; token: string }> { - const query = new URLSearchParams(); - query.set('email', email); - return this.client - .get<{ customerId: string; token: string }>(`/get-customer-id?${query.toString()}`, this.headers()) - .catch((err) => { - const error = err as AppError; - if (error.status === 404) { - return this.createCustomer(name, email); - } else { - throw error; - } - }); + public createCustomer( + name: string, + email: string, + country?: string, + companyVatId?: string, + ): Promise<{ customerId: string; token: string }> { + return this.client.post('/create-customer', { name, email, country, companyVatId }, this.headers()); } public createSubscription(