react-native-bootpay-api 13.8.43 → 13.13.41
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/index.tsx +4 -2
- package/lib/Bootpay.js +25 -7
- package/lib/BootpayTypes.js +1 -1
- package/lib/UserInfo.js +1 -1
- package/lib/bootpayAnalytics.js +1 -1
- package/package.json +9 -8
- package/react-native.config.js +44 -51
- package/src/Bootpay.tsx +326 -470
- package/src/BootpayTypes.ts +98 -114
- package/src/UserInfo.ts +69 -63
- package/src/bootpayAnalytics.ts +151 -47
- package/src/index.tsx +3 -8
- package/src/Loader.tsx +0 -41
package/src/BootpayTypes.ts
CHANGED
|
@@ -1,136 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
ViewProps,
|
|
4
|
-
} from 'react-native'
|
|
1
|
+
import { ViewProps } from 'react-native';
|
|
5
2
|
|
|
6
3
|
export interface BootpayTypesProps extends ViewProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
ref?: any;
|
|
5
|
+
ios_application_id?: string;
|
|
6
|
+
android_application_id?: string;
|
|
7
|
+
onCancel?: (data: Object) => void;
|
|
8
|
+
onError?: (data: Object) => void;
|
|
9
|
+
onIssued?: (data: Object) => void;
|
|
10
|
+
onConfirm?: (data: Object) => boolean;
|
|
11
|
+
onDone?: (data: Object) => void;
|
|
12
|
+
onClose?: () => void;
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
export interface LoadingTypesProps extends ViewProps {
|
|
19
|
-
|
|
16
|
+
loading?: boolean;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
19
|
export class User {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
id?: string;
|
|
21
|
+
username?: string;
|
|
22
|
+
email?: string;
|
|
23
|
+
gender?: number;
|
|
24
|
+
birth?: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
area?: string;
|
|
27
|
+
addr?: string;
|
|
28
|
+
|
|
29
|
+
constructor() {}
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
export class Item {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
name?: string;
|
|
34
|
+
qty?: number;
|
|
35
|
+
id?: string;
|
|
36
|
+
price?: number;
|
|
37
|
+
cat1?: string;
|
|
38
|
+
cat2?: string;
|
|
39
|
+
cat3?: string;
|
|
40
|
+
|
|
41
|
+
constructor() {}
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
export class StatItem {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
item_name?: string;
|
|
46
|
+
item_img?: string;
|
|
47
|
+
unique?: string;
|
|
48
|
+
price?: number;
|
|
49
|
+
cat1?: string;
|
|
50
|
+
cat2?: string;
|
|
51
|
+
cat3?: string;
|
|
52
|
+
|
|
53
|
+
constructor() {}
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
export class Onestore {
|
|
63
|
-
|
|
56
|
+
export class Onestore {
|
|
57
|
+
ad_id?: string = 'UNKNOWN_ADID';
|
|
58
|
+
sim_operator?: string = 'UNKNOWN_SIM_OPERATOR';
|
|
59
|
+
installer_package_name?: string = 'UNKNOWN_INSTALLER';
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
sim_operator?: string = "UNKNOWN_SIM_OPERATOR"
|
|
67
|
-
installer_package_name?: string = "UNKNOWN_INSTALLER"
|
|
61
|
+
constructor() {}
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// export interface Extra {
|
|
73
|
-
// card_quota?: string;
|
|
74
|
-
// seller_name?: string;
|
|
75
|
-
// delivery_day?: number;
|
|
76
|
-
|
|
77
|
-
// }
|
|
78
|
-
|
|
79
64
|
export class Extra {
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
confirm_grace_seconds?: number = 0 // 결제승인 유예시간 ( 승인 요청을 여러번하더라도 승인 이후 특정 시간동안 계속해서 결제 response_data 를 리턴한다 )
|
|
114
|
-
show_close_button: boolean = false // x 닫기 버튼을 보여줄지 말지
|
|
65
|
+
card_quota?: string;
|
|
66
|
+
seller_name?: string;
|
|
67
|
+
delivery_day?: number = 1;
|
|
68
|
+
locale?: string = 'ko';
|
|
69
|
+
offer_period?: string;
|
|
70
|
+
display_cash_receipt?: boolean = true;
|
|
71
|
+
deposit_expiration?: string;
|
|
72
|
+
app_scheme?: string;
|
|
73
|
+
use_card_point?: boolean = true;
|
|
74
|
+
direct_card?: string;
|
|
75
|
+
use_order_id?: boolean = false;
|
|
76
|
+
international_card_only?: boolean = false;
|
|
77
|
+
phone_carrier?: string = '';
|
|
78
|
+
direct_app_card?: boolean = false;
|
|
79
|
+
direct_samsungpay?: boolean = false;
|
|
80
|
+
test_deposit?: boolean = false;
|
|
81
|
+
enable_error_webhook?: boolean = false;
|
|
82
|
+
separately_confirmed?: boolean = true;
|
|
83
|
+
confirmOnlyRestApi?: boolean = false;
|
|
84
|
+
open_type?: string = 'redirect';
|
|
85
|
+
use_bootpay_inapp_sdk?: boolean = true;
|
|
86
|
+
redirect_url?: string = 'https://api.bootpay.co.kr/v2';
|
|
87
|
+
display_success_result?: boolean = false;
|
|
88
|
+
display_error_result?: boolean = true;
|
|
89
|
+
disposable_cup_deposit?: number = 0;
|
|
90
|
+
use_welcomepayment?: number = 0;
|
|
91
|
+
first_subscription_comment?: string = '';
|
|
92
|
+
except_card_companies?: string[];
|
|
93
|
+
enable_easy_payments?: string[];
|
|
94
|
+
confirm_grace_seconds?: number = 0;
|
|
95
|
+
show_close_button?: boolean = false;
|
|
96
|
+
|
|
97
|
+
constructor() {}
|
|
115
98
|
}
|
|
116
99
|
|
|
117
|
-
export class Payload {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
100
|
+
export class Payload {
|
|
101
|
+
application_id?: string;
|
|
102
|
+
android_application_id?: string;
|
|
103
|
+
ios_application_id?: string;
|
|
104
|
+
pg?: string;
|
|
105
|
+
method?: string;
|
|
106
|
+
methods?: string[];
|
|
107
|
+
order_name?: string;
|
|
108
|
+
price?: number;
|
|
109
|
+
tax_free?: number;
|
|
110
|
+
order_id?: string;
|
|
111
|
+
subscription_id?: string;
|
|
112
|
+
authentication_id?: string;
|
|
113
|
+
metadata?: Object;
|
|
114
|
+
user_token?: string;
|
|
115
|
+
extra?: Extra;
|
|
116
|
+
user?: User;
|
|
117
|
+
items?: Item[];
|
|
118
|
+
|
|
119
|
+
constructor() {}
|
|
120
|
+
}
|
package/src/UserInfo.ts
CHANGED
|
@@ -1,79 +1,85 @@
|
|
|
1
|
-
// import { Component } from 'react';
|
|
2
1
|
import DeviceInfo from 'react-native-device-info';
|
|
3
|
-
import
|
|
2
|
+
import * as Keychain from 'react-native-keychain';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}).catch((error: any) => {
|
|
16
|
-
reject(error);
|
|
17
|
-
});
|
|
18
|
-
})
|
|
19
|
-
}
|
|
4
|
+
export default class UserInfo {
|
|
5
|
+
static async setBootpayInfo(key: string, val: any): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
await Keychain.setGenericPassword(key, String(val), {
|
|
8
|
+
service: key,
|
|
9
|
+
accessible: Keychain.ACCESSIBLE.WHEN_UNLOCKED, // 접근 가능 설정
|
|
10
|
+
});
|
|
11
|
+
return val;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error(`Error setting Bootpay info for key ${key}:`, error);
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
keychainService: 'bootpayKeychain'
|
|
26
|
-
}).then((res: any) => {
|
|
27
|
-
resolve(res);
|
|
28
|
-
}).catch((error: any) => {
|
|
29
|
-
reject(error);
|
|
30
|
-
});
|
|
31
|
-
})
|
|
32
|
-
}
|
|
15
|
+
// 특정 에러 코드에 따라 처리 (iOS와 Android 모두 고려)
|
|
16
|
+
if (error.message.includes('null is not an object')) {
|
|
17
|
+
console.warn('Keychain configuration or capability might be missing.');
|
|
18
|
+
}
|
|
33
19
|
|
|
34
|
-
|
|
35
|
-
let uuid = DeviceInfo.getUniqueId();
|
|
36
|
-
return UserInfo.setBootpayInfo('uuid', uuid);
|
|
20
|
+
throw error;
|
|
37
21
|
}
|
|
22
|
+
}
|
|
38
23
|
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
static async getBootpayInfo(key: string, defaultVal: string): Promise<any> {
|
|
25
|
+
try {
|
|
26
|
+
const credentials = await Keychain.getGenericPassword({ service: key });
|
|
27
|
+
if (credentials) {
|
|
28
|
+
return credentials.password;
|
|
29
|
+
} else {
|
|
30
|
+
return defaultVal;
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error getting Bootpay info for key ${key}:`, error);
|
|
34
|
+
return defaultVal;
|
|
41
35
|
}
|
|
36
|
+
}
|
|
42
37
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
static async getBootpayUUID(): Promise<string> {
|
|
39
|
+
const uuid = DeviceInfo.getUniqueId();
|
|
40
|
+
await UserInfo.setBootpayInfo('uuid', uuid);
|
|
41
|
+
return uuid;
|
|
42
|
+
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
static async getBootpaySK(): Promise<string> {
|
|
45
|
+
return await UserInfo.getBootpayInfo('bootpay_sk', '');
|
|
46
|
+
}
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
static async setBootpaySK(val: string): Promise<any> {
|
|
49
|
+
return await UserInfo.setBootpayInfo('bootpay_sk', val);
|
|
50
|
+
}
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
static async newBootpaySK(uuid: string, time: number): Promise<any> {
|
|
53
|
+
return await UserInfo.setBootpaySK(`${uuid}_${time}`);
|
|
54
|
+
}
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
static async getBootpayLastTime(): Promise<number> {
|
|
57
|
+
const lastTime = await UserInfo.getBootpayInfo('bootpay_last_time', '0');
|
|
58
|
+
return parseInt(lastTime, 10);
|
|
59
|
+
}
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
static async setBootpayLastTime(val: number): Promise<any> {
|
|
62
|
+
return await UserInfo.setBootpayInfo('bootpay_last_time', String(val));
|
|
63
|
+
}
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const lastTime = await UserInfo.getBootpayLastTime();
|
|
65
|
+
static async getBootpayUserId(): Promise<string> {
|
|
66
|
+
return await UserInfo.getBootpayInfo('bootpay_user_id', '');
|
|
67
|
+
}
|
|
71
68
|
|
|
72
|
-
|
|
69
|
+
static async setBootpayUserId(val: string): Promise<any> {
|
|
70
|
+
return await UserInfo.setBootpayInfo('bootpay_user_id', val);
|
|
71
|
+
}
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
static async updateInfo(): Promise<void> {
|
|
74
|
+
const uuid = await UserInfo.getBootpayUUID();
|
|
75
|
+
const bootpaySK = await UserInfo.getBootpaySK();
|
|
76
|
+
const lastTime = await UserInfo.getBootpayLastTime();
|
|
77
|
+
const current = Date.now();
|
|
78
|
+
|
|
79
|
+
if (!bootpaySK) await UserInfo.newBootpaySK(uuid, current);
|
|
80
|
+
const isExpired = current - lastTime > 30 * 60 * 1000;
|
|
81
|
+
if (isExpired) await UserInfo.newBootpaySK(uuid, current);
|
|
82
|
+
|
|
83
|
+
await UserInfo.setBootpayLastTime(current);
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/bootpayAnalytics.ts
CHANGED
|
@@ -41,88 +41,192 @@ const stringToHex = (str: string): string => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
// userTrace 함수의 반환 타입을 명시
|
|
44
|
-
const userTrace = async (
|
|
44
|
+
const userTrace = async (
|
|
45
|
+
applicationId: string,
|
|
46
|
+
userId: string,
|
|
47
|
+
phone: string,
|
|
48
|
+
email: string,
|
|
49
|
+
gender: string,
|
|
50
|
+
birth: string,
|
|
51
|
+
area: string
|
|
52
|
+
): Promise<any> => {
|
|
45
53
|
try {
|
|
46
54
|
const payload = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
id: userId,
|
|
56
|
+
ver: DeviceInfo.getVersion(),
|
|
57
|
+
application_id: applicationId,
|
|
58
|
+
phone: phone,
|
|
59
|
+
email: email,
|
|
60
|
+
gender: gender,
|
|
61
|
+
birth: birth,
|
|
62
|
+
area: area,
|
|
55
63
|
};
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
const key = getRandomKey(32);
|
|
66
|
+
const iv = getRandomKey(16);
|
|
59
67
|
|
|
60
68
|
try {
|
|
61
|
-
const data = await NativeModules.Aes.encrypt(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
method: 'POST',
|
|
66
|
-
headers: {
|
|
67
|
-
Accept: 'application/json',
|
|
68
|
-
'Content-Type': 'application/json'
|
|
69
|
-
},
|
|
70
|
-
body: JSON.stringify({
|
|
71
|
-
data: data,
|
|
72
|
-
session_key: await getSessionKey(key, iv)
|
|
73
|
-
})
|
|
74
|
-
}
|
|
69
|
+
const data = await NativeModules.Aes.encrypt(
|
|
70
|
+
JSON.stringify(payload),
|
|
71
|
+
stringToHex(key),
|
|
72
|
+
stringToHex(iv)
|
|
75
73
|
);
|
|
74
|
+
|
|
75
|
+
const response = await fetch('https://analytics.bootpay.co.kr/login', {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: {
|
|
78
|
+
'Accept': 'application/json',
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
},
|
|
81
|
+
body: JSON.stringify({
|
|
82
|
+
data: data,
|
|
83
|
+
session_key: await getSessionKey(key, iv),
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
|
|
76
87
|
const json = await response.json();
|
|
77
88
|
return json;
|
|
78
89
|
} catch (e) {
|
|
79
90
|
console.log(e);
|
|
91
|
+
throw e;
|
|
80
92
|
}
|
|
81
93
|
} catch (error) {
|
|
82
94
|
console.error(error);
|
|
95
|
+
throw error;
|
|
83
96
|
}
|
|
84
97
|
};
|
|
85
98
|
|
|
99
|
+
// const userTrace = async (applicationId: string, userId: string, phone: string, email: string, gender: string, birth: string, area: string): Promise<any> => {
|
|
100
|
+
// try {
|
|
101
|
+
// const payload = {
|
|
102
|
+
// id: userId,
|
|
103
|
+
// ver: DeviceInfo.getVersion(),
|
|
104
|
+
// application_id: applicationId,
|
|
105
|
+
// phone: phone,
|
|
106
|
+
// email: email,
|
|
107
|
+
// gender: gender,
|
|
108
|
+
// birth: birth,
|
|
109
|
+
// area: area,
|
|
110
|
+
// };
|
|
111
|
+
|
|
112
|
+
// var key = getRandomKey(32);
|
|
113
|
+
// var iv = getRandomKey(16);
|
|
114
|
+
|
|
115
|
+
// try {
|
|
116
|
+
// const data = await NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv));
|
|
117
|
+
// const response = await fetch(
|
|
118
|
+
// 'https://analytics.bootpay.co.kr/login',
|
|
119
|
+
// {
|
|
120
|
+
// method: 'POST',
|
|
121
|
+
// headers: {
|
|
122
|
+
// Accept: 'application/json',
|
|
123
|
+
// 'Content-Type': 'application/json'
|
|
124
|
+
// },
|
|
125
|
+
// body: JSON.stringify({
|
|
126
|
+
// data: data,
|
|
127
|
+
// session_key: await getSessionKey(key, iv)
|
|
128
|
+
// })
|
|
129
|
+
// }
|
|
130
|
+
// );
|
|
131
|
+
// const json = await response.json();
|
|
132
|
+
// return json;
|
|
133
|
+
// } catch (e) {
|
|
134
|
+
// console.log(e);
|
|
135
|
+
// }
|
|
136
|
+
// } catch (error) {
|
|
137
|
+
// console.error(error);
|
|
138
|
+
// }
|
|
139
|
+
// };
|
|
140
|
+
|
|
86
141
|
// pageTrace 함수의 반환 타입을 명시
|
|
87
|
-
const pageTrace = async (
|
|
142
|
+
const pageTrace = async (
|
|
143
|
+
applicationId: string,
|
|
144
|
+
url: string,
|
|
145
|
+
pageType: string,
|
|
146
|
+
items: any
|
|
147
|
+
): Promise<any> => {
|
|
88
148
|
try {
|
|
89
149
|
const payload = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
150
|
+
application_id: applicationId,
|
|
151
|
+
url: url,
|
|
152
|
+
page_type: pageType,
|
|
153
|
+
items: items,
|
|
154
|
+
referer: '',
|
|
95
155
|
};
|
|
96
156
|
|
|
97
|
-
|
|
98
|
-
|
|
157
|
+
const key = getRandomKey(32);
|
|
158
|
+
const iv = getRandomKey(16);
|
|
99
159
|
|
|
100
160
|
try {
|
|
101
|
-
const data = await NativeModules.Aes.encrypt(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
method: 'POST',
|
|
106
|
-
headers: {
|
|
107
|
-
Accept: 'application/json',
|
|
108
|
-
'Content-Type': 'application/json'
|
|
109
|
-
},
|
|
110
|
-
body: JSON.stringify({
|
|
111
|
-
data: data,
|
|
112
|
-
session_key: await getSessionKey(key, iv)
|
|
113
|
-
})
|
|
114
|
-
}
|
|
161
|
+
const data = await NativeModules.Aes.encrypt(
|
|
162
|
+
JSON.stringify(payload),
|
|
163
|
+
stringToHex(key),
|
|
164
|
+
stringToHex(iv)
|
|
115
165
|
);
|
|
166
|
+
|
|
167
|
+
const response = await fetch('https://analytics.bootpay.co.kr/call', {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
headers: {
|
|
170
|
+
'Accept': 'application/json',
|
|
171
|
+
'Content-Type': 'application/json',
|
|
172
|
+
},
|
|
173
|
+
body: JSON.stringify({
|
|
174
|
+
data: data,
|
|
175
|
+
session_key: await getSessionKey(key, iv),
|
|
176
|
+
}),
|
|
177
|
+
});
|
|
178
|
+
|
|
116
179
|
const json = await response.json();
|
|
117
180
|
return json;
|
|
118
181
|
} catch (e) {
|
|
119
182
|
console.log(e);
|
|
183
|
+
throw e;
|
|
120
184
|
}
|
|
121
185
|
} catch (error) {
|
|
122
186
|
console.error(error);
|
|
187
|
+
throw error;
|
|
123
188
|
}
|
|
124
189
|
};
|
|
125
190
|
|
|
191
|
+
// const pageTrace = async (applicationId: string, url: string, pageType: string, items: any): Promise<any> => {
|
|
192
|
+
// try {
|
|
193
|
+
// const payload = {
|
|
194
|
+
// "application_id": applicationId,
|
|
195
|
+
// "url": url,
|
|
196
|
+
// "page_type": pageType,
|
|
197
|
+
// "items": items,
|
|
198
|
+
// "referer": '',
|
|
199
|
+
// };
|
|
200
|
+
|
|
201
|
+
// var key = getRandomKey(32);
|
|
202
|
+
// var iv = getRandomKey(16);
|
|
203
|
+
|
|
204
|
+
// try {
|
|
205
|
+
// const data = await NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv));
|
|
206
|
+
// const response = await fetch(
|
|
207
|
+
// 'https://analytics.bootpay.co.kr/call',
|
|
208
|
+
// {
|
|
209
|
+
// method: 'POST',
|
|
210
|
+
// headers: {
|
|
211
|
+
// Accept: 'application/json',
|
|
212
|
+
// 'Content-Type': 'application/json'
|
|
213
|
+
// },
|
|
214
|
+
// body: JSON.stringify({
|
|
215
|
+
// data: data,
|
|
216
|
+
// session_key: await getSessionKey(key, iv)
|
|
217
|
+
// })
|
|
218
|
+
// }
|
|
219
|
+
// );
|
|
220
|
+
// const json = await response.json();
|
|
221
|
+
// return json;
|
|
222
|
+
// } catch (e) {
|
|
223
|
+
// console.log(e);
|
|
224
|
+
// }
|
|
225
|
+
// } catch (error) {
|
|
226
|
+
// console.error(error);
|
|
227
|
+
// }
|
|
228
|
+
// };
|
|
229
|
+
|
|
126
230
|
// strEncode 함수의 반환 타입을 명시
|
|
127
231
|
// const strEncode = async (str: string, key: string, iv: string): Promise<string> => {
|
|
128
232
|
// return await NativeModules.Aes.encrypt(str, key, iv).then(cipher => {
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { Bootpay } from './Bootpay'
|
|
2
|
-
import { Payload, Extra, Item, User } from './BootpayTypes'
|
|
3
|
-
// import { userTrace, pageTrace } from './BootpayAnalytics'
|
|
1
|
+
import { Bootpay } from './Bootpay';
|
|
2
|
+
import { Payload, Extra, Item, User } from './BootpayTypes';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { Bootpay, Payload, Extra, Item, User };
|
|
8
|
-
|
|
9
|
-
// export { BootpayModal, userTrace, pageTrace };
|
|
4
|
+
export { Bootpay, Payload, Extra, Item, User };
|