Skip to content

Commit

Permalink
Merge pull request #234 from internxt/feature/PB-2437-change-plan-b2b
Browse files Browse the repository at this point in the history
[PB-2437]: feature/Add possibility to update b2b subscription plan
  • Loading branch information
CandelR authored Aug 12, 2024
2 parents dab87aa + bb47fed commit 9e0ba81
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/sdk",
"version": "1.5.8",
"version": "1.5.9",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
29 changes: 17 additions & 12 deletions src/drive/payments/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
import { headersWithToken } from '../../shared/headers';
import { HttpClient } from '../../shared/http/client';
import AppError from '../../shared/types/errors';
import {
CreateCheckoutSessionPayload,
CreatedSubscriptionData,
CreatePaymentSessionPayload,
CustomerBillingInfo,
DisplayPrice,
FreeTrialAvailable,
Invoice,
InvoicePayload,
PaymentMethod,
ProductData,
UserSubscription,
FreeTrialAvailable,
RedeemCodePayload,
UpdateSubscriptionPaymentMethod,
UserSubscription,
UserType,
InvoicePayload,
CustomerBillingInfo,
CreatedSubscriptionData,
} from './types';
import { HttpClient } from '../../shared/http/client';
import AppError from '../../shared/types/errors';

export class Payments {
private readonly client: HttpClient;
Expand Down Expand Up @@ -183,11 +183,16 @@ export class Payments {
return this.client.post('/subscriptions/update-payment-method', { ...payload }, this.headers());
}

public updateSubscriptionPrice(
priceId: string,
couponCode?: string,
): Promise<{ userSubscription: UserSubscription; request3DSecure: boolean; clientSecret: string }> {
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode }, this.headers());
public updateSubscriptionPrice({
priceId,
couponCode,
userType,
}: {
priceId: string;
couponCode?: string;
userType: UserType;
}): Promise<{ userSubscription: UserSubscription; request3DSecure: boolean; clientSecret: string }> {
return this.client.put('/subscriptions', { price_id: priceId, couponCode: couponCode, userType }, this.headers());
}

public cancelSubscription(userType?: UserType): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/workspaces/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ describe('Workspaces service tests', () => {

await client.deleteTeam({ workspaceId, teamId });

expect(deleteCall.firstCall.args).toEqual([`/workspaces/${workspaceId}/teams/${teamId}`, headers]);
expect(deleteCall.firstCall.args).toEqual([`workspaces/${workspaceId}/teams/${teamId}`, headers]);
});
});

Expand Down

0 comments on commit 9e0ba81

Please sign in to comment.