react-native-bootpay-api 1.5.0 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,131 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.pageTrace = exports.userTrace = void 0;
7
-
8
- var _reactNativeBase = _interopRequireDefault(require("react-native-base64"));
9
-
10
- var _reactNativeDeviceInfo = _interopRequireDefault(require("react-native-device-info"));
11
-
12
- var _reactNative = require("react-native");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- // import CryptoJS from 'crypto-js';
17
- var Aes = _reactNative.NativeModules.Aes;
18
-
19
- const userTrace = async (applicationId, userId, phone, email, gender, birth, area) => {
20
- try {
21
- const payload = {
22
- "id": userId,
23
- "ver": _reactNativeDeviceInfo.default.getVersion(),
24
- "application_id": applicationId,
25
- "phone": phone,
26
- "email": email,
27
- "gender": gender,
28
- "birth": birth,
29
- "area": area
30
- };
31
- var key = getRandomKey(32);
32
- var iv = getRandomKey(16);
33
-
34
- try {
35
- const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);
36
- const response = await fetch('https://analytics.bootpay.co.kr/login', {
37
- method: 'POST',
38
- headers: {
39
- Accept: 'application/json',
40
- 'Content-Type': 'application/json'
41
- },
42
- body: JSON.stringify({
43
- data: data,
44
- session_key: await getSessionKey(key, iv)
45
- })
46
- });
47
- const json = await response.json();
48
- return json;
49
- } catch (e) {
50
- console.log(e);
51
- }
52
- } catch (error) {
53
- console.error(error);
54
- }
55
- };
56
-
57
- exports.userTrace = userTrace;
58
-
59
- const pageTrace = async (applicationId, url, pageType, items) => {
60
- try {
61
- const payload = {
62
- "application_id": applicationId,
63
- "url": url,
64
- "page_type": pageType,
65
- "items": items,
66
- "referer": ''
67
- };
68
- var key = getRandomKey(32);
69
- var iv = getRandomKey(16);
70
-
71
- try {
72
- const data = await Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv)).then(cipher => cipher);
73
- const response = await fetch('https://analytics.bootpay.co.kr/call', {
74
- method: 'POST',
75
- headers: {
76
- Accept: 'application/json',
77
- 'Content-Type': 'application/json'
78
- },
79
- body: JSON.stringify({
80
- data: data,
81
- session_key: await getSessionKey(key, iv)
82
- })
83
- });
84
- const json = await response.json();
85
- return json;
86
- } catch (e) {
87
- console.log(e);
88
- }
89
- } catch (error) {
90
- console.error(error);
91
- }
92
- };
93
-
94
- exports.pageTrace = pageTrace;
95
-
96
- const stringToHex = str => {
97
- var hex = '';
98
-
99
- for (var i = 0, l = str.length; i < l; i++) {
100
- hex += str.charCodeAt(i).toString(16);
101
- }
102
-
103
- return hex;
104
- };
105
-
106
- const getRandomKey = length => {
107
- var text = '';
108
- var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
109
-
110
- for (var i = 0; i < length; i++) text += keys.charAt(Math.floor(Math.random() * keys.length));
111
-
112
- return text;
113
- };
114
-
115
- const getSessionKey = async (key, iv) => {
116
- const keyValue = _reactNativeBase.default.encode(key);
117
-
118
- const ivValue = _reactNativeBase.default.encode(iv);
119
-
120
- return `${keyValue}##${ivValue}`;
121
- };
122
-
123
- const strEncode = async (str, key, iv) => {
124
- return await Aes.encrypt(str, key, iv).then(cipher => {
125
- Aes.hmac256(cipher, key).then(hash => {
126
- console.log('HMAC', hash);
127
- return hash;
128
- });
129
- });
130
- };
131
- //# sourceMappingURL=BootpayAnalytics.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["BootpayAnalytics.js"],"names":["Aes","NativeModules","userTrace","applicationId","userId","phone","email","gender","birth","area","payload","DeviceInfo","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","base64","encode","ivValue","strEncode","hmac256","hash"],"mappings":";;;;;;;AAEA;;AACA;;AAGA;;;;AADA;AAEA,IAAIA,GAAG,GAAGC,2BAAcD,GAAxB;;AAGA,MAAME,SAAS,GAAG,OAAOC,aAAP,EAAsBC,MAAtB,EAA8BC,KAA9B,EAAqCC,KAArC,EAA4CC,MAA5C,EAAoDC,KAApD,EAA2DC,IAA3D,KAAoE;AAClF,MAAI;AACA,UAAMC,OAAO,GAAG;AACZ,YAAMN,MADM;AAEZ,aAAOO,+BAAWC,UAAX,EAFK;AAGZ,wBAAkBT,aAHN;AAIZ,eAASE,KAJG;AAKZ,eAASC,KALG;AAMZ,gBAAUC,MANE;AAOZ,eAASC,KAPG;AAQZ,cAAQC;AARI,KAAhB;AAWA,QAAII,GAAG,GAAGC,YAAY,CAAC,EAAD,CAAtB;AACA,QAAIC,EAAE,GAAGD,YAAY,CAAC,EAAD,CAArB;;AAEA,QAAI;AACA,YAAME,IAAI,GAAG,MAAMhB,GAAG,CAACiB,OAAJ,CAAYC,IAAI,CAACC,SAAL,CAAeT,OAAf,CAAZ,EAAqCU,WAAW,CAACP,GAAD,CAAhD,EAAuDO,WAAW,CAACL,EAAD,CAAlE,EAAwEM,IAAxE,CAA6EC,MAAM,IAAIA,MAAvF,CAAnB;AAEA,YAAMC,QAAQ,GAAG,MAAMC,KAAK,CACxB,uCADwB,EAExB;AACIC,QAAAA,MAAM,EAAE,MADZ;AAEIC,QAAAA,OAAO,EAAE;AACLC,UAAAA,MAAM,EAAE,kBADH;AAEL,0BAAgB;AAFX,SAFb;AAMIC,QAAAA,IAAI,EAAEV,IAAI,CAACC,SAAL,CAAe;AACjBH,UAAAA,IAAI,EAAEA,IADW;AAEjBa,UAAAA,WAAW,EAAE,MAAMC,aAAa,CAACjB,GAAD,EAAME,EAAN;AAFf,SAAf;AANV,OAFwB,CAA5B;AAcE,YAAMgB,IAAI,GAAG,MAAMR,QAAQ,CA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SAAO,MAAMf,GAAG,CAACiB,OAAJ,CAAYuB,GAAZ,EAAiB3B,GAAjB,EAAsBE,EAAtB,EAA0BM,IAA1B,CAA+BC,MAAM,IAAI;AAClDtB,IAAAA,GAAG,CAAC0D,OAAJ,CAAYpC,MAAZ,EAAoBT,GAApB,EAAyBQ,IAAzB,CAA8BsC,IAAI,IAAI;AAClC1B,MAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ,EAAoByB,IAApB;AACA,aAAOA,IAAP;AACH,KAHD;AAIH,GALY,CAAb;AAOH,CARD","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,264 +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, "s", void 0);
37
-
38
- _defineProperty(this, "request", async (payload, items, user, extra) => {
39
- payload.application_id = _reactNative.Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
40
- payload.items = items;
41
- payload.user_info = user;
42
- payload.extra = extra;
43
- var quickPopup = '';
44
-
45
- if (extra != undefined && extra.quick_popup != undefined) {
46
- if (extra.quick_popup == 1) {
47
- quickPopup = 'BootPay.startQuickPopup();';
48
- }
49
- } //visibility가 true가 되면 webview onLoaded가 실행됨
50
-
51
-
52
- this.setState({
53
- visibility: true,
54
- script: `
55
- ${await this.getMountJavascript()}
56
- ${quickPopup}
57
- ${this.generateScript(payload)}
58
- `,
59
- firstLoad: false,
60
- showCloseButton: extra.show_close_button || false
61
- });
62
-
63
- _UserInfo.default.updateInfo();
64
- });
65
-
66
- _defineProperty(this, "dismiss", () => {
67
- this.setState(({
68
- visibility
69
- }) => ({
70
- visibility: false
71
- }));
72
- this.removePaymentWindow();
73
- });
74
-
75
- _defineProperty(this, "getMountJavascript", async () => {
76
- return `
77
- ${this.getBootpayPlatform()}
78
- ${await this.getAnalyticsData()}
79
- `;
80
- });
81
-
82
- _defineProperty(this, "generateScript", payload => {
83
- const onError = '.error(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
84
- const onCancel = '.cancel(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
85
- const onReady = '.ready(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
86
- const onConfirm = '.confirm(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
87
- const onClose = '.close(function(data){ window.BootpayRNWebView.postMessage("close"); })';
88
- const onDone = '.done(function(data){ window.BootpayRNWebView.postMessage( JSON.stringify(data) ); })';
89
- return `BootPay.request(${JSON.stringify(payload)})` + onError + onCancel + onReady + onConfirm + onClose + onDone + '; void(0);';
90
- });
91
-
92
- _defineProperty(this, "onMessage", ({
93
- nativeEvent
94
- }) => {
95
- if (nativeEvent == undefined || nativeEvent.data == undefined) return;
96
-
97
- if (nativeEvent.data == 'close') {
98
- if (this.props.onClose == undefined) return;
99
- var json = {
100
- action: 'BootpayClose',
101
- message: '결제창이 닫혔습니다'
102
- };
103
- this.props.onClose(json);
104
- this.dismiss();
105
- return;
106
- }
107
-
108
- const data = JSON.parse(nativeEvent.data);
109
-
110
- switch (data.action) {
111
- case 'BootpayCancel':
112
- if (this.props.onCancel != undefined) this.props.onCancel(data);
113
- this.setState({
114
- visibility: false
115
- });
116
- break;
117
-
118
- case 'BootpayError':
119
- if (this.props.onError != undefined) this.props.onError(data);
120
- this.setState({
121
- visibility: false
122
- });
123
- break;
124
-
125
- case 'BootpayBankReady':
126
- if (this.props.onReady != undefined) this.props.onReady(data);
127
- break;
128
-
129
- case 'BootpayConfirm':
130
- if (this.props.onConfirm != undefined) this.props.onConfirm(data);
131
- break;
132
-
133
- case 'BootpayDone':
134
- if (this.props.onDone != undefined) this.props.onDone(data);
135
- this.setState({
136
- visibility: false
137
- });
138
- break;
139
- }
140
- });
141
-
142
- _defineProperty(this, "onShouldStartLoadWithRequest", url => {
143
- return true;
144
- });
145
-
146
- _defineProperty(this, "getBootpayPlatform", () => {
147
- if (_reactNative.Platform.OS == 'ios') {
148
- return "BootPay.setDevice('IOS');";
149
- } else if (_reactNative.Platform.OS == 'android') {
150
- return "BootPay.setDevice('ANDROID');";
151
- }
152
- });
153
-
154
- _defineProperty(this, "transactionConfirm", data => {
155
- // console.log('transactionConfirm: ' + data);
156
- var json = JSON.stringify(data);
157
- this.callJavaScript(`
158
- BootPay.transactionConfirm(${json});
159
- `);
160
- });
161
-
162
- _defineProperty(this, "removePaymentWindow", () => {
163
- this.callJavaScript(`
164
- BootPay.removePaymentWindow();
165
- `);
166
- });
167
-
168
- _defineProperty(this, "callJavaScript", script => {
169
- if (this.webView == null || this.webView == undefined) return; // console.log('callJavascript: ' + script);
170
-
171
- this.webView.injectJavaScript(`
172
- javascript:(function(){${script} })()
173
- `); // this.webView.evalu
174
- });
175
-
176
- _defineProperty(this, "getAnalyticsData", async () => {
177
- const uuid = await _UserInfo.default.getBootpayUUID();
178
- const bootpaySK = await _UserInfo.default.getBootpaySK();
179
- const bootLastTime = await _UserInfo.default.getBootpayLastTime();
180
- const elaspedTime = Date.now() - bootLastTime;
181
- 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}});`);
182
- });
183
- }
184
-
185
- async componentWillUnmount() {
186
- this.setState({
187
- visibility: false,
188
- firstLoad: false,
189
- showCloseButton: false
190
- });
191
-
192
- _UserInfo.default.setBootpayLastTime(Date.now());
193
- }
194
-
195
- render() {
196
- return /*#__PURE__*/_react.default.createElement(_reactNative.Modal, {
197
- animationType: 'slide',
198
- transparent: false,
199
- visible: this.state.visibility
200
- }, /*#__PURE__*/_react.default.createElement(_reactNative.SafeAreaView, {
201
- style: {
202
- flex: 1
203
- }
204
- }, this.state.showCloseButton && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
205
- onPress: () => {
206
- var cancelData = {
207
- action: 'BootpayCancel',
208
- message: '사용자에 의해 취소되었습니다'
209
- };
210
- var closeData = {
211
- action: 'BootpayClose',
212
- message: '결제창이 닫혔습니다'
213
- };
214
- if (this.props.onCancel != undefined) this.props.onCancel(cancelData);
215
- if (this.props.onClose != undefined) this.props.onClose(closeData);
216
- this.setState({
217
- visibility: false
218
- });
219
- }
220
- }, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
221
- style: [styles.overlay],
222
- source: require('../images/close.png')
223
- })), /*#__PURE__*/_react.default.createElement(_reactNativeWebviewBootpay.default, {
224
- ref: wv => this.webView = wv,
225
- useWebKit: true,
226
- originWhitelist: ['*'],
227
- source: {
228
- uri: 'https://inapp.bootpay.co.kr/3.3.3/production.html'
229
- },
230
- injectedJavaScript: this.state.script,
231
- javaScriptEnabled: true,
232
- javaScriptCanOpenWindowsAutomatically: true,
233
- scalesPageToFit: true,
234
- onMessage: this.onMessage,
235
- onShouldStartLoadWithRequest: this.onShouldStartLoadWithRequest
236
- })));
237
- }
238
-
239
- }
240
-
241
- exports.BootpayWebView = BootpayWebView;
242
-
243
- var styles = _reactNative.StyleSheet.create({
244
- container: {
245
- flex: 1,
246
- justifyContent: 'center',
247
- alignItems: 'center',
248
- backgroundColor: '#F5FCFF'
249
- },
250
- welcome: {
251
- fontSize: 20,
252
- textAlign: 'center',
253
- margin: 10
254
- },
255
- // Flex to fill, position absolute,
256
- // Fixed left/top, and the width set to the window width
257
- overlay: {
258
- width: 25,
259
- height: 25,
260
- right: 5,
261
- alignSelf: 'flex-end'
262
- }
263
- });
264
- //# 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","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,mCAGlC;AACJC,MAAAA,UAAU,EAAE,KADR;AAEJC,MAAAA,MAAM,EAAE,EAFJ;AAGJC,MAAAA,SAAS,EAAE;AAHP,KAHkC;;AAAA;;AAAA,qCAsEhC,OAAOC,OAAP,EAAgBC,KAAhB,EAAuBC,IAAvB,EAA6BC,KAA7B,KAAuC;AAE7CH,MAAAA,OAAO,CAACI,cAAR,GAA0BC,sBAASC,EAAT,IAAe,KAAf,GAAuB,KAAKC,KAAL,CAAWC,kBAAlC,GAAuD,KAAKD,KAAL,CAAWE,sBAA5F;AACAT,MAAAA,OAAO,CAACC,KAAR,GAAgBA,KAAhB;AACAD,MAAAA,OAAO,CAACU,SAAR,GAAoBR,IAApB;AACAF,MAAAA,OAAO,CAACG,KAAR,GAAgBA,KAAhB;AAGA,UAAIQ,UAAU,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,CADX;AAEI,MAAA,MAAM,EAAEC,OAAO,CAAC,qBAAD;AAFnB,MAhBJ,CAHR,eAwBI,6BAAC,kCAAD;AACI,MAAA,GAAG,EAAGC,EAAD,IAAQ,KAAKrB,OAAL,GAAeqB,EADhC;AAEI,MAAA,SAAS,EAAE,IAFf;AAGI,MAAA,eAAe,EAAE,CAAC,GAAD,CAHrB;AAII,MAAA,MAAM,EAAE;AACJC,QAAAA,GAAG,EAAE;AADD,OAJZ;AAOI,MAAA,kBAAkB,EAAE,KAAKR,KAAL,CAAWzD,MAPnC;AAQI,MAAA,iBAAiB,EAAE,IARvB;AASI,MAAA,qCAAqC,EAAE,IAT3C;AAUI,MAAA,eAAe,EAAE,IAVrB;AAWI,MAAA,SAAS,EAAE,KAAKkE,SAXpB;AAYI,MAAA,4BAA4B,EAAE,KAAKC;AAZvC,MAxBJ,CAJG,CAAP;AA6CH;;AApEyC;;;;AAkP9C,IAAIN,MAAM,GAAGO,wBAAWC,MAAX,CAAkB;AAC3BC,EAAAA,SAAS,EAAE;AACTZ,IAAAA,IAAI,EAAE,CADG;AAETa,IAAAA,cAAc,EAAE,QAFP;AAGTC,IAAAA,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 } 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,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","bootpaySK","getBootpaySK","lastTime","getBootpayLastTime","current","Date","now","newBootpaySK","isExpired"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;;;AAEe,MAAMA,QAAN,SAAuBC,gBAAvB,CAAiC;AAiDnB,SAAlBC,kBAAkB,CAACC,GAAD,EAAa;AAClC,WAAOH,QAAQ,CAACI,cAAT,CAAwB,mBAAxB,EAA6CD,GAA7C,CAAP;AACH;;AAEsB,SAAhBE,gBAAgB,GAAG;AACtB,WAAOL,QAAQ,CAACM,cAAT,CAAwB,iBAAxB,EAA2C,EA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itive-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
- "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 }"]}
@@ -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// } "]}