@tonder.io/ionic-lite-sdk 0.0.32-beta → 0.0.33-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 +36 -0
- package/dist/classes/liteCheckout.d.ts +13 -4
- package/dist/index.js +1 -1
- package/dist/types/requests.d.ts +3 -0
- 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 +254 -0
- package/src/classes/errorResponse.ts +16 -16
- package/src/classes/liteCheckout.ts +535 -462
- package/src/helpers/utils.ts +12 -12
- package/src/index.ts +4 -4
- package/src/types/commons.ts +62 -62
- package/src/types/requests.ts +93 -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 +651 -649
- package/tsconfig.json +18 -18
package/src/helpers/utils.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export const getBrowserInfo = () => {
|
|
2
|
-
const browserInfo = {
|
|
3
|
-
javascript_enabled: true, // Assumed since JavaScript is running
|
|
4
|
-
time_zone: new Date().getTimezoneOffset(),
|
|
5
|
-
language: navigator.language || 'en-US', // Fallback to 'en-US'
|
|
6
|
-
color_depth: window.screen ? window.screen.colorDepth : null,
|
|
7
|
-
screen_width: window.screen ? window.screen.width * window.devicePixelRatio || window.screen.width : null,
|
|
8
|
-
screen_height: window.screen ? window.screen.height * window.devicePixelRatio || window.screen.height : null,
|
|
9
|
-
user_agent: navigator.userAgent,
|
|
10
|
-
};
|
|
11
|
-
return browserInfo;
|
|
12
|
-
}
|
|
1
|
+
export const getBrowserInfo = () => {
|
|
2
|
+
const browserInfo = {
|
|
3
|
+
javascript_enabled: true, // Assumed since JavaScript is running
|
|
4
|
+
time_zone: new Date().getTimezoneOffset(),
|
|
5
|
+
language: navigator.language || 'en-US', // Fallback to 'en-US'
|
|
6
|
+
color_depth: window.screen ? window.screen.colorDepth : null,
|
|
7
|
+
screen_width: window.screen ? window.screen.width * window.devicePixelRatio || window.screen.width : null,
|
|
8
|
+
screen_height: window.screen ? window.screen.height * window.devicePixelRatio || window.screen.height : null,
|
|
9
|
+
user_agent: navigator.userAgent,
|
|
10
|
+
};
|
|
11
|
+
return browserInfo;
|
|
12
|
+
}
|
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,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
|
-
};
|
|
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
|
+
};
|
package/src/types/requests.ts
CHANGED
|
@@ -1,90 +1,94 @@
|
|
|
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 StartCheckoutRequest = {
|
|
25
|
-
card: any,
|
|
26
|
-
name: any,
|
|
27
|
-
last_name: string,
|
|
28
|
-
email_client: any,
|
|
29
|
-
phone_number: any,
|
|
30
|
-
return_url?: string,
|
|
31
|
-
id_product: string,
|
|
32
|
-
quantity_product: number,
|
|
33
|
-
id_ship: string,
|
|
34
|
-
instance_id_ship: string,
|
|
35
|
-
amount: any,
|
|
36
|
-
title_ship: string,
|
|
37
|
-
description: string,
|
|
38
|
-
device_session_id: any,
|
|
39
|
-
token_id: string,
|
|
40
|
-
order_id: any,
|
|
41
|
-
business_id: any,
|
|
42
|
-
payment_id: any,
|
|
43
|
-
source: string,
|
|
44
|
-
browser_info?: any,
|
|
45
|
-
metadata: any,
|
|
46
|
-
currency: string
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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 StartCheckoutRequest = {
|
|
25
|
+
card: any,
|
|
26
|
+
name: any,
|
|
27
|
+
last_name: string,
|
|
28
|
+
email_client: any,
|
|
29
|
+
phone_number: any,
|
|
30
|
+
return_url?: string,
|
|
31
|
+
id_product: string,
|
|
32
|
+
quantity_product: number,
|
|
33
|
+
id_ship: string,
|
|
34
|
+
instance_id_ship: string,
|
|
35
|
+
amount: any,
|
|
36
|
+
title_ship: string,
|
|
37
|
+
description: string,
|
|
38
|
+
device_session_id: any,
|
|
39
|
+
token_id: string,
|
|
40
|
+
order_id: any,
|
|
41
|
+
business_id: any,
|
|
42
|
+
payment_id: any,
|
|
43
|
+
source: string,
|
|
44
|
+
browser_info?: any,
|
|
45
|
+
metadata: any,
|
|
46
|
+
currency: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type StartCheckoutIdRequest = {
|
|
50
|
+
checkout_id: any
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface VaultRequest extends SkyflowRecord {
|
|
54
|
+
records: SkyflowRecord[],
|
|
55
|
+
continueOnError?: boolean,
|
|
56
|
+
byot?: "DISABLE" | "ENABLE" | "ENABLE_STRICT"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type RegisterCustomerCardRequest = {
|
|
60
|
+
skyflow_id: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type TokensRequest = {
|
|
64
|
+
vault_id: string,
|
|
65
|
+
vault_url: string,
|
|
66
|
+
data: {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type StartCheckoutFullRequest = {
|
|
72
|
+
order: {
|
|
73
|
+
items: OrderItem[];
|
|
74
|
+
};
|
|
75
|
+
total: number;
|
|
76
|
+
customer: {
|
|
77
|
+
name: string;
|
|
78
|
+
lastname: string;
|
|
79
|
+
email: string;
|
|
80
|
+
phone: string;
|
|
81
|
+
};
|
|
82
|
+
skyflowTokens: {
|
|
83
|
+
cardholder_name: string;
|
|
84
|
+
card_number: string;
|
|
85
|
+
cvv: string;
|
|
86
|
+
expiration_year: string;
|
|
87
|
+
expiration_month: string;
|
|
88
|
+
skyflow_id: string;
|
|
89
|
+
};
|
|
90
|
+
return_url: string;
|
|
91
|
+
isSandbox: boolean;
|
|
92
|
+
metadata: any;
|
|
93
|
+
currency: string;
|
|
90
94
|
}
|