@tonder.io/ionic-lite-sdk 0.0.35-beta.2 → 0.0.35-beta.4
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/.idea/prettier.xml +6 -0
- package/.idea/workspace.xml +23 -24
- package/dist/index.js +1 -1
- package/dist/{classes → src/classes}/BaseInlineCheckout.d.ts +5 -8
- package/dist/{classes → src/classes}/errorResponse.d.ts +1 -1
- package/dist/{classes → src/classes}/liteCheckout.d.ts +5 -11
- package/dist/{data → src/data}/businessApi.d.ts +1 -1
- package/dist/{data → src/data}/cardApi.d.ts +1 -1
- package/dist/{data → src/data}/checkoutApi.d.ts +1 -2
- package/dist/{data → src/data}/customerApi.d.ts +1 -1
- package/dist/{data → src/data}/paymentMethodApi.d.ts +1 -1
- package/dist/{helpers → src/helpers}/skyflow.d.ts +1 -1
- package/dist/{helpers → src/helpers}/utils.d.ts +1 -1
- package/dist/src/index.d.ts +3 -0
- package/package.json +2 -2
- package/src/classes/BaseInlineCheckout.ts +341 -303
- package/src/classes/errorResponse.ts +1 -1
- package/src/classes/liteCheckout.ts +260 -204
- package/src/data/businessApi.ts +17 -13
- package/src/data/cardApi.ts +70 -63
- package/src/data/checkoutApi.ts +75 -59
- package/src/data/customerApi.ts +27 -27
- package/src/data/openPayApi.ts +12 -7
- package/src/data/paymentMethodApi.ts +32 -29
- package/src/data/skyflowApi.ts +18 -14
- package/src/helpers/mercadopago.ts +14 -14
- package/src/helpers/skyflow.ts +35 -29
- package/src/helpers/utils.ts +51 -39
- package/src/helpers/validations.ts +35 -35
- package/src/index.ts +7 -1
- package/src/shared/catalog/paymentMethodsCatalog.ts +8 -8
- package/src/shared/constants/paymentMethodAPM.ts +59 -59
- package/src/shared/constants/tonderUrl.ts +4 -4
- package/tests/methods/createOrder.test.ts +1 -1
- package/tests/methods/createPayment.test.ts +1 -1
- package/tests/methods/customerRegister.test.ts +1 -1
- package/tests/methods/getBusiness.test.ts +1 -1
- package/tests/methods/getCustomerCards.test.ts +1 -1
- package/tests/methods/registerCustomerCard.test.ts +1 -1
- package/tests/methods/startCheckoutRouter.test.ts +1 -1
- package/tests/methods/startCheckoutRouterFull.test.ts +1 -1
- package/tests/utils/mockClasses.ts +3 -3
- package/dist/index.d.ts +0 -2
- package/src/types/card.ts +0 -34
- package/src/types/checkout.ts +0 -118
- package/src/types/commons.ts +0 -125
- 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/requests.ts +0 -115
- package/src/types/responses.ts +0 -189
- package/src/types/skyflow.ts +0 -17
- package/src/types/validations.d.ts +0 -11
- /package/dist/{classes → src/classes}/3dsHandler.d.ts +0 -0
- /package/dist/{data → src/data}/api.d.ts +0 -0
- /package/dist/{data → src/data}/openPayApi.d.ts +0 -0
- /package/dist/{data → src/data}/skyflowApi.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/constants.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/mercadopago.d.ts +0 -0
- /package/dist/{helpers → src/helpers}/validations.d.ts +0 -0
- /package/dist/{shared → src/shared}/catalog/paymentMethodsCatalog.d.ts +0 -0
- /package/dist/{shared → src/shared}/constants/messages.d.ts +0 -0
- /package/dist/{shared → src/shared}/constants/paymentMethodAPM.d.ts +0 -0
- /package/dist/{shared → src/shared}/constants/tonderUrl.d.ts +0 -0
package/src/helpers/utils.ts
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
1
|
import { ErrorResponse } from "../classes/errorResponse";
|
|
2
|
-
import { IErrorResponse } from "
|
|
3
|
-
import { PAYMENT_METHOD } from "./constants";
|
|
2
|
+
import { IErrorResponse } from "../../types";
|
|
4
3
|
|
|
5
4
|
export const getBrowserInfo = () => {
|
|
6
5
|
const browserInfo = {
|
|
7
|
-
javascript_enabled: true,
|
|
6
|
+
javascript_enabled: true, // Assumed since JavaScript is running
|
|
8
7
|
time_zone: new Date().getTimezoneOffset(),
|
|
9
|
-
language: navigator.language ||
|
|
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
|
|
12
|
-
|
|
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
|
|
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,
|
|
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,51 +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
|
-
}
|
|
70
|
+
};
|
|
65
71
|
|
|
66
72
|
function formatPublicErrorResponse(data: Record<string, any>, error: any) {
|
|
67
|
-
let code = 200
|
|
73
|
+
let code = 200;
|
|
68
74
|
try {
|
|
69
|
-
code = Number(error?.code || 200)
|
|
70
|
-
}catch{}
|
|
75
|
+
code = Number(error?.code || 200);
|
|
76
|
+
} catch {}
|
|
71
77
|
|
|
72
78
|
const default_res = {
|
|
73
79
|
status: "error",
|
|
74
80
|
code,
|
|
75
81
|
message: "",
|
|
76
|
-
detail:
|
|
77
|
-
|
|
82
|
+
detail:
|
|
83
|
+
error?.body?.detail ||
|
|
84
|
+
error?.body?.error ||
|
|
85
|
+
error.body ||
|
|
86
|
+
"Ocurrio un error inesperado.",
|
|
87
|
+
};
|
|
78
88
|
|
|
79
89
|
return {
|
|
80
90
|
...default_res,
|
|
81
|
-
...data
|
|
91
|
+
...data,
|
|
82
92
|
};
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
|
|
86
95
|
const clearSpace = (text: string) => {
|
|
87
|
-
return text.trim().replace(/\s+/g,
|
|
88
|
-
}
|
|
96
|
+
return text.trim().replace(/\s+/g, "");
|
|
97
|
+
};
|
|
89
98
|
|
|
90
99
|
const getCardType = (scheme: string) => {
|
|
91
|
-
if(scheme === "Visa") {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return "https://d35a75syrgujp0.cloudfront.net/cards/
|
|
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";
|
|
97
109
|
} else {
|
|
98
|
-
return "https://d35a75syrgujp0.cloudfront.net/cards/default_card.png"
|
|
110
|
+
return "https://d35a75syrgujp0.cloudfront.net/cards/default_card.png";
|
|
99
111
|
}
|
|
100
|
-
}
|
|
112
|
+
};
|
|
101
113
|
|
|
102
114
|
export {
|
|
103
115
|
buildErrorResponseFromCatch,
|
|
104
116
|
buildErrorResponse,
|
|
105
117
|
getCardType,
|
|
106
118
|
formatPublicErrorResponse,
|
|
107
|
-
clearSpace
|
|
108
|
-
}
|
|
119
|
+
clearSpace,
|
|
120
|
+
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
export function validateCardNumber(cardNumber: string) {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const regex = /^\d{12,19}$/;
|
|
3
|
+
return regex.test(cardNumber) && luhnCheck(cardNumber);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export function validateCardholderName(name: string) {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const regex = /^([a-zA-Z\\ \\,\\.\\-\\']{2,})$/;
|
|
8
|
+
return regex.test(name);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export function validateCVV(cvv: string) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const regex = /^\d{3,4}$/;
|
|
13
|
+
return regex.test(cvv);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function validateExpirationDate(expirationDate: string) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
26
|
}
|
|
27
27
|
|
|
28
28
|
export function validateExpirationMonth(month: string) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const regex = /^(0[1-9]|1[0-2])$/;
|
|
30
|
+
return regex.test(month);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function validateExpirationYear(year: string) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
40
|
}
|
|
41
41
|
|
|
42
42
|
const luhnCheck = (num: number | string) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
55
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { LiteCheckout } from './classes/liteCheckout'
|
|
2
|
+
import { validateCVV, validateCardNumber, validateExpirationMonth, validateCardholderName, validateExpirationYear } from './helpers/validations'
|
|
2
3
|
|
|
3
4
|
export {
|
|
4
|
-
LiteCheckout
|
|
5
|
+
LiteCheckout,
|
|
6
|
+
validateCVV,
|
|
7
|
+
validateCardNumber,
|
|
8
|
+
validateCardholderName,
|
|
9
|
+
validateExpirationMonth,
|
|
10
|
+
validateExpirationYear
|
|
5
11
|
}
|
|
@@ -238,11 +238,11 @@ const PAYMENT_METHODS_CATALOG = {
|
|
|
238
238
|
|
|
239
239
|
|
|
240
240
|
export const getPaymentMethodDetails = (scheme_data: string) => {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
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,63 +1,63 @@
|
|
|
1
1
|
const PAYMENT_METHOD_APM = Object.freeze({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
61
|
});
|
|
62
62
|
|
|
63
63
|
export { PAYMENT_METHOD_APM };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const TONDER_URL_BY_MODE = Object.freeze({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
production: "https://app.tonder.io",
|
|
3
|
+
sandbox: "https://sandbox.tonder.io",
|
|
4
|
+
stage: "https://stage.tonder.io",
|
|
5
|
+
development: "http://localhost:8000",
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
export { TONDER_URL_BY_MODE };
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { OrderResponseClass, OrderClass, OrderClassEmptyValues, OrderEmptyValuesResponse } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { CreatePaymentResponseClass, CreatePaymentRequestClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { BusinessClass, CustomerRegisterClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { BusinessClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { GetCustomerCardsResponseClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@ import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
|
4
4
|
import { constructorFields } from "../utils/defaultMock";
|
|
5
5
|
import { RegisterCustomerCardRequestClass, RegisterCustomerCardResponseClass } from "../utils/mockClasses";
|
|
6
6
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
7
|
-
import { IErrorResponse } from "../../
|
|
7
|
+
import { IErrorResponse } from "../../types/responses";
|
|
8
8
|
|
|
9
9
|
declare global {
|
|
10
10
|
interface Window {
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { StartCheckoutResponseClass, StartCheckoutRequestClass, CreatePaymentRequestClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import "../utils/defaultMock";
|
|
|
2
2
|
import { LiteCheckout } from "../../src";
|
|
3
3
|
import { ErrorResponse } from "../../src/classes/errorResponse";
|
|
4
4
|
import { LiteCheckoutConstructor } from "../../src/classes/liteCheckout";
|
|
5
|
-
import { IErrorResponse } from "../../
|
|
5
|
+
import { IErrorResponse } from "../../types/responses";
|
|
6
6
|
import { constructorFields } from "../utils/defaultMock";
|
|
7
7
|
import { StartCheckoutResponseClass, StartCheckoutFullRequestClass, BusinessClass, CustomerRegisterClass, OrderResponseClass, CreatePaymentResponseClass } from "../utils/mockClasses";
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Business, OrderItem } from "../../
|
|
1
|
+
import { Business, OrderItem } from "../../types/commons";
|
|
2
2
|
import {
|
|
3
3
|
CreateOrderRequest,
|
|
4
4
|
CreatePaymentRequest,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
StartCheckoutRequest,
|
|
7
7
|
StartCheckoutFullRequest,
|
|
8
8
|
StartCheckoutRequestWithCard, TokensSkyflowRequest
|
|
9
|
-
} from "../../
|
|
9
|
+
} from "../../types/requests";
|
|
10
10
|
import {
|
|
11
11
|
CreateOrderResponse,
|
|
12
12
|
CreatePaymentResponse,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
RegisterCustomerCardResponse,
|
|
16
16
|
StartCheckoutResponse,
|
|
17
17
|
CustomerRegisterResponse
|
|
18
|
-
} from "../../
|
|
18
|
+
} from "../../types/responses";
|
|
19
19
|
|
|
20
20
|
export class BusinessClass implements Business {
|
|
21
21
|
business!: {
|
package/dist/index.d.ts
DELETED
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
|
-
}
|