Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.16",
"version": "1.9.17",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions src/drive/payments/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ export type CreatedSubscriptionData = {
paymentIntentId?: string;
};

export type CreatedPaymentIntent = { clientSecret: string; id: string; invoiceStatus?: string };

export type AvailableProducts = {
featuresPerService: {
antivirus: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * as Shared from './shared';
export * as Workspaces from './workspaces';
export * from './meet';
export * as Payments from './payments';
export * from './misc';
1 change: 1 addition & 0 deletions src/misc/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './location';
11 changes: 11 additions & 0 deletions src/misc/location/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { HttpClient } from '../../shared/http/client';

export interface UserLocation {
ip: string;
location: string;
}

export const getUserLocation = async (apiUrl: string): Promise<UserLocation> => {
const client = HttpClient.create(apiUrl);
return client.get<UserLocation>(`${apiUrl}`, {});
};
14 changes: 7 additions & 7 deletions src/payments/checkout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CreatedSubscriptionData } from '../drive/payments/types/types';
import { CreatedPaymentIntent, CreatedSubscriptionData } from '../drive/payments/types/types';
import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
import { basicHeaders, headersWithToken } from '../shared/headers';
import { HttpClient } from '../shared/http/client';
Expand Down Expand Up @@ -27,24 +27,24 @@ export class Checkout {
* @returns The customer ID and the user token used to create a subscription or payment intent
*/
public getCustomerId({
country,
customerName,
postalCode,
country,
companyVatId,
companyName,
}: {
country: string;
customerName: string;
postalCode: string;
country: string;
companyVatId?: string;
companyName?: string;
}): Promise<{
customerId: string;
token: string;
}> {
const query = new URLSearchParams();
query.set('customerName', customerName);
query.set('country', country);
query.set('postalCode', postalCode);
if (companyVatId !== undefined) query.set('companyVatId', companyVatId);
if (companyName !== undefined) query.set('companyName', companyName);
return this.client.get(`/checkout/customer?${query.toString()}`, this.authHeaders());
}

Expand Down Expand Up @@ -102,7 +102,7 @@ export class Checkout {
token,
currency,
promoCodeId,
}: CreatePaymentIntentPayload): Promise<{ clientSecret: string; id: string; invoiceStatus?: string }> {
}: CreatePaymentIntentPayload): Promise<CreatedPaymentIntent> {
return this.client.post(
'/checkout/payment-intent',
{
Expand Down