@internxt/sdk 1.11.15 → 1.11.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { CreatedSubscriptionData } from '../drive/payments/types/types';
2
2
  import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
3
- import { CreatePaymentIntentPayload, CreateSubscriptionPayload, CryptoCurrency, GetPriceByIdPayload, PaymentIntent, PriceWithTax } from './types';
3
+ import { CreateCustomerPayload, CreatePaymentIntentPayload, CreateSubscriptionPayload, CryptoCurrency, GetPriceByIdPayload, PaymentIntent, PriceWithTax } from './types';
4
4
  export declare class Checkout {
5
5
  private readonly client;
6
6
  private readonly appDetails;
@@ -9,18 +9,18 @@ export declare class Checkout {
9
9
  private constructor();
10
10
  /**
11
11
  * @description Creates a customer or gets the existing one if it already exists
12
+ * @param customerName - The name of the customer
13
+ * @param lineAddress1 - The address of the user
14
+ * @param lineAddress2 - The address of the user
15
+ * @param postalCode - The postal code of the city where the user lives
16
+ * @param city - The city of the user
12
17
  * @param country - The country of the customer
13
18
  * @param postalCode - The postal code of the customer
19
+ * @param captchaToken - The captcha token to verify the call
14
20
  * @param companyVatId - The VAT ID of the company (optional)
15
21
  * @returns The customer ID and the user token used to create a subscription or payment intent
16
22
  */
17
- getCustomerId({ customerName, postalCode, country, captchaToken, companyVatId, }: {
18
- customerName: string;
19
- postalCode: string;
20
- country: string;
21
- captchaToken: string;
22
- companyVatId?: string;
23
- }): Promise<{
23
+ createCustomer({ customerName, lineAddress1, lineAddress2, postalCode, city, country, captchaToken, companyVatId, }: CreateCustomerPayload): Promise<{
24
24
  customerId: string;
25
25
  token: string;
26
26
  }>;
@@ -25,21 +25,29 @@ var Checkout = /** @class */ (function () {
25
25
  };
26
26
  /**
27
27
  * @description Creates a customer or gets the existing one if it already exists
28
+ * @param customerName - The name of the customer
29
+ * @param lineAddress1 - The address of the user
30
+ * @param lineAddress2 - The address of the user
31
+ * @param postalCode - The postal code of the city where the user lives
32
+ * @param city - The city of the user
28
33
  * @param country - The country of the customer
29
34
  * @param postalCode - The postal code of the customer
35
+ * @param captchaToken - The captcha token to verify the call
30
36
  * @param companyVatId - The VAT ID of the company (optional)
31
37
  * @returns The customer ID and the user token used to create a subscription or payment intent
32
38
  */
33
- Checkout.prototype.getCustomerId = function (_a) {
34
- var customerName = _a.customerName, postalCode = _a.postalCode, country = _a.country, captchaToken = _a.captchaToken, companyVatId = _a.companyVatId;
35
- var query = new URLSearchParams();
36
- query.set('customerName', customerName);
37
- query.set('country', country);
38
- query.set('postalCode', postalCode);
39
- query.set('captchaToken', captchaToken);
40
- if (companyVatId !== undefined)
41
- query.set('companyVatId', companyVatId);
42
- return this.client.get("/checkout/customer?".concat(query.toString()), this.authHeaders());
39
+ Checkout.prototype.createCustomer = function (_a) {
40
+ var customerName = _a.customerName, lineAddress1 = _a.lineAddress1, lineAddress2 = _a.lineAddress2, postalCode = _a.postalCode, city = _a.city, country = _a.country, captchaToken = _a.captchaToken, companyVatId = _a.companyVatId;
41
+ return this.client.post('/checkout/customer', {
42
+ customerName: customerName,
43
+ city: city,
44
+ lineAddress1: lineAddress1,
45
+ lineAddress2: lineAddress2,
46
+ country: country,
47
+ postalCode: postalCode,
48
+ captchaToken: captchaToken,
49
+ companyVatId: companyVatId,
50
+ }, this.authHeaders());
43
51
  };
44
52
  /**
45
53
  * @description Creates a subscription for a given customer
@@ -1,4 +1,14 @@
1
1
  import { UserType } from '../../drive/payments/types/types';
2
+ export interface CreateCustomerPayload {
3
+ customerName: string;
4
+ lineAddress1: string;
5
+ lineAddress2?: string;
6
+ city: string;
7
+ country: string;
8
+ postalCode: string;
9
+ captchaToken: string;
10
+ companyVatId?: string;
11
+ }
2
12
  export interface CreateSubscriptionPayload {
3
13
  customerId: string;
4
14
  priceId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.11.15",
4
+ "version": "1.11.16",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",