@tonder.io/ionic-lite-sdk 0.0.32-beta → 0.0.34-beta
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.
- package/.gitlab-ci.yml +28 -28
- package/README.md +202 -193
- package/dist/classes/3dsHandler.d.ts +33 -0
- package/dist/classes/liteCheckout.d.ts +16 -6
- package/dist/data/api.d.ts +1 -0
- package/dist/helpers/constants.d.ts +62 -0
- package/dist/helpers/utils.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/types/commons.d.ts +16 -0
- package/dist/types/requests.d.ts +14 -2
- package/dist/types/responses.d.ts +1 -0
- package/jest.config.ts +14 -14
- package/package.json +38 -38
- package/rollup.config.js +16 -16
- package/src/classes/3dsHandler.ts +241 -0
- package/src/classes/errorResponse.ts +16 -16
- package/src/classes/liteCheckout.ts +521 -462
- package/src/data/api.ts +21 -0
- package/src/helpers/constants.ts +64 -0
- package/src/helpers/utils.ts +315 -12
- package/src/index.ts +4 -4
- package/src/types/commons.ts +80 -62
- package/src/types/requests.ts +105 -89
- package/src/types/responses.ts +188 -187
- package/src/types/skyflow.ts +17 -17
- package/tests/classes/liteCheckout.test.ts +57 -57
- package/tests/methods/createOrder.test.ts +142 -142
- package/tests/methods/createPayment.test.ts +122 -122
- package/tests/methods/customerRegister.test.ts +119 -119
- package/tests/methods/getBusiness.test.ts +115 -115
- package/tests/methods/getCustomerCards.test.ts +117 -117
- package/tests/methods/getOpenpayDeviceSessionID.test.ts +94 -94
- package/tests/methods/getSkyflowToken.test.ts +154 -154
- package/tests/methods/getVaultToken.test.ts +106 -106
- package/tests/methods/registerCustomerCard.test.ts +117 -117
- package/tests/methods/startCheckoutRouter.test.ts +119 -119
- package/tests/methods/startCheckoutRouterFull.test.ts +138 -138
- package/tests/utils/defaultMock.ts +20 -20
- package/tests/utils/mockClasses.ts +652 -649
- package/tsconfig.json +18 -18
package/src/data/api.ts
ADDED
|
@@ -0,0 +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
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +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 }
|
|
64
|
+
|
package/src/helpers/utils.ts
CHANGED
|
@@ -1,12 +1,315 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
const buildErrorResponseFromCatch = (e: any): ErrorResponse => {
|
|
19
|
+
|
|
20
|
+
const error = new ErrorResponse({
|
|
21
|
+
code: e?.status ? e.status : e.code,
|
|
22
|
+
body: e?.body,
|
|
23
|
+
name: e ? typeof e == "string" ? "catch" : (e as Error).name : "Error",
|
|
24
|
+
message: e ? (typeof e == "string" ? e : (e as Error).message) : "Error",
|
|
25
|
+
stack: typeof e == "string" ? undefined : (e as Error).stack,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
return error;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const buildErrorResponse = async (
|
|
32
|
+
response: Response,
|
|
33
|
+
stack: string | undefined = undefined
|
|
34
|
+
): Promise<ErrorResponse> => {
|
|
35
|
+
|
|
36
|
+
let body, status, message = "Error";
|
|
37
|
+
|
|
38
|
+
if (response && "json" in response) {
|
|
39
|
+
body = await response?.json();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (response && "status" in response) {
|
|
43
|
+
status = response.status.toString();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (response && "text" in response) {
|
|
47
|
+
message = await response.text();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const error = new ErrorResponse({
|
|
51
|
+
code: status,
|
|
52
|
+
body: body,
|
|
53
|
+
name: status,
|
|
54
|
+
message: message,
|
|
55
|
+
stack,
|
|
56
|
+
} as IErrorResponse)
|
|
57
|
+
|
|
58
|
+
return error;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const getPaymentMethodDetails = (scheme_data: string): {icon: string; label: string} => {
|
|
62
|
+
const scheme: PAYMENT_METHOD = clearSpace(scheme_data.toUpperCase()) as PAYMENT_METHOD;
|
|
63
|
+
|
|
64
|
+
const PAYMENT_METHODS_CATALOG: Partial<Record<PAYMENT_METHOD, { icon: string, label: string }>> = {
|
|
65
|
+
[PAYMENT_METHOD.SORIANA]: {
|
|
66
|
+
label: "Soriana",
|
|
67
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/soriana.png",
|
|
68
|
+
},
|
|
69
|
+
[PAYMENT_METHOD.OXXO]: {
|
|
70
|
+
label: "Oxxo",
|
|
71
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/oxxo.png",
|
|
72
|
+
},
|
|
73
|
+
[PAYMENT_METHOD.CODI]: {
|
|
74
|
+
label: "CoDi",
|
|
75
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/codi.png",
|
|
76
|
+
},
|
|
77
|
+
[PAYMENT_METHOD.SPEI]: {
|
|
78
|
+
label: "SPEI",
|
|
79
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/spei.png",
|
|
80
|
+
},
|
|
81
|
+
[PAYMENT_METHOD.PAYPAL]: {
|
|
82
|
+
label: "Paypal",
|
|
83
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/paypal.png",
|
|
84
|
+
},
|
|
85
|
+
[PAYMENT_METHOD.COMERCIALMEXICANA]: {
|
|
86
|
+
label: "Comercial Mexicana",
|
|
87
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/comercial_exicana.png",
|
|
88
|
+
},
|
|
89
|
+
[PAYMENT_METHOD.BANCOMER]: {
|
|
90
|
+
label: "Bancomer",
|
|
91
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bancomer.png",
|
|
92
|
+
},
|
|
93
|
+
[PAYMENT_METHOD.WALMART]: {
|
|
94
|
+
label: "Walmart",
|
|
95
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/walmart.png",
|
|
96
|
+
},
|
|
97
|
+
[PAYMENT_METHOD.BODEGA]: {
|
|
98
|
+
label: "Bodega Aurrera",
|
|
99
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bodega_aurrera.png",
|
|
100
|
+
},
|
|
101
|
+
[PAYMENT_METHOD.SAMSCLUB]: {
|
|
102
|
+
label: "Sam´s Club",
|
|
103
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/sams_club.png",
|
|
104
|
+
},
|
|
105
|
+
[PAYMENT_METHOD.SUPERAMA]: {
|
|
106
|
+
label: "Superama",
|
|
107
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/superama.png",
|
|
108
|
+
},
|
|
109
|
+
[PAYMENT_METHOD.CALIMAX]: {
|
|
110
|
+
label: "Calimax",
|
|
111
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/calimax.png",
|
|
112
|
+
},
|
|
113
|
+
[PAYMENT_METHOD.EXTRA]: {
|
|
114
|
+
label: "Tiendas Extra",
|
|
115
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/tiendas_extra.png",
|
|
116
|
+
},
|
|
117
|
+
[PAYMENT_METHOD.CIRCULOK]: {
|
|
118
|
+
label: "Círculo K",
|
|
119
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/circulo_k.png",
|
|
120
|
+
},
|
|
121
|
+
[PAYMENT_METHOD.SEVEN11]: {
|
|
122
|
+
label: "7 Eleven",
|
|
123
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/7_eleven.png",
|
|
124
|
+
},
|
|
125
|
+
[PAYMENT_METHOD.TELECOMM]: {
|
|
126
|
+
label: "Telecomm",
|
|
127
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/telecomm.png",
|
|
128
|
+
},
|
|
129
|
+
[PAYMENT_METHOD.BANORTE]: {
|
|
130
|
+
label: "Banorte",
|
|
131
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/banorte.png",
|
|
132
|
+
},
|
|
133
|
+
[PAYMENT_METHOD.BENAVIDES]: {
|
|
134
|
+
label: "Farmacias Benavides",
|
|
135
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_benavides.png",
|
|
136
|
+
},
|
|
137
|
+
[PAYMENT_METHOD.DELAHORRO]: {
|
|
138
|
+
label: "Farmacias del Ahorro",
|
|
139
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_ahorro.png",
|
|
140
|
+
},
|
|
141
|
+
[PAYMENT_METHOD.ELASTURIANO]: {
|
|
142
|
+
label: "El Asturiano",
|
|
143
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/asturiano.png",
|
|
144
|
+
},
|
|
145
|
+
[PAYMENT_METHOD.WALDOS]: {
|
|
146
|
+
label: "Waldos",
|
|
147
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/waldos.png",
|
|
148
|
+
},
|
|
149
|
+
[PAYMENT_METHOD.ALSUPER]: {
|
|
150
|
+
label: "Alsuper",
|
|
151
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/al_super.png",
|
|
152
|
+
},
|
|
153
|
+
[PAYMENT_METHOD.KIOSKO]: {
|
|
154
|
+
label: "Kiosko",
|
|
155
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/kiosko.png",
|
|
156
|
+
},
|
|
157
|
+
[PAYMENT_METHOD.STAMARIA]: {
|
|
158
|
+
label: "Farmacias Santa María",
|
|
159
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_santa_maria.png",
|
|
160
|
+
},
|
|
161
|
+
[PAYMENT_METHOD.LAMASBARATA]: {
|
|
162
|
+
label: "Farmacias la más barata",
|
|
163
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_barata.png",
|
|
164
|
+
},
|
|
165
|
+
[PAYMENT_METHOD.FARMROMA]: {
|
|
166
|
+
label: "Farmacias Roma",
|
|
167
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_roma.png",
|
|
168
|
+
},
|
|
169
|
+
[PAYMENT_METHOD.FARMUNION]: {
|
|
170
|
+
label: "Pago en Farmacias Unión",
|
|
171
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_union.png",
|
|
172
|
+
},
|
|
173
|
+
[PAYMENT_METHOD.FARMATODO]: {
|
|
174
|
+
label: "Pago en Farmacias Farmatodo",
|
|
175
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_farmatodo.png ",
|
|
176
|
+
},
|
|
177
|
+
[PAYMENT_METHOD.SFDEASIS]: {
|
|
178
|
+
label: "Pago en Farmacias San Francisco de Asís",
|
|
179
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_san_francisco.png",
|
|
180
|
+
},
|
|
181
|
+
[PAYMENT_METHOD.FARM911]: {
|
|
182
|
+
label: "Farmacias 911",
|
|
183
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
184
|
+
},
|
|
185
|
+
[PAYMENT_METHOD.FARMECONOMICAS]: {
|
|
186
|
+
label: "Farmacias Economicas",
|
|
187
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
188
|
+
},
|
|
189
|
+
[PAYMENT_METHOD.FARMMEDICITY]: {
|
|
190
|
+
label: "Farmacias Medicity",
|
|
191
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
192
|
+
},
|
|
193
|
+
[PAYMENT_METHOD.RIANXEIRA]: {
|
|
194
|
+
label: "Rianxeira",
|
|
195
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
196
|
+
},
|
|
197
|
+
[PAYMENT_METHOD.WESTERNUNION]: {
|
|
198
|
+
label: "Western Union",
|
|
199
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
200
|
+
},
|
|
201
|
+
[PAYMENT_METHOD.ZONAPAGO]: {
|
|
202
|
+
label: "Zona Pago",
|
|
203
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
204
|
+
},
|
|
205
|
+
[PAYMENT_METHOD.CAJALOSANDES]: {
|
|
206
|
+
label: "Caja Los Andes",
|
|
207
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
208
|
+
},
|
|
209
|
+
[PAYMENT_METHOD.CAJAPAITA]: {
|
|
210
|
+
label: "Caja Paita",
|
|
211
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
212
|
+
},
|
|
213
|
+
[PAYMENT_METHOD.CAJASANTA]: {
|
|
214
|
+
label: "Caja Santa",
|
|
215
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
216
|
+
},
|
|
217
|
+
[PAYMENT_METHOD.CAJASULLANA]: {
|
|
218
|
+
label: "Caja Sullana",
|
|
219
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
220
|
+
},
|
|
221
|
+
[PAYMENT_METHOD.CAJATRUJILLO]: {
|
|
222
|
+
label: "Caja Trujillo",
|
|
223
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
224
|
+
},
|
|
225
|
+
[PAYMENT_METHOD.EDPYME]: {
|
|
226
|
+
label: "Edpyme",
|
|
227
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
228
|
+
},
|
|
229
|
+
[PAYMENT_METHOD.KASNET]: {
|
|
230
|
+
label: "KasNet",
|
|
231
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
232
|
+
},
|
|
233
|
+
[PAYMENT_METHOD.NORANDINO]: {
|
|
234
|
+
label: "Norandino",
|
|
235
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
236
|
+
},
|
|
237
|
+
[PAYMENT_METHOD.QAPAQ]: {
|
|
238
|
+
label: "Qapaq",
|
|
239
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
240
|
+
},
|
|
241
|
+
[PAYMENT_METHOD.RAIZ]: {
|
|
242
|
+
label: "Raiz",
|
|
243
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
244
|
+
},
|
|
245
|
+
[PAYMENT_METHOD.PAYSER]: {
|
|
246
|
+
label: "Paysera",
|
|
247
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
248
|
+
},
|
|
249
|
+
[PAYMENT_METHOD.WUNION]: {
|
|
250
|
+
label: "Western Union",
|
|
251
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
252
|
+
},
|
|
253
|
+
[PAYMENT_METHOD.BANCOCONTINENTAL]: {
|
|
254
|
+
label: "Banco Continental",
|
|
255
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
256
|
+
},
|
|
257
|
+
[PAYMENT_METHOD.GMONEY]: {
|
|
258
|
+
label: "Go money",
|
|
259
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
260
|
+
},
|
|
261
|
+
[PAYMENT_METHOD.GOPAY]: {
|
|
262
|
+
label: "Go pay",
|
|
263
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
264
|
+
},
|
|
265
|
+
[PAYMENT_METHOD.WU]: {
|
|
266
|
+
label: "Western Union",
|
|
267
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
268
|
+
},
|
|
269
|
+
[PAYMENT_METHOD.PUNTOSHEY]: {
|
|
270
|
+
label: "Puntoshey",
|
|
271
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
272
|
+
},
|
|
273
|
+
[PAYMENT_METHOD.AMPM]: {
|
|
274
|
+
label: "Ampm",
|
|
275
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
276
|
+
},
|
|
277
|
+
[PAYMENT_METHOD.JUMBOMARKET]: {
|
|
278
|
+
label: "Jumbomarket",
|
|
279
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
280
|
+
},
|
|
281
|
+
[PAYMENT_METHOD.SMELPUEBLO]: {
|
|
282
|
+
label: "Smelpueblo",
|
|
283
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
284
|
+
},
|
|
285
|
+
[PAYMENT_METHOD.BAM]: {
|
|
286
|
+
label: "Bam",
|
|
287
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
288
|
+
},
|
|
289
|
+
[PAYMENT_METHOD.REFACIL]: {
|
|
290
|
+
label: "Refacil",
|
|
291
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
292
|
+
},
|
|
293
|
+
[PAYMENT_METHOD.ACYVALORES]: {
|
|
294
|
+
label: "Acyvalores",
|
|
295
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const _default = {
|
|
300
|
+
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
301
|
+
label: ""
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
return PAYMENT_METHODS_CATALOG[scheme] || _default;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const clearSpace = (text: string) => {
|
|
308
|
+
return text.trim().replace(/\s+/g, '');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export {
|
|
312
|
+
buildErrorResponseFromCatch,
|
|
313
|
+
buildErrorResponse,
|
|
314
|
+
getPaymentMethodDetails
|
|
315
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LiteCheckout } from './classes/liteCheckout'
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
LiteCheckout
|
|
1
|
+
import { LiteCheckout } from './classes/liteCheckout'
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
LiteCheckout
|
|
5
5
|
}
|
package/src/types/commons.ts
CHANGED
|
@@ -1,62 +1,80 @@
|
|
|
1
|
-
export type Business = {
|
|
2
|
-
business: {
|
|
3
|
-
pk: number;
|
|
4
|
-
name: string;
|
|
5
|
-
categories: {
|
|
6
|
-
pk: number;
|
|
7
|
-
name: string;
|
|
8
|
-
}[];
|
|
9
|
-
web: string;
|
|
10
|
-
logo: string;
|
|
11
|
-
full_logo_url: string;
|
|
12
|
-
background_color: string;
|
|
13
|
-
primary_color: string;
|
|
14
|
-
checkout_mode: boolean;
|
|
15
|
-
textCheckoutColor: string;
|
|
16
|
-
textDetailsColor: string;
|
|
17
|
-
checkout_logo: string;
|
|
18
|
-
};
|
|
19
|
-
openpay_keys: {
|
|
20
|
-
merchant_id: string;
|
|
21
|
-
public_key: string;
|
|
22
|
-
};
|
|
23
|
-
fintoc_keys: {
|
|
24
|
-
public_key: string;
|
|
25
|
-
};
|
|
26
|
-
vault_id: string;
|
|
27
|
-
vault_url: string;
|
|
28
|
-
reference: number;
|
|
29
|
-
is_installments_available: boolean;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type Customer = {
|
|
33
|
-
firstName: string;
|
|
34
|
-
lastName: string;
|
|
35
|
-
country: string;
|
|
36
|
-
street: string;
|
|
37
|
-
city: string;
|
|
38
|
-
state: string;
|
|
39
|
-
postCode: string;
|
|
40
|
-
email: string;
|
|
41
|
-
phone: string;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type OrderItem = {
|
|
45
|
-
description: string;
|
|
46
|
-
quantity: number;
|
|
47
|
-
price_unit: number;
|
|
48
|
-
discount: number;
|
|
49
|
-
taxes: number;
|
|
50
|
-
product_reference: number;
|
|
51
|
-
name: string;
|
|
52
|
-
amount_total: number;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type PaymentData = {
|
|
56
|
-
customer: Customer;
|
|
57
|
-
currency: string;
|
|
58
|
-
cart: {
|
|
59
|
-
total: string | number;
|
|
60
|
-
items: OrderItem[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
1
|
+
export type Business = {
|
|
2
|
+
business: {
|
|
3
|
+
pk: number;
|
|
4
|
+
name: string;
|
|
5
|
+
categories: {
|
|
6
|
+
pk: number;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
web: string;
|
|
10
|
+
logo: string;
|
|
11
|
+
full_logo_url: string;
|
|
12
|
+
background_color: string;
|
|
13
|
+
primary_color: string;
|
|
14
|
+
checkout_mode: boolean;
|
|
15
|
+
textCheckoutColor: string;
|
|
16
|
+
textDetailsColor: string;
|
|
17
|
+
checkout_logo: string;
|
|
18
|
+
};
|
|
19
|
+
openpay_keys: {
|
|
20
|
+
merchant_id: string;
|
|
21
|
+
public_key: string;
|
|
22
|
+
};
|
|
23
|
+
fintoc_keys: {
|
|
24
|
+
public_key: string;
|
|
25
|
+
};
|
|
26
|
+
vault_id: string;
|
|
27
|
+
vault_url: string;
|
|
28
|
+
reference: number;
|
|
29
|
+
is_installments_available: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type Customer = {
|
|
33
|
+
firstName: string;
|
|
34
|
+
lastName: string;
|
|
35
|
+
country: string;
|
|
36
|
+
street: string;
|
|
37
|
+
city: string;
|
|
38
|
+
state: string;
|
|
39
|
+
postCode: string;
|
|
40
|
+
email: string;
|
|
41
|
+
phone: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type OrderItem = {
|
|
45
|
+
description: string;
|
|
46
|
+
quantity: number;
|
|
47
|
+
price_unit: number;
|
|
48
|
+
discount: number;
|
|
49
|
+
taxes: number;
|
|
50
|
+
product_reference: number;
|
|
51
|
+
name: string;
|
|
52
|
+
amount_total: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type PaymentData = {
|
|
56
|
+
customer: Customer;
|
|
57
|
+
currency: string;
|
|
58
|
+
cart: {
|
|
59
|
+
total: string | number;
|
|
60
|
+
items: OrderItem[];
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type TonderAPM = {
|
|
65
|
+
pk: string;
|
|
66
|
+
payment_method: string;
|
|
67
|
+
priority: number;
|
|
68
|
+
category: string;
|
|
69
|
+
unavailable_countries: string[];
|
|
70
|
+
status: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type APM = {
|
|
74
|
+
id: string;
|
|
75
|
+
payment_method: string;
|
|
76
|
+
priority: number;
|
|
77
|
+
category: string;
|
|
78
|
+
icon: string;
|
|
79
|
+
label: string;
|
|
80
|
+
}
|