@tonder.io/ionic-lite-sdk 0.0.35-beta.8 → 0.0.36-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 (87) hide show
  1. package/.gitlab-ci.yml +28 -28
  2. package/README.md +221 -202
  3. package/dist/classes/errorResponse.d.ts +1 -1
  4. package/dist/classes/liteCheckout.d.ts +32 -56
  5. package/dist/data/api.d.ts +1 -1
  6. package/dist/helpers/utils.d.ts +4 -8
  7. package/dist/index.d.ts +1 -2
  8. package/dist/index.js +1 -1
  9. package/dist/types/commons.d.ts +0 -37
  10. package/dist/types/requests.d.ts +3 -12
  11. package/dist/types/responses.d.ts +3 -0
  12. package/jest.config.ts +14 -14
  13. package/package.json +38 -38
  14. package/rollup.config.js +16 -16
  15. package/src/classes/3dsHandler.ts +237 -237
  16. package/src/classes/errorResponse.ts +16 -16
  17. package/src/classes/liteCheckout.ts +575 -598
  18. package/src/data/api.ts +20 -20
  19. package/src/helpers/constants.ts +63 -63
  20. package/src/helpers/mercadopago.ts +15 -15
  21. package/src/helpers/utils.ts +320 -120
  22. package/src/index.ts +4 -10
  23. package/src/types/commons.ts +83 -125
  24. package/src/types/requests.ts +105 -114
  25. package/src/types/responses.ts +193 -189
  26. package/src/types/skyflow.ts +17 -17
  27. package/tests/classes/liteCheckout.test.ts +57 -57
  28. package/tests/methods/createOrder.test.ts +142 -142
  29. package/tests/methods/createPayment.test.ts +122 -122
  30. package/tests/methods/customerRegister.test.ts +119 -119
  31. package/tests/methods/getBusiness.test.ts +115 -115
  32. package/tests/methods/getCustomerCards.test.ts +119 -113
  33. package/tests/methods/getOpenpayDeviceSessionID.test.ts +95 -0
  34. package/tests/methods/getSkyflowToken.test.ts +155 -0
  35. package/tests/methods/getVaultToken.test.ts +107 -0
  36. package/tests/methods/registerCustomerCard.test.ts +117 -117
  37. package/tests/methods/startCheckoutRouter.test.ts +119 -119
  38. package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
  39. package/tests/utils/defaultMock.ts +20 -21
  40. package/tests/utils/mockClasses.ts +656 -659
  41. package/tsconfig.json +18 -18
  42. package/.idea/aws.xml +0 -17
  43. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  44. package/.idea/prettier.xml +0 -6
  45. package/.idea/vcs.xml +0 -6
  46. package/.idea/workspace.xml +0 -133
  47. package/dist/classes/BaseInlineCheckout.d.ts +0 -45
  48. package/dist/data/businessApi.d.ts +0 -2
  49. package/dist/data/cardApi.d.ts +0 -4
  50. package/dist/data/checkoutApi.d.ts +0 -4
  51. package/dist/data/customerApi.d.ts +0 -2
  52. package/dist/data/openPayApi.d.ts +0 -1
  53. package/dist/data/paymentMethodApi.d.ts +0 -5
  54. package/dist/data/skyflowApi.d.ts +0 -1
  55. package/dist/helpers/skyflow.d.ts +0 -3
  56. package/dist/helpers/validations.d.ts +0 -6
  57. package/dist/shared/catalog/paymentMethodsCatalog.d.ts +0 -1
  58. package/dist/shared/constants/messages.d.ts +0 -11
  59. package/dist/shared/constants/paymentMethodAPM.d.ts +0 -62
  60. package/dist/shared/constants/tonderUrl.d.ts +0 -7
  61. package/dist/types/card.d.ts +0 -29
  62. package/dist/types/checkout.d.ts +0 -103
  63. package/dist/types/customer.d.ts +0 -12
  64. package/dist/types/paymentMethod.d.ts +0 -22
  65. package/dist/types/transaction.d.ts +0 -101
  66. package/src/classes/BaseInlineCheckout.ts +0 -356
  67. package/src/data/businessApi.ts +0 -18
  68. package/src/data/cardApi.ts +0 -89
  69. package/src/data/checkoutApi.ts +0 -87
  70. package/src/data/customerApi.ts +0 -31
  71. package/src/data/openPayApi.ts +0 -12
  72. package/src/data/paymentMethodApi.ts +0 -37
  73. package/src/data/skyflowApi.ts +0 -20
  74. package/src/helpers/skyflow.ts +0 -91
  75. package/src/helpers/validations.ts +0 -55
  76. package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
  77. package/src/shared/constants/messages.ts +0 -11
  78. package/src/shared/constants/paymentMethodAPM.ts +0 -63
  79. package/src/shared/constants/tonderUrl.ts +0 -8
  80. package/src/types/card.ts +0 -34
  81. package/src/types/checkout.ts +0 -118
  82. package/src/types/customer.ts +0 -12
  83. package/src/types/index.d.ts +0 -10
  84. package/src/types/liteInlineCheckout.d.ts +0 -191
  85. package/src/types/paymentMethod.ts +0 -24
  86. package/src/types/transaction.ts +0 -101
  87. package/src/types/validations.d.ts +0 -11
