@tonder.io/ionic-lite-sdk 0.0.36-beta.1 → 0.0.38-beta.1

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 (79) hide show
  1. package/README.md +427 -116
  2. package/dist/classes/BaseInlineCheckout.d.ts +47 -0
  3. package/dist/classes/liteCheckout.d.ts +25 -29
  4. package/dist/data/businessApi.d.ts +2 -0
  5. package/dist/data/cardApi.d.ts +4 -0
  6. package/dist/data/checkoutApi.d.ts +5 -0
  7. package/dist/data/customerApi.d.ts +2 -0
  8. package/dist/data/openPayApi.d.ts +1 -0
  9. package/dist/data/paymentMethodApi.d.ts +5 -0
  10. package/dist/data/skyflowApi.d.ts +1 -0
  11. package/dist/helpers/skyflow.d.ts +3 -0
  12. package/dist/helpers/utils.d.ts +8 -4
  13. package/dist/helpers/validations.d.ts +6 -0
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.js +1 -1
  16. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +1 -0
  17. package/dist/shared/constants/messages.d.ts +11 -0
  18. package/dist/shared/constants/paymentMethodAPM.d.ts +62 -0
  19. package/dist/shared/constants/tonderUrl.d.ts +7 -0
  20. package/dist/types/card.d.ts +30 -0
  21. package/dist/types/checkout.d.ts +109 -0
  22. package/dist/types/commons.d.ts +42 -0
  23. package/dist/types/customer.d.ts +22 -0
  24. package/dist/types/liteInlineCheckout.d.ts +151 -0
  25. package/dist/types/paymentMethod.d.ts +22 -0
  26. package/dist/types/requests.d.ts +12 -3
  27. package/dist/types/transaction.d.ts +101 -0
  28. package/package.json +4 -1
  29. package/src/classes/BaseInlineCheckout.ts +387 -0
  30. package/src/classes/errorResponse.ts +1 -1
  31. package/src/classes/liteCheckout.ts +372 -356
  32. package/src/data/businessApi.ts +18 -0
  33. package/src/data/cardApi.ts +87 -0
  34. package/src/data/checkoutApi.ts +84 -0
  35. package/src/data/customerApi.ts +31 -0
  36. package/src/data/openPayApi.ts +12 -0
  37. package/src/data/paymentMethodApi.ts +37 -0
  38. package/src/data/skyflowApi.ts +20 -0
  39. package/src/helpers/mercadopago.ts +14 -14
  40. package/src/helpers/skyflow.ts +91 -0
  41. package/src/helpers/utils.ts +66 -266
  42. package/src/helpers/validations.ts +55 -0
  43. package/src/index.ts +9 -1
  44. package/src/shared/catalog/paymentMethodsCatalog.ts +248 -0
  45. package/src/shared/constants/messages.ts +11 -0
  46. package/src/shared/constants/paymentMethodAPM.ts +63 -0
  47. package/src/shared/constants/tonderUrl.ts +8 -0
  48. package/src/types/card.ts +35 -0
  49. package/src/types/checkout.ts +124 -0
  50. package/src/types/commons.ts +114 -67
  51. package/src/types/customer.ts +22 -0
  52. package/src/types/liteInlineCheckout.ts +216 -0
  53. package/src/types/paymentMethod.ts +24 -0
  54. package/src/types/requests.ts +12 -3
  55. package/src/types/transaction.ts +101 -0
  56. package/src/types/validations.d.ts +11 -0
  57. package/tests/classes/liteCheckout.test.ts +5 -5
  58. package/tests/methods/createOrder.test.ts +3 -4
  59. package/tests/methods/createPayment.test.ts +2 -3
  60. package/tests/methods/customerRegister.test.ts +3 -4
  61. package/tests/methods/getBusiness.test.ts +4 -5
  62. package/tests/methods/getCustomerCards.test.ts +6 -13
  63. package/tests/methods/registerCustomerCard.test.ts +2 -2
  64. package/tests/methods/startCheckoutRouter.test.ts +2 -2
  65. package/tests/methods/startCheckoutRouterFull.test.ts +2 -2
  66. package/tests/utils/defaultMock.ts +3 -2
  67. package/tests/utils/mockClasses.ts +7 -4
  68. package/types/classes/liteCheckout.d.ts +29 -0
  69. package/types/classes/liteCheckout.js +225 -0
  70. package/types/classes/liteCheckout.js.map +1 -0
  71. package/types/helpers/utils.d.ts +3 -0
  72. package/types/helpers/utils.js +27 -0
  73. package/types/helpers/utils.js.map +1 -0
  74. package/types/index.d.ts +2 -0
  75. package/types/index.js +6 -0
  76. package/types/index.js.map +1 -0
  77. package/tests/methods/getOpenpayDeviceSessionID.test.ts +0 -95
  78. package/tests/methods/getSkyflowToken.test.ts +0 -155
  79. package/tests/methods/getVaultToken.test.ts +0 -107
