react-native-bootpay-api 1.4.4 → 4.0.0-beta.0

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.
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"sources":["BootpayAnalytics.js"],"names":["base64","DeviceInfo","NativeModules","Aes","userTrace","applicationId","userId","phone","email","gender","birth","area","payload","getVersion","key","getRandomKey","iv","data","encrypt","JSON","stringify","stringToHex","then","cipher","response","fetch","method","headers","Accept","body","session_key","getSessionKey","json","e","console","log","error","pageTrace","url","pageType","items","str","hex","i","l","length","charCodeAt","toString","text","keys","charAt","Math","floor","random","keyValue","encode","ivValue","strEncode","hmac256","hash"],"mappings":"AAEA,OAAOA,MAAP,MAAmB,qBAAnB;AACA,OAAOC,UAAP,MAAuB,0BAAvB,C,CAEA;;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,IAAIC,GAAG,GAAGD,aAAa,CAACC,GAAxB;;AAGA,MAAMC,SAAS,GAAG,OAAOC,aAAP,EAAsB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,IAAzB,CAA8BqC,IAAI,IAAI;AAClCzB,MAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ,EAAoBwB,IAApB;AACA,aAAOA,IAAP;AACH,KAHD;AAIH,GALY,CAAb;AAOH,CARD;;AAUA,SAASvD,SAAT,EAAoBiC,SAApB","sourcesContent":["\n \nimport base64 from 'react-native-base64'\nimport DeviceInfo from 'react-native-device-info';\n\n// import CryptoJS from 'crypto-js'; \nimport { NativeModules } from 'react-native'\nvar Aes = NativeModules.Aes\n\n\nconst userTrace = async (applicationId, userId, phone, email, gender, birth, area) => { \n try { \n const payload = {\n \"id\": userId, \n \"ver\": DeviceInfo.getVersion(),\n \"application_id\": applicationId, \n \"phone\": phone,\n \"email\": email,\n \"gender\": gender,\n \"birth\": birth,\n \"area\": area\n };\n\n var key = getRandomKey(32);\n var iv = getRandomKey(16);\n \n try { \n const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);\n\n const response = await fetch(\n 'https://analytics.bootpay.co.kr/login',\n {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n data: data,\n session_key: await getSessionKey(key, iv)\n })\n }\n );\n const json = await response.json();\n return json;\n } catch (e) {\n console.log(e);\n } \n } catch (error) {\n console.error(error);\n }\n}\n\nconst pageTrace = async (applicationId, url, pageType, items) => { \n try { \n const payload = {\n \"application_id\": applicationId, \n \"url\": url, \n \"page_type\": pageType,\n \"items\": items,\n \"referer\": ''\n }; \n\n var key = getRandomKey(32);\n var iv = getRandomKey(16);\n \n try { \n const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);\n\n const response = await fetch(\n 'https://analytics.bootpay.co.kr/call',\n {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify({\n data: data,\n session_key: await getSessionKey(key, iv)\n })\n }\n );\n const json = await response.json();\n return json;\n } catch (e) {\n console.log(e);\n } \n } catch (error) {\n console.error(error);\n }\n}\n\nconst stringToHex = (str) => {\n var hex = ''\n for (var i = 0, l = str.length; i < l; i++) {\n hex += str.charCodeAt(i).toString(16)\n }\n return hex\n}\n\nconst getRandomKey = (length) => {\n var text = '';\n var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n for (var i = 0; i < length; i++)\n text += keys.charAt(Math.floor(Math.random() * keys.length));\n\n return text;\n}\n\n\nconst getSessionKey = async (key, iv) => {\n const keyValue = base64.encode(key);\n const ivValue = base64.encode(iv);\n\n return `${keyValue}##${ivValue}`;\n}\n\nconst strEncode = async (str, key, iv) => {\n return await Aes.encrypt(str, key, iv).then(cipher => {\n Aes.hmac256(cipher, key).then(hash => {\n console.log('HMAC', hash)\n return hash;\n })\n })\n\n}\n\nexport { userTrace, pageTrace }\n"]}
@@ -1,242 +0,0 @@
1
- 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; }
2
-
3
- import React, { Component, useRef } from 'react';
4
- import { SafeAreaView, Modal, Platform, TouchableOpacity, Image, StyleSheet } from 'react-native';
5
- import WebView from 'react-native-webview-bootpay';
6
- import UserInfo from './UserInfo';
7
- export class BootpayWebView extends Component {
8
- constructor(...args) {
9
- super(...args);
10
-
11
- _defineProperty(this, "webView", useRef < WebView > null);
12
-
13
- _defineProperty(this, "state", {
14
- visibility: false,
15
- script: '',
16
- firstLoad: false
17
- });
18
-
19
- _defineProperty(this, "s", void 0);
20
-
21
- _defineProperty(this, "request", async (payload, items, user, extra) => {
22
- payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
23
- payload.items = items;
24
- payload.user_info = user;
25
- payload.extra = extra;
26
- var quickPopup = '';
27
-
28
- if (extra != undefined && extra.quick_popup != undefined) {
29
- if (extra.quick_popup == 1) {
30
- quickPopup = 'BootPay.startQuickPopup();';
31
- }
32
- } //visibility가 true가 되면 webview onLoaded가 실행됨
33
-
34
-
35
- this.setState({
36
- visibility: true,
37
- script: `
38
- ${await this.getMountJavascript()}
39
- ${quickPopup}
40
- ${this.generateScript(payload)}
41
- `,
42
- firstLoad: false,
43
- showCloseButton: extra.show_close_button || false
44
- });
45
- UserInfo.updateInfo();
46
- });
47
-
48
- _defineProperty(this, "dismiss", () => {
49
- this.setState(({
50
- visibility
51
- }) => ({
52
- visibility: false
53
- }));
54
- this.removePaymentWindow();
55
- });
56
-
57
- _defineProperty(this, "getMountJavascript", async () => {
58
- return `
59
- ${this.getBootpayPlatform()}
60
- ${await this.getAnalyticsData()}
61
- `;
62
- });
63
-
64
- _defineProperty(this, "generateScript", payload => {
65
- const onError = '.error(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
66
- const onCancel = '.cancel(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
67
- const onReady = '.ready(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
68
- const onConfirm = '.confirm(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
69
- const onClose = '.close(function(data){ window.BootpayRNWebView.postMessage("close"); })';
70
- const onDone = '.done(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
71
- return `BootPay.request(${JSON.stringify(payload)})` + onError + onCancel + onReady + onConfirm + onClose + onDone + '; void(0);';
72
- });
73
-
74
- _defineProperty(this, "onMessage", ({
75
- nativeEvent
76
- }) => {
77
- if (nativeEvent == undefined || nativeEvent.data == undefined) return;
78
-
79
- if (nativeEvent.data == 'close') {
80
- if (this.props.onClose == undefined) return;
81
- var json = {
82
- action: 'BootpayClose',
83
- message: '결제창이 닫혔습니다'
84
- };
85
- this.props.onClose(json);
86
- this.dismiss();
87
- return;
88
- }
89
-
90
- const data = JSON.parse(nativeEvent.data);
91
-
92
- switch (data.action) {
93
- case 'BootpayCancel':
94
- if (this.props.onCancel != undefined) this.props.onCancel(data);
95
- this.setState({
96
- visibility: false
97
- });
98
- break;
99
-
100
- case 'BootpayError':
101
- if (this.props.onError != undefined) this.props.onError(data);
102
- this.setState({
103
- visibility: false
104
- });
105
- break;
106
-
107
- case 'BootpayBankReady':
108
- if (this.props.onReady != undefined) this.props.onReady(data);
109
- break;
110
-
111
- case 'BootpayConfirm':
112
- if (this.props.onConfirm != undefined) this.props.onConfirm(data);
113
- break;
114
-
115
- case 'BootpayDone':
116
- if (this.props.onDone != undefined) this.props.onDone(data);
117
- this.setState({
118
- visibility: false
119
- });
120
- break;
121
- }
122
- });
123
-
124
- _defineProperty(this, "onShouldStartLoadWithRequest", url => {
125
- return true;
126
- });
127
-
128
- _defineProperty(this, "getBootpayPlatform", () => {
129
- if (Platform.OS == 'ios') {
130
- return "BootPay.setDevice('IOS');";
131
- } else if (Platform.OS == 'android') {
132
- return "BootPay.setDevice('ANDROID');";
133
- }
134
- });
135
-
136
- _defineProperty(this, "transactionConfirm", data => {
137
- // console.log('transactionConfirm: ' + data);
138
- var json = JSON.stringify(data);
139
- this.callJavaScript(`
140
- BootPay.transactionConfirm(${json});
141
- `);
142
- });
143
-
144
- _defineProperty(this, "removePaymentWindow", () => {
145
- this.callJavaScript(`
146
- BootPay.removePaymentWindow();
147
- `);
148
- });
149
-
150
- _defineProperty(this, "callJavaScript", script => {
151
- if (this.webView == null || this.webView == undefined) return; // console.log('callJavascript: ' + script);
152
-
153
- this.webView.injectJavaScript(`
154
- javascript:(function(){${script} })()
155
- `); // this.webView.evalu
156
- });
157
-
158
- _defineProperty(this, "getAnalyticsData", async () => {
159
- const uuid = await UserInfo.getBootpayUUID();
160
- const bootpaySK = await UserInfo.getBootpaySK();
161
- const bootLastTime = await UserInfo.getBootpayLastTime();
162
- const elaspedTime = Date.now() - bootLastTime;
163
- 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}});`);
164
- });
165
- }
166
-
167
- async componentWillUnmount() {
168
- this.setState({
169
- visibility: false,
170
- firstLoad: false,
171
- showCloseButton: false
172
- });
173
- UserInfo.setBootpayLastTime(Date.now());
174
- }
175
-
176
- render() {
177
- return /*#__PURE__*/React.createElement(Modal, {
178
- animationType: 'slide',
179
- transparent: false,
180
- visible: this.state.visibility
181
- }, /*#__PURE__*/React.createElement(SafeAreaView, {
182
- style: {
183
- flex: 1
184
- }
185
- }, this.state.showCloseButton && /*#__PURE__*/React.createElement(TouchableOpacity, {
186
- onPress: () => {
187
- var cancelData = {
188
- action: 'BootpayCancel',
189
- message: '사용자에 의해 취소되었습니다'
190
- };
191
- var closeData = {
192
- action: 'BootpayClose',
193
- message: '결제창이 닫혔습니다'
194
- };
195
- if (this.props.onCancel != undefined) this.props.onCancel(cancelData);
196
- if (this.props.onClose != undefined) this.props.onClose(closeData);
197
- this.setState({
198
- visibility: false
199
- });
200
- }
201
- }, /*#__PURE__*/React.createElement(Image, {
202
- style: [styles.overlay],
203
- source: require('../images/close.png')
204
- })), /*#__PURE__*/React.createElement(WebView, {
205
- ref: wv => this.webView = wv,
206
- useWebKit: true,
207
- originWhitelist: ['*'],
208
- source: {
209
- uri: 'https://inapp.bootpay.co.kr/3.3.3/production.html'
210
- },
211
- injectedJavaScript: this.state.script,
212
- javaScriptEnabled: true,
213
- javaScriptCanOpenWindowsAutomatically: true,
214
- scalesPageToFit: true,
215
- onMessage: this.onMessage,
216
- onShouldStartLoadWithRequest: this.onShouldStartLoadWithRequest
217
- })));
218
- }
219
-
220
- }
221
- var styles = StyleSheet.create({
222
- container: {
223
- flex: 1,
224
- justifyContent: 'center',
225
- alignItems: 'center',
226
- backgroundColor: '#F5FCFF'
227
- },
228
- welcome: {
229
- fontSize: 20,
230
- textAlign: 'center',
231
- margin: 10
232
- },
233
- // Flex to fill, position absolute,
234
- // Fixed left/top, and the width set to the window width
235
- overlay: {
236
- width: 25,
237
- height: 25,
238
- right: 5,
239
- alignSelf: 'flex-end'
240
- }
241
- });
242
- //# sourceMappingURL=BootpayWebView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["BootpayWebView.js"],"names":["React","Component","useRef","SafeAreaView","Modal","Platform","TouchableOpacity","Image","StyleSheet","WebView","UserInfo","BootpayWebView","visibility","script","firstLoad","payload","items","user","extra","application_id","OS","props","ios_application_id","android_application_id","user_info","quickPopup","undefined","quick_popup","setState","getMountJavascript","generateScript","showCloseButton","show_close_button","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","state","flex","cancelData","closeData","styles","overlay","require","wv","uri","onMessage","onShouldStartLoadWithRequest","create","container","justifyContent","alignItems","backgroundColor","welcome","fontSize","textAlign","margin","width","height","right","alignSelf"],"mappings":";;AAEA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AACA,SAASC,YAAT,EAAuBC,KAAvB,EAA8BC,QAA9B,EAAwCC,gBAAxC,EAA0DC,KAA1D,EAAiEC,UAAjE,QAAmF,cAAnF;AACA,OAAOC,OAAP,MAAqB,8BAArB;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA,OAAO,MAAMC,cAAN,SAA6BV,SAA7B,CAAuC;AAAA;AAAA;;AAAA,qCAChCC,MAAM,GAACO,OAAP,GAAgB,IADgB;;AAAA,mCAGlC;AACJG,MAAAA,UAAU,EAAE,KADR;AAEJC,MAAAA,MAAM,EAAE,EAFJ;AAGJC,MAAAA,SAAS,EAAE;AAHP,KAHkC;;AAAA;;AAAA,qCAsEhC,OAAOC,OAAP,EAAgBC,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ADH;AAEPC,IAAAA,SAAS,EAAE,QAFJ;AAGPC,IAAAA,MAAM,EAAE;AAHD,GAPkB;AAY3B;AACA;AACAd,EAAAA,OAAO,EAAE;AACPe,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 } from 'react';\nimport { SafeAreaView, Modal, Platform, TouchableOpacity, Image, StyleSheet } 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 state = {\n visibility: false, \n script: '',\n firstLoad: false\n } \ns\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\n\n return <Modal\n animationType={'slide'}\n transparent={false}\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 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 });"]}
@@ -1,79 +0,0 @@
1
- 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; }
2
-
3
- import { Component } from 'react';
4
- import DeviceInfo from 'react-native-device-info';
5
- import SInfo from 'react-native-sensitive-info';
6
- export default class UserInfo extends Component {
7
- static setBootpayLastTime(val) {
8
- return UserInfo.setBootpayInfo('bootpay_last_time', val);
9
- }
10
-
11
- static getBootpayUserId() {
12
- return UserInfo.getBootpayInfo('bootpay_user_id', '');
13
- }
14
-
15
- }
16
-
17
- _defineProperty(UserInfo, "getBootpayInfo", (key, defaultVal) => {
18
- return new Promise((resolve, reject) => {
19
- SInfo.getItem(key, {
20
- sharedPreferencesName: 'bootpaySharedPrefs',
21
- keychainService: 'bootpayKeychain'
22
- }).then(res => {
23
- res == undefined ? resolve(defaultVal) : resolve(res);
24
- resolve(res);
25
- }).catch(error => {
26
- reject(error);
27
- });
28
- });
29
- });
30
-
31
- _defineProperty(UserInfo, "setBootpayInfo", (key, val) => {
32
- return new Promise((resolve, reject) => {
33
- SInfo.setItem(String(key), String(val), {
34
- sharedPreferencesName: 'bootpaySharedPrefs',
35
- keychainService: 'bootpayKeychain'
36
- }).then(res => {
37
- resolve(res);
38
- }).catch(error => {
39
- reject(error);
40
- });
41
- });
42
- });
43
-
44
- _defineProperty(UserInfo, "getBootpayUUID", () => {
45
- let uuid = DeviceInfo.getUniqueId();
46
- return UserInfo.setBootpayInfo('uuid', uuid);
47
- });
48
-
49
- _defineProperty(UserInfo, "getBootpaySK", () => {
50
- return UserInfo.getBootpayInfo('bootpay_sk', '');
51
- });
52
-
53
- _defineProperty(UserInfo, "setBootpaySK", val => {
54
- return UserInfo.setBootpayInfo('bootpay_sk', val);
55
- });
56
-
57
- _defineProperty(UserInfo, "newBootpaySK", (uuid, time) => {
58
- return UserInfo.setBootpaySK(`${uuid}_${time}`);
59
- });
60
-
61
- _defineProperty(UserInfo, "getBootpayLastTime", async () => {
62
- return await UserInfo.getBootpayInfo('bootpay_last_time', 0);
63
- });
64
-
65
- _defineProperty(UserInfo, "setBootpayUserId", val => {
66
- return UserInfo.setBootpayInfo('bootpay_user_id', val);
67
- });
68
-
69
- _defineProperty(UserInfo, "updateInfo", async () => {
70
- const uuid = await UserInfo.getBootpayUUID();
71
- const bootpaySK = await UserInfo.getBootpaySK();
72
- const lastTime = await UserInfo.getBootpayLastTime();
73
- let current = Date.now();
74
- if (bootpaySK == '') await UserInfo.newBootpaySK(uuid, current);
75
- const isExpired = current - lastTime > 30 * 60 * 1000;
76
- if (isExpired) await UserInfo.newBootpaySK(uuid, current);
77
- await UserInfo.setBootpayLastTime(current);
78
- });
79
- //# sourceMappingURL=UserInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["UserInfo.tsx"],"names":["Component","DeviceInfo","SInfo","UserInfo","setBootpayLastTime","val","setBootpayInfo","getBootpayUserId","getBootpayInfo","key","defaultVal","Promise","resolve","reject","getItem","sharedPreferencesName","keychainService","then","res","undefined","catch","error","setItem","String","uuid","getUniqueId","time","setBootpaySK","getBootpayUUID","bootpaySK","getBootpaySK","lastTime","getBootpayLastTime","current","Date","now","newBootpaySK","isExpired"],"mappings":";;AAAA,SAASA,SAAT,QAA0B,OAA1B;AACA,OAAOC,UAAP,MAAuB,0BAAvB;AACA,OAAOC,KAAP,MAAkB,6BAAlB;AAEA,eAAe,MAAMC,QAAN,SAAuBH,SAAvB,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EAAL,GAAU,IAAjD;AACA,MAAGM,SAAH,EAAc,MAAMlC,QAAQ,CAACiC,YAAT,CAAsBZ,IAAtB,EAA4BS,OAA5B,CAAN;AACd,QAAM9B,QAAQ,CAACC,kBAAT,CAA4B6B,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}"]}
@@ -1,28 +0,0 @@
1
- import { BootpayWebView } from './BootpayWebView';
2
- import { userTrace, pageTrace } from './BootpayAnalytics';
3
- export { BootpayWebView, userTrace, pageTrace }; // interface BootpayWebViewProps {
4
- // ios_application_id: string;
5
- // android_application_id: string;
6
- // onCancel: (data: string) => void;
7
- // onError: (data: string) => void;
8
- // onReady: (data: string) => void;
9
- // onConfirm: (data: string) => void;
10
- // onDone: (data: string) => void;
11
- // onClose: () => void;
12
- // }
13
- // export class BootpayWebView extends Component<BootpayWebViewProps> {
14
- // request: (payload: Object, items: Object, user: Object, extra: Object) => Promise<string>;
15
- // dismiss: () => Promise<string>;
16
- // transactionConfirm: (data: string) => Promise<string>;
17
- // }
18
- // export class BootpayAnalytics {
19
- // static userTrace: () => void;
20
- // static pageTrace: () => void;
21
- // }
22
- // export const userTrace: () => void;
23
- // export default function pageTrace(): void;
24
- // export const userTrace: () => void;
25
- // export default function PageTrace() : void;
26
- // const Bootpay =
27
- // export { BootpayWebView, userTrace, pageTrace }
28
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.d.ts"],"names":["BootpayWebView","userTrace","pageTrace"],"mappings":"AAKA,SAASA,cAAT,QAA+B,kBAA/B;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AAGA,SAASF,cAAT,EAAyBC,SAAzB,EAAoCC,SAApC,G,CAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AAEA","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 }"]}
@@ -1,21 +0,0 @@
1
- // import { useBootpay } from './useBootpay';
2
- import { BootpayWebView } from './BootpayWebView';
3
- import { userTrace, pageTrace } from './BootpayAnalytics';
4
- export { BootpayWebView, userTrace, pageTrace }; // export { useBootpay };
5
- // import React, { Component } from 'react';
6
- // import WebView from 'react-native-webview-bootpay';
7
- // export class BootpayWebView extends Component {
8
- // render() {
9
- // return <WebView
10
- // useWebKit={true}
11
- // originWhitelist={['*']}
12
- // source={{
13
- // uri: 'https://www.google.com'
14
- // }}
15
- // javaScriptEnabled={true}
16
- // javaScriptCanOpenWindowsAutomatically={true}
17
- // scalesPageToFit={true}
18
- // />
19
- // }
20
- // }
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.js"],"names":["BootpayWebView","userTrace","pageTrace"],"mappings":"AACA;AACA,SAASA,cAAT,QAA+B,kBAA/B;AACA,SAASC,SAAT,EAAoBC,SAApB,QAAqC,oBAArC;AAEA,SAAUF,cAAV,EAA0BC,SAA1B,EAAqCC,SAArC,G,CACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,43 +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
- //# 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 +0,0 @@
1
- {"version":3,"file":"UserInfo.d.ts","sourceRoot":"","sources":["../../src/UserInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAS;IAC3C,MAAM,CAAC,cAAc,QAAS,MAAM,cAAc,GAAG,sBAYpD;IAED,MAAM,CAAC,cAAc,QAAS,MAAM,OAAO,GAAG,sBAW7C;IAED,MAAM,CAAC,cAAc,yBAGpB;IAED,MAAM,CAAC,YAAY,yBAElB;IAED,MAAM,CAAC,YAAY,QAAS,MAAM,sBAEjC;IAED,MAAM,CAAC,YAAY,SAAU,MAAM,QAAQ,MAAM,sBAEhD;IAED,MAAM,CAAC,kBAAkB,yBAExB;IAED,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM;IAIrC,MAAM,CAAC,gBAAgB;IAIvB,MAAM,CAAC,gBAAgB,QAAS,MAAM,sBAErC;IAED,MAAM,CAAC,UAAU,sBAWhB;CACJ"}