@tonder.io/ionic-lite-sdk 0.0.35-beta.3 → 0.0.35-beta.30

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.
Files changed (52) hide show
  1. package/README.md +425 -114
  2. package/dist/classes/BaseInlineCheckout.d.ts +19 -18
  3. package/dist/classes/errorResponse.d.ts +1 -1
  4. package/dist/classes/liteCheckout.d.ts +11 -42
  5. package/dist/data/businessApi.d.ts +1 -1
  6. package/dist/data/cardApi.d.ts +1 -1
  7. package/dist/data/checkoutApi.d.ts +2 -1
  8. package/dist/data/customerApi.d.ts +1 -1
  9. package/dist/data/paymentMethodApi.d.ts +2 -2
  10. package/dist/helpers/skyflow.d.ts +1 -1
  11. package/dist/index.d.ts +3 -1
  12. package/dist/index.js +1 -1
  13. package/dist/types/card.d.ts +1 -0
  14. package/dist/types/checkout.d.ts +2 -1
  15. package/dist/types/commons.d.ts +8 -3
  16. package/dist/types/customer.d.ts +10 -0
  17. package/dist/types/liteInlineCheckout.d.ts +151 -0
  18. package/dist/types/transaction.d.ts +101 -0
  19. package/package.json +3 -1
  20. package/src/classes/BaseInlineCheckout.ts +67 -41
  21. package/src/classes/errorResponse.ts +1 -1
  22. package/src/classes/liteCheckout.ts +49 -87
  23. package/src/data/businessApi.ts +1 -1
  24. package/src/data/cardApi.ts +1 -5
  25. package/src/data/checkoutApi.ts +3 -6
  26. package/src/data/customerApi.ts +1 -1
  27. package/src/data/paymentMethodApi.ts +2 -2
  28. package/src/helpers/skyflow.ts +1 -1
  29. package/src/helpers/utils.ts +1 -1
  30. package/src/index.ts +9 -1
  31. package/src/types/card.ts +1 -0
  32. package/src/types/checkout.ts +2 -1
  33. package/src/types/commons.ts +104 -99
  34. package/src/types/customer.ts +10 -0
  35. package/src/types/liteInlineCheckout.ts +215 -0
  36. package/src/types/transaction.ts +101 -0
  37. package/tests/classes/liteCheckout.test.ts +2 -2
  38. package/tests/methods/createOrder.test.ts +3 -4
  39. package/tests/methods/createPayment.test.ts +2 -3
  40. package/tests/methods/customerRegister.test.ts +3 -4
  41. package/tests/methods/getBusiness.test.ts +2 -3
  42. package/tests/methods/getCustomerCards.test.ts +2 -3
  43. package/tests/methods/registerCustomerCard.test.ts +2 -2
  44. package/tests/methods/startCheckoutRouter.test.ts +2 -2
  45. package/tests/methods/startCheckoutRouterFull.test.ts +2 -2
  46. package/.idea/aws.xml +0 -17
  47. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  48. package/.idea/prettier.xml +0 -6
  49. package/.idea/vcs.xml +0 -6
  50. package/.idea/workspace.xml +0 -128
  51. package/src/types/index.d.ts +0 -10
  52. package/src/types/liteInlineCheckout.d.ts +0 -191