@@ -1,41 +1,47 @@
1
1
  import { ErrorResponse } from "../classes/errorResponse";
2
- import { IErrorResponse } from "../types/responses";
3
- import { PAYMENT_METHOD } from "./constants";
2
+ import {IErrorResponse} from "../types/responses";
4
3
 
5
4
  export const getBrowserInfo = () => {
6
5
  const browserInfo = {
7
- javascript_enabled: true, // Assumed since JavaScript is running
6
+ javascript_enabled: true, // Assumed since JavaScript is running
8
7
  time_zone: new Date().getTimezoneOffset(),
9
- language: navigator.language || 'en-US', // Fallback to 'en-US'
8
+ language: navigator.language || "en-US", // Fallback to 'en-US'
10
9
  color_depth: window.screen ? window.screen.colorDepth : null,
11
- screen_width: window.screen ? window.screen.width * window.devicePixelRatio || window.screen.width : null,
12
- screen_height: window.screen ? window.screen.height * window.devicePixelRatio || window.screen.height : null,
10
+ screen_width: window.screen
11
+ ? window.screen.width * window.devicePixelRatio || window.screen.width
12
+ : null,
13
+ screen_height: window.screen
14
+ ? window.screen.height * window.devicePixelRatio || window.screen.height
15
+ : null,
13
16
  user_agent: navigator.userAgent,
14
17
  };
15
18
  return browserInfo;
16
- }
19
+ };
17
20
 
18
- export const getBusinessId = (merchantData: any) =>{
19
- return merchantData && "business" in merchantData ? merchantData?.business?.pk:""
20
- }
21
+ export const getBusinessId = (merchantData: any) => {
22
+ return merchantData && "business" in merchantData
23
+ ? merchantData?.business?.pk
24
+ : "";
25
+ };
21
26
  const buildErrorResponseFromCatch = (e: any): ErrorResponse => {
22
-
23
27
  const error = new ErrorResponse({
24
28
  code: e?.status ? e.status : e.code,
25
29
  body: e?.body,
26
- name: e ? typeof e == "string" ? "catch" : (e as Error).name : "Error",
30
+ name: e ? (typeof e == "string" ? "catch" : (e as Error).name) : "Error",
27
31
  message: e ? (typeof e == "string" ? e : (e as Error).message) : "Error",
28
32
  stack: typeof e == "string" ? undefined : (e as Error).stack,
29
- })
33
+ });
30
34
 
31
35
  return error;
32
- }
36
+ };
33
37
 
