react-native-bootpay-api 4.3.3 → 5.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.tsx +4 -0
- package/lib/Bootpay.d.ts.map +1 -1
- package/lib/Bootpay.js +13 -12
- package/lib/BootpayTypes.d.ts +1 -0
- package/lib/BootpayTypes.d.ts.map +1 -1
- package/lib/bootpayAnalytics.d.ts +12 -0
- package/lib/bootpayAnalytics.d.ts.map +1 -0
- package/lib/bootpayAnalytics.js +195 -0
- package/lib/index.d.ts.map +1 -1
- package/package.json +30 -25
- package/react-native.config.js +6 -3
- package/src/Bootpay.tsx +453 -0
- package/src/BootpayTypes.ts +136 -0
- package/src/Loader.tsx +41 -0
- package/src/UserInfo.ts +79 -0
- package/src/__tests__/index.test.d.ts +1 -0
- package/src/__tests__/index.test.d.ts.map +1 -0
- package/src/__tests__/index.test.js +2 -0
- package/src/__tests__/index.test.tsx +1 -0
- package/src/bootpayAnalytics.ts +136 -0
- package/src/index.tsx +9 -0
- package/index.js +0 -4
package/index.tsx
ADDED
package/lib/Bootpay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bootpay.d.ts","sourceRoot":"","sources":["../src/Bootpay.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIzC,OAAO,OAAO,EAAE,EAAC,mBAAmB,EAAC,MAAO,8BAA8B,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAQ/E,qBAAa,OAAQ,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAGrD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAEtB,KAAK,EAAE,iBAAiB;IAMpC,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB,KAAK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IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAErF;IAED,qBAAqB,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,mBAEvF;IAED,cAAc,YAAmB,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,IAAI,SAAS,KAAK,iBAAiB,MAAM,mBA4BvG;IAGD,kBAAkB,wBAQjB;IAGD,cAAc,YAAY,OAAO,iBAAiB,MAAM,YAavD;CAEJ"}
|
package/lib/Bootpay.js
CHANGED
|
@@ -142,8 +142,12 @@ var Bootpay = /** @class */ (function (_super) {
|
|
|
142
142
|
break;
|
|
143
143
|
case 'confirm':
|
|
144
144
|
this.showProgressBar(true);
|
|
145
|
-
if
|
|
146
|
-
|
|
145
|
+
// if(this.props.onConfirm != undefined) this.props.onConfirm(data);
|
|
146
|
+
if (this.props.onConfirm != undefined) {
|
|
147
|
+
if (this.props.onConfirm(data)) {
|
|
148
|
+
this.transactionConfirm();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
147
151
|
break;
|
|
148
152
|
case 'done':
|
|
149
153
|
this.showProgressBar(false);
|
|
@@ -178,8 +182,11 @@ var Bootpay = /** @class */ (function (_super) {
|
|
|
178
182
|
break;
|
|
179
183
|
case 'confirm':
|
|
180
184
|
this.showProgressBar(true);
|
|
181
|
-
if (this.props.onConfirm != undefined)
|
|
182
|
-
this.props.onConfirm(data)
|
|
185
|
+
if (this.props.onConfirm != undefined) {
|
|
186
|
+
if (this.props.onConfirm(data)) {
|
|
187
|
+
this.transactionConfirm();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
183
190
|
break;
|
|
184
191
|
case 'done':
|
|
185
192
|
this.showProgressBar(false);
|
|
@@ -407,15 +414,9 @@ var Bootpay = /** @class */ (function (_super) {
|
|
|
407
414
|
}}>
|
|
408
415
|
<Image style={[styles.overlay]} source={require('../images/close.png')}/>
|
|
409
416
|
</TouchableOpacity>}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
+
|
|
417
418
|
<WebView ref={this.webView} originWhitelist={['*']} source={{
|
|
418
|
-
uri: 'https://webview.bootpay.co.kr/4.
|
|
419
|
+
uri: 'https://webview.bootpay.co.kr/4.3.3'
|
|
419
420
|
}} injectedJavaScript={this.state.script} javaScriptEnabled={true} javaScriptCanOpenWindowsAutomatically={true}
|
|
420
421
|
// scalesPageToFit={true}
|
|
421
422
|
onMessage={this.onMessage}/>
|
package/lib/BootpayTypes.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BootpayTypes.d.ts","sourceRoot":"","sources":["../src/BootpayTypes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACV,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACrC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAChD,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB;AAKD,qBAAa,IAAI;;IAGb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,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AM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;CACjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare module 'react-native' {
|
|
2
|
+
interface NativeModulesStatic {
|
|
3
|
+
Aes: {
|
|
4
|
+
encrypt: (data: string, key: string, iv: string) => Promise<string>;
|
|
5
|
+
hmac256: (data: string, key: string) => Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare const userTrace: (applicationId: string, userId: string, phone: string, email: string, gender: string, birth: string, area: string) => Promise<any>;
|
|
10
|
+
declare const pageTrace: (applicationId: string, url: string, pageType: string, items: any) => Promise<any>;
|
|
11
|
+
export { userTrace, pageTrace };
|
|
12
|
+
//# sourceMappingURL=bootpayAnalytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootpayAnalytics.d.ts","sourceRoot":"","sources":["../src/bootpayAnalytics.ts"],"names":[],"mappings":"AAKA,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,mBAAmB;QAC3B,GAAG,EAAE;YACH,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;YACpE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;SACzD,CAAC;KACH;CACF;AA+BD,QAAA,MAAM,SAAS,kBAAyB,MAAM,UAAU,MAAM,SAAS,MAAM,SAAS,MAAM,UAAU,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAG,QAAQ,GAAG,CAwCtJ,CAAC;AAGF,QAAA,MAAM,SAAS,kBAAyB,MAAM,OAAO,MAAM,YAAY,MAAM,SAAS,GAAG,KAAG,QAAQ,GAAG,CAqCtG,CAAC;AAYF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import base64 from 'react-native-base64';
|
|
38
|
+
import DeviceInfo from 'react-native-device-info';
|
|
39
|
+
import { NativeModules } from 'react-native';
|
|
40
|
+
// getRandomKey 함수의 반환 타입을 명시
|
|
41
|
+
var getRandomKey = function (length) {
|
|
42
|
+
var text = '';
|
|
43
|
+
var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
44
|
+
for (var i = 0; i < length; i++)
|
|
45
|
+
text += keys.charAt(Math.floor(Math.random() * keys.length));
|
|
46
|
+
return text;
|
|
47
|
+
};
|
|
48
|
+
// getSessionKey 함수의 반환 타입을 명시
|
|
49
|
+
var getSessionKey = function (key, iv) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var keyValue, ivValue;
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
keyValue = base64.encode(key);
|
|
53
|
+
ivValue = base64.encode(iv);
|
|
54
|
+
return [2 /*return*/, "".concat(keyValue, "##").concat(ivValue)];
|
|
55
|
+
});
|
|
56
|
+
}); };
|
|
57
|
+
// stringToHex 함수의 반환 타입을 명시
|
|
58
|
+
var stringToHex = function (str) {
|
|
59
|
+
var hex = '';
|
|
60
|
+
for (var i = 0, l = str.length; i < l; i++) {
|
|
61
|
+
hex += str.charCodeAt(i).toString(16);
|
|
62
|
+
}
|
|
63
|
+
return hex;
|
|
64
|
+
};
|
|
65
|
+
// userTrace 함수의 반환 타입을 명시
|
|
66
|
+
var userTrace = function (applicationId, userId, phone, email, gender, birth, area) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var payload, key, iv, data, response, _a, _b, _c, _d, json, e_1, error_1;
|
|
68
|
+
var _e, _f;
|
|
69
|
+
return __generator(this, function (_g) {
|
|
70
|
+
switch (_g.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
_g.trys.push([0, 8, , 9]);
|
|
73
|
+
payload = {
|
|
74
|
+
"id": userId,
|
|
75
|
+
"ver": DeviceInfo.getVersion(),
|
|
76
|
+
"application_id": applicationId,
|
|
77
|
+
"phone": phone,
|
|
78
|
+
"email": email,
|
|
79
|
+
"gender": gender,
|
|
80
|
+
"birth": birth,
|
|
81
|
+
"area": area
|
|
82
|
+
};
|
|
83
|
+
key = getRandomKey(32);
|
|
84
|
+
iv = getRandomKey(16);
|
|
85
|
+
_g.label = 1;
|
|
86
|
+
case 1:
|
|
87
|
+
_g.trys.push([1, 6, , 7]);
|
|
88
|
+
return [4 /*yield*/, NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv))];
|
|
89
|
+
case 2:
|
|
90
|
+
data = _g.sent();
|
|
91
|
+
_a = fetch;
|
|
92
|
+
_b = ['https://analytics.bootpay.co.kr/login'];
|
|
93
|
+
_e = {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
headers: {
|
|
96
|
+
Accept: 'application/json',
|
|
97
|
+
'Content-Type': 'application/json'
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
_d = (_c = JSON).stringify;
|
|
101
|
+
_f = {
|
|
102
|
+
data: data
|
|
103
|
+
};
|
|
104
|
+
return [4 /*yield*/, getSessionKey(key, iv)];
|
|
105
|
+
case 3: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_e.body = _d.apply(_c, [(_f.session_key = _g.sent(),
|
|
106
|
+
_f)]),
|
|
107
|
+
_e)]))];
|
|
108
|
+
case 4:
|
|
109
|
+
response = _g.sent();
|
|
110
|
+
return [4 /*yield*/, response.json()];
|
|
111
|
+
case 5:
|
|
112
|
+
json = _g.sent();
|
|
113
|
+
return [2 /*return*/, json];
|
|
114
|
+
case 6:
|
|
115
|
+
e_1 = _g.sent();
|
|
116
|
+
console.log(e_1);
|
|
117
|
+
return [3 /*break*/, 7];
|
|
118
|
+
case 7: return [3 /*break*/, 9];
|
|
119
|
+
case 8:
|
|
120
|
+
error_1 = _g.sent();
|
|
121
|
+
console.error(error_1);
|
|
122
|
+
return [3 /*break*/, 9];
|
|
123
|
+
case 9: return [2 /*return*/];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}); };
|
|
127
|
+
// pageTrace 함수의 반환 타입을 명시
|
|
128
|
+
var pageTrace = function (applicationId, url, pageType, items) { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
+
var payload, key, iv, data, response, _a, _b, _c, _d, json, e_2, error_2;
|
|
130
|
+
var _e, _f;
|
|
131
|
+
return __generator(this, function (_g) {
|
|
132
|
+
switch (_g.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
_g.trys.push([0, 8, , 9]);
|
|
135
|
+
payload = {
|
|
136
|
+
"application_id": applicationId,
|
|
137
|
+
"url": url,
|
|
138
|
+
"page_type": pageType,
|
|
139
|
+
"items": items,
|
|
140
|
+
"referer": ''
|
|
141
|
+
};
|
|
142
|
+
key = getRandomKey(32);
|
|
143
|
+
iv = getRandomKey(16);
|
|
144
|
+
_g.label = 1;
|
|
145
|
+
case 1:
|
|
146
|
+
_g.trys.push([1, 6, , 7]);
|
|
147
|
+
return [4 /*yield*/, NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv))];
|
|
148
|
+
case 2:
|
|
149
|
+
data = _g.sent();
|
|
150
|
+
_a = fetch;
|
|
151
|
+
_b = ['https://analytics.bootpay.co.kr/call'];
|
|
152
|
+
_e = {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
headers: {
|
|
155
|
+
Accept: 'application/json',
|
|
156
|
+
'Content-Type': 'application/json'
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
_d = (_c = JSON).stringify;
|
|
160
|
+
_f = {
|
|
161
|
+
data: data
|
|
162
|
+
};
|
|
163
|
+
return [4 /*yield*/, getSessionKey(key, iv)];
|
|
164
|
+
case 3: return [4 /*yield*/, _a.apply(void 0, _b.concat([(_e.body = _d.apply(_c, [(_f.session_key = _g.sent(),
|
|
165
|
+
_f)]),
|
|
166
|
+
_e)]))];
|
|
167
|
+
case 4:
|
|
168
|
+
response = _g.sent();
|
|
169
|
+
return [4 /*yield*/, response.json()];
|
|
170
|
+
case 5:
|
|
171
|
+
json = _g.sent();
|
|
172
|
+
return [2 /*return*/, json];
|
|
173
|
+
case 6:
|
|
174
|
+
e_2 = _g.sent();
|
|
175
|
+
console.log(e_2);
|
|
176
|
+
return [3 /*break*/, 7];
|
|
177
|
+
case 7: return [3 /*break*/, 9];
|
|
178
|
+
case 8:
|
|
179
|
+
error_2 = _g.sent();
|
|
180
|
+
console.error(error_2);
|
|
181
|
+
return [3 /*break*/, 9];
|
|
182
|
+
case 9: return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}); };
|
|
186
|
+
// strEncode 함수의 반환 타입을 명시
|
|
187
|
+
// const strEncode = async (str: string, key: string, iv: string): Promise<string> => {
|
|
188
|
+
// return await NativeModules.Aes.encrypt(str, key, iv).then(cipher => {
|
|
189
|
+
// return NativeModules.Aes.hmac256(cipher, key).then(hash => {
|
|
190
|
+
// console.log('HMAC', hash);
|
|
191
|
+
// return hash;
|
|
192
|
+
// });
|
|
193
|
+
// });
|
|
194
|
+
// };
|
|
195
|
+
export { userTrace, pageTrace };
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAK3D,OAAO,EAAG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-bootpay-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.25",
|
|
4
4
|
"description": "React Native를 위한 bootpay 라이브러리 입니다.",
|
|
5
|
-
"main": "index.
|
|
6
|
-
"main-internal": "src/index.ts",
|
|
7
|
-
"typings": "src/index.d.ts",
|
|
5
|
+
"main": "index.tsx",
|
|
8
6
|
"author": "bootpay <bootpay.co.kr@gmail.com>",
|
|
9
7
|
"license": "MIT",
|
|
10
8
|
"homepage": "https://www.bootpay.co.kr",
|
|
@@ -13,8 +11,10 @@
|
|
|
13
11
|
],
|
|
14
12
|
"scripts": {
|
|
15
13
|
"android": "react-native run-android",
|
|
16
|
-
"ios": "react-native run-ios
|
|
17
|
-
"
|
|
14
|
+
"ios": "react-native run-ios",
|
|
15
|
+
"build:ios": "react-native bundle --entry-file='./index.js' --bundle-output='./example/ios/main.jsbundle' --dev=false --platform='ios'",
|
|
16
|
+
|
|
17
|
+
"macos": "react-native run-macos --scheme WebviewExample --project-path example/macos",
|
|
18
18
|
"start": "cd example && react-native start",
|
|
19
19
|
"windows": "install-windows-test-app --project-directory example/windows && react-native run-windows --root example --arch x64",
|
|
20
20
|
"ci": "CI=true && yarn lint",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"build": "yarn tsc",
|
|
24
24
|
"prepare": "yarn build",
|
|
25
25
|
"appium": "appium",
|
|
26
|
-
"test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.js"
|
|
26
|
+
"test:windows": "yarn jest --setupFiles=./jest-setups/jest.setup.js",
|
|
27
|
+
"add:macos": "yarn add react-native-macos@0.71.33"
|
|
27
28
|
},
|
|
28
29
|
"rn-docs": {
|
|
29
30
|
"title": "bootpay",
|
|
@@ -31,21 +32,20 @@
|
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"react": "*",
|
|
34
|
-
"react-native": "*"
|
|
35
|
-
"react-native-webview-bootpay": "11.x"
|
|
35
|
+
"react-native": "*"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"escape-string-regexp": "2.0.0",
|
|
39
|
-
"invariant": "2.2.4"
|
|
39
|
+
"invariant": "2.2.4",
|
|
40
|
+
"react-native-webview-bootpay": "13.6.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@babel/core": "^7.0.0",
|
|
43
44
|
"@babel/runtime": "^7.0.0",
|
|
44
45
|
"@semantic-release/git": "7.0.16",
|
|
45
46
|
"@types/invariant": "^2.2.30",
|
|
46
|
-
"@types/jest": "^
|
|
47
|
-
"@types/react": "
|
|
48
|
-
"@types/react-native": "^0.67.3",
|
|
47
|
+
"@types/jest": "^29.4.0",
|
|
48
|
+
"@types/react": "18.0.27",
|
|
49
49
|
"@types/selenium-webdriver": "4.0.9",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "2.1.0",
|
|
51
51
|
"@typescript-eslint/parser": "2.1.0",
|
|
@@ -58,26 +58,29 @@
|
|
|
58
58
|
"eslint-plugin-react": "7.14.3",
|
|
59
59
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
60
60
|
"eslint-plugin-react-native": "3.7.0",
|
|
61
|
-
"jest": "^
|
|
62
|
-
"metro-react-native-babel-preset": "
|
|
63
|
-
"react": "
|
|
64
|
-
"react-
|
|
65
|
-
"react-native": "0.
|
|
66
|
-
"react-native-
|
|
67
|
-
"react-native-
|
|
68
|
-
"react-native-windows": "0.68.4",
|
|
61
|
+
"jest": "^29.4.1",
|
|
62
|
+
"metro-react-native-babel-preset": "0.73.7",
|
|
63
|
+
"react": "18.2.0",
|
|
64
|
+
"react-native": "0.71.12",
|
|
65
|
+
"react-native-macos": "0.71.33",
|
|
66
|
+
"react-native-test-app": "2.5.15",
|
|
67
|
+
"react-native-windows": "0.71.30",
|
|
69
68
|
"selenium-appium": "1.0.2",
|
|
70
69
|
"selenium-webdriver": "4.0.0-alpha.7",
|
|
71
70
|
"semantic-release": "15.13.24",
|
|
72
71
|
"typescript": "^4.0.0",
|
|
73
|
-
"winappdriver": "^0.0.7",
|
|
74
|
-
"react-native-webview-bootpay": "11.26.20",
|
|
72
|
+
"winappdriver": "^0.0.7",
|
|
75
73
|
"react-native-device-info": "^8.7.0",
|
|
76
74
|
"react-native-sensitive-info": "^5.5.8",
|
|
77
|
-
"react-native-base64": "^0.2.
|
|
75
|
+
"@types/react-native-base64": "^0.2.2",
|
|
78
76
|
"react-native-aes-crypto": "^2.1.0",
|
|
79
77
|
"@types/lodash": "^4.14.182"
|
|
80
78
|
},
|
|
79
|
+
"resolutions": {
|
|
80
|
+
"@react-native-community/cli": "10.2.4",
|
|
81
|
+
"@react-native-community/cli-platform-android": "10.2.0",
|
|
82
|
+
"@react-native-community/cli-platform-ios": "10.2.4"
|
|
83
|
+
},
|
|
81
84
|
"repository": {
|
|
82
85
|
"type": "git",
|
|
83
86
|
"url": "https://github.com/bootpay/react-native-bootpay-api.git"
|
|
@@ -90,7 +93,9 @@
|
|
|
90
93
|
"windows",
|
|
91
94
|
"lib",
|
|
92
95
|
"images",
|
|
93
|
-
"src
|
|
96
|
+
"src",
|
|
97
|
+
"index.js",
|
|
98
|
+
"index.d.ts",
|
|
94
99
|
"react-native-bootpay-api.podspec",
|
|
95
100
|
"react-native.config.js"
|
|
96
101
|
]
|
package/react-native.config.js
CHANGED
|
@@ -4,7 +4,7 @@ const project = (() => {
|
|
|
4
4
|
try {
|
|
5
5
|
const {
|
|
6
6
|
androidManifestPath,
|
|
7
|
-
iosProjectPath,
|
|
7
|
+
// iosProjectPath,
|
|
8
8
|
windowsProjectPath,
|
|
9
9
|
} = require('react-native-test-app');
|
|
10
10
|
return {
|
|
@@ -15,8 +15,11 @@ const project = (() => {
|
|
|
15
15
|
),
|
|
16
16
|
},
|
|
17
17
|
ios: {
|
|
18
|
-
|
|
19
|
-
},
|
|
18
|
+
sourceDir: 'example/ios',
|
|
19
|
+
},
|
|
20
|
+
// ios: {
|
|
21
|
+
// project: iosProjectPath('example/ios'),
|
|
22
|
+
// },
|
|
20
23
|
};
|
|
21
24
|
} catch (_) {
|
|
22
25
|
return undefined;
|
package/src/Bootpay.tsx
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import React, { Component } from 'react';
|
|
4
|
+
import { SafeAreaView, Modal, TouchableOpacity, Image, StyleSheet, Platform } from 'react-native';
|
|
5
|
+
// import { StyleSheet, Platform } from 'react-native';
|
|
6
|
+
// import { Platform, StyleSheet, Dimensions } from 'react-native';
|
|
7
|
+
import WebView, {WebViewMessageEvent} from 'react-native-webview-bootpay';
|
|
8
|
+
import { BootpayTypesProps, Payload, Extra, Item, User } from './BootpayTypes';
|
|
9
|
+
import {debounce} from 'lodash';
|
|
10
|
+
import UserInfo from './UserInfo'
|
|
11
|
+
// import Loader from './Loader'
|
|
12
|
+
// import ClipLoader from "react-spinners/ClipLoader";
|
|
13
|
+
// import Spinner from 'react-native-loading-spinner-overlay';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export class Bootpay extends Component<BootpayTypesProps> {
|
|
17
|
+
// webView = useRef<WebView>(null);
|
|
18
|
+
|
|
19
|
+
webView: React.RefObject<WebView>;
|
|
20
|
+
|
|
21
|
+
constructor(props: BootpayTypesProps) {
|
|
22
|
+
super(props);
|
|
23
|
+
|
|
24
|
+
this.webView = React.createRef();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
payload?: Payload
|
|
28
|
+
|
|
29
|
+
state = {
|
|
30
|
+
visibility: false,
|
|
31
|
+
script: '',
|
|
32
|
+
firstLoad: false,
|
|
33
|
+
showCloseButton: false,
|
|
34
|
+
isShowProgress: false
|
|
35
|
+
}
|
|
36
|
+
// _payload = {}
|
|
37
|
+
_VERSION = "4.3.1"
|
|
38
|
+
_DEBUG = false;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
dismiss = () => {
|
|
42
|
+
this.setState(
|
|
43
|
+
{
|
|
44
|
+
visibility: false
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
showProgressBar = (isShow: boolean) => {
|
|
51
|
+
this.setState(
|
|
52
|
+
{
|
|
53
|
+
isShowProgress: isShow
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
closeDismiss = () => {
|
|
60
|
+
if(this.props.onClose != undefined) this.props.onClose();
|
|
61
|
+
this.dismiss();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
onMessage = async (event: WebViewMessageEvent) => {
|
|
66
|
+
|
|
67
|
+
if (event == undefined) return;
|
|
68
|
+
|
|
69
|
+
const res = JSON.parse(JSON.stringify(event.nativeEvent.data));
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if(res == 'close') {
|
|
73
|
+
this.showProgressBar(false);
|
|
74
|
+
this.closeDismiss();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const data = JSON.parse(res);
|
|
80
|
+
// console.log(`redirect: ${JSON.stringify(data)}`);
|
|
81
|
+
|
|
82
|
+
var redirect = false
|
|
83
|
+
let show_success = false
|
|
84
|
+
let show_error = false
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if(this.payload?.extra != undefined) {
|
|
88
|
+
if(this.payload.extra?.open_type == 'redirect') {
|
|
89
|
+
redirect = true;
|
|
90
|
+
}
|
|
91
|
+
if(this.payload.extra?.display_error_result == true) {
|
|
92
|
+
show_error = true;
|
|
93
|
+
}
|
|
94
|
+
if(this.payload.extra?.display_success_result == true) {
|
|
95
|
+
show_success = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if(redirect === true) {
|
|
101
|
+
switch (data.event) {
|
|
102
|
+
case 'cancel':
|
|
103
|
+
this.showProgressBar(false);
|
|
104
|
+
if(this.props.onCancel != undefined) this.props.onCancel(data);
|
|
105
|
+
this.closeDismiss();
|
|
106
|
+
break;
|
|
107
|
+
case 'error':
|
|
108
|
+
this.showProgressBar(false);
|
|
109
|
+
if(this.props.onError != undefined) this.props.onError(data);
|
|
110
|
+
if(show_error == false) {
|
|
111
|
+
this.closeDismiss();
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case 'issued':
|
|
115
|
+
this.showProgressBar(false);
|
|
116
|
+
if(this.props.onIssued != undefined) this.props.onIssued(data);
|
|
117
|
+
if(show_success == false) {
|
|
118
|
+
this.closeDismiss();
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case 'confirm':
|
|
122
|
+
this.showProgressBar(true);
|
|
123
|
+
// if(this.props.onConfirm != undefined) this.props.onConfirm(data);
|
|
124
|
+
if(this.props.onConfirm != undefined) {
|
|
125
|
+
if(this.props.onConfirm(data)) {
|
|
126
|
+
this.transactionConfirm();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case 'done':
|
|
131
|
+
this.showProgressBar(false);
|
|
132
|
+
if(this.props.onDone != undefined) this.props.onDone(data);
|
|
133
|
+
if(show_success == false) {
|
|
134
|
+
this.closeDismiss();
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case 'close':
|
|
138
|
+
this.showProgressBar(false);
|
|
139
|
+
this.closeDismiss();
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
switch (data.event) {
|
|
144
|
+
case 'cancel':
|
|
145
|
+
this.showProgressBar(false);
|
|
146
|
+
if(this.props.onCancel != undefined) this.props.onCancel(data);
|
|
147
|
+
break;
|
|
148
|
+
case 'error':
|
|
149
|
+
this.showProgressBar(false);
|
|
150
|
+
if(this.props.onError != undefined) this.props.onError(data);
|
|
151
|
+
break;
|
|
152
|
+
case 'issued':
|
|
153
|
+
this.showProgressBar(false);
|
|
154
|
+
if(this.props.onIssued != undefined) this.props.onIssued(data);
|
|
155
|
+
break;
|
|
156
|
+
case 'confirm':
|
|
157
|
+
this.showProgressBar(true);
|
|
158
|
+
if(this.props.onConfirm != undefined) {
|
|
159
|
+
if(this.props.onConfirm(data)) {
|
|
160
|
+
this.transactionConfirm();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
break;
|
|
164
|
+
case 'done':
|
|
165
|
+
this.showProgressBar(false);
|
|
166
|
+
if(this.props.onDone != undefined) this.props.onDone(data);
|
|
167
|
+
break;
|
|
168
|
+
case 'close':
|
|
169
|
+
this.showProgressBar(false);
|
|
170
|
+
this.closeDismiss();
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
onShouldStartLoadWithRequest = (_ : string) => {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
getSDKVersion = () => {
|
|
181
|
+
if(Platform.OS == 'ios') {
|
|
182
|
+
return "Bootpay.setVersion('" + this._VERSION + "', 'ios_react_native')"
|
|
183
|
+
// return "Bootpay.setDevice('IOS');";
|
|
184
|
+
} else if(Platform.OS == 'android'){
|
|
185
|
+
return "Bootpay.setVersion('" + this._VERSION + "', 'android_react_native')"
|
|
186
|
+
// return "Bootpay.setDevice('ANDROID');";
|
|
187
|
+
} else {
|
|
188
|
+
return ""
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
getEnvironmentMode = () => {
|
|
193
|
+
if(this._DEBUG) {
|
|
194
|
+
return "Bootpay.setEnvironmentMode('development');";
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
return "";
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
getBootpayPlatform = () => {
|
|
201
|
+
if(Platform.OS == 'ios') {
|
|
202
|
+
return "Bootpay.setDevice('IOS');";
|
|
203
|
+
} else if(Platform.OS == 'android'){
|
|
204
|
+
return "Bootpay.setDevice('ANDROID');";
|
|
205
|
+
} else {
|
|
206
|
+
return ""
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// setPayScript = () => {
|
|
211
|
+
// const fullScript = this.generateScript(this.state.script);
|
|
212
|
+
// this.injectJavaScript(fullScript);
|
|
213
|
+
// if(this.state.showCloseButton == true) {
|
|
214
|
+
// if(this.webView == null || this.webView == undefined) return;
|
|
215
|
+
// this.webView.showCloseButton( );
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
|
|
219
|
+
transactionConfirm = () => {
|
|
220
|
+
const script = "Bootpay.confirm()"
|
|
221
|
+
+
|
|
222
|
+
".then( function (res) {" +
|
|
223
|
+
this.confirm() +
|
|
224
|
+
this.issued() +
|
|
225
|
+
this.done() +
|
|
226
|
+
"}, function (res) {" +
|
|
227
|
+
this.error() +
|
|
228
|
+
this.cancel() +
|
|
229
|
+
"})";
|
|
230
|
+
|
|
231
|
+
this.callJavaScript(script);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
removePaymentWindow = () => {
|
|
235
|
+
this.dismiss();
|
|
236
|
+
// this.callJavaScript(`
|
|
237
|
+
// Bootpay.removePaymentWindow();
|
|
238
|
+
// `);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
callJavaScript = (script: string) => {
|
|
242
|
+
if(this.webView == null || this.webView == undefined) return
|
|
243
|
+
|
|
244
|
+
this.webView.current?.injectJavaScript(`
|
|
245
|
+
setTimeout(function() { ${script} }, 30);
|
|
246
|
+
`)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getAnalyticsData = async () => {
|
|
250
|
+
const uuid = await UserInfo.getBootpayUUID();
|
|
251
|
+
// const bootpaySK = await UserInfo.getBootpaySK();
|
|
252
|
+
const bootLastTime = await UserInfo.getBootpayLastTime();
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
const elaspedTime = Date.now() - bootLastTime;
|
|
256
|
+
return `window.Bootpay.$analytics.setAnalyticsData({uuid:'${uuid}', time:${elaspedTime}});`;
|
|
257
|
+
// this.callJavaScript(`window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
confirm = () => {
|
|
261
|
+
return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
done = () => {
|
|
265
|
+
return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
issued = () => {
|
|
269
|
+
return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
error = () => {
|
|
273
|
+
return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
cancel = () => {
|
|
277
|
+
return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
close = () => {
|
|
281
|
+
return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
async componentWillUnmount() {
|
|
287
|
+
this.setState(
|
|
288
|
+
{
|
|
289
|
+
visibility: false,
|
|
290
|
+
firstLoad: false,
|
|
291
|
+
showCloseButton: false
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
UserInfo.setBootpayLastTime(Date.now());
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
componentDidMount() {
|
|
299
|
+
this.closeDismiss = debounce(this.closeDismiss, 30);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
render() {
|
|
303
|
+
return (
|
|
304
|
+
<Modal
|
|
305
|
+
animationType={'slide'}
|
|
306
|
+
transparent={false}
|
|
307
|
+
onRequestClose={()=> {
|
|
308
|
+
this.closeDismiss();
|
|
309
|
+
// console.log(1234);
|
|
310
|
+
// this.dismiss();
|
|
311
|
+
}}
|
|
312
|
+
|
|
313
|
+
visible={this.state.visibility}>
|
|
314
|
+
<SafeAreaView style={{ flex: 1 }}>
|
|
315
|
+
{
|
|
316
|
+
this.state.showCloseButton &&
|
|
317
|
+
<TouchableOpacity
|
|
318
|
+
onPress={() => {
|
|
319
|
+
var cancelData = {
|
|
320
|
+
action: 'BootpayCancel',
|
|
321
|
+
message: '사용자에 의해 취소되었습니다'
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if(this.props.onCancel != undefined) this.props.onCancel(cancelData);
|
|
325
|
+
if(this.props.onClose != undefined) this.props.onClose();
|
|
326
|
+
|
|
327
|
+
this.setState({visibility: false})
|
|
328
|
+
|
|
329
|
+
// this.showProgressBar(true);
|
|
330
|
+
|
|
331
|
+
} }>
|
|
332
|
+
<Image
|
|
333
|
+
style={[styles.overlay]}
|
|
334
|
+
source={require('../images/close.png')} />
|
|
335
|
+
</TouchableOpacity>
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
<WebView
|
|
339
|
+
ref={this.webView}
|
|
340
|
+
originWhitelist={['*']}
|
|
341
|
+
source={{
|
|
342
|
+
uri: 'https://webview.bootpay.co.kr/4.3.3'
|
|
343
|
+
}}
|
|
344
|
+
injectedJavaScript={this.state.script}
|
|
345
|
+
javaScriptEnabled={true}
|
|
346
|
+
javaScriptCanOpenWindowsAutomatically={true}
|
|
347
|
+
// scalesPageToFit={true}
|
|
348
|
+
onMessage={this.onMessage}
|
|
349
|
+
/>
|
|
350
|
+
</SafeAreaView>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
</Modal>
|
|
354
|
+
)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
requestPayment = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
|
|
360
|
+
|
|
361
|
+
this.bootpayRequest(payload, items, user, extra, "requestPayment");
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
requestSubscription = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
|
|
365
|
+
this.bootpayRequest(payload, items, user, extra, "requestSubscription");
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
requestAuthentication = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
|
|
369
|
+
this.bootpayRequest(payload, items, user, extra, "requestAuthentication");
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
bootpayRequest = async (payload: Payload, items: [Item], user: User, extra: Extra, requestMethod: string) => {
|
|
373
|
+
|
|
374
|
+
payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
|
|
375
|
+
payload.items = items;
|
|
376
|
+
payload.user = user;
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
payload.user = Object.assign(new User(), user); //set default value from class optional parameter value
|
|
380
|
+
payload.extra = Object.assign(new Extra(), extra); //set default value from class optional parameter value
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
this.payload = payload
|
|
384
|
+
|
|
385
|
+
this.setState(
|
|
386
|
+
{
|
|
387
|
+
visibility: true,
|
|
388
|
+
script: `
|
|
389
|
+
${await this.getMountJavascript()}
|
|
390
|
+
${this.generateScript(payload, requestMethod)}
|
|
391
|
+
`,
|
|
392
|
+
firstLoad: false,
|
|
393
|
+
showCloseButton: extra.show_close_button || false,
|
|
394
|
+
spinner: false
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
UserInfo.updateInfo();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
getMountJavascript = async () => {
|
|
404
|
+
return `
|
|
405
|
+
${this.getSDKVersion()}
|
|
406
|
+
${this.getEnvironmentMode()}
|
|
407
|
+
${this.getBootpayPlatform()}
|
|
408
|
+
${this.close()}
|
|
409
|
+
${await this.getAnalyticsData()}
|
|
410
|
+
`;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
generateScript= (payload: Payload, requestMethod: string) => {
|
|
415
|
+
const script = "Bootpay." + requestMethod +
|
|
416
|
+
`(${JSON.stringify(payload)})` +
|
|
417
|
+
".then( function (res) {" +
|
|
418
|
+
this.confirm() +
|
|
419
|
+
this.issued() +
|
|
420
|
+
this.done() +
|
|
421
|
+
"}, function (res) {" +
|
|
422
|
+
this.error() +
|
|
423
|
+
this.cancel() +
|
|
424
|
+
"}); void(0);";
|
|
425
|
+
|
|
426
|
+
return script;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
var styles = StyleSheet.create({
|
|
433
|
+
container: {
|
|
434
|
+
flex: 1,
|
|
435
|
+
justifyContent: 'center',
|
|
436
|
+
alignItems: 'center',
|
|
437
|
+
backgroundColor: '#F5FCFF',
|
|
438
|
+
},
|
|
439
|
+
welcome: {
|
|
440
|
+
fontSize: 20,
|
|
441
|
+
textAlign: 'center',
|
|
442
|
+
margin: 10,
|
|
443
|
+
},
|
|
444
|
+
// Flex to fill, position absolute,
|
|
445
|
+
// Fixed left/top, and the width set to the window width
|
|
446
|
+
overlay: {
|
|
447
|
+
width: 25,
|
|
448
|
+
height: 25,
|
|
449
|
+
right: 5,
|
|
450
|
+
alignSelf: 'flex-end'
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
ViewProps,
|
|
4
|
+
} from 'react-native'
|
|
5
|
+
|
|
6
|
+
export interface BootpayTypesProps extends ViewProps {
|
|
7
|
+
ref?: any
|
|
8
|
+
ios_application_id?: string
|
|
9
|
+
android_application_id?: string
|
|
10
|
+
onCancel?: (data: Object) => void
|
|
11
|
+
onError?: (data: Object) => void
|
|
12
|
+
onIssued?: (data: Object) => void
|
|
13
|
+
onConfirm?: (data: Object) => boolean
|
|
14
|
+
onDone?: (data: Object) => void
|
|
15
|
+
onClose?: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LoadingTypesProps extends ViewProps {
|
|
19
|
+
loading?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export class User {
|
|
26
|
+
constructor() {}
|
|
27
|
+
|
|
28
|
+
id?: string
|
|
29
|
+
username?: string
|
|
30
|
+
email?: string
|
|
31
|
+
gender?: number
|
|
32
|
+
birth?: string
|
|
33
|
+
phone?: string
|
|
34
|
+
area?: string
|
|
35
|
+
addr?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class Item {
|
|
39
|
+
constructor() {}
|
|
40
|
+
|
|
41
|
+
name?: string
|
|
42
|
+
qty?: number
|
|
43
|
+
id?: string
|
|
44
|
+
price?: number
|
|
45
|
+
cat1?: string
|
|
46
|
+
cat2?: string
|
|
47
|
+
cat3?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class StatItem {
|
|
51
|
+
constructor() {}
|
|
52
|
+
|
|
53
|
+
item_name?: string
|
|
54
|
+
item_img?: string
|
|
55
|
+
unique?: string
|
|
56
|
+
price?: number
|
|
57
|
+
cat1?: string
|
|
58
|
+
cat2?: string
|
|
59
|
+
cat3?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class Onestore {
|
|
63
|
+
constructor() {}
|
|
64
|
+
|
|
65
|
+
ad_id?: string = "UNKNOWN_ADID"
|
|
66
|
+
sim_operator?: string = "UNKNOWN_SIM_OPERATOR"
|
|
67
|
+
installer_package_name?: string = "UNKNOWN_INSTALLER"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// export interface Extra {
|
|
73
|
+
// card_quota?: string;
|
|
74
|
+
// seller_name?: string;
|
|
75
|
+
// delivery_day?: number;
|
|
76
|
+
|
|
77
|
+
// }
|
|
78
|
+
|
|
79
|
+
export class Extra {
|
|
80
|
+
constructor() {}
|
|
81
|
+
|
|
82
|
+
card_quota?: string // 할부허용 범위 (5만원 이상 구매시)
|
|
83
|
+
seller_name?: string //노출되는 판매자명 설정
|
|
84
|
+
delivery_day?: number = 1 // 배송일자
|
|
85
|
+
locale?: string = 'ko' //결제창 언어지원
|
|
86
|
+
offer_period?: string //결제창 제공기간에 해당하는 string 값, 지원하는 PG만 적용됨
|
|
87
|
+
display_cash_receipt?: boolean = true // 현금영수증 보일지 말지.. 가상계좌 KCP 옵션
|
|
88
|
+
deposit_expiration?: string //가상계좌 입금 만료일자 설정
|
|
89
|
+
app_scheme?: string // 모바일 앱에서 결제 완료 후 돌아오는 옵션 ( 아이폰만 적용 )
|
|
90
|
+
use_card_point?: boolean = true //카드 포인트 사용 여부 (토스만 가능)
|
|
91
|
+
direct_card?: string //해당 카드로 바로 결제창 (토스만 가능)
|
|
92
|
+
use_order_id?: boolean = false //가맹점 order_id로 PG로 전송
|
|
93
|
+
international_card_only?: boolean = false // 해외 결제카드 선택 여부 (토스만 가능)
|
|
94
|
+
phone_carrier?: string = "" //본인인증 시 고정할 통신사명, SKT,KT,LGT 중 1개만 가능
|
|
95
|
+
direct_app_card?: boolean = false // 카드사앱으로 direct 호출
|
|
96
|
+
direct_samsungpay?: boolean = false // 삼성페이 바로 띄우기
|
|
97
|
+
test_deposit?: boolean = false // 가상계좌 모의 입금
|
|
98
|
+
enable_error_webhook?: boolean = false //결제 오류시 Feedback URL로 webhook
|
|
99
|
+
separately_confirmed?: boolean = true // confirm 이벤트를 호출할지 말지, false일 경우 자동승인
|
|
100
|
+
confirmOnlyRestApi?: boolean = false // REST API로만 승인 처리
|
|
101
|
+
open_type?: string = 'redirect' // 페이지 오픈 type, [iframe, popup, redirect] 중 택 1
|
|
102
|
+
use_bootpay_inapp_sdk?: boolean = true // native app에서는 redirect를 완성도있게 지원하기 위한 옵션
|
|
103
|
+
redirect_url?: string = 'https://api.bootpay.co.kr/v2' //open_type이 redirect일 경우 페이지 이동할 URL ( 오류 및 결제 완료 모두 수신 가능 )
|
|
104
|
+
display_success_result?: boolean = false // 결제 완료되면 부트페이가 제공하는 완료창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
|
|
105
|
+
display_error_result?: boolean = true // 결제 실패되면 부트페이가 제공하는 실패창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
|
|
106
|
+
disposable_cup_deposit?: number = 0 // 배달대행 플랫폼을 위한 컵 보증급 가격
|
|
107
|
+
// ExtraCardEasyOption cardEasyOption = ExtraCardEasyOption();
|
|
108
|
+
// List<BrowserOpenType>? browserOpenType = [];
|
|
109
|
+
use_welcomepayment?: number = 0 //웰컴 재판모듈 진행시 1
|
|
110
|
+
first_subscription_comment?: string = '' // 자동결제 price > 0 조건일 때 첫 결제 관련 메세지
|
|
111
|
+
except_card_companies?: [string] // 제외할 카드사 리스트 ( enable_card_companies가 우선순위를 갖는다 )
|
|
112
|
+
enable_easy_payments?: [string] // 노출될 간편결제 리스트
|
|
113
|
+
confirm_grace_seconds?: number = 0 // 결제승인 유예시간 ( 승인 요청을 여러번하더라도 승인 이후 특정 시간동안 계속해서 결제 response_data 를 리턴한다 )
|
|
114
|
+
show_close_button: boolean = false // x 닫기 버튼을 보여줄지 말지
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export class Payload {
|
|
118
|
+
|
|
119
|
+
application_id?: string
|
|
120
|
+
android_application_id?: string
|
|
121
|
+
ios_application_id?: string
|
|
122
|
+
pg?: string
|
|
123
|
+
method?: string
|
|
124
|
+
methods?: [string]
|
|
125
|
+
order_name?: string
|
|
126
|
+
price?: number
|
|
127
|
+
tax_free?: number
|
|
128
|
+
order_id?: string
|
|
129
|
+
subscription_id?: string
|
|
130
|
+
authentication_id?: string
|
|
131
|
+
metadata?: Object
|
|
132
|
+
user_token?: string
|
|
133
|
+
extra?: Extra
|
|
134
|
+
user?: User
|
|
135
|
+
items?: [Item]
|
|
136
|
+
}
|
package/src/Loader.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// import React from 'react'
|
|
2
|
+
// import ClipLoader from "react-spinners/ClipLoader";
|
|
3
|
+
// import { LoadingTypesProps } from './BootpayTypes';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// const override: React.CSSProperties = {
|
|
7
|
+
// display: "block",
|
|
8
|
+
// margin: "0 auto",
|
|
9
|
+
// borderColor: "red",
|
|
10
|
+
// };
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// class Loader extends React.Component<LoadingTypesProps> {
|
|
14
|
+
// constructor(props: LoadingTypesProps) {
|
|
15
|
+
// super(props);
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// state = {
|
|
20
|
+
// loading: true,
|
|
21
|
+
// }
|
|
22
|
+
|
|
23
|
+
// render() {
|
|
24
|
+
// return (
|
|
25
|
+
// <div className="sweet-loading">
|
|
26
|
+
// <ClipLoader
|
|
27
|
+
// cssOverride={override}
|
|
28
|
+
// size={150}
|
|
29
|
+
// color={"#123abc"}
|
|
30
|
+
// loading={this.state.loading}
|
|
31
|
+
// speedMultiplier={1.5}
|
|
32
|
+
// />
|
|
33
|
+
// <span>
|
|
34
|
+
// ddd
|
|
35
|
+
// </span>
|
|
36
|
+
// </div>
|
|
37
|
+
// );
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// export default Loader;
|
package/src/UserInfo.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// import { Component } from 'react';
|
|
2
|
+
import DeviceInfo from 'react-native-device-info';
|
|
3
|
+
import SInfo from 'react-native-sensitive-info';
|
|
4
|
+
|
|
5
|
+
// export default class UserInfo extends Component {
|
|
6
|
+
export default class UserInfo {
|
|
7
|
+
static getBootpayInfo = (key: string, defaultVal: any) => {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
SInfo.getItem(key, {
|
|
10
|
+
sharedPreferencesName: 'bootpaySharedPrefs',
|
|
11
|
+
keychainService: 'bootpayKeychain'
|
|
12
|
+
}).then((res: any) => {
|
|
13
|
+
res == undefined ? resolve(defaultVal) : resolve(res);
|
|
14
|
+
resolve(res);
|
|
15
|
+
}).catch((error: any) => {
|
|
16
|
+
reject(error);
|
|
17
|
+
});
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static setBootpayInfo = (key: string, val: any) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
SInfo.setItem(String(key), String(val), {
|
|
24
|
+
sharedPreferencesName: 'bootpaySharedPrefs',
|
|
25
|
+
keychainService: 'bootpayKeychain'
|
|
26
|
+
}).then((res: any) => {
|
|
27
|
+
resolve(res);
|
|
28
|
+
}).catch((error: any) => {
|
|
29
|
+
reject(error);
|
|
30
|
+
});
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static getBootpayUUID = () => {
|
|
35
|
+
let uuid = DeviceInfo.getUniqueId();
|
|
36
|
+
return UserInfo.setBootpayInfo('uuid', uuid);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static getBootpaySK = () => {
|
|
40
|
+
return UserInfo.getBootpayInfo('bootpay_sk', '')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static setBootpaySK = (val: string) => {
|
|
44
|
+
return UserInfo.setBootpayInfo('bootpay_sk', val)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static newBootpaySK = (uuid: string, time: number) => {
|
|
48
|
+
return UserInfo.setBootpaySK(`${uuid}_${time}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static getBootpayLastTime = async () => {
|
|
52
|
+
return await UserInfo.getBootpayInfo('bootpay_last_time', 0) as number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static setBootpayLastTime(val: number){
|
|
56
|
+
return UserInfo.setBootpayInfo('bootpay_last_time', val);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static getBootpayUserId() {
|
|
60
|
+
return UserInfo.getBootpayInfo('bootpay_user_id', '');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static setBootpayUserId = (val: string) => {
|
|
64
|
+
return UserInfo.setBootpayInfo('bootpay_user_id', val);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static updateInfo = async () => {
|
|
68
|
+
const uuid = await UserInfo.getBootpayUUID() as string;
|
|
69
|
+
const bootpaySK = await UserInfo.getBootpaySK() as string;
|
|
70
|
+
const lastTime = await UserInfo.getBootpayLastTime();
|
|
71
|
+
|
|
72
|
+
let current = Date.now();
|
|
73
|
+
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["index.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
it.todo('write a test');
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import base64 from 'react-native-base64';
|
|
2
|
+
import DeviceInfo from 'react-native-device-info';
|
|
3
|
+
import { NativeModules } from 'react-native';
|
|
4
|
+
|
|
5
|
+
// TypeScript에서 NativeModules.Aes를 사용하려면 해당 모듈에 대한 타입을 선언해야 합니다.
|
|
6
|
+
declare module 'react-native' {
|
|
7
|
+
interface NativeModulesStatic {
|
|
8
|
+
Aes: {
|
|
9
|
+
encrypt: (data: string, key: string, iv: string) => Promise<string>;
|
|
10
|
+
hmac256: (data: string, key: string) => Promise<string>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// getRandomKey 함수의 반환 타입을 명시
|
|
16
|
+
const getRandomKey = (length: number): string => {
|
|
17
|
+
var text = '';
|
|
18
|
+
var keys = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
19
|
+
|
|
20
|
+
for (var i = 0; i < length; i++)
|
|
21
|
+
text += keys.charAt(Math.floor(Math.random() * keys.length));
|
|
22
|
+
|
|
23
|
+
return text;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// getSessionKey 함수의 반환 타입을 명시
|
|
27
|
+
const getSessionKey = async (key: string, iv: string): Promise<string> => {
|
|
28
|
+
const keyValue = base64.encode(key);
|
|
29
|
+
const ivValue = base64.encode(iv);
|
|
30
|
+
|
|
31
|
+
return `${keyValue}##${ivValue}`;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// stringToHex 함수의 반환 타입을 명시
|
|
35
|
+
const stringToHex = (str: string): string => {
|
|
36
|
+
var hex = '';
|
|
37
|
+
for (var i = 0, l = str.length; i < l; i++) {
|
|
38
|
+
hex += str.charCodeAt(i).toString(16);
|
|
39
|
+
}
|
|
40
|
+
return hex;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// userTrace 함수의 반환 타입을 명시
|
|
44
|
+
const userTrace = async (applicationId: string, userId: string, phone: string, email: string, gender: string, birth: string, area: string): Promise<any> => {
|
|
45
|
+
try {
|
|
46
|
+
const payload = {
|
|
47
|
+
"id": userId,
|
|
48
|
+
"ver": DeviceInfo.getVersion(),
|
|
49
|
+
"application_id": applicationId,
|
|
50
|
+
"phone": phone,
|
|
51
|
+
"email": email,
|
|
52
|
+
"gender": gender,
|
|
53
|
+
"birth": birth,
|
|
54
|
+
"area": area,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var key = getRandomKey(32);
|
|
58
|
+
var iv = getRandomKey(16);
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const data = await NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv));
|
|
62
|
+
const response = await fetch(
|
|
63
|
+
'https://analytics.bootpay.co.kr/login',
|
|
64
|
+
{
|
|
65
|
+
method: 'POST',
|
|
66
|
+
headers: {
|
|
67
|
+
Accept: 'application/json',
|
|
68
|
+
'Content-Type': 'application/json'
|
|
69
|
+
},
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
data: data,
|
|
72
|
+
session_key: await getSessionKey(key, iv)
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
const json = await response.json();
|
|
77
|
+
return json;
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.log(e);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(error);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// pageTrace 함수의 반환 타입을 명시
|
|
87
|
+
const pageTrace = async (applicationId: string, url: string, pageType: string, items: any): Promise<any> => {
|
|
88
|
+
try {
|
|
89
|
+
const payload = {
|
|
90
|
+
"application_id": applicationId,
|
|
91
|
+
"url": url,
|
|
92
|
+
"page_type": pageType,
|
|
93
|
+
"items": items,
|
|
94
|
+
"referer": '',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var key = getRandomKey(32);
|
|
98
|
+
var iv = getRandomKey(16);
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
const data = await NativeModules.Aes.encrypt(JSON.stringify(payload), stringToHex(key), stringToHex(iv));
|
|
102
|
+
const response = await fetch(
|
|
103
|
+
'https://analytics.bootpay.co.kr/call',
|
|
104
|
+
{
|
|
105
|
+
method: 'POST',
|
|
106
|
+
headers: {
|
|
107
|
+
Accept: 'application/json',
|
|
108
|
+
'Content-Type': 'application/json'
|
|
109
|
+
},
|
|
110
|
+
body: JSON.stringify({
|
|
111
|
+
data: data,
|
|
112
|
+
session_key: await getSessionKey(key, iv)
|
|
113
|
+
})
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
const json = await response.json();
|
|
117
|
+
return json;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.log(e);
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(error);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// strEncode 함수의 반환 타입을 명시
|
|
127
|
+
// const strEncode = async (str: string, key: string, iv: string): Promise<string> => {
|
|
128
|
+
// return await NativeModules.Aes.encrypt(str, key, iv).then(cipher => {
|
|
129
|
+
// return NativeModules.Aes.hmac256(cipher, key).then(hash => {
|
|
130
|
+
// console.log('HMAC', hash);
|
|
131
|
+
// return hash;
|
|
132
|
+
// });
|
|
133
|
+
// });
|
|
134
|
+
// };
|
|
135
|
+
|
|
136
|
+
export { userTrace, pageTrace };
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Bootpay } from './Bootpay'
|
|
2
|
+
import { Payload, Extra, Item, User } from './BootpayTypes'
|
|
3
|
+
// import { userTrace, pageTrace } from './BootpayAnalytics'
|
|
4
|
+
|
|
5
|
+
// import { WebView } from 'react-native-bootpay-api';
|
|
6
|
+
|
|
7
|
+
export { Bootpay, Payload, Extra, Item, User };
|
|
8
|
+
|
|
9
|
+
// export { BootpayModal, userTrace, pageTrace };
|
package/index.js
DELETED