@@ -0,0 +1,101 @@
1
+ export interface ITransaction {
2
+ id: number;
3
+ provider: string;
4
+ country: string;
5
+ currency_code: string;
6
+ transaction_status: string;
7
+ created: string;
8
+ modified: string;
9
+ operation_date: string;
10
+ transaction_reference: string;
11
+ transaction_type: string;
12
+ status: string;
13
+ amount: string;
14
+ related_transaction_reference?: null | string;
15
+ reason?: null | string;
16
+ is_refunded?: null | boolean;
17
+ is_disputed?: null | boolean;
18
+ number_of_payment_attempts: number;
19
+ card_brand?: null | string;
20
+ number_of_installments: number;
21
+ payment?: {
22
+ id: number;
23
+ created: string;
24
+ modified: string;
25
+ amount: string;
26
+ status: string;
27
+ date: string;
28
+ paid_date: null | string;
29
+ source: null | string;
30
+ customer_order_reference: null | string;
31
+ client: number;
32
+ business: number;
33
+ shipping_address?: null | string;
34
+ billing_address?: null | string;
35
+ order: number;
36
+ };
37
+ checkout: {
38
+ id: string;
39
+ created: string;
40
+ modified: string;
41
+ checkout_data: {
42
+ name: string;
43
+ amount: number;
44
+ source: string;
45
+ id_ship: string;
46
+ currency: string;
47
+ order_id: number;
48
+ token_id: string;
49
+ last_name: string;
50
+ id_product: string;
51
+ ip_address: string;
52
+ payment_id: number;
53
+ return_url: string;
54
+ title_ship: string;
55
+ business_id: number;
56
+ checkout_id: string;
57
+ description: string;
58
+ browser_info: {
59
+ language: string;
60
+ time_zone: number;
61
+ user_agent: string;
62
+ color_depth: number;
63
+ screen_width: number;
64
+ screen_height: number;
65
+ javascript_enabled: boolean;
66
+ };
67
+ email_client: string;
68
+ phone_number: string;
69
+ instance_id_ship: string;
70
+ quantity_product: number;
71
+ device_session_id: null | string;
72
+ number_of_payment_attempts: number;
73
+ };
74
+ number_of_payment_attempts: number;
75
+ tried_psps: string[];
76
+ rejected_transactions: string[];
77
+ routing_step: number;
78
+ route_length: number;
79
+ last_status: string;
80
+ ip_address: string;
81
+ is_dynamic_routing: boolean;
82
+ is_route_finished: boolean;
83
+ business: number;
84
+ payment: number;
85
+ };
86
+ currency: {
87
+ id: number;
88
+ name: string;
89
+ code: string;
90
+ symbol: string;
91
+ country: null | string;
92
+ };
93
+ payment_method?: null | {
94
+ id: number;
95
+ name: string;
96
+ display_name: string;
97
+ category: string;
98
+ is_apm: boolean;
99
+ };
100
+ issuing_country?: null | string;
101
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonder.io/ionic-lite-sdk",
3
- "version": "0.0.35-beta.3",
3
+ "version": "0.0.35-beta.30",
4
4
  "description": "Tonder ionic lite SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,6 +12,7 @@
12
12
  "author": "",
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
+ "lodash.get": "^4.4.2",
15
16
  "skyflow-js": "^1.34.1",
16
17
  "ts-node": "^10.9.2"
17
18
  },
@@ -24,6 +25,7 @@
24
25
  "@rollup/plugin-typescript": "11.1.6",
25
26
  "@types/crypto-js": "^4.2.2",
26
27
  "@types/jest": "^29.5.11",
28
+ "@types/lodash.get": "^4.4.9",
27
29
  "@types/node": "^20.11.5",
28
30
  "jest": "^29.7.0",
29
31
  "jest-environment-jsdom": "^29.7.0",