34
38
  const buildErrorResponse = async (
35
39
  response: Response,
36
- stack: string | undefined = undefined
40
+ stack: string | undefined = undefined,
37
41
  ): Promise<ErrorResponse> => {
38
- let body, status, message = "Error";
42
+ let body,
43
+ status,
44
+ message = "Error";
39
45
 
40
46
  if (response && "json" in response) {
41
47
  body = await response?.json();
@@ -49,8 +55,8 @@ const buildErrorResponse = async (
49
55
  message = await response.text();
50
56
  }
51
57
 
52
- if(body?.detail){
53
- message = body.detail
58
+ if (body?.detail) {
59
+ message = body.detail;
54
60
  }
55
61
  const error = new ErrorResponse({
56
62
  code: status,
@@ -58,263 +64,57 @@ const buildErrorResponse = async (
58
64
  name: status,
59
65
  message: message,
60
66
  stack,
61
- } as IErrorResponse)
67
+ } as IErrorResponse);
62
68
 
63
69
  return error;
64
- }
65
-
66
- const getPaymentMethodDetails = (scheme_data: string): {icon: string; label: string} => {
67
- const scheme: PAYMENT_METHOD = clearSpace(scheme_data.toUpperCase()) as PAYMENT_METHOD;
68
-
69
- const PAYMENT_METHODS_CATALOG: Partial<Record<PAYMENT_METHOD, { icon: string, label: string }>> = {
70
- [PAYMENT_METHOD.SORIANA]: {
71
- label: "Soriana",
72
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/soriana.png",
73
- },
74
- [PAYMENT_METHOD.OXXO]: {
75
- label: "Oxxo",
76
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/oxxo.png",
77
- },
78
- [PAYMENT_METHOD.CODI]: {
79
- label: "CoDi",
80
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/codi.png",
81
- },
82
- [PAYMENT_METHOD.SPEI]: {
83
- label: "SPEI",
84
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/spei.png",
85
- },
86
- [PAYMENT_METHOD.PAYPAL]: {
87
- label: "Paypal",
88
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/paypal.png",
89
- },
90
- [PAYMENT_METHOD.COMERCIALMEXICANA]: {
91
- label: "Comercial Mexicana",
92
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/comercial_exicana.png",
93
- },
94
- [PAYMENT_METHOD.BANCOMER]: {
95
- label: "Bancomer",
96
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bancomer.png",
97
- },
98
- [PAYMENT_METHOD.WALMART]: {
99
- label: "Walmart",
100
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/walmart.png",
101
- },
102
- [PAYMENT_METHOD.BODEGA]: {
103
- label: "Bodega Aurrera",
104
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bodega_aurrera.png",
105
- },
106
- [PAYMENT_METHOD.SAMSCLUB]: {
107
- label: "Sam´s Club",
108
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/sams_club.png",
109
- },
110
- [PAYMENT_METHOD.SUPERAMA]: {
111
- label: "Superama",
112
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/superama.png",
113
- },
114
- [PAYMENT_METHOD.CALIMAX]: {
115
- label: "Calimax",
116
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/calimax.png",
117
- },
118
- [PAYMENT_METHOD.EXTRA]: {
119
- label: "Tiendas Extra",
120
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/tiendas_extra.png",
121
- },
122
- [PAYMENT_METHOD.CIRCULOK]: {
123
- label: "Círculo K",
124
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/circulo_k.png",
125
- },
126
- [PAYMENT_METHOD.SEVEN11]: {
127
- label: "7 Eleven",
128
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/7_eleven.png",
129
- },
130
- [PAYMENT_METHOD.TELECOMM]: {
131
- label: "Telecomm",
132
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/telecomm.png",
133
- },
134
- [PAYMENT_METHOD.BANORTE]: {
135
- label: "Banorte",
136
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/banorte.png",
137
- },
138
- [PAYMENT_METHOD.BENAVIDES]: {
139
- label: "Farmacias Benavides",
140
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_benavides.png",
141
- },
142
- [PAYMENT_METHOD.DELAHORRO]: {
143
- label: "Farmacias del Ahorro",
144
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_ahorro.png",
145
- },
146
- [PAYMENT_METHOD.ELASTURIANO]: {
147
- label: "El Asturiano",
148
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/asturiano.png",
149
- },
150
- [PAYMENT_METHOD.WALDOS]: {
151
- label: "Waldos",
152
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/waldos.png",
153
- },
154
- [PAYMENT_METHOD.ALSUPER]: {
155
- label: "Alsuper",
156
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/al_super.png",
157
- },
158
- [PAYMENT_METHOD.KIOSKO]: {
159
- label: "Kiosko",
160
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/kiosko.png",
161
- },
162
- [PAYMENT_METHOD.STAMARIA]: {
163
- label: "Farmacias Santa María",
164
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_santa_maria.png",
165
- },
166
- [PAYMENT_METHOD.LAMASBARATA]: {
167
- label: "Farmacias la más barata",
168
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_barata.png",
169
- },
170
- [PAYMENT_METHOD.FARMROMA]: {
171
- label: "Farmacias Roma",
172
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_roma.png",
173
- },
174
- [PAYMENT_METHOD.FARMUNION]: {
175
- label: "Pago en Farmacias Unión",
176
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_union.png",
177
- },
178
- [PAYMENT_METHOD.FARMATODO]: {
179
- label: "Pago en Farmacias Farmatodo",
180
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_farmatodo.png ",
181
- },
182
- [PAYMENT_METHOD.SFDEASIS]: {
183
- label: "Pago en Farmacias San Francisco de Asís",
184
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_san_francisco.png",
185
- },
186
- [PAYMENT_METHOD.FARM911]: {
187
- label: "Farmacias 911",
188
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
189
- },
190
- [PAYMENT_METHOD.FARMECONOMICAS]: {
191
- label: "Farmacias Economicas",
192
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
193
- },
194
- [PAYMENT_METHOD.FARMMEDICITY]: {
195
- label: "Farmacias Medicity",
196
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
197
- },
198
- [PAYMENT_METHOD.RIANXEIRA]: {
199
- label: "Rianxeira",
200
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
201
- },
202
- [PAYMENT_METHOD.WESTERNUNION]: {
203
- label: "Western Union",
204
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
205
- },
206
- [PAYMENT_METHOD.ZONAPAGO]: {
207
- label: "Zona Pago",
208
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
209
- },
210
- [PAYMENT_METHOD.CAJALOSANDES]: {
211
- label: "Caja Los Andes",
212
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
213
- },
214
- [PAYMENT_METHOD.CAJAPAITA]: {
215
- label: "Caja Paita",
216
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
217
- },
218
- [PAYMENT_METHOD.CAJASANTA]: {
219
- label: "Caja Santa",
220
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
221
- },
222
- [PAYMENT_METHOD.CAJASULLANA]: {
223
- label: "Caja Sullana",
224
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
225
- },
226
- [PAYMENT_METHOD.CAJATRUJILLO]: {
227
- label: "Caja Trujillo",
228
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
229
- },
230
- [PAYMENT_METHOD.EDPYME]: {
231
- label: "Edpyme",
232
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
233
- },
234
- [PAYMENT_METHOD.KASNET]: {
235
- label: "KasNet",
236
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
237
- },
238
- [PAYMENT_METHOD.NORANDINO]: {
239
- label: "Norandino",
240
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
241
- },
242
- [PAYMENT_METHOD.QAPAQ]: {
243
- label: "Qapaq",
244
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
245
- },
246
- [PAYMENT_METHOD.RAIZ]: {
247
- label: "Raiz",
248
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
249
- },
250
- [PAYMENT_METHOD.PAYSER]: {
251
- label: "Paysera",
252
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
253
- },
254
- [PAYMENT_METHOD.WUNION]: {
255
- label: "Western Union",
256
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
257
- },
258
- [PAYMENT_METHOD.BANCOCONTINENTAL]: {
259
- label: "Banco Continental",
260
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
261
- },
262
- [PAYMENT_METHOD.GMONEY]: {
263
- label: "Go money",
264
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
265
- },
266
- [PAYMENT_METHOD.GOPAY]: {
267
- label: "Go pay",
268
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
269
- },
270
- [PAYMENT_METHOD.WU]: {
271
- label: "Western Union",
272
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
273
- },
274
- [PAYMENT_METHOD.PUNTOSHEY]: {
275
- label: "Puntoshey",
276
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
277
- },
278
- [PAYMENT_METHOD.AMPM]: {
279
- label: "Ampm",
280
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
281
- },
282
- [PAYMENT_METHOD.JUMBOMARKET]: {
283
- label: "Jumbomarket",
284
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
285
- },
286
- [PAYMENT_METHOD.SMELPUEBLO]: {
287
- label: "Smelpueblo",
288
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
289
- },
290
- [PAYMENT_METHOD.BAM]: {
291
- label: "Bam",
292
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
293
- },
294
- [PAYMENT_METHOD.REFACIL]: {
295
- label: "Refacil",
296
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
297
- },
298
- [PAYMENT_METHOD.ACYVALORES]: {
299
- label: "Acyvalores",
300
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
301
- },
70
+ };
71
+
72
+ function formatPublicErrorResponse(data: Record<string, any>, error: any) {
73
+ let code = 200;
74
+ try {
75
+ code = Number(error?.code || 200);
76
+ } catch {}
77
+
78
+ const default_res = {
79
+ status: "error",
80
+ code,
81
+ message: "",
82
+ detail:
83
+ error?.body?.detail ||
84
+ error?.body?.error ||
85
+ error.body ||
86
+ "Ocurrio un error inesperado.",
302
87
  };
303
88
 
304
- const _default = {
305
- icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
306
- label: ""
89
+ return {
90
+ ...default_res,
91
+ ...data,
307
92
  };
308
-
309
- return PAYMENT_METHODS_CATALOG[scheme] || _default;
310
93
  }
311
94
 
312
95
  const clearSpace = (text: string) => {
313
- return text.trim().replace(/\s+/g, '');
314
- }
96
+ return text.trim().replace(/\s+/g, "");
97
+ };
98
+
99
+ const getCardType = (scheme: string) => {
100
+ if (scheme === "Visa") {
101
+ // Check if visa
102
+ return "https://d35a75syrgujp0.cloudfront.net/cards/visa.png";
103
+ } else if (scheme === "Mastercard") {
104
+ // Check if master
105
+ return "https://d35a75syrgujp0.cloudfront.net/cards/mastercard.png";
106
+ } else if (scheme === "American Express") {
107
+ // Check if amex
108
+ return "https://d35a75syrgujp0.cloudfront.net/cards/american_express.png";
109
+ } else {
110
+ return "https://d35a75syrgujp0.cloudfront.net/cards/default_card.png";
111
+ }
112
+ };
315
113
 
316
114
  export {
317
115
  buildErrorResponseFromCatch,
318
116
  buildErrorResponse,
319
- getPaymentMethodDetails
320
- }
117
+ getCardType,
118
+ formatPublicErrorResponse,
119
+ clearSpace,
120
+ };
@@ -0,0 +1,55 @@
1
+ export function validateCardNumber(cardNumber: string) {
2
+ const regex = /^\d{12,19}$/;
3
+ return regex.test(cardNumber) && luhnCheck(cardNumber);
4
+ }
5
+
6
+ export function validateCardholderName(name: string) {
7
+ const regex = /^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/;
8
+ return regex.test(name);
9
+ }
10
+
11
+ export function validateCVV(cvv: string) {
12
+ const regex = /^\d{3,4}$/;
13
+ return regex.test(cvv);
14
+ }
15
+
16
+ export function validateExpirationDate(expirationDate: string) {
17
+ const regex = /^(0[1-9]|1[0-2])\/\d{2}$/;
18
+ if (!regex.test(expirationDate)) {
19
+ return false;
20
+ }
21
+ const [month, year] = expirationDate.split("/");
22
+ const currentDate = new Date();
23
+ // @ts-ignore
24
+ const expiration = new Date(`20${year}`, month - 1);
25
+ return expiration >= currentDate;
26
+ }
27
+
28
+ export function validateExpirationMonth(month: string) {
29
+ const regex = /^(0[1-9]|1[0-2])$/;
30
+ return regex.test(month);
31
+ }
32
+
33
+ export function validateExpirationYear(year: string) {
34
+ const regex = /^\d{2}$/;
35
+ if (!regex.test(year)) {
36
+ return false;
37
+ }
38
+ const currentYear = new Date().getFullYear() % 100;
39
+ return parseInt(year, 10) >= currentYear;
40
+ }
41
+
42
+ const luhnCheck = (num: number | string) => {
43
+ const arr = `${num}`
44
+ .split("")
45
+ .reverse()
46
+ .map((x) => Number.parseInt(x));
47
+ const lastDigit = arr.shift();
48
+ let sum = arr.reduce(
49
+ (acc, val, i) =>
50
+ i % 2 !== 0 ? acc + val : acc + ((val *= 2) > 9 ? val - 9 : val),
51
+ 0,
52
+ );
53
+ sum += lastDigit!;
54
+ return sum % 10 === 0;
55
+ };
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
  }