package/src/data/api.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { buildErrorResponse, buildErrorResponseFromCatch } from "../helpers/utils";
2
-
3
- export async function getCustomerAPMs(baseUrlTonder: string, apiKeyTonder: string, query: string = "?status=active&page_size=10000&country=México", signal: AbortSignal | null | undefined = null) {
4
- try {
5
- const response = await fetch(
6
- `${baseUrlTonder}/api/v1/payment_methods${query}`,
7
- {
8
- method: 'GET',
9
- headers: {
10
- Authorization: `Token ${apiKeyTonder}`,
11
- 'Content-Type': 'application/json'
12
- },
13
- signal
14
- });
15
-
16
- if (response.ok) return await response.json();
17
- throw await buildErrorResponse(response);
18
- } catch (error) {
19
- throw buildErrorResponseFromCatch(error);
20
- }
1
+ import { buildErrorResponse, buildErrorResponseFromCatch } from "../helpers/utils";
2
+
3
+ export async function getCustomerAPMs(baseUrlTonder: string, publicApiKeyTonder: string, query: string = "?status=active&page_size=10000&country=México", signal: AbortSignal | null | undefined = null) {
4
+ try {
5
+ const response = await fetch(
6
+ `${baseUrlTonder}/api/v1/payment_methods${query}`,
7
+ {
8
+ method: 'GET',
9
+ headers: {
10
+ Authorization: `Token ${publicApiKeyTonder}`,
11
+ 'Content-Type': 'application/json'
12
+ },
13
+ signal
14
+ });
15
+
16
+ if (response.ok) return await response.json();
17
+ throw await buildErrorResponse(response);
18
+ } catch (error) {
19
+ throw buildErrorResponseFromCatch(error);
20
+ }
21
21
  }
@@ -1,64 +1,64 @@
1
- enum PAYMENT_METHOD {
2
- SORIANA = "SORIANA",
3
- OXXO = "OXXO",
4
- SPEI= "SPEI",
5
- CODI= "CODI",
6
- MERCADOPAGO= "MERCADOPAGO",
7
- PAYPAL= "PAYPAL",
8
- COMERCIALMEXICANA= "COMERCIALMEXICANA",
9
- BANCOMER= "BANCOMER",
10
- WALMART= "WALMART",
11
- BODEGA= "BODEGA",
12
- SAMSCLUB= "SAMSCLUB",
13
- SUPERAMA= "SUPERAMA",
14
- CALIMAX= "CALIMAX",
15
- EXTRA= "EXTRA",
16
- CIRCULOK= "CIRCULOK",
17
- SEVEN11= "7ELEVEN",
18
- TELECOMM= "TELECOMM",
19
- BANORTE= "BANORTE",
20
- BENAVIDES= "BENAVIDES",
21
- DELAHORRO= "DELAHORRO",
22
- ELASTURIANO= "ELASTURIANO",
23
- WALDOS= "WALDOS",
24
- ALSUPER= "ALSUPER",
25
- KIOSKO= "KIOSKO",
26
- STAMARIA= "STAMARIA",
27
- LAMASBARATA= "LAMASBARATA",
28
- FARMROMA= "FARMROMA",
29
- FARMUNION= "FARMUNION",
30
- FARMATODO= "FARMATODO",
31
- SFDEASIS= "SFDEASIS",
32
- FARM911= "FARM911",
33
- FARMECONOMICAS= "FARMECONOMICAS",
34
- FARMMEDICITY= "FARMMEDICITY",
35
- RIANXEIRA= "RIANXEIRA",
36
- WESTERNUNION= "WESTERNUNION",
37
- ZONAPAGO= "ZONAPAGO",
38
- CAJALOSANDES= "CAJALOSANDES",
39
- CAJAPAITA= "CAJAPAITA",
40
- CAJASANTA= "CAJASANTA",
41
- CAJASULLANA= "CAJASULLANA",
42
- CAJATRUJILLO= "CAJATRUJILLO",
43
- EDPYME= "EDPYME",
44
- KASNET= "KASNET",
45
- NORANDINO= "NORANDINO",
46
- QAPAQ= "QAPAQ",
47
- RAIZ= "RAIZ",
48
- PAYSER= "PAYSER",
49
- WUNION= "WUNION",
50
- BANCOCONTINENTAL= "BANCOCONTINENTAL",
51
- GMONEY= "GMONEY",
52
- GOPAY= "GOPAY",
53
- WU= "WU",
54
- PUNTOSHEY= "PUNTOSHEY",
55
- AMPM= "AMPM",
56
- JUMBOMARKET= "JUMBOMARKET",
57
- SMELPUEBLO= "SMELPUEBLO",
58
- BAM= "BAM",
59
- REFACIL= "REFACIL",
60
- ACYVALORES= "ACYVALORES"
61
- }
62
-
63
- export { PAYMENT_METHOD }
1
+ enum PAYMENT_METHOD {
2
+ SORIANA = "SORIANA",
3
+ OXXO = "OXXO",
4
+ SPEI= "SPEI",
5
+ CODI= "CODI",
6
+ MERCADOPAGO= "MERCADOPAGO",
7
+ PAYPAL= "PAYPAL",
8
+ COMERCIALMEXICANA= "COMERCIALMEXICANA",
9
+ BANCOMER= "BANCOMER",
10
+ WALMART= "WALMART",
11
+ BODEGA= "BODEGA",
12
+ SAMSCLUB= "SAMSCLUB",
13
+ SUPERAMA= "SUPERAMA",
14
+ CALIMAX= "CALIMAX",
15
+ EXTRA= "EXTRA",
16
+ CIRCULOK= "CIRCULOK",
17
+ SEVEN11= "7ELEVEN",
18
+ TELECOMM= "TELECOMM",
19
+ BANORTE= "BANORTE",
20
+ BENAVIDES= "BENAVIDES",
21
+ DELAHORRO= "DELAHORRO",
22
+ ELASTURIANO= "ELASTURIANO",
23
+ WALDOS= "WALDOS",
24
+ ALSUPER= "ALSUPER",
25
+ KIOSKO= "KIOSKO",
26
+ STAMARIA= "STAMARIA",
27
+ LAMASBARATA= "LAMASBARATA",
28
+ FARMROMA= "FARMROMA",
29
+ FARMUNION= "FARMUNION",
30
+ FARMATODO= "FARMATODO",
31
+ SFDEASIS= "SFDEASIS",
32
+ FARM911= "FARM911",
33
+ FARMECONOMICAS= "FARMECONOMICAS",
34
+ FARMMEDICITY= "FARMMEDICITY",
35
+ RIANXEIRA= "RIANXEIRA",
36
+ WESTERNUNION= "WESTERNUNION",
37
+ ZONAPAGO= "ZONAPAGO",
38
+ CAJALOSANDES= "CAJALOSANDES",
39
+ CAJAPAITA= "CAJAPAITA",
40
+ CAJASANTA= "CAJASANTA",
41
+ CAJASULLANA= "CAJASULLANA",
42
+ CAJATRUJILLO= "CAJATRUJILLO",
43
+ EDPYME= "EDPYME",
44
+ KASNET= "KASNET",
45
+ NORANDINO= "NORANDINO",
46
+ QAPAQ= "QAPAQ",
47
+ RAIZ= "RAIZ",
48
+ PAYSER= "PAYSER",
49
+ WUNION= "WUNION",
50
+ BANCOCONTINENTAL= "BANCOCONTINENTAL",
51
+ GMONEY= "GMONEY",
52
+ GOPAY= "GOPAY",
53
+ WU= "WU",
54
+ PUNTOSHEY= "PUNTOSHEY",
55
+ AMPM= "AMPM",
56
+ JUMBOMARKET= "JUMBOMARKET",
57
+ SMELPUEBLO= "SMELPUEBLO",
58
+ BAM= "BAM",
59
+ REFACIL= "REFACIL",
60
+ ACYVALORES= "ACYVALORES"
61
+ }
62
+
63
+ export { PAYMENT_METHOD }
64
64
 
@@ -1,16 +1,16 @@
1
- export function injectMercadoPagoSecurity() {
2
- try {
3
- const script = document.createElement("script");
4
- script.src = "https://www.mercadopago.com/v2/security.js";
5
- script.setAttribute("view", "");
6
- script.onload = () => {
7
- console.log("Mercado Pago script loaded successfully.");
8
- };
9
- script.onerror = (error) => {
10
- console.error("Error loading Mercado Pago script:", error);
11
- };
12
- document.head.appendChild(script);
13
- } catch (error) {
14
- console.error("Error attempting to inject Mercado Pago script:", error);
15
- }
1
+ export function injectMercadoPagoSecurity() {
2
+ try {
3
+ const script = document.createElement('script');
4
+ script.src = "https://www.mercadopago.com/v2/security.js";
5
+ script.setAttribute('view', '');
6
+ script.onload = () => {
7
+ console.log("Mercado Pago script loaded successfully.");
8
+ };
9
+ script.onerror = (error) => {
10
+ console.error("Error loading Mercado Pago script:", error);
11
+ };
12
+ document.head.appendChild(script);
13
+ } catch (error) {
14
+ console.error("Error attempting to inject Mercado Pago script:", error);
15
+ }
16
16
  }
@@ -1,120 +1,320 @@
1
- import { ErrorResponse } from "../classes/errorResponse";
2
- import { IErrorResponse } from "../types";
3
-
4
- export const getBrowserInfo = () => {
5
- const browserInfo = {
6
- javascript_enabled: true, // Assumed since JavaScript is running
7
- time_zone: new Date().getTimezoneOffset(),
8
- language: navigator.language || "en-US", // Fallback to 'en-US'
9
- color_depth: window.screen ? window.screen.colorDepth : 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,
16
- user_agent: navigator.userAgent,
17
- };
18
- return browserInfo;
19
- };
20
-
21
- export const getBusinessId = (merchantData: any) => {
22
- return merchantData && "business" in merchantData
23
- ? merchantData?.business?.pk
24
- : "";
25
- };
26
- const buildErrorResponseFromCatch = (e: any): ErrorResponse => {
27
- const error = new ErrorResponse({
28
- code: e?.status ? e.status : e.code,
29
- body: e?.body,
30
- name: e ? (typeof e == "string" ? "catch" : (e as Error).name) : "Error",
31
- message: e ? (typeof e == "string" ? e : (e as Error).message) : "Error",
32
- stack: typeof e == "string" ? undefined : (e as Error).stack,
33
- });
34
-
35
- return error;
36
- };
37
-
38
- const buildErrorResponse = async (
39
- response: Response,
40
- stack: string | undefined = undefined,
41
- ): Promise<ErrorResponse> => {
42
- let body,
43
- status,
44
- message = "Error";
45
-
46
- if (response && "json" in response) {
47
- body = await response?.json();
48
- }
49
-
50
- if (response && "status" in response) {
51
- status = response.status.toString();
52
- }
53
-
54
- if (!body && response && "text" in response) {
55
- message = await response.text();
56
- }
57
-
58
- if (body?.detail) {
59
- message = body.detail;
60
- }
61
- const error = new ErrorResponse({
62
- code: status,
63
- body: body,
64
- name: status,
65
- message: message,
66
- stack,
67
- } as IErrorResponse);
68
-
69
- return error;
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.",
87
- };
88
-
89
- return {
90
- ...default_res,
91
- ...data,
92
- };
93
- }
94
-
95
- const clearSpace = (text: string) => {
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
- };
113
-
114
- export {
115
- buildErrorResponseFromCatch,
116
- buildErrorResponse,
117
- getCardType,
118
- formatPublicErrorResponse,
119
- clearSpace,
120
- };
1
+ import { ErrorResponse } from "../classes/errorResponse";
2
+ import { IErrorResponse } from "../types/responses";
3
+ import { PAYMENT_METHOD } from "./constants";
4
+
5
+ export const getBrowserInfo = () => {
6
+ const browserInfo = {
7
+ javascript_enabled: true, // Assumed since JavaScript is running
8
+ time_zone: new Date().getTimezoneOffset(),
9
+ language: navigator.language || 'en-US', // Fallback to 'en-US'
10
+ 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,
13
+ user_agent: navigator.userAgent,
14
+ };
15
+ return browserInfo;
16
+ }
17
+
18
+ export const getBusinessId = (merchantData: any) =>{
19
+ return merchantData && "business" in merchantData ? merchantData?.business?.pk:""
20
+ }
21
+ const buildErrorResponseFromCatch = (e: any): ErrorResponse => {
22
+
23
+ const error = new ErrorResponse({
24
+ code: e?.status ? e.status : e.code,
25
+ body: e?.body,
26
+ name: e ? typeof e == "string" ? "catch" : (e as Error).name : "Error",
27
+ message: e ? (typeof e == "string" ? e : (e as Error).message) : "Error",
28
+ stack: typeof e == "string" ? undefined : (e as Error).stack,
29
+ })
30
+
31
+ return error;
32
+ }
33
+
34
+ const buildErrorResponse = async (
35
+ response: Response,
36
+ stack: string | undefined = undefined
37
+ ): Promise<ErrorResponse> => {
38
+ let body, status, message = "Error";
39
+
40
+ if (response && "json" in response) {
41
+ body = await response?.json();
42
+ }
43
+
44
+ if (response && "status" in response) {
45
+ status = response.status.toString();
46
+ }
47
+
48
+ if (!body && response && "text" in response) {
49
+ message = await response.text();
50
+ }
51
+
52
+ if(body?.detail){
53
+ message = body.detail
54
+ }
55
+ const error = new ErrorResponse({
56
+ code: status,
57
+ body: body,
58
+ name: status,
59
+ message: message,
60
+ stack,
61
+ } as IErrorResponse)
62
+
63
+ 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
+ },
302
+ };
303
+
304
+ const _default = {
305
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
306
+ label: ""
307
+ };
308
+
309
+ return PAYMENT_METHODS_CATALOG[scheme] || _default;
310
+ }
311
+
312
+ const clearSpace = (text: string) => {
313
+ return text.trim().replace(/\s+/g, '');
314
+ }
315
+
316
+ export {
317
+ buildErrorResponseFromCatch,
318
+ buildErrorResponse,
319
+ getPaymentMethodDetails
320
+ }
package/src/index.ts CHANGED
@@ -1,11 +1,5 @@
1
- import { LiteCheckout } from './classes/liteCheckout'
2
- import { validateCVV, validateCardNumber, validateExpirationMonth, validateCardholderName, validateExpirationYear } from './helpers/validations'
3
-
4
- export {
5
- LiteCheckout,
6
- validateCVV,
7
- validateCardNumber,
8
- validateCardholderName,
9
- validateExpirationMonth,
10
- validateExpirationYear
1
+ import { LiteCheckout } from './classes/liteCheckout'
2
+
3
+ export {
4
+ LiteCheckout
11
5
  }