@@ -11,38 +11,31 @@ import {
11
11
  import { getOpenpayDeviceSessionID } from "../data/openPayApi";
12
12
  import { getBrowserInfo } from "../helpers/utils";
13
13
  import { registerOrFetchCustomer } from "../data/customerApi";
14
+ import { get } from "lodash";
14
15
  import {
15
- Business,
16
- ICustomer,
17
- IItem,
18
- IInlineCheckoutBaseOptions,
19
- IConfigureCheckout,
20
- IProcessPaymentRequest,
21
- IStartCheckoutResponse,
22
- StartCheckoutResponse,
23
- ICardFields,
24
- } from "../types";
16
+ fetchCustomerCards,
17
+ removeCustomerCard,
18
+ saveCustomerCard,
19
+ } from "../data/cardApi";
20
+ import { fetchCustomerPaymentMethods } from "../data/paymentMethodApi";
21
+ import {Business, IConfigureCheckout, IInlineCheckoutBaseOptions} from "../types/commons";
22
+ import {ICustomer} from "../types/customer";
23
+ import {ICardFields, IItem, IProcessPaymentRequest, IStartCheckoutResponse} from "../types/checkout";
24
+ import {ICustomerCardsResponse, ISaveCardResponse, ISaveCardSkyflowRequest} from "../types/card";
25
+ import {IPaymentMethodResponse} from "../types/paymentMethod";
26
+ import {ITransaction} from "../types/transaction";
25
27
  export class BaseInlineCheckout {
26
28
  baseUrl = "";
27
- cartTotal = "0";
29
+ cartTotal: string | number = "0";
28
30
  process3ds: ThreeDSHandler;
29
31
  mode?: "production" | "sandbox" | "stage" | "development" | undefined;
30
32
  apiKeyTonder: string;
31
- returnUrl: string;
32
- callBack?: ((response: any) => void) | undefined;
33
+ returnUrl?: string;
34
+ callBack?: ((response: IStartCheckoutResponse | Record<string, any>) => void) | undefined;
33
35
  merchantData?: Business;
34
36
  abortController: AbortController;
35
37
 
36
- firstName?: string;
37
- lastName?: string;
38
- country?: string;
39
- address?: string;
40
- city?: string;
41
- state?: string;
42
- postCode?: string;
43
- email?: string;
44
- phone?: string;
45
- customer?: ICustomer;
38
+ customer?: ICustomer | { email: string };
46
39
 
47
40
  cartItems?: IItem[];
48
41
  metadata = {};
@@ -57,12 +50,14 @@ export class BaseInlineCheckout {
57
50
  apiKeyTonder,
58
51
  returnUrl,
59
52
  callBack = () => {},
53
+ baseUrlTonder
60
54
  }: IInlineCheckoutBaseOptions) {
61
- this.apiKeyTonder = apiKey || apiKeyTonder || "";
55
+ this.apiKeyTonder = apiKeyTonder || apiKey || "";
62
56
  this.returnUrl = returnUrl;
63
57
  this.callBack = callBack;
64
58
  this.mode = mode;
65
- this.baseUrl = TONDER_URL_BY_MODE[this.mode] || TONDER_URL_BY_MODE["stage"];
59
+ this.customer = {} as ICustomer
60
+ this.baseUrl = baseUrlTonder || TONDER_URL_BY_MODE[this.mode] || TONDER_URL_BY_MODE["stage"];
66
61
  this.abortController = new AbortController();
67
62
  this.process3ds = new ThreeDSHandler({
68
63
  apiKey: apiKey,
@@ -74,7 +69,7 @@ export class BaseInlineCheckout {
74
69
  if ("customer" in data) this.#handleCustomer(data["customer"]);
75
70
  }
76
71
 
77
- async verify3dsTransaction() {
72
+ async verify3dsTransaction(): Promise<ITransaction | IStartCheckoutResponse | void> {
78
73
  const result3ds = await this.process3ds.verifyTransactionStatus();
79
74
  const resultCheckout = await this.#resumeCheckout(result3ds);
80
75
  this.process3ds.setPayload(resultCheckout);
@@ -205,10 +200,14 @@ export class BaseInlineCheckout {
205
200
 
206
201
  // Checkout router
207
202
  const routerItems = {
208
- name: this.firstName || "",
209
- last_name: this.lastName || "",
210
- email_client: this.email,
211
- phone_number: this.phone,
203
+ name: get(this.customer, "firstName", get(this.customer, "name", "")),
204
+ last_name: get(
205
+ this.customer,
206
+ "lastName",
207
+ get(this.customer, "lastname", ""),
208
+ ),
209
+ email_client: get(this.customer, "email", ""),
210
+ phone_number: get(this.customer, "phone", ""),
212
211
  return_url: this.returnUrl,
213
212
  id_product: "no_id",
214
213
  quantity_product: 1,
@@ -261,18 +260,45 @@ export class BaseInlineCheckout {
261
260
  }
262
261
  }
263
262
 
264
- #handleCustomer(customer: ICustomer) {
263
+ async _getCustomerCards(
264
+ authToken: string,
265
+ businessId: string | number,
266
+ ): Promise<ICustomerCardsResponse> {
267
+ return await fetchCustomerCards(this.baseUrl, authToken, businessId);
268
+ }
269
+
270
+ async _saveCustomerCard(
271
+ authToken: string,
272
+ businessId: string | number,
273
+ skyflowTokens: ISaveCardSkyflowRequest,
274
+ ): Promise<ISaveCardResponse> {
275
+ return await saveCustomerCard(
276
+ this.baseUrl,
277
+ authToken,
278
+ businessId,
279
+ skyflowTokens,
280
+ );
281
+ }
282
+
283
+ async _removeCustomerCard(
284
+ authToken: string,
285
+ businessId: string | number,
286
+ skyflowId: string,
287
+ ): Promise<string> {
288
+ return await removeCustomerCard(
289
+ this.baseUrl,
290
+ authToken,
291
+ skyflowId,
292
+ businessId,
293
+ );
294
+ }
295
+ async _fetchCustomerPaymentMethods(): Promise<IPaymentMethodResponse> {
296
+ return await fetchCustomerPaymentMethods(this.baseUrl, this.apiKeyTonder);
297
+ }
298
+
299
+ #handleCustomer(customer: ICustomer | { email: string }) {
265
300
  if (!customer) return;
266
301
 
267
- this.firstName = customer?.firstName;
268
- this.lastName = customer?.lastName;
269
- this.country = customer?.country;
270
- this.address = customer?.street;
271
- this.city = customer?.city;
272
- this.state = customer?.state;
273
- this.postCode = customer?.postCode;
274
- this.email = customer?.email;
275
- this.phone = customer?.phone;
276
302
  this.customer = customer;
277
303
  }
278
304
 
@@ -294,7 +320,7 @@ export class BaseInlineCheckout {
294
320
 
295
321
  // TODO: Make private after remove deprecated functions of liteCheckout
296
322
  async _handle3dsRedirect(
297
- response: ErrorResponse | StartCheckoutResponse | false | undefined,
323
+ response: ITransaction | IStartCheckoutResponse | void,
298
324
  ) {
299
325
  const iframe =
300
326
  response && "next_action" in response
@@ -1,4 +1,4 @@
1
- import { IErrorResponse } from "../types";
1
+ import {IErrorResponse} from "../types/responses";
2
2
 
3
3
  export class ErrorResponse implements IErrorResponse {
4
4
  code?: string | undefined;
@@ -12,42 +12,29 @@ import {
12
12
  } from "../helpers/utils";
13
13
  import { getCustomerAPMs } from "../data/api";
14
14
  import { BaseInlineCheckout } from "./BaseInlineCheckout";
15
- import {
16
- fetchCustomerCards,
17
- removeCustomerCard,
18
- saveCustomerCard,
19
- } from "../data/cardApi";
20
15
  import { MESSAGES } from "../shared/constants/messages";
21
16
  import { getSkyflowTokens } from "../helpers/skyflow";
22
- import { fetchCustomerAPMs } from "../data/paymentMethodApi";
23
17
  import { startCheckoutRouter } from "../data/checkoutApi";
24
18
  import { getOpenpayDeviceSessionID } from "../data/openPayApi";
25
19
  import { getPaymentMethodDetails } from "../shared/catalog/paymentMethodsCatalog";
20
+ import {APM, IInlineLiteCheckoutOptions, TonderAPM} from "../types/commons";
21
+ import {ICustomerCardsResponse, ISaveCardRequest, ISaveCardResponse, ISaveCardSkyflowRequest} from "../types/card";
22
+ import {IPaymentMethod} from "../types/paymentMethod";
26
23
  import {
27
- APM,
28
- IInlineCheckoutBaseOptions,
29
- ILiteInlineCheckout,
30
- TonderAPM,
31
- RegisterCustomerCardResponse,
32
- ISaveCardRequest,
33
- ICustomerCardsResponse,
34
- ISaveCardResponse,
35
- IPaymentMethod,
36
- GetBusinessResponse,
37
- TokensRequest,
38
- ICardFields,
24
+ CreateOrderResponse,
25
+ CreatePaymentResponse,
39
26
  CustomerRegisterResponse,
40
- StartCheckoutFullRequest,
27
+ GetBusinessResponse, IErrorResponse, RegisterCustomerCardResponse, StartCheckoutResponse
28
+ } from "../types/responses";
29
+ import {
41
30
  CreateOrderRequest,
42
- CreatePaymentRequest,
43
- StartCheckoutRequest,
44
- IErrorResponse,
45
- StartCheckoutResponse,
31
+ CreatePaymentRequest, RegisterCustomerCardRequest, StartCheckoutFullRequest,
46
32
  StartCheckoutIdRequest,
47
- CreatePaymentResponse,
48
- CreateOrderResponse,
49
- RegisterCustomerCardRequest,
50
- } from "../types";
33
+ StartCheckoutRequest,
34
+ TokensRequest
35
+ } from "../types/requests";
36
+ import {ICardFields, IStartCheckoutResponse} from "../types/checkout";
37
+ import {ILiteCheckout} from "../types/liteInlineCheckout";
51
38
 
52
39
  declare global {
53
40
  interface Window {
@@ -55,29 +42,22 @@ declare global {
55
42
  }
56
43
  }
57
44
 
58
- export interface LiteCheckoutConstructor extends IInlineCheckoutBaseOptions {}
59
-
60
- export class LiteCheckout
61
- extends BaseInlineCheckout
62
- implements ILiteInlineCheckout
63
- {
45
+ export class LiteCheckout extends BaseInlineCheckout implements ILiteCheckout{
64
46
  activeAPMs: APM[] = [];
65
- #customerData?: Record<string, any>;
66
47
 
67
- constructor({ apiKey, mode, returnUrl, callBack }: LiteCheckoutConstructor) {
68
- super({ mode, apiKey, returnUrl, callBack });
48
+ constructor({ apiKey, mode, returnUrl, callBack, apiKeyTonder, baseUrlTonder }: IInlineLiteCheckoutOptions) {
49
+ super({ mode, apiKey, returnUrl, callBack, apiKeyTonder, baseUrlTonder });
69
50
  }
70
51
 
71
- async injectCheckout() {
52
+ public async injectCheckout() {
72
53
  await this._initializeCheckout();
73
54
  }
74
55
 
75
- async getCustomerCards(): Promise<ICustomerCardsResponse> {
56
+ public async getCustomerCards(): Promise<ICustomerCardsResponse> {
76
57
  try {
77
58
  await this._fetchMerchantData();
78
59
  const { auth_token } = await this._getCustomer();
79
- const response = await fetchCustomerCards(
80
- this.baseUrl,
60
+ const response = await this._getCustomerCards(
81
61
  auth_token,
82
62
  this.merchantData!.business.pk,
83
63
  );
@@ -99,13 +79,15 @@ export class LiteCheckout
99
79
  }
100
80
  }
101
81
 
102
- async saveCustomerCard(card: ISaveCardRequest): Promise<ISaveCardResponse> {
82
+ public async saveCustomerCard(
83
+ card: ISaveCardRequest,
84
+ ): Promise<ISaveCardResponse> {
103
85
  try {
104
86
  await this._fetchMerchantData();
105
87
  const { auth_token } = await this._getCustomer();
106
88
  const { vault_id, vault_url, business } = this.merchantData!;
107
89
 
108
- const skyflowTokens = await getSkyflowTokens({
90
+ const skyflowTokens: ISaveCardSkyflowRequest = await getSkyflowTokens({
109
91
  vault_id: vault_id,
110
92
  vault_url: vault_url,
111
93
  data: card,
@@ -113,8 +95,7 @@ export class LiteCheckout
113
95
  apiKey: this.apiKeyTonder,
114
96
  });
115
97
 
116
- return await saveCustomerCard(
117
- this.baseUrl,
98
+ return await this._saveCustomerCard(
118
99
  auth_token,
119
100
  business?.pk,
120
101
  skyflowTokens,
@@ -129,17 +110,16 @@ export class LiteCheckout
129
110
  }
130
111
  }
131
112
 
132
- async removeCustomerCard(skyflowId: string): Promise<string> {
113
+ public async removeCustomerCard(skyflowId: string): Promise<string> {
133
114
  try {
134
115
  await this._fetchMerchantData();
135
116
  const { auth_token } = await this._getCustomer();
136
117
  const { business } = this.merchantData!;
137
118
 
138
- return await removeCustomerCard(
139
- this.baseUrl,
119
+ return await this._removeCustomerCard(
140
120
  auth_token,
141
- skyflowId,
142
121
  business?.pk,
122
+ skyflowId,
143
123
  );
144
124
  } catch (error) {
145
125
  throw formatPublicErrorResponse(
@@ -151,9 +131,9 @@ export class LiteCheckout
151
131
  }
152
132
  }
153
133
 
154
- async getCustomerPaymentMethods(): Promise<IPaymentMethod[]> {
134
+ public async getCustomerPaymentMethods(): Promise<IPaymentMethod[]> {
155
135
  try {
156
- const response = await fetchCustomerAPMs(this.baseUrl, this.apiKeyTonder);
136
+ const response = await this._fetchCustomerPaymentMethods();
157
137
 
158
138
  const apms_results =
159
139
  response && "results" in response && response["results"].length > 0
@@ -183,7 +163,7 @@ export class LiteCheckout
183
163
  }
184
164
  }
185
165
 
186
- async getBusiness(): Promise<GetBusinessResponse> {
166
+ public async getBusiness(): Promise<GetBusinessResponse> {
187
167
  try {
188
168
  return await fetchBusiness(
189
169
  this.baseUrl,
@@ -200,6 +180,23 @@ export class LiteCheckout
200
180
  }
201
181
  }
202
182
 
183
+ // TODO: DEPRECATED
184
+ async getOpenpayDeviceSessionID(
185
+ merchant_id: string,
186
+ public_key: string,
187
+ is_sandbox: boolean,
188
+ ): Promise<string | ErrorResponse> {
189
+ try {
190
+ return await getOpenpayDeviceSessionID(
191
+ merchant_id,
192
+ public_key,
193
+ is_sandbox,
194
+ );
195
+ } catch (e) {
196
+ throw buildErrorResponseFromCatch(e);
197
+ }
198
+ }
199
+
203
200
  // TODO: DEPRECATED
204
201
  async getSkyflowTokens({
205
202
  vault_id,
@@ -257,11 +254,6 @@ export class LiteCheckout
257
254
  }
258
255
 
259
256
  // TODO: DEPRECATED
260
- /**
261
- * @deprecated This method is deprecated and will be removed in a future release.
262
- * It is no longer necessary to use this method as customer registration is now automatically handled
263
- * during the payment process or when using card management methods.
264
- */
265
257
  async customerRegister(
266
258
  email: string,
267
259
  ): Promise<CustomerRegisterResponse | ErrorResponse> {
@@ -287,11 +279,6 @@ export class LiteCheckout
287
279
  }
288
280
 
289
281
  // TODO: DEPRECATED
290
- /**
291
- * @deprecated This method is deprecated and will be removed in a future release.
292
- * It is no longer necessary to use this method as order creation is now automatically
293
- * handled when making a payment through the `payment` function.
294
- */
295
282
  async createOrder(
296
283
  orderItems: CreateOrderRequest,
297
284
  ): Promise<CreateOrderResponse | ErrorResponse> {
@@ -314,11 +301,6 @@ export class LiteCheckout
314
301
  }
315
302
 
316
303
  // TODO: DEPRECATED
317
- /**
318
- * @deprecated This method is deprecated and will be removed in a future release.
319
- * It is no longer necessary to use this method as payment creation is now automatically
320
- * handled when making a payment through the `payment` function.
321
- */
322
304
  async createPayment(
323
305
  paymentItems: CreatePaymentRequest,
324
306
  ): Promise<CreatePaymentResponse | ErrorResponse> {
@@ -341,10 +323,6 @@ export class LiteCheckout
341
323
  }
342
324
 
343
325
  // TODO: DEPRECATED
344
- /**
345
- * @deprecated This method is deprecated and will be removed in a future release.
346
- * Use the {@link payment} method
347
- */
348
326
  async startCheckoutRouter(
349
327
  routerData: StartCheckoutRequest | StartCheckoutIdRequest,
350
328
  ): Promise<StartCheckoutResponse | ErrorResponse | undefined> {
@@ -358,16 +336,12 @@ export class LiteCheckout
358
336
  }
359
337
 
360
338
  // TODO: DEPRECATED
361
- async init3DSRedirect(checkoutResult: ErrorResponse | StartCheckoutResponse) {
339
+ async init3DSRedirect(checkoutResult: IStartCheckoutResponse) {
362
340
  this.process3ds.setPayload(checkoutResult);
363
341
  return await this._handle3dsRedirect(checkoutResult);
364
342
  }
365
343
 
366
344
  // TODO: DEPRECATED
367
- /**
368
- * @deprecated This method is deprecated and will be removed in a future release.
369
- * Use the {@link payment} method
370
- */
371
345
  async startCheckoutRouterFull(
372
346
  routerFullData: StartCheckoutFullRequest,
373
347
  ): Promise<StartCheckoutResponse | ErrorResponse | undefined> {
@@ -500,10 +474,6 @@ export class LiteCheckout
500
474
  }
501
475
 
502
476
  // TODO: DEPRECATED
503
- /**
504
- * @deprecated This method is deprecated and will be removed in a future release.
505
- * Use the {@link saveCustomerCard} method
506
- */
507
477
  async registerCustomerCard(
508
478
  customerToken: string,
509
479
  data: RegisterCustomerCardRequest,
@@ -532,10 +502,6 @@ export class LiteCheckout
532
502
  }
533
503
 
534
504
  // TODO: DEPRECATED
535
- /**
536
- * @deprecated This method is deprecated and will be removed in a future release.
537
- * Use the {@link removeCustomerCard} method
538
- */
539
505
  async deleteCustomerCard(
540
506
  customerToken: string,
541
507
  skyflowId: string = "",
@@ -562,10 +528,6 @@ export class LiteCheckout
562
528
  }
563
529
 
564
530
  // TODO: DEPRECATED
565
- /**
566
- * @deprecated This method is deprecated and will be removed in a future release.
567
- * Use the {@link getCustomerPaymentMethods} method
568
- */
569
531
  async getActiveAPMs(): Promise<APM[]> {
570
532
  try {
571
533
  const apms_response = await getCustomerAPMs(
@@ -1,4 +1,4 @@
1
- import { GetBusinessResponse } from "../types";
1
+ import {GetBusinessResponse} from "../types/responses";
2
2
 
3
3
  export async function fetchBusiness(
4
4
  baseUrl: string,
@@ -2,12 +2,8 @@ import {
2
2
  buildErrorResponse,
3
3
  buildErrorResponseFromCatch,
4
4
  } from "../helpers/utils";
5
- import {
6
- ICustomerCardsResponse,
7
- ISaveCardResponse,
8
- ISaveCardSkyflowRequest,
9
- } from "../types";
10
5
  import { MESSAGES } from "../shared/constants/messages";
6
+ import {ICustomerCardsResponse, ISaveCardResponse, ISaveCardSkyflowRequest} from "../types/card";
11
7
 
12
8
  export async function fetchCustomerCards(
13
9
  baseUrl: string,
@@ -1,11 +1,8 @@
1
+ import {CreateOrderRequest, CreatePaymentRequest} from "../types/requests";
2
+ import {IStartCheckoutIdRequest, IStartCheckoutRequest} from "../types/checkout";
3
+
1
4
  declare const MP_DEVICE_SESSION_ID: string | undefined;
2
5
 
3
- import {
4
- CreateOrderRequest,
5
- CreatePaymentRequest,
6
- IStartCheckoutIdRequest,
7
- IStartCheckoutRequest,
8
- } from "../types";
9
6
 
10
7
  export async function createOrder(
11
8
  baseUrl: string,
@@ -1,4 +1,4 @@
1
- import { CustomerRegisterResponse } from "../types";
1
+ import {CustomerRegisterResponse} from "../types/responses";
2
2
 
3
3
  export async function registerOrFetchCustomer(
4
4
  baseUrl: string,
@@ -2,9 +2,9 @@ import {
2
2
  buildErrorResponse,
3
3
  buildErrorResponseFromCatch,
4
4
  } from "../helpers/utils";
5
- import { IPaymentMethodResponse } from "../types";
5
+ import {IPaymentMethodResponse} from "../types/paymentMethod";
6
6
 
7
- export async function fetchCustomerAPMs(
7
+ export async function fetchCustomerPaymentMethods(
8
8
  baseUrl: string,
9
9
  apiKey: string,
10
10
  params = {
@@ -4,7 +4,7 @@ import CollectContainer from "skyflow-js/types/core/external/collect/collect-con
4
4
  import {buildErrorResponseFromCatch} from "./utils";
5
5
  import CollectElement from "skyflow-js/types/core/external/collect/collect-element";
6
6
  import {getVaultToken} from "../data/skyflowApi";
7
- import {TokensSkyflowRequest} from "../types";
7
+ import {TokensSkyflowRequest} from "../types/requests";
8
8
 
9
9
  export async function getSkyflowTokens({
10
10
  baseUrl,
@@ -1,5 +1,5 @@
1
1
  import { ErrorResponse } from "../classes/errorResponse";
2
- import { IErrorResponse } from "../types";
2
+ import {IErrorResponse} from "../types/responses";
3
3
 
4
4
  export const getBrowserInfo = () => {
5
5
  const browserInfo = {
package/src/index.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import { LiteCheckout } from './classes/liteCheckout'
2
+ import { BaseInlineCheckout } from './classes/BaseInlineCheckout'
3
+ import { validateCVV, validateCardNumber, validateExpirationMonth, validateCardholderName, validateExpirationYear } from './helpers/validations'
2
4
 
3
5
  export {
4
- LiteCheckout
6
+ LiteCheckout,
7
+ BaseInlineCheckout,
8
+ validateCVV,
9
+ validateCardNumber,
10
+ validateCardholderName,
11
+ validateExpirationMonth,
12
+ validateExpirationYear
5
13
  }
package/src/types/card.ts CHANGED
@@ -9,6 +9,7 @@ export interface ICardSkyflowFields {
9
9
  expiration_year: string;
10
10
  skyflow_id: string;
11
11
  card_scheme: string;
12
+ cardholder_name: string;
12
13
  }
13
14
 
14
15
  export interface ICustomerCardsResponse {