@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/types/commons.ts
CHANGED
|
@@ -1,125 +1,83 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
label: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export interface IConfigureCheckout {
|
|
89
|
-
customer: ICustomer;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface IInlineCheckoutBaseOptions {
|
|
93
|
-
mode?: "production" | "sandbox" | "stage" | "development";
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated This property is deprecated and will be removed in a future release.
|
|
96
|
-
* `baseUrlTonder` is no longer required.
|
|
97
|
-
*/
|
|
98
|
-
baseUrlTonder?: string;
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated This property is deprecated and will be removed in a future release.
|
|
101
|
-
* Use `apiKey` instead, as `apiKeyTonder` is no longer required.
|
|
102
|
-
*/
|
|
103
|
-
apiKeyTonder?: string;
|
|
104
|
-
/**
|
|
105
|
-
* @deprecated This property is deprecated and will be removed in a future release.
|
|
106
|
-
* `signal` is no longer required.
|
|
107
|
-
*/
|
|
108
|
-
signal?: AbortSignal;
|
|
109
|
-
apiKey: string;
|
|
110
|
-
returnUrl: string;
|
|
111
|
-
callBack?: (response: any) => void;
|
|
112
|
-
}
|
|
113
|
-
export interface IApiError {
|
|
114
|
-
code: string;
|
|
115
|
-
body: Record<string, string> | string;
|
|
116
|
-
name: string;
|
|
117
|
-
message: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface IPublicError {
|
|
121
|
-
status: string;
|
|
122
|
-
code: number;
|
|
123
|
-
message: string;
|
|
124
|
-
detail: Record<string, any> | string;
|
|
125
|
-
}
|
|
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
|
+
mercado_pago: {
|
|
27
|
+
active: boolean;
|
|
28
|
+
};
|
|
29
|
+
vault_id: string;
|
|
30
|
+
vault_url: string;
|
|
31
|
+
reference: number;
|
|
32
|
+
is_installments_available: boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type Customer = {
|
|
36
|
+
firstName: string;
|
|
37
|
+
lastName: string;
|
|
38
|
+
country: string;
|
|
39
|
+
street: string;
|
|
40
|
+
city: string;
|
|
41
|
+
state: string;
|
|
42
|
+
postCode: string;
|
|
43
|
+
email: string;
|
|
44
|
+
phone: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type OrderItem = {
|
|
48
|
+
description: string;
|
|
49
|
+
quantity: number;
|
|
50
|
+
price_unit: number;
|
|
51
|
+
discount: number;
|
|
52
|
+
taxes: number;
|
|
53
|
+
product_reference: number;
|
|
54
|
+
name: string;
|
|
55
|
+
amount_total: number;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type PaymentData = {
|
|
59
|
+
customer: Customer;
|
|
60
|
+
currency: string;
|
|
61
|
+
cart: {
|
|
62
|
+
total: string | number;
|
|
63
|
+
items: OrderItem[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type TonderAPM = {
|
|
68
|
+
pk: string;
|
|
69
|
+
payment_method: string;
|
|
70
|
+
priority: number;
|
|
71
|
+
category: string;
|
|
72
|
+
unavailable_countries: string[];
|
|
73
|
+
status: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type APM = {
|
|
77
|
+
id: string;
|
|
78
|
+
payment_method: string;
|
|
79
|
+
priority: number;
|
|
80
|
+
category: string;
|
|
81
|
+
icon: string;
|
|
82
|
+
label: string;
|
|
83
|
+
}
|
package/src/types/requests.ts
CHANGED
|
@@ -1,115 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface CreateOrderRequest {
|
|
5
|
-
business: string,
|
|
6
|
-
client: string,
|
|
7
|
-
billing_address_id?: number | null,
|
|
8
|
-
shipping_address_id?: number | null,
|
|
9
|
-
amount: number,
|
|
10
|
-
status?: string,
|
|
11
|
-
reference: string | number,
|
|
12
|
-
is_oneclick: boolean,
|
|
13
|
-
items:
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type CreatePaymentRequest = {
|
|
17
|
-
business_pk?: string | number,
|
|
18
|
-
amount: number,
|
|
19
|
-
date?: string,
|
|
20
|
-
order_id?: string | number
|
|
21
|
-
client_id?: string | number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type StartCheckoutRequestBase = {
|
|
25
|
-
name: any,
|
|
26
|
-
last_name: string,
|
|
27
|
-
email_client: any,
|
|
28
|
-
phone_number: any,
|
|
29
|
-
return_url?: string,
|
|
30
|
-
id_product: string,
|
|
31
|
-
quantity_product: number,
|
|
32
|
-
id_ship: string,
|
|
33
|
-
instance_id_ship: string,
|
|
34
|
-
amount: any,
|
|
35
|
-
title_ship: string,
|
|
36
|
-
description: string,
|
|
37
|
-
device_session_id: any,
|
|
38
|
-
token_id: string,
|
|
39
|
-
order_id: any,
|
|
40
|
-
business_id: any,
|
|
41
|
-
payment_id: any,
|
|
42
|
-
source: string,
|
|
43
|
-
browser_info?: any,
|
|
44
|
-
metadata: any,
|
|
45
|
-
currency: string,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type StartCheckoutRequestWithCard = StartCheckoutRequestBase & {
|
|
49
|
-
card: any,
|
|
50
|
-
payment_method?: never,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export type StartCheckoutRequestWithPaymentMethod = StartCheckoutRequestBase & {
|
|
54
|
-
card?: never,
|
|
55
|
-
payment_method: string,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type StartCheckoutRequest = StartCheckoutRequestWithCard | StartCheckoutRequestWithPaymentMethod;
|
|
59
|
-
|
|
60
|
-
export type StartCheckoutIdRequest = {
|
|
61
|
-
checkout_id: any
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface VaultRequest extends SkyflowRecord {
|
|
65
|
-
records: SkyflowRecord[],
|
|
66
|
-
continueOnError?: boolean,
|
|
67
|
-
byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type RegisterCustomerCardRequest = {
|
|
71
|
-
skyflow_id: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export type
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
expiration_year: string;
|
|
107
|
-
expiration_month: string;
|
|
108
|
-
skyflow_id: string;
|
|
109
|
-
};
|
|
110
|
-
return_url: string;
|
|
111
|
-
isSandbox: boolean;
|
|
112
|
-
metadata: any;
|
|
113
|
-
currency: string;
|
|
114
|
-
payment_method?: string;
|
|
1
|
+
import { OrderItem } from "./commons";
|
|
2
|
+
import { SkyflowRecord } from "./skyflow";
|
|
3
|
+
|
|
4
|
+
export interface CreateOrderRequest {
|
|
5
|
+
business: string,
|
|
6
|
+
client: string,
|
|
7
|
+
billing_address_id?: number | null,
|
|
8
|
+
shipping_address_id?: number | null,
|
|
9
|
+
amount: number,
|
|
10
|
+
status?: string,
|
|
11
|
+
reference: string | number,
|
|
12
|
+
is_oneclick: boolean,
|
|
13
|
+
items: OrderItem[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type CreatePaymentRequest = {
|
|
17
|
+
business_pk?: string | number,
|
|
18
|
+
amount: number,
|
|
19
|
+
date?: string,
|
|
20
|
+
order_id?: string | number
|
|
21
|
+
client_id?: string | number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type StartCheckoutRequestBase = {
|
|
25
|
+
name: any,
|
|
26
|
+
last_name: string,
|
|
27
|
+
email_client: any,
|
|
28
|
+
phone_number: any,
|
|
29
|
+
return_url?: string,
|
|
30
|
+
id_product: string,
|
|
31
|
+
quantity_product: number,
|
|
32
|
+
id_ship: string,
|
|
33
|
+
instance_id_ship: string,
|
|
34
|
+
amount: any,
|
|
35
|
+
title_ship: string,
|
|
36
|
+
description: string,
|
|
37
|
+
device_session_id: any,
|
|
38
|
+
token_id: string,
|
|
39
|
+
order_id: any,
|
|
40
|
+
business_id: any,
|
|
41
|
+
payment_id: any,
|
|
42
|
+
source: string,
|
|
43
|
+
browser_info?: any,
|
|
44
|
+
metadata: any,
|
|
45
|
+
currency: string,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type StartCheckoutRequestWithCard = StartCheckoutRequestBase & {
|
|
49
|
+
card: any,
|
|
50
|
+
payment_method?: never,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type StartCheckoutRequestWithPaymentMethod = StartCheckoutRequestBase & {
|
|
54
|
+
card?: never,
|
|
55
|
+
payment_method: string,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type StartCheckoutRequest = StartCheckoutRequestWithCard | StartCheckoutRequestWithPaymentMethod;
|
|
59
|
+
|
|
60
|
+
export type StartCheckoutIdRequest = {
|
|
61
|
+
checkout_id: any
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface VaultRequest extends SkyflowRecord {
|
|
65
|
+
records: SkyflowRecord[],
|
|
66
|
+
continueOnError?: boolean,
|
|
67
|
+
byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type RegisterCustomerCardRequest = {
|
|
71
|
+
skyflow_id: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type TokensRequest = {
|
|
75
|
+
vault_id: string,
|
|
76
|
+
vault_url: string,
|
|
77
|
+
data: {
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type StartCheckoutFullRequest = {
|
|
83
|
+
order: {
|
|
84
|
+
items: OrderItem[];
|
|
85
|
+
};
|
|
86
|
+
total: number;
|
|
87
|
+
customer: {
|
|
88
|
+
name: string;
|
|
89
|
+
lastname: string;
|
|
90
|
+
email: string;
|
|
91
|
+
phone: string;
|
|
92
|
+
};
|
|
93
|
+
skyflowTokens: {
|
|
94
|
+
cardholder_name: string;
|
|
95
|
+
card_number: string;
|
|
96
|
+
cvv: string;
|
|
97
|
+
expiration_year: string;
|
|
98
|
+
expiration_month: string;
|
|
99
|
+
skyflow_id: string;
|
|
100
|
+
};
|
|
101
|
+
return_url: string;
|
|
102
|
+
isSandbox: boolean;
|
|
103
|
+
metadata: any;
|
|
104
|
+
currency: string;
|
|
105
|
+
payment_method?: string;
|
|
115
106
|
}
|