@tonder.io/ionic-lite-sdk 0.0.35-beta.7 → 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.
- package/.gitlab-ci.yml +28 -28
- package/README.md +221 -202
- package/dist/classes/errorResponse.d.ts +1 -1
- package/dist/classes/liteCheckout.d.ts +32 -56
- package/dist/data/api.d.ts +1 -1
- package/dist/helpers/utils.d.ts +4 -8
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/types/commons.d.ts +0 -37
- package/dist/types/requests.d.ts +3 -12
- package/dist/types/responses.d.ts +3 -0
- package/jest.config.ts +14 -14
- package/package.json +38 -38
- package/rollup.config.js +16 -16
- package/src/classes/3dsHandler.ts +237 -237
- package/src/classes/errorResponse.ts +16 -16
- package/src/classes/liteCheckout.ts +575 -598
- package/src/data/api.ts +20 -20
- package/src/helpers/constants.ts +63 -63
- package/src/helpers/mercadopago.ts +15 -15
- package/src/helpers/utils.ts +320 -120
- package/src/index.ts +4 -10
- package/src/types/commons.ts +83 -125
- package/src/types/requests.ts +105 -114
- package/src/types/responses.ts +193 -189
- 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 +119 -113
- package/tests/methods/getOpenpayDeviceSessionID.test.ts +95 -0
- package/tests/methods/getSkyflowToken.test.ts +155 -0
- package/tests/methods/getVaultToken.test.ts +107 -0
- 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 -21
- package/tests/utils/mockClasses.ts +656 -659
- package/tsconfig.json +18 -18
- package/.idea/aws.xml +0 -17
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -132
- package/dist/classes/BaseInlineCheckout.d.ts +0 -45
- package/dist/data/businessApi.d.ts +0 -2
- package/dist/data/cardApi.d.ts +0 -4
- package/dist/data/checkoutApi.d.ts +0 -4
- package/dist/data/customerApi.d.ts +0 -2
- package/dist/data/openPayApi.d.ts +0 -1
- package/dist/data/paymentMethodApi.d.ts +0 -5
- package/dist/data/skyflowApi.d.ts +0 -1
- package/dist/helpers/skyflow.d.ts +0 -3
- package/dist/helpers/validations.d.ts +0 -6
- package/dist/shared/catalog/paymentMethodsCatalog.d.ts +0 -1
- package/dist/shared/constants/messages.d.ts +0 -11
- package/dist/shared/constants/paymentMethodAPM.d.ts +0 -62
- package/dist/shared/constants/tonderUrl.d.ts +0 -7
- package/dist/types/card.d.ts +0 -29
- package/dist/types/checkout.d.ts +0 -103
- package/dist/types/customer.d.ts +0 -12
- package/dist/types/paymentMethod.d.ts +0 -22
- package/src/classes/BaseInlineCheckout.ts +0 -356
- package/src/data/businessApi.ts +0 -18
- package/src/data/cardApi.ts +0 -89
- package/src/data/checkoutApi.ts +0 -87
- package/src/data/customerApi.ts +0 -31
- package/src/data/openPayApi.ts +0 -12
- package/src/data/paymentMethodApi.ts +0 -37
- package/src/data/skyflowApi.ts +0 -20
- package/src/helpers/skyflow.ts +0 -91
- package/src/helpers/validations.ts +0 -55
- package/src/shared/catalog/paymentMethodsCatalog.ts +0 -248
- package/src/shared/constants/messages.ts +0 -11
- package/src/shared/constants/paymentMethodAPM.ts +0 -63
- package/src/shared/constants/tonderUrl.ts +0 -8
- package/src/types/card.ts +0 -34
- package/src/types/checkout.ts +0 -118
- package/src/types/customer.ts +0 -12
- package/src/types/index.d.ts +0 -10
- package/src/types/liteInlineCheckout.d.ts +0 -191
- package/src/types/paymentMethod.ts +0 -24
- package/src/types/validations.d.ts +0 -11
package/src/helpers/skyflow.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {ErrorResponse} from "../classes/errorResponse";
|
|
2
|
-
import Skyflow from "skyflow-js";
|
|
3
|
-
import CollectContainer from "skyflow-js/types/core/external/collect/collect-container";
|
|
4
|
-
import {buildErrorResponseFromCatch} from "./utils";
|
|
5
|
-
import CollectElement from "skyflow-js/types/core/external/collect/collect-element";
|
|
6
|
-
import {getVaultToken} from "../data/skyflowApi";
|
|
7
|
-
import {TokensSkyflowRequest} from "../types";
|
|
8
|
-
|
|
9
|
-
export async function getSkyflowTokens({
|
|
10
|
-
baseUrl,
|
|
11
|
-
apiKey,
|
|
12
|
-
vault_id,
|
|
13
|
-
vault_url,
|
|
14
|
-
data,
|
|
15
|
-
}: TokensSkyflowRequest): Promise<any | ErrorResponse> {
|
|
16
|
-
const skyflow = Skyflow.init({
|
|
17
|
-
vaultID: vault_id,
|
|
18
|
-
vaultURL: vault_url,
|
|
19
|
-
getBearerToken: async () => await getVaultToken(baseUrl, apiKey),
|
|
20
|
-
options: {
|
|
21
|
-
logLevel: Skyflow.LogLevel.ERROR,
|
|
22
|
-
env: Skyflow.Env.DEV,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const collectContainer: CollectContainer = skyflow.container(
|
|
27
|
-
Skyflow.ContainerType.COLLECT,
|
|
28
|
-
) as CollectContainer;
|
|
29
|
-
|
|
30
|
-
const fieldPromises = await getFieldsPromise(data, collectContainer);
|
|
31
|
-
|
|
32
|
-
const result = await Promise.all(fieldPromises);
|
|
33
|
-
|
|
34
|
-
const mountFail = result.some((item: boolean) => !item);
|
|
35
|
-
|
|
36
|
-
if (mountFail) {
|
|
37
|
-
throw buildErrorResponseFromCatch(
|
|
38
|
-
Error("Ocurrió un error al montar los campos de la tarjeta"),
|
|
39
|
-
);
|
|
40
|
-
} else {
|
|
41
|
-
try {
|
|
42
|
-
const collectResponseSkyflowTonder =
|
|
43
|
-
(await collectContainer.collect()) as any;
|
|
44
|
-
if (collectResponseSkyflowTonder)
|
|
45
|
-
return collectResponseSkyflowTonder["records"][0]["fields"];
|
|
46
|
-
throw buildErrorResponseFromCatch(
|
|
47
|
-
Error("Por favor, verifica todos los campos de tu tarjeta"),
|
|
48
|
-
);
|
|
49
|
-
} catch (error) {
|
|
50
|
-
throw buildErrorResponseFromCatch(error);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async function getFieldsPromise(data: any, collectContainer: CollectContainer): Promise<Promise<boolean>[]> {
|
|
56
|
-
const fields = await getFields(data, collectContainer);
|
|
57
|
-
if (!fields) return [];
|
|
58
|
-
|
|
59
|
-
return fields.map((field: { element: CollectElement, key: string }) => {
|
|
60
|
-
return new Promise((resolve) => {
|
|
61
|
-
const div = document.createElement("div");
|
|
62
|
-
div.hidden = true;
|
|
63
|
-
div.id = `id-${field.key}`;
|
|
64
|
-
document.querySelector(`body`)?.appendChild(div);
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
field.element.mount(`#id-${field.key}`);
|
|
67
|
-
setInterval(() => {
|
|
68
|
-
if (field.element.isMounted()) {
|
|
69
|
-
const value = data[field.key];
|
|
70
|
-
field.element.update({ value: value });
|
|
71
|
-
return resolve(field.element.isMounted());
|
|
72
|
-
}
|
|
73
|
-
}, 120);
|
|
74
|
-
}, 120);
|
|
75
|
-
});
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function getFields(data: any, collectContainer: CollectContainer): Promise<{ element: CollectElement, key: string }[]> {
|
|
80
|
-
return await Promise.all(
|
|
81
|
-
Object.keys(data).map(async (key) => {
|
|
82
|
-
const cardHolderNameElement = await collectContainer.create({
|
|
83
|
-
table: "cards",
|
|
84
|
-
column: key,
|
|
85
|
-
type: Skyflow.ElementType.INPUT_FIELD,
|
|
86
|
-
});
|
|
87
|
-
return { element: cardHolderNameElement, key: key };
|
|
88
|
-
})
|
|
89
|
-
)
|
|
90
|
-
}
|
|
91
|
-
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import {clearSpace} from "../../helpers/utils";
|
|
2
|
-
import {PAYMENT_METHOD_APM} from "../constants/paymentMethodAPM";
|
|
3
|
-
|
|
4
|
-
const PAYMENT_METHODS_CATALOG = {
|
|
5
|
-
[PAYMENT_METHOD_APM.SORIANA]: {
|
|
6
|
-
label: "Soriana",
|
|
7
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/soriana.png",
|
|
8
|
-
},
|
|
9
|
-
[PAYMENT_METHOD_APM.OXXO]: {
|
|
10
|
-
label: "Oxxo",
|
|
11
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/oxxo.png",
|
|
12
|
-
},
|
|
13
|
-
[PAYMENT_METHOD_APM.CODI]: {
|
|
14
|
-
label: "CoDi",
|
|
15
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/codi.png",
|
|
16
|
-
},
|
|
17
|
-
[PAYMENT_METHOD_APM.SPEI]: {
|
|
18
|
-
label: "SPEI",
|
|
19
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/spei.png",
|
|
20
|
-
},
|
|
21
|
-
[PAYMENT_METHOD_APM.PAYPAL]: {
|
|
22
|
-
label: "Paypal",
|
|
23
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/paypal.png",
|
|
24
|
-
},
|
|
25
|
-
[PAYMENT_METHOD_APM.COMERCIALMEXICANA]: {
|
|
26
|
-
label: "Comercial Mexicana",
|
|
27
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/comercial_exicana.png",
|
|
28
|
-
},
|
|
29
|
-
[PAYMENT_METHOD_APM.BANCOMER]: {
|
|
30
|
-
label: "Bancomer",
|
|
31
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bancomer.png",
|
|
32
|
-
},
|
|
33
|
-
[PAYMENT_METHOD_APM.WALMART]: {
|
|
34
|
-
label: "Walmart",
|
|
35
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/walmart.png",
|
|
36
|
-
},
|
|
37
|
-
[PAYMENT_METHOD_APM.BODEGA]: {
|
|
38
|
-
label: "Bodega Aurrera",
|
|
39
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/bodega_aurrera.png",
|
|
40
|
-
},
|
|
41
|
-
[PAYMENT_METHOD_APM.SAMSCLUB]: {
|
|
42
|
-
label: "Sam´s Club",
|
|
43
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/sams_club.png",
|
|
44
|
-
},
|
|
45
|
-
[PAYMENT_METHOD_APM.SUPERAMA]: {
|
|
46
|
-
label: "Superama",
|
|
47
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/superama.png",
|
|
48
|
-
},
|
|
49
|
-
[PAYMENT_METHOD_APM.CALIMAX]: {
|
|
50
|
-
label: "Calimax",
|
|
51
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/calimax.png",
|
|
52
|
-
},
|
|
53
|
-
[PAYMENT_METHOD_APM.EXTRA]: {
|
|
54
|
-
label: "Tiendas Extra",
|
|
55
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/tiendas_extra.png",
|
|
56
|
-
},
|
|
57
|
-
[PAYMENT_METHOD_APM.CIRCULOK]: {
|
|
58
|
-
label: "Círculo K",
|
|
59
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/circulo_k.png",
|
|
60
|
-
},
|
|
61
|
-
[PAYMENT_METHOD_APM.SEVEN11]: {
|
|
62
|
-
label: "7 Eleven",
|
|
63
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/7_eleven.png",
|
|
64
|
-
},
|
|
65
|
-
[PAYMENT_METHOD_APM.TELECOMM]: {
|
|
66
|
-
label: "Telecomm",
|
|
67
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/telecomm.png",
|
|
68
|
-
},
|
|
69
|
-
[PAYMENT_METHOD_APM.BANORTE]: {
|
|
70
|
-
label: "Banorte",
|
|
71
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/banorte.png",
|
|
72
|
-
},
|
|
73
|
-
[PAYMENT_METHOD_APM.BENAVIDES]: {
|
|
74
|
-
label: "Farmacias Benavides",
|
|
75
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_benavides.png",
|
|
76
|
-
},
|
|
77
|
-
[PAYMENT_METHOD_APM.DELAHORRO]: {
|
|
78
|
-
label: "Farmacias del Ahorro",
|
|
79
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_ahorro.png",
|
|
80
|
-
},
|
|
81
|
-
[PAYMENT_METHOD_APM.ELASTURIANO]: {
|
|
82
|
-
label: "El Asturiano",
|
|
83
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/asturiano.png",
|
|
84
|
-
},
|
|
85
|
-
[PAYMENT_METHOD_APM.WALDOS]: {
|
|
86
|
-
label: "Waldos",
|
|
87
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/waldos.png",
|
|
88
|
-
},
|
|
89
|
-
[PAYMENT_METHOD_APM.ALSUPER]: {
|
|
90
|
-
label: "Alsuper",
|
|
91
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/al_super.png",
|
|
92
|
-
},
|
|
93
|
-
[PAYMENT_METHOD_APM.KIOSKO]: {
|
|
94
|
-
label: "Kiosko",
|
|
95
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/kiosko.png",
|
|
96
|
-
},
|
|
97
|
-
[PAYMENT_METHOD_APM.STAMARIA]: {
|
|
98
|
-
label: "Farmacias Santa María",
|
|
99
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_santa_maria.png",
|
|
100
|
-
},
|
|
101
|
-
[PAYMENT_METHOD_APM.LAMASBARATA]: {
|
|
102
|
-
label: "Farmacias la más barata",
|
|
103
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_barata.png",
|
|
104
|
-
},
|
|
105
|
-
[PAYMENT_METHOD_APM.FARMROMA]: {
|
|
106
|
-
label: "Farmacias Roma",
|
|
107
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_roma.png",
|
|
108
|
-
},
|
|
109
|
-
[PAYMENT_METHOD_APM.FARMUNION]: {
|
|
110
|
-
label: "Pago en Farmacias Unión",
|
|
111
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_union.png",
|
|
112
|
-
},
|
|
113
|
-
[PAYMENT_METHOD_APM.FARMATODO]: {
|
|
114
|
-
label: "Pago en Farmacias Farmatodo",
|
|
115
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_farmatodo.png ",
|
|
116
|
-
},
|
|
117
|
-
[PAYMENT_METHOD_APM.SFDEASIS]: {
|
|
118
|
-
label: "Pago en Farmacias San Francisco de Asís",
|
|
119
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/farmacias_san_francisco.png",
|
|
120
|
-
},
|
|
121
|
-
[PAYMENT_METHOD_APM.FARM911]: {
|
|
122
|
-
label: "Farmacias 911",
|
|
123
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
124
|
-
},
|
|
125
|
-
[PAYMENT_METHOD_APM.FARMECONOMICAS]: {
|
|
126
|
-
label: "Farmacias Economicas",
|
|
127
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
128
|
-
},
|
|
129
|
-
[PAYMENT_METHOD_APM.FARMMEDICITY]: {
|
|
130
|
-
label: "Farmacias Medicity",
|
|
131
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
132
|
-
},
|
|
133
|
-
[PAYMENT_METHOD_APM.RIANXEIRA]: {
|
|
134
|
-
label: "Rianxeira",
|
|
135
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
136
|
-
},
|
|
137
|
-
[PAYMENT_METHOD_APM.WESTERNUNION]: {
|
|
138
|
-
label: "Western Union",
|
|
139
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
140
|
-
},
|
|
141
|
-
[PAYMENT_METHOD_APM.ZONAPAGO]: {
|
|
142
|
-
label: "Zona Pago",
|
|
143
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
144
|
-
},
|
|
145
|
-
[PAYMENT_METHOD_APM.CAJALOSANDES]: {
|
|
146
|
-
label: "Caja Los Andes",
|
|
147
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
148
|
-
},
|
|
149
|
-
[PAYMENT_METHOD_APM.CAJAPAITA]: {
|
|
150
|
-
label: "Caja Paita",
|
|
151
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
152
|
-
},
|
|
153
|
-
[PAYMENT_METHOD_APM.CAJASANTA]: {
|
|
154
|
-
label: "Caja Santa",
|
|
155
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
156
|
-
},
|
|
157
|
-
[PAYMENT_METHOD_APM.CAJASULLANA]: {
|
|
158
|
-
label: "Caja Sullana",
|
|
159
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
160
|
-
},
|
|
161
|
-
[PAYMENT_METHOD_APM.CAJATRUJILLO]: {
|
|
162
|
-
label: "Caja Trujillo",
|
|
163
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
164
|
-
},
|
|
165
|
-
[PAYMENT_METHOD_APM.EDPYME]: {
|
|
166
|
-
label: "Edpyme",
|
|
167
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
168
|
-
},
|
|
169
|
-
[PAYMENT_METHOD_APM.KASNET]: {
|
|
170
|
-
label: "KasNet",
|
|
171
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
172
|
-
},
|
|
173
|
-
[PAYMENT_METHOD_APM.NORANDINO]: {
|
|
174
|
-
label: "Norandino",
|
|
175
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
176
|
-
},
|
|
177
|
-
[PAYMENT_METHOD_APM.QAPAQ]: {
|
|
178
|
-
label: "Qapaq",
|
|
179
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
180
|
-
},
|
|
181
|
-
[PAYMENT_METHOD_APM.RAIZ]: {
|
|
182
|
-
label: "Raiz",
|
|
183
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
184
|
-
},
|
|
185
|
-
[PAYMENT_METHOD_APM.PAYSER]: {
|
|
186
|
-
label: "Paysera",
|
|
187
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
188
|
-
},
|
|
189
|
-
[PAYMENT_METHOD_APM.WUNION]: {
|
|
190
|
-
label: "Western Union",
|
|
191
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
192
|
-
},
|
|
193
|
-
[PAYMENT_METHOD_APM.BANCOCONTINENTAL]: {
|
|
194
|
-
label: "Banco Continental",
|
|
195
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
196
|
-
},
|
|
197
|
-
[PAYMENT_METHOD_APM.GMONEY]: {
|
|
198
|
-
label: "Go money",
|
|
199
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
200
|
-
},
|
|
201
|
-
[PAYMENT_METHOD_APM.GOPAY]: {
|
|
202
|
-
label: "Go pay",
|
|
203
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
204
|
-
},
|
|
205
|
-
[PAYMENT_METHOD_APM.WU]: {
|
|
206
|
-
label: "Western Union",
|
|
207
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
208
|
-
},
|
|
209
|
-
[PAYMENT_METHOD_APM.PUNTOSHEY]: {
|
|
210
|
-
label: "Puntoshey",
|
|
211
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
212
|
-
},
|
|
213
|
-
[PAYMENT_METHOD_APM.AMPM]: {
|
|
214
|
-
label: "Ampm",
|
|
215
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
216
|
-
},
|
|
217
|
-
[PAYMENT_METHOD_APM.JUMBOMARKET]: {
|
|
218
|
-
label: "Jumbomarket",
|
|
219
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
220
|
-
},
|
|
221
|
-
[PAYMENT_METHOD_APM.SMELPUEBLO]: {
|
|
222
|
-
label: "Smelpueblo",
|
|
223
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
224
|
-
},
|
|
225
|
-
[PAYMENT_METHOD_APM.BAM]: {
|
|
226
|
-
label: "Bam",
|
|
227
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
228
|
-
},
|
|
229
|
-
[PAYMENT_METHOD_APM.REFACIL]: {
|
|
230
|
-
label: "Refacil",
|
|
231
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
232
|
-
},
|
|
233
|
-
[PAYMENT_METHOD_APM.ACYVALORES]: {
|
|
234
|
-
label: "Acyvalores",
|
|
235
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
export const getPaymentMethodDetails = (scheme_data: string) => {
|
|
241
|
-
const scheme: string = clearSpace(scheme_data.toUpperCase());
|
|
242
|
-
const _default = {
|
|
243
|
-
icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
|
|
244
|
-
label: "",
|
|
245
|
-
};
|
|
246
|
-
// @ts-ignore
|
|
247
|
-
return PAYMENT_METHODS_CATALOG[scheme] || _default;
|
|
248
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const MESSAGES = Object.freeze({
|
|
2
|
-
saveCardError: "Ha ocurrido un error guardando la tarjeta. Inténtalo nuevamente.",
|
|
3
|
-
removeCardError: "Ha ocurrido un error eliminado la tarjeta. Inténtalo nuevamente.",
|
|
4
|
-
getCardsError: "Ha ocurrido un error obteniendo las tarjetas del customer. Inténtalo nuevamente.",
|
|
5
|
-
cardExist: "La tarjeta fue registrada previamente.",
|
|
6
|
-
removedCard: "Card deleted successfully",
|
|
7
|
-
errorCheckout: "No se ha podido procesar el pago",
|
|
8
|
-
cardSaved: "Tarjeta registrada con éxito.",
|
|
9
|
-
getPaymentMethodsError: "Ha ocurrido un error obteniendo las métodos de pago del customer. Inténtalo nuevamente.",
|
|
10
|
-
getBusinessError: "Ha ocurrido un error obteniendo los datos del comercio. Inténtalo nuevamente."
|
|
11
|
-
})
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const PAYMENT_METHOD_APM = Object.freeze({
|
|
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_APM };
|
package/src/types/card.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface ICard {
|
|
2
|
-
fields: ICardSkyflowFields;
|
|
3
|
-
icon?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface ICardSkyflowFields {
|
|
7
|
-
card_number: string;
|
|
8
|
-
expiration_month: string;
|
|
9
|
-
expiration_year: string;
|
|
10
|
-
skyflow_id: string;
|
|
11
|
-
card_scheme: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ICustomerCardsResponse {
|
|
15
|
-
user_id: number;
|
|
16
|
-
cards: ICard[];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ISaveCardResponse {
|
|
20
|
-
skyflow_id: string;
|
|
21
|
-
user_id: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface ISaveCardSkyflowRequest {
|
|
25
|
-
skyflow_id: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ISaveCardRequest {
|
|
29
|
-
card_number: string;
|
|
30
|
-
cvv: string;
|
|
31
|
-
expiration_month: string;
|
|
32
|
-
expiration_year: string;
|
|
33
|
-
cardholder_name: string;
|
|
34
|
-
}
|
package/src/types/checkout.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {ICustomer} from "./customer";
|
|
2
|
-
|
|
3
|
-
export interface IStartCheckoutRequestBase {
|
|
4
|
-
name: any;
|
|
5
|
-
last_name: string;
|
|
6
|
-
email_client: any;
|
|
7
|
-
phone_number: any;
|
|
8
|
-
return_url?: string;
|
|
9
|
-
id_product: string;
|
|
10
|
-
quantity_product: number;
|
|
11
|
-
id_ship: string;
|
|
12
|
-
instance_id_ship: string;
|
|
13
|
-
amount: any;
|
|
14
|
-
title_ship: string;
|
|
15
|
-
description: string;
|
|
16
|
-
device_session_id: any;
|
|
17
|
-
token_id: string;
|
|
18
|
-
order_id: any;
|
|
19
|
-
business_id: any;
|
|
20
|
-
payment_id: any;
|
|
21
|
-
source: string;
|
|
22
|
-
browser_info?: any;
|
|
23
|
-
metadata: any;
|
|
24
|
-
currency: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type IStartCheckoutRequestWithCard = IStartCheckoutRequestBase & {
|
|
28
|
-
card: any;
|
|
29
|
-
payment_method?: never;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type IStartCheckoutRequestWithPaymentMethod =
|
|
33
|
-
IStartCheckoutRequestBase & {
|
|
34
|
-
card?: never;
|
|
35
|
-
payment_method: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type IStartCheckoutRequest =
|
|
39
|
-
| IStartCheckoutRequestWithCard
|
|
40
|
-
| IStartCheckoutRequestWithPaymentMethod;
|
|
41
|
-
|
|
42
|
-
export interface IStartCheckoutIdRequest {
|
|
43
|
-
checkout_id: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface IStartCheckoutErrorResponse {
|
|
47
|
-
status: string;
|
|
48
|
-
message: string;
|
|
49
|
-
psp_response: [
|
|
50
|
-
{
|
|
51
|
-
status: number;
|
|
52
|
-
response: Object;
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
checkout_id: string;
|
|
56
|
-
is_route_finished: boolean;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface IStartCheckoutResponse {
|
|
60
|
-
status: string;
|
|
61
|
-
message: string;
|
|
62
|
-
psp_response: Record<string, any>;
|
|
63
|
-
checkout_id: string;
|
|
64
|
-
is_route_finished: Boolean;
|
|
65
|
-
transaction_status: string;
|
|
66
|
-
transaction_id: number;
|
|
67
|
-
payment_id: number;
|
|
68
|
-
provider: string;
|
|
69
|
-
next_action: {
|
|
70
|
-
redirect_to_url: {
|
|
71
|
-
url: string;
|
|
72
|
-
return_url: string;
|
|
73
|
-
verify_transaction_status_url: string;
|
|
74
|
-
};
|
|
75
|
-
iframe_resources?: {
|
|
76
|
-
iframe: string;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
actions: IStartCheckoutActionResponse[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface IStartCheckoutActionResponse {
|
|
83
|
-
name: string;
|
|
84
|
-
url: string;
|
|
85
|
-
method: string;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export interface IItem {
|
|
90
|
-
description: string;
|
|
91
|
-
quantity: number;
|
|
92
|
-
price_unit: number;
|
|
93
|
-
discount: number;
|
|
94
|
-
taxes: number;
|
|
95
|
-
product_reference: string | number;
|
|
96
|
-
name: string;
|
|
97
|
-
amount_total: number;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface IProcessPaymentRequest {
|
|
101
|
-
customer: ICustomer;
|
|
102
|
-
cart: {
|
|
103
|
-
total: string | number;
|
|
104
|
-
items: IItem[];
|
|
105
|
-
};
|
|
106
|
-
metadata?: Record<string, any>;
|
|
107
|
-
currency?: string;
|
|
108
|
-
payment_method?: string;
|
|
109
|
-
card?: ICardFields | string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface ICardFields {
|
|
113
|
-
card_number: string;
|
|
114
|
-
cvv: string;
|
|
115
|
-
expiration_month: string;
|
|
116
|
-
expiration_year: string;
|
|
117
|
-
cardholder_name: string;
|
|
118
|
-
}
|
package/src/types/customer.ts
DELETED
package/src/types/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './card';
|
|
2
|
-
export * from './checkout';
|
|
3
|
-
export * from './commons';
|
|
4
|
-
export * from './customer';
|
|
5
|
-
export * from './paymentMethod';
|
|
6
|
-
export * from './liteInlineCheckout';
|
|
7
|
-
export * from './validations';
|
|
8
|
-
export * from './responses';
|
|
9
|
-
export * from './requests';
|
|
10
|
-
|