Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <[email protected]>",
"version": "1.9.21",
"version": "1.9.22",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
24 changes: 23 additions & 1 deletion src/drive/payments/object-storage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PaymentMethodVerification, PaymentMethodVerificationPayload } from 'src/payments/types';
import { ApiUrl, AppDetails } from '../../shared';
import { basicHeaders } from '../../shared/headers';
import { HttpClient } from '../../shared/http/client';
Expand Down Expand Up @@ -27,7 +28,7 @@ export class ObjectStorage {

public getObjectStoragePlanById(priceId: string, currency?: string): Promise<ObjectStoragePlan> {
const query = new URLSearchParams();
priceId !== undefined && query.set('planId', priceId);
query.set('planId', priceId);
currency !== undefined && query.set('currency', currency);
return this.client.get(`/object-storage/price?${query.toString()}`, this.headers());
}
Expand Down Expand Up @@ -64,6 +65,7 @@ export class ObjectStorage {
priceId,
currency,
token,

promoCodeId,
}: {
customerId: string;
Expand All @@ -85,6 +87,26 @@ export class ObjectStorage {
);
}

public paymentMethodVerification({
customerId,
token,
currency = 'eur',
priceId,
paymentMethod,
}: PaymentMethodVerificationPayload): Promise<PaymentMethodVerification> {
return this.client.post(
'/payment-method-verification',
{
customerId,
token,
currency,
priceId,
paymentMethod,
},
this.headers(),
);
}

private headers() {
return basicHeaders(this.appDetails.clientName, this.appDetails.clientVersion);
}
Expand Down
14 changes: 14 additions & 0 deletions src/payments/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ export interface CreatePaymentIntentPayload {
promoCodeId?: string;
}

export interface PaymentMethodVerificationPayload {
customerId: string;
token: string;
paymentMethod: string;
priceId: string;
currency?: string;
}

export interface PaymentMethodVerification {
intentId: string;
verified: boolean;
clientSecret?: string;
}

export interface GetPriceByIdPayload {
priceId: string;
promoCodeName?: string;
Expand Down