react-native-bootpay-api 1.5.2 → 4.0.0-beta.2
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/package.json +1 -1
- package/src/BootpayWebView.js +100 -57
- package/CHANGELOG.md +0 -29
- package/lib/commonjs/BootpayAnalytics.js +0 -131
- package/lib/commonjs/BootpayAnalytics.js.map +0 -1
- package/lib/commonjs/BootpayWebView.js +0 -281
- package/lib/commonjs/BootpayWebView.js.map +0 -1
- package/lib/commonjs/UserInfo.js +0 -94
- package/lib/commonjs/UserInfo.js.map +0 -1
- package/lib/commonjs/index.d.js +0 -28
- package/lib/commonjs/index.d.js.map +0 -1
- package/lib/commonjs/index.js +0 -28
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/useBootpay.js +0 -44
- package/lib/commonjs/useBootpay.js.map +0 -1
- package/lib/module/BootpayAnalytics.js +0 -115
- package/lib/module/BootpayAnalytics.js.map +0 -1
- package/lib/module/BootpayWebView.js +0 -259
- package/lib/module/BootpayWebView.js.map +0 -1
- package/lib/module/UserInfo.js +0 -79
- package/lib/module/UserInfo.js.map +0 -1
- package/lib/module/index.d.js +0 -28
- package/lib/module/index.d.js.map +0 -1
- package/lib/module/index.js +0 -21
- package/lib/module/index.js.map +0 -1
- package/lib/module/useBootpay.js +0 -43
- package/lib/module/useBootpay.js.map +0 -1
- package/lib/typescript/UserInfo.d.ts +0 -15
- package/lib/typescript/UserInfo.d.ts.map +0 -1
- package/src/useBootpay.js +0 -51
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BootpayWebView = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _reactNativeWebviewBootpay = _interopRequireDefault(require("react-native-webview-bootpay"));
|
|
13
|
-
|
|
14
|
-
var _UserInfo = _interopRequireDefault(require("./UserInfo"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
class BootpayWebView extends _react.Component {
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "webView", _react.useRef < _reactNativeWebviewBootpay.default > null);
|
|
29
|
-
|
|
30
|
-
_defineProperty(this, "state", {
|
|
31
|
-
visibility: false,
|
|
32
|
-
script: '',
|
|
33
|
-
firstLoad: false
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "request", async (payload, items, user, extra) => {
|
|
37
|
-
payload.application_id = _reactNative.Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
|
|
38
|
-
payload.items = items;
|
|
39
|
-
payload.user_info = user;
|
|
40
|
-
payload.extra = extra;
|
|
41
|
-
var quickPopup = '';
|
|
42
|
-
|
|
43
|
-
if (extra != undefined && extra.quick_popup != undefined) {
|
|
44
|
-
if (extra.quick_popup == 1) {
|
|
45
|
-
quickPopup = 'BootPay.startQuickPopup();';
|
|
46
|
-
}
|
|
47
|
-
} //visibility가 true가 되면 webview onLoaded가 실행됨
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.setState({
|
|
51
|
-
visibility: true,
|
|
52
|
-
script: `
|
|
53
|
-
${await this.getMountJavascript()}
|
|
54
|
-
${quickPopup}
|
|
55
|
-
${this.generateScript(payload)}
|
|
56
|
-
`,
|
|
57
|
-
firstLoad: false,
|
|
58
|
-
showCloseButton: extra.show_close_button || false
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
_UserInfo.default.updateInfo();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
_defineProperty(this, "dismiss", () => {
|
|
65
|
-
this.setState(({
|
|
66
|
-
visibility
|
|
67
|
-
}) => ({
|
|
68
|
-
visibility: false
|
|
69
|
-
}));
|
|
70
|
-
this.removePaymentWindow();
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
_defineProperty(this, "getMountJavascript", async () => {
|
|
74
|
-
return `
|
|
75
|
-
${this.getBootpayPlatform()}
|
|
76
|
-
${await this.getAnalyticsData()}
|
|
77
|
-
`;
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
_defineProperty(this, "generateScript", payload => {
|
|
81
|
-
const onError = '.error(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
|
|
82
|
-
const onCancel = '.cancel(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
|
|
83
|
-
const onReady = '.ready(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
|
|
84
|
-
const onConfirm = '.confirm(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
|
|
85
|
-
const onClose = '.close(function(data){ window.BootpayRNWebView.postMessage("close"); })';
|
|
86
|
-
const onDone = '.done(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
|
|
87
|
-
return `BootPay.request(${JSON.stringify(payload)})` + onError + onCancel + onReady + onConfirm + onClose + onDone + '; void(0);';
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
_defineProperty(this, "onMessage", ({
|
|
91
|
-
nativeEvent
|
|
92
|
-
}) => {
|
|
93
|
-
if (nativeEvent == undefined || nativeEvent.data == undefined) return;
|
|
94
|
-
|
|
95
|
-
if (nativeEvent.data == 'close') {
|
|
96
|
-
if (this.props.onClose == undefined) return;
|
|
97
|
-
var json = {
|
|
98
|
-
action: 'BootpayClose',
|
|
99
|
-
message: '결제창이 닫혔습니다'
|
|
100
|
-
};
|
|
101
|
-
this.props.onClose(json);
|
|
102
|
-
this.dismiss();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const data = JSON.parse(nativeEvent.data);
|
|
107
|
-
|
|
108
|
-
switch (data.action) {
|
|
109
|
-
case 'BootpayCancel':
|
|
110
|
-
if (this.props.onCancel != undefined) this.props.onCancel(data);
|
|
111
|
-
this.setState({
|
|
112
|
-
visibility: false
|
|
113
|
-
});
|
|
114
|
-
break;
|
|
115
|
-
|
|
116
|
-
case 'BootpayError':
|
|
117
|
-
if (this.props.onError != undefined) this.props.onError(data);
|
|
118
|
-
this.setState({
|
|
119
|
-
visibility: false
|
|
120
|
-
});
|
|
121
|
-
break;
|
|
122
|
-
|
|
123
|
-
case 'BootpayBankReady':
|
|
124
|
-
if (this.props.onReady != undefined) this.props.onReady(data);
|
|
125
|
-
break;
|
|
126
|
-
|
|
127
|
-
case 'BootpayConfirm':
|
|
128
|
-
if (this.props.onConfirm != undefined) this.props.onConfirm(data);
|
|
129
|
-
break;
|
|
130
|
-
|
|
131
|
-
case 'BootpayDone':
|
|
132
|
-
if (this.props.onDone != undefined) this.props.onDone(data);
|
|
133
|
-
this.setState({
|
|
134
|
-
visibility: false
|
|
135
|
-
});
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
_defineProperty(this, "onShouldStartLoadWithRequest", url => {
|
|
141
|
-
return true;
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
_defineProperty(this, "getBootpayPlatform", () => {
|
|
145
|
-
if (_reactNative.Platform.OS == 'ios') {
|
|
146
|
-
return "BootPay.setDevice('IOS');";
|
|
147
|
-
} else if (_reactNative.Platform.OS == 'android') {
|
|
148
|
-
return "BootPay.setDevice('ANDROID');";
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
_defineProperty(this, "transactionConfirm", data => {
|
|
153
|
-
// console.log('transactionConfirm: ' + data);
|
|
154
|
-
var json = JSON.stringify(data);
|
|
155
|
-
this.callJavaScript(`
|
|
156
|
-
BootPay.transactionConfirm(${json});
|
|
157
|
-
`);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
_defineProperty(this, "removePaymentWindow", () => {
|
|
161
|
-
this.callJavaScript(`
|
|
162
|
-
BootPay.removePaymentWindow();
|
|
163
|
-
`);
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
_defineProperty(this, "callJavaScript", script => {
|
|
167
|
-
if (this.webView == null || this.webView == undefined) return; // console.log('callJavascript: ' + script);
|
|
168
|
-
|
|
169
|
-
this.webView.injectJavaScript(`
|
|
170
|
-
javascript:(function(){${script} })()
|
|
171
|
-
`); // this.webView.evalu
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
_defineProperty(this, "getAnalyticsData", async () => {
|
|
175
|
-
const uuid = await _UserInfo.default.getBootpayUUID();
|
|
176
|
-
const bootpaySK = await _UserInfo.default.getBootpaySK();
|
|
177
|
-
const bootLastTime = await _UserInfo.default.getBootpayLastTime();
|
|
178
|
-
const elaspedTime = Date.now() - bootLastTime;
|
|
179
|
-
return `window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`; // this.callJavaScript(`window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// canGoBack() {
|
|
184
|
-
// console.log('canGoBack');
|
|
185
|
-
// if(this.webView.current) {
|
|
186
|
-
// return this.webView.current.canGoBack();
|
|
187
|
-
// }
|
|
188
|
-
// return false;
|
|
189
|
-
// }
|
|
190
|
-
// goBack() {
|
|
191
|
-
// console.log('GoBack');
|
|
192
|
-
// if(this.webView.goBack) {
|
|
193
|
-
// this.webView.current.goBack();
|
|
194
|
-
// }
|
|
195
|
-
// }
|
|
196
|
-
async componentWillUnmount() {
|
|
197
|
-
this.setState({
|
|
198
|
-
visibility: false,
|
|
199
|
-
firstLoad: false,
|
|
200
|
-
showCloseButton: false
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
_UserInfo.default.setBootpayLastTime(Date.now());
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
render() {
|
|
207
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.Modal, {
|
|
208
|
-
animationType: 'slide',
|
|
209
|
-
transparent: false // shouldCloseOnOverlayClick={true}
|
|
210
|
-
,
|
|
211
|
-
onRequestClose: () => {
|
|
212
|
-
console.log('onRequestClose');
|
|
213
|
-
this.dismiss();
|
|
214
|
-
},
|
|
215
|
-
visible: this.state.visibility
|
|
216
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.SafeAreaView, {
|
|
217
|
-
style: {
|
|
218
|
-
flex: 1
|
|
219
|
-
}
|
|
220
|
-
}, this.state.showCloseButton && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
221
|
-
onPress: () => {
|
|
222
|
-
var cancelData = {
|
|
223
|
-
action: 'BootpayCancel',
|
|
224
|
-
message: '사용자에 의해 취소되었습니다'
|
|
225
|
-
};
|
|
226
|
-
var closeData = {
|
|
227
|
-
action: 'BootpayClose',
|
|
228
|
-
message: '결제창이 닫혔습니다'
|
|
229
|
-
};
|
|
230
|
-
if (this.props.onCancel != undefined) this.props.onCancel(cancelData);
|
|
231
|
-
if (this.props.onClose != undefined) this.props.onClose(closeData);
|
|
232
|
-
this.setState({
|
|
233
|
-
visibility: false
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
237
|
-
style: [styles.overlay],
|
|
238
|
-
source: require('../images/close.png')
|
|
239
|
-
})), /*#__PURE__*/_react.default.createElement(_reactNativeWebviewBootpay.default, {
|
|
240
|
-
ref: wv => this.webView = wv // ref={btWebView}
|
|
241
|
-
,
|
|
242
|
-
useWebKit: true,
|
|
243
|
-
originWhitelist: ['*'],
|
|
244
|
-
source: {
|
|
245
|
-
uri: 'https://inapp.bootpay.co.kr/3.3.3/production.html'
|
|
246
|
-
},
|
|
247
|
-
injectedJavaScript: this.state.script,
|
|
248
|
-
javaScriptEnabled: true,
|
|
249
|
-
javaScriptCanOpenWindowsAutomatically: true // scalesPageToFit={true}
|
|
250
|
-
,
|
|
251
|
-
onMessage: this.onMessage,
|
|
252
|
-
onShouldStartLoadWithRequest: this.onShouldStartLoadWithRequest
|
|
253
|
-
})));
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
exports.BootpayWebView = BootpayWebView;
|
|
259
|
-
|
|
260
|
-
var styles = _reactNative.StyleSheet.create({
|
|
261
|
-
container: {
|
|
262
|
-
flex: 1,
|
|
263
|
-
justifyContent: 'center',
|
|
264
|
-
alignItems: 'center',
|
|
265
|
-
backgroundColor: '#F5FCFF'
|
|
266
|
-
},
|
|
267
|
-
welcome: {
|
|
268
|
-
fontSize: 20,
|
|
269
|
-
textAlign: 'center',
|
|
270
|
-
margin: 10
|
|
271
|
-
},
|
|
272
|
-
// Flex to fill, position absolute,
|
|
273
|
-
// Fixed left/top, and the width set to the window width
|
|
274
|
-
overlay: {
|
|
275
|
-
width: 25,
|
|
276
|
-
height: 25,
|
|
277
|
-
right: 5,
|
|
278
|
-
alignSelf: 'flex-end'
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
//# sourceMappingURL=BootpayWebView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["BootpayWebView.js"],"names":["BootpayWebView","Component","useRef","WebView","visibility","script","firstLoad","payload","items","user","extra","application_id","Platform","OS","props","ios_application_id","android_application_id","user_info","quickPopup","undefined","quick_popup","setState","getMountJavascript","generateScript","showCloseButton","show_close_button","UserInfo","updateInfo","removePaymentWindow","getBootpayPlatform","getAnalyticsData","onError","onCancel","onReady","onConfirm","onClose","onDone","JSON","stringify","nativeEvent","data","json","action","message","dismiss","parse","url","callJavaScript","webView","injectJavaScript","uuid","getBootpayUUID","bootpaySK","getBootpaySK","bootLastTime","getBootpayLastTime","elaspedTime","Date","now","componentWillUnmount","setBootpayLastTime","render","console","log","state","flex","cancelData","closeData","styles","overlay","require","wv","uri","onMessage","onShouldStartLoadWithRequest","StyleSheet","create","container","justifyContent","alignItems","backgroundColor","welcome","fontSize","textAlign","margin","width","height","right","alignSelf"],"mappings":";;;;;;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,MAAMA,cAAN,SAA6BC,gBAA7B,CAAuC;AAAA;AAAA;;AAAA,qCAChCC,gBAAOC,kCAAP,GAAgB,IADgB;;AAAA,mCAIlC;AACJC,MAAAA,UAAU,EAAE,KADR;AAEJC,MAAAA,MAAM,EAAE,EAFJ;AAGJC,MAAAA,SAAS,EAAE;AAHP,KAJkC;;AAAA,qCA2FhC,OAAOC,OAAP,EAAgBC,KAAhB,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A,UAAU,EAAE,QAHH;AAITC,IAAAA,eAAe,EAAE;AAJR,GADgB;AAO3BC,EAAAA,OAAO,EAAE;AACPC,IAAAA,QAAQ,EAAE,EADH;AAEPC,IAAAA,SAAS,EAAE,QAFJ;AAGPC,IAAAA,MAAM,EAAE;AAHD,GAPkB;AAY3B;AACA;AACAf,EAAAA,OAAO,EAAE;AACPgB,IAAAA,KAAK,EAAE,EADA;AAEPC,IAAAA,MAAM,EAAE,EAFD;AAGPC,IAAAA,KAAK,EAAE,CAHA;AAIPC,IAAAA,SAAS,EAAE;AAJJ;AAdkB,CAAlB,CAAb","sourcesContent":["\n\nimport React, { Component, useRef, useEffect } from 'react';\nimport { SafeAreaView, Modal, Platform, TouchableOpacity, Image, StyleSheet, BackHandler} from 'react-native';\nimport WebView from 'react-native-webview-bootpay';\nimport UserInfo from './UserInfo'\n\nexport class BootpayWebView extends Component {\n webView = useRef<WebView>(null); \n\n \n state = {\n visibility: false, \n script: '',\n firstLoad: false\n } \n \n // canGoBack() {\n // console.log('canGoBack');\n // if(this.webView.current) {\n // return this.webView.current.canGoBack();\n // }\n // return false;\n // }\n\n // goBack() {\n // console.log('GoBack');\n // if(this.webView.goBack) {\n // this.webView.current.goBack();\n // }\n // }\n\n async componentWillUnmount() {\n this.setState(\n {\n visibility: false, \n firstLoad: false,\n showCloseButton: false\n }\n )\n UserInfo.setBootpayLastTime(Date.now());\n }\n \n render() { \n return <Modal\n animationType={'slide'}\n transparent={false}\n \n // shouldCloseOnOverlayClick={true} \n onRequestClose={()=> {\n console.log('onRequestClose');\n this.dismiss();\n }}\n visible={this.state.visibility}>\n <SafeAreaView style={{ flex: 1 }}>\n {\n this.state.showCloseButton &&\n <TouchableOpacity\n onPress={() => {\n var cancelData = {\n action: 'BootpayCancel',\n message: '사용자에 의해 취소되었습니다'\n }\n var closeData = {\n action: 'BootpayClose',\n message: '결제창이 닫혔습니다'\n }\n \n if(this.props.onCancel != undefined) this.props.onCancel(cancelData);\n if(this.props.onClose != undefined) this.props.onClose(closeData); \n\n this.setState({visibility: false})\n } }>\n <Image \n style={[styles.overlay]}\n source={require('../images/close.png')} />\n </TouchableOpacity>\n }\n <WebView\n ref={(wv) => this.webView = wv}\n // ref={btWebView}\n useWebKit={true}\n originWhitelist={['*']}\n source={{\n uri: 'https://inapp.bootpay.co.kr/3.3.3/production.html'\n }}\n injectedJavaScript={this.state.script}\n javaScriptEnabled={true}\n javaScriptCanOpenWindowsAutomatically={true}\n // scalesPageToFit={true} \n onMessage={this.onMessage}\n onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}\n />\n </SafeAreaView>\n\n </Modal>\n }\n\n request = async (payload, items, user, extra) => { \n\n payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;\n payload.items = items;\n payload.user_info = user;\n payload.extra = extra; \n \n\n var quickPopup = '';\n\n if(extra != undefined && extra.quick_popup != undefined) {\n if(extra.quick_popup == 1) {\n quickPopup = 'BootPay.startQuickPopup();';\n }\n } \n \n\n //visibility가 true가 되면 webview onLoaded가 실행됨\n this.setState(\n {\n visibility: true,\n script: `\n ${await this.getMountJavascript()}\n ${quickPopup}\n ${this.generateScript(payload)}\n `,\n firstLoad: false,\n showCloseButton: extra.show_close_button || false \n }\n ) \n\n UserInfo.updateInfo();\n }\n\n dismiss = () => {\n this.setState(\n ({ visibility }) => ({\n visibility: false\n })\n )\n this.removePaymentWindow();\n }\n \n\n getMountJavascript = async () => { \n return `\n ${this.getBootpayPlatform()}\n ${await this.getAnalyticsData()}\n `; \n }\n\n\n generateScript= (payload) => { \n const onError = '.error(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';\n const onCancel = '.cancel(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';\n const onReady = '.ready(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';\n const onConfirm = '.confirm(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';\n const onClose = '.close(function(data){ window.BootpayRNWebView.postMessage(\"close\"); })';\n const onDone = '.done(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';\n\n return `BootPay.request(${JSON.stringify(payload)})` + onError + onCancel + onReady + onConfirm + onClose + onDone + '; void(0);';\n }\n\n onMessage = ({ nativeEvent }) => { \n if (nativeEvent == undefined || nativeEvent.data == undefined) return;\n \n if(nativeEvent.data == 'close') {\n if(this.props.onClose == undefined) return;\n var json = {\n action: 'BootpayClose',\n message: '결제창이 닫혔습니다'\n }\n this.props.onClose(json);\n this.dismiss();\n return;\n }\n\n const data = JSON.parse(nativeEvent.data);\n switch (data.action) {\n case 'BootpayCancel':\n if(this.props.onCancel != undefined) this.props.onCancel(data);\n this.setState(\n {\n visibility: false\n }\n )\n break;\n case 'BootpayError':\n if(this.props.onError != undefined) this.props.onError(data);\n this.setState(\n {\n visibility: false\n }\n )\n break;\n case 'BootpayBankReady':\n if(this.props.onReady != undefined) this.props.onReady(data);\n break;\n case 'BootpayConfirm':\n if(this.props.onConfirm != undefined) this.props.onConfirm(data);\n break;\n case 'BootpayDone':\n if(this.props.onDone != undefined) this.props.onDone(data);\n this.setState(\n {\n visibility: false\n }\n )\n break;\n }\n }\n\n onShouldStartLoadWithRequest = (url) => { \n return true;\n }\n\n getBootpayPlatform = () => { \n if(Platform.OS == 'ios') {\n return \"BootPay.setDevice('IOS');\";\n } else if(Platform.OS == 'android'){\n return \"BootPay.setDevice('ANDROID');\"; \n }\n }\n\n // setPayScript = () => {\n // const fullScript = this.generateScript(this.state.script);\n // this.injectJavaScript(fullScript);\n // if(this.state.showCloseButton == true) {\n // if(this.webView == null || this.webView == undefined) return; \n // this.webView.showCloseButton();\n // }\n // } \n\n transactionConfirm = (data) => {\n // console.log('transactionConfirm: ' + data);\n\n var json = JSON.stringify(data)\n this.callJavaScript(`\n BootPay.transactionConfirm(${json});\n `);\n }\n\n removePaymentWindow = () => {\n this.callJavaScript(`\n BootPay.removePaymentWindow();\n `);\n } \n\n callJavaScript = (script) => {\n if(this.webView == null || this.webView == undefined) return;\n\n // console.log('callJavascript: ' + script);\n\n this.webView.injectJavaScript(`\n javascript:(function(){${script} })()\n `);\n // this.webView.evalu\n } \n\n getAnalyticsData = async () => { \n const uuid = await UserInfo.getBootpayUUID(); \n const bootpaySK = await UserInfo.getBootpaySK();\n const bootLastTime = await UserInfo.getBootpayLastTime(); \n\n\n const elaspedTime = Date.now() - bootLastTime; \n return `window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`;\n // this.callJavaScript(`window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`); \n }\n} \n\n\nvar styles = StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: '#F5FCFF',\n },\n welcome: {\n fontSize: 20,\n textAlign: 'center',\n margin: 10,\n },\n // Flex to fill, position absolute, \n // Fixed left/top, and the width set to the window width\n overlay: { \n width: 25,\n height: 25, \n right: 5,\n alignSelf: 'flex-end'\n } \n });"]}
|
package/lib/commonjs/UserInfo.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
var _reactNativeDeviceInfo = _interopRequireDefault(require("react-native-device-info"));
|
|
11
|
-
|
|
12
|
-
var _reactNativeSensitiveInfo = _interopRequireDefault(require("react-native-sensitive-info"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
|
|
18
|
-
class UserInfo extends _react.Component {
|
|
19
|
-
static setBootpayLastTime(val) {
|
|
20
|
-
return UserInfo.setBootpayInfo('bootpay_last_time', val);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static getBootpayUserId() {
|
|
24
|
-
return UserInfo.getBootpayInfo('bootpay_user_id', '');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
exports.default = UserInfo;
|
|
30
|
-
|
|
31
|
-
_defineProperty(UserInfo, "getBootpayInfo", (key, defaultVal) => {
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
_reactNativeSensitiveInfo.default.getItem(key, {
|
|
34
|
-
sharedPreferencesName: 'bootpaySharedPrefs',
|
|
35
|
-
keychainService: 'bootpayKeychain'
|
|
36
|
-
}).then(res => {
|
|
37
|
-
res == undefined ? resolve(defaultVal) : resolve(res);
|
|
38
|
-
resolve(res);
|
|
39
|
-
}).catch(error => {
|
|
40
|
-
reject(error);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
_defineProperty(UserInfo, "setBootpayInfo", (key, val) => {
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
_reactNativeSensitiveInfo.default.setItem(String(key), String(val), {
|
|
48
|
-
sharedPreferencesName: 'bootpaySharedPrefs',
|
|
49
|
-
keychainService: 'bootpayKeychain'
|
|
50
|
-
}).then(res => {
|
|
51
|
-
resolve(res);
|
|
52
|
-
}).catch(error => {
|
|
53
|
-
reject(error);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
_defineProperty(UserInfo, "getBootpayUUID", () => {
|
|
59
|
-
let uuid = _reactNativeDeviceInfo.default.getUniqueId();
|
|
60
|
-
|
|
61
|
-
return UserInfo.setBootpayInfo('uuid', uuid);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
_defineProperty(UserInfo, "getBootpaySK", () => {
|
|
65
|
-
return UserInfo.getBootpayInfo('bootpay_sk', '');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
_defineProperty(UserInfo, "setBootpaySK", val => {
|
|
69
|
-
return UserInfo.setBootpayInfo('bootpay_sk', val);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
_defineProperty(UserInfo, "newBootpaySK", (uuid, time) => {
|
|
73
|
-
return UserInfo.setBootpaySK(`${uuid}_${time}`);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
_defineProperty(UserInfo, "getBootpayLastTime", async () => {
|
|
77
|
-
return await UserInfo.getBootpayInfo('bootpay_last_time', 0);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
_defineProperty(UserInfo, "setBootpayUserId", val => {
|
|
81
|
-
return UserInfo.setBootpayInfo('bootpay_user_id', val);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
_defineProperty(UserInfo, "updateInfo", async () => {
|
|
85
|
-
const uuid = await UserInfo.getBootpayUUID();
|
|
86
|
-
const bootpaySK = await UserInfo.getBootpaySK();
|
|
87
|
-
const lastTime = await UserInfo.getBootpayLastTime();
|
|
88
|
-
let current = Date.now();
|
|
89
|
-
if (bootpaySK == '') await UserInfo.newBootpaySK(uuid, current);
|
|
90
|
-
const isExpired = current - lastTime > 30 * 60 * 1000;
|
|
91
|
-
if (isExpired) await UserInfo.newBootpaySK(uuid, current);
|
|
92
|
-
await UserInfo.setBootpayLastTime(current);
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=UserInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["UserInfo.tsx"],"names":["UserInfo","Component","setBootpayLastTime","val","setBootpayInfo","getBootpayUserId","getBootpayInfo","key","defaultVal","Promise","resolve","reject","SInfo","getItem","sharedPreferencesName","keychainService","then","res","undefined","catch","error","setItem","String","uuid","DeviceInfo","getUniqueId","time","setBootpaySK","getBootpayUUID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AACoC,YAAT,CAAsBb,IAAtB,EAA4BU,OAA5B,CAAN;AACpB,QAAMI,SAAS,GAAGJ,OAAO,GAAGF,QAAV,GAAqB,KAAK,EAAL,GAAU,IAAjD;AACA,MAAGM,SAAH,EAAc,MAAMrC,QAAQ,CAACoC,YAAT,CAAsBb,IAAtB,EAA4BU,OAA5B,CAAN;AACd,QAAMjC,QAAQ,CAACE,kBAAT,CAA4B+B,OAA5B,CAAN;AACH,C","sourcesContent":["import { Component } from 'react';\nimport DeviceInfo from 'react-native-device-info';\nimport SInfo from 'react-native-sensitive-info'; \n\nexport default class UserInfo extends Component { \n static getBootpayInfo = (key: string, defaultVal: any) => {\n return new Promise((resolve, reject) => {\n SInfo.getItem(key, {\n sharedPreferencesName: 'bootpaySharedPrefs',\n keychainService: 'bootpayKeychain'\n }).then((res: any) => { \n res == undefined ? resolve(defaultVal) : resolve(res); \n resolve(res);\n }).catch((error: any) => { \n reject(error);\n }); \n })\n }\n\n static setBootpayInfo = (key: string, val: any) => {\n return new Promise((resolve, reject) => {\n SInfo.setItem(String(key), String(val), {\n sharedPreferencesName: 'bootpaySharedPrefs',\n keychainService: 'bootpayKeychain'\n }).then((res: any) => { \n resolve(res);\n }).catch((error: any) => { \n reject(error);\n }); \n })\n }\n\n static getBootpayUUID = () => {\n let uuid = DeviceInfo.getUniqueId(); \n return UserInfo.setBootpayInfo('uuid', uuid); \n }\n\n static getBootpaySK = () => {\n return UserInfo.getBootpayInfo('bootpay_sk', ''); \n }\n\n static setBootpaySK = (val: string) => {\n return UserInfo.setBootpayInfo('bootpay_sk', val); \n }\n\n static newBootpaySK = (uuid: string, time: number) => { \n return UserInfo.setBootpaySK(`${uuid}_${time}`); \n }\n\n static getBootpayLastTime = async () => { \n return await UserInfo.getBootpayInfo('bootpay_last_time', 0); \n }\n\n static setBootpayLastTime(val: number){\n return UserInfo.setBootpayInfo('bootpay_last_time', val); \n } \n\n static getBootpayUserId() {\n return UserInfo.getBootpayInfo('bootpay_user_id', ''); \n }\n\n static setBootpayUserId = (val: string) => {\n return UserInfo.setBootpayInfo('bootpay_user_id', val); \n }\n\n static updateInfo = async () => {\n const uuid = await UserInfo.getBootpayUUID() as string; \n const bootpaySK = await UserInfo.getBootpaySK() as string;\n const lastTime = await UserInfo.getBootpayLastTime() as number;\n\n let current = Date.now();\n\n if(bootpaySK == '') await UserInfo.newBootpaySK(uuid, current);\n const isExpired = current - lastTime > 30 * 60 * 1000;\n if(isExpired) await UserInfo.newBootpaySK(uuid, current);\n await UserInfo.setBootpayLastTime(current);\n }\n}"]}
|
package/lib/commonjs/index.d.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BootpayWebView", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _BootpayWebView.BootpayWebView;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "userTrace", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _BootpayAnalytics.userTrace;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "pageTrace", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _BootpayAnalytics.pageTrace;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _BootpayWebView = require("./BootpayWebView");
|
|
26
|
-
|
|
27
|
-
var _BootpayAnalytics = require("./BootpayAnalytics");
|
|
28
|
-
//# sourceMappingURL=index.d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.d.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAKA;;AACA","sourcesContent":["import { Component, ReactNode } from 'react';\nimport { ViewProperties, EmitterSubscription } from 'react-native';\nimport { EventEmitter } from 'events';\n\n\nimport { BootpayWebView } from './BootpayWebView'\nimport { userTrace, pageTrace } from './BootpayAnalytics'\n\n\nexport { BootpayWebView, userTrace, pageTrace }\n\n// interface BootpayWebViewProps {\n// ios_application_id: string;\n// android_application_id: string;\n\n// onCancel: (data: string) => void;\n// onError: (data: string) => void;\n// onReady: (data: string) => void;\n// onConfirm: (data: string) => void;\n// onDone: (data: string) => void;\n// onClose: () => void;\n// }\n\n// export class BootpayWebView extends Component<BootpayWebViewProps> { \n// request: (payload: Object, items: Object, user: Object, extra: Object) => Promise<string>;\n// dismiss: () => Promise<string>;\n// transactionConfirm: (data: string) => Promise<string>;\n// }\n\n// export class BootpayAnalytics {\n// static userTrace: () => void;\n// static pageTrace: () => void;\n// }\n\n// export const userTrace: () => void;\n// export default function pageTrace(): void;\n// export const userTrace: () => void;\n\n// export default function PageTrace() : void;\n\n// const Bootpay = \n \n// export { BootpayWebView, userTrace, pageTrace }"]}
|
package/lib/commonjs/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BootpayWebView", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _BootpayWebView.BootpayWebView;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "userTrace", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _BootpayAnalytics.userTrace;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "pageTrace", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _BootpayAnalytics.pageTrace;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var _BootpayWebView = require("./BootpayWebView");
|
|
26
|
-
|
|
27
|
-
var _BootpayAnalytics = require("./BootpayAnalytics");
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AACA","sourcesContent":[" \n// import { useBootpay } from './useBootpay';\nimport { BootpayWebView } from './BootpayWebView'\nimport { userTrace, pageTrace } from './BootpayAnalytics'\n\nexport { BootpayWebView, userTrace, pageTrace };\n// export { useBootpay };\n\n// import React, { Component } from 'react';\n// import WebView from 'react-native-webview-bootpay';\n\n// export class BootpayWebView extends Component {\n// render() {\n// return <WebView \n// useWebKit={true}\n// originWhitelist={['*']}\n// source={{\n// uri: 'https://www.google.com'\n// }}\n// javaScriptEnabled={true}\n// javaScriptCanOpenWindowsAutomatically={true}\n// scalesPageToFit={true} \n// />\n// }\n// } "]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// import { useCallback } from 'react';
|
|
2
|
-
// import BootpayAnalytics from './BootpayAnalytics';
|
|
3
|
-
// import BootpayWebView from './BootpayWebView';
|
|
4
|
-
// export const useBootpay = () => {
|
|
5
|
-
// const bootpay = useRef(new BootpayWebView());
|
|
6
|
-
// // const anlaytics = useRef(new BootpayAnalytics());
|
|
7
|
-
// const [bootpayEvents, setBootpayEvents] = useState([]);
|
|
8
|
-
// const request = useCallback((payload, items, user, extra) => {
|
|
9
|
-
// console.log('use call reqeust');
|
|
10
|
-
// return bootpay.current.request(payload, items, user, extra);
|
|
11
|
-
// }, []);
|
|
12
|
-
// const dismiss = useCallback(() => {
|
|
13
|
-
// console.log('use call dismiss');
|
|
14
|
-
// return bootpay.current.dismiss();
|
|
15
|
-
// }, []);
|
|
16
|
-
// const transactionConfirm = useCallback((data) => {
|
|
17
|
-
// console.log('use call transactionConfirm');
|
|
18
|
-
// return bootpay.current.transactionConfirm(data);
|
|
19
|
-
// }, []);
|
|
20
|
-
// const userTrace = useCallback(() => {
|
|
21
|
-
// console.log('user trace click');
|
|
22
|
-
// BootpayAnalytics.userTrace();
|
|
23
|
-
// // return anlaytics.current.userTrace();
|
|
24
|
-
// }, []);
|
|
25
|
-
// const pageTrace = useCallback(() => {
|
|
26
|
-
// BootpayAnalytics.pageTrace();
|
|
27
|
-
// // return anlaytics.current.pageTrace();
|
|
28
|
-
// }, []);
|
|
29
|
-
// return [
|
|
30
|
-
// {
|
|
31
|
-
// bootpayEvents,
|
|
32
|
-
// },
|
|
33
|
-
// {
|
|
34
|
-
// request,
|
|
35
|
-
// transactionConfirm,
|
|
36
|
-
// dismiss,
|
|
37
|
-
// text,
|
|
38
|
-
// userTrace,
|
|
39
|
-
// pageTrace
|
|
40
|
-
// },
|
|
41
|
-
// ];
|
|
42
|
-
// }
|
|
43
|
-
"use strict";
|
|
44
|
-
//# sourceMappingURL=useBootpay.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["useBootpay.js"],"names":[],"mappings":"AAAA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":["// import { useCallback } from 'react';\n// import BootpayAnalytics from './BootpayAnalytics';\n// import BootpayWebView from './BootpayWebView'; \n\n// export const useBootpay = () => {\n// const bootpay = useRef(new BootpayWebView());\n// // const anlaytics = useRef(new BootpayAnalytics());\n\n// const [bootpayEvents, setBootpayEvents] = useState([]);\n\n// const request = useCallback((payload, items, user, extra) => {\n// console.log('use call reqeust');\n// return bootpay.current.request(payload, items, user, extra);\n// }, []);\n\n// const dismiss = useCallback(() => {\n// console.log('use call dismiss');\n// return bootpay.current.dismiss();\n// }, []);\n\n// const transactionConfirm = useCallback((data) => {\n// console.log('use call transactionConfirm');\n// return bootpay.current.transactionConfirm(data);\n// }, []);\n\n// const userTrace = useCallback(() => {\n\n// console.log('user trace click');\n// BootpayAnalytics.userTrace();\n// // return anlaytics.current.userTrace();\n// }, []);\n\n// const pageTrace = useCallback(() => {\n// BootpayAnalytics.pageTrace();\n// // return anlaytics.current.pageTrace();\n// }, []);\n\n// return [\n// {\n// bootpayEvents,\n// },\n// {\n// request,\n// transactionConfirm,\n// dismiss,\n// text,\n// userTrace,\n// pageTrace\n// },\n// ];\n// }\n"]}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import base64 from 'react-native-base64';
|
|
2
|
-
import DeviceInfo from 'react-native-device-info'; // import CryptoJS from 'crypto-js';
|
|
3
|
-
|
|
4
|
-
import { NativeModules } from 'react-native';
|
|
5
|
-
var Aes = NativeModules.Aes;
|
|
6
|
-
|
|
7
|
-
const userTrace = async (applicationId, userId, phone, email, gender, birth, area) => {
|
|
8
|
-
try {
|
|
9
|
-
const payload = {
|
|
10
|
-
"id": userId,
|
|
11
|
-
"ver": DeviceInfo.getVersion(),
|
|
12
|
-
"application_id": applicationId,
|
|
13
|
-
"phone": phone,
|
|
14
|
-
"email": email,
|
|
15
|
-
"gender": gender,
|
|
16
|
-
"birth": birth,
|
|
17
|
-
"area": area
|
|
18
|
-
};
|
|
19
|
-
var key = getRandomKey(32);
|
|
20
|
-
var iv = getRandomKey(16);
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);
|
|
24
|
-
const response = await fetch('https://analytics.bootpay.co.kr/login', {
|
|
25
|
-
method: 'POST',
|
|
26
|
-
headers: {
|
|
27
|
-
Accept: 'application/json',
|
|
28
|
-
'Content-Type': 'application/json'
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify({
|
|
31
|
-
data: data,
|
|
32
|
-
session_key: await getSessionKey(key, iv)
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
const json = await response.json();
|
|
36
|
-
return json;
|
|
37
|
-
} catch (e) {
|
|
38
|
-
console.log(e);
|
|
39
|
-
}
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error(error);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const pageTrace = async (applicationId, url, pageType, items) => {
|
|
46
|
-
try {
|
|
47
|
-
const payload = {
|
|
48
|
-
"application_id": applicationId,
|
|
49
|
-
"url": url,
|
|
50
|
-
"page_type": pageType,
|
|
51
|
-
"items": items,
|
|
52
|
-
"referer": ''
|
|
53
|
-
};
|
|
54
|
-
var key = getRandomKey(32);
|
|
55
|
-
var iv = getRandomKey(16);
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);
|
|
59
|
-
const response = await fetch('https://analytics.bootpay.co.kr/call', {
|
|
60
|
-
method: 'POST',
|
|
61
|
-
headers: {
|
|
62
|
-
Accept: 'application/json',
|
|
63
|
-
'Content-Type': 'application/json'
|
|
64
|
-
},
|
|
65
|
-
body: JSON.stringify({
|
|
66
|
-
data: data,
|
|
67
|
-
session_key: await getSessionKey(key, iv)
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
const json = await response.json();
|
|
71
|
-
return json;
|
|
72
|
-
} catch (e) {
|
|
73
|
-
console.log(e);
|
|
74
|
-
}
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error(error);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const stringToHex = str => {
|
|
81
|
-
var hex = '';
|
|
82
|
-
|
|
83
|
-
for (var i = 0, l = str.length; i < l; i++) {
|
|
84
|
-
hex += str.charCodeAt(i).toString(16);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return hex;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const getRandomKey = length => {
|
|
91
|
-
var text = '';
|
|
92
|
-
var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
93
|
-
|
|
94
|
-
for (var i = 0; i < length; i++) text += keys.charAt(Math.floor(Math.random() * keys.length));
|
|
95
|
-
|
|
96
|
-
return text;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const getSessionKey = async (key, iv) => {
|
|
100
|
-
const keyValue = base64.encode(key);
|
|
101
|
-
const ivValue = base64.encode(iv);
|
|
102
|
-
return `${keyValue}##${ivValue}`;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const strEncode = async (str, key, iv) => {
|
|
106
|
-
return await Aes.encrypt(str, key, iv).then(cipher => {
|
|
107
|
-
Aes.hmac256(cipher, key).then(hash => {
|
|
108
|
-
console.log('HMAC', hash);
|
|
109
|
-
return hash;
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export { userTrace, pageTrace };
|
|
115
|
-
//# sourceMappingURL=BootpayAnalytics.js.map
|