react-native-bootpay-api 4.0.0-beta.2 → 4.0.7

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/README.md CHANGED
@@ -82,7 +82,7 @@ react-native-bootpay-api는 내부적으로 아래의 모듈에 의존합니다.
82
82
 
83
83
  ## 사용예제
84
84
 
85
- ```dart
85
+ ```typescript
86
86
  import React, { useRef } from 'react';
87
87
 
88
88
  import {
@@ -91,28 +91,35 @@ import {
91
91
  Text,
92
92
  TouchableOpacity
93
93
  } from 'react-native';
94
- import { BootpayWebView } from 'react-native-bootpay-api';
94
+ import { BootpayWebView } from 'react-native-bootpay-api';
95
+ // import { WebView } from 'react-native-webview-bootpay';
95
96
 
96
97
 
97
98
  export default function App() {
98
99
  const bootpay = useRef<BootpayWebView>(null);
99
100
 
101
+
100
102
 
101
- const onPress = () => {
103
+ const goBootpayTest = () => {
102
104
  const payload = {
103
- pg: 'payletter', //['kcp', 'danal', 'inicis', 'nicepay', 'lgup', 'toss', 'payapp', 'easypay', 'jtnet', 'tpay', 'mobilians', 'payletter', 'onestore', 'welcome'] 중 택 1
104
- name: '마스카라', //결제창에 보여질 상품명
105
+ pg: '나이스페이', //['kcp', 'danal', 'inicis', 'nicepay', 'lgup', 'toss', 'payapp', 'easypay', 'jtnet', 'tpay', 'mobilians', 'payletter', 'onestore', 'welcome'] 중 택 1
106
+ method: '네이버페이', // ['카드', '휴대폰', '계좌이체', '가상계좌', '카카오페이', '네이버페이', '페이코', '카드자동'] 중 택 1
107
+ order_name: '마스카라', //결제창에 보여질 상품명
105
108
  order_id: '1234_1234', //개발사에 관리하는 주문번호
106
- method: 'card',
107
- price: 1000 //결제금액
109
+ // subscription_id: '12345_21345', //개발사에 관리하는 주문번호 (정기결제용)
110
+ // authentication_id: '12345_21345', //개발사에 관리하는 주문번호 (본인인증용)
111
+ // method: 'card',
112
+ // methods: ['card', 'vbank', 'bank', 'phone'], // 통합결제창 진행시 사용하고자 하는 결제수단 지정 가능, method와 함께 적용 불가
113
+ price: 1000, //결제금액
114
+ // taxFree: 0, //면세금액
108
115
  }
109
116
 
110
117
  //결제되는 상품정보들로 통계에 사용되며, price의 합은 결제금액과 동일해야함
111
118
  const items = [
112
119
  {
113
- item_name: '키보드', //통계에 반영될 상품명
120
+ name: '키보드', //통계에 반영될 상품명
114
121
  qty: 1, //수량
115
- unique: 'ITEM_CODE_KEYBOARD', //개발사에서 관리하는 상품고유번호
122
+ id: 'ITEM_CODE_KEYBOARD', //개발사에서 관리하는 상품고유번호
116
123
  price: 1000, //상품단가
117
124
  cat1: '패션', //카테고리 상 , 자유롭게 기술
118
125
  cat2: '여성상의', //카테고리 중, 자유롭게 기술
@@ -135,80 +142,158 @@ export default function App() {
135
142
 
136
143
  //기타 설정
137
144
  const extra = {
138
- app_scheme: "bootpayrnapi", //ios의 경우 카드사 호출 되돌아오기 위한 스키마명
139
- expire_month: "0", //정기결제가 적용되는 개월 (정기결제 사용시), 미지정일시 PG사 기본값에 따름
140
- vbank_result: true, //가상계좌 결과창을 볼지(true), 말지(false)
141
- start_at: "", //정기 결제 시작일 - 지정하지 않을 경우 - 그 날 당일로부터 결제가 가능한 Billing key 지급, "2020-10-14"
142
- end_at: "", // 정기결제 만료일 - 기간 없음 - 무제한, "2020-10-14"
143
- quota: "0,2,3", //결제금액이 5만원 이상시 할부개월 허용범위를 설정할 수 있음, [0(일시불), 2개월, 3개월] 허용, 미설정시 12개월까지 허용
144
- offer_period: "", //결제창 제공기간에 해당하는 string 값, 지원하는 PG만 적용됨
145
- popup: 1, //1이면 popup, 아니면 iframe 연동
146
- quick_popup: 1, //1: popup 호출시 버튼을 띄우지 않는다. 아닐 경우 버튼을 호출한다
147
- locale: "ko",
148
- disp_cash_result: "Y", // 현금영수증 보일지 말지.. 가상계좌 KCP 옵션
149
- escrow: "0", // 에스크로 쓸지 안쓸지
150
- theme: "purple",
151
- custom_background: "",
152
- custom_font_color: "",
153
- show_close_button: true
145
+ card_quota: "0,2,3", //결제금액이 5만원 이상시 할부개월 허용범위를 설정할 있음, [0(일시불), 2개월, 3개월] 허용, 미설정시 12개월까지 허용
146
+ app_scheme: "bootpayrnapi", //ios의 경우 카드사 호출 되돌아오기 위한 스키마명
147
+ show_close_button: false, // x 닫기 버튼 삽입 (닫기버튼이 없는 PG사를 위한 옵션)
148
+ }
149
+
150
+ if(bootpay != null && bootpay.current != null) bootpay.current.requestPayment(payload, items, user, extra);
151
+ }
152
+
153
+
154
+ const goBootpaySubscriptionTest = () => {
155
+ const payload = {
156
+ pg: '나이스페이', //['kcp', 'danal', 'inicis', 'nicepay', 'lgup', 'toss', 'payapp', 'easypay', 'jtnet', 'tpay', 'mobilians', 'payletter', 'onestore', 'welcome'] 중 택 1
157
+ method: '카드자동', // ['카드', '휴대폰', '계좌이체', '가상계좌', '카카오페이', '네이버페이', '페이코', '카드자동'] 중 택 1
158
+ order_name: '마스카라', //결제창에 보여질 상품명
159
+ // order_id: '1234_1234', //개발사에 관리하는 주문번호
160
+ subscription_id: '12345_21345', //개발사에 관리하는 주문번호 (카드자동결제용)
161
+ // authentication_id: '12345_21345', //개발사에 관리하는 주문번호 (본인인증용)
162
+ // method: 'card',
163
+ // methods: ['card', 'vbank', 'bank', 'phone'], // 통합결제창 진행시 사용하고자 하는 결제수단 지정 가능, method와 함께 적용 불가
164
+ price: 1000, //결제금액
165
+ // taxFree: 0, //면세금액
166
+ }
167
+
168
+ //결제되는 상품정보들로 통계에 사용되며, price의 합은 결제금액과 동일해야함
169
+ const items = [
170
+ {
171
+ name: '키보드', //통계에 반영될 상품명
172
+ qty: 1, //수량
173
+ id: 'ITEM_CODE_KEYBOARD', //개발사에서 관리하는 상품고유번호
174
+ price: 1000, //상품단가
175
+ cat1: '패션', //카테고리 상 , 자유롭게 기술
176
+ cat2: '여성상의', //카테고리 중, 자유롭게 기술
177
+ cat3: '블라우스', //카테고리 하, 자유롭게 기술
178
+ }
179
+ ]
180
+
181
+ //구매자 정보로 결제창이 미리 적용될 수 있으며, 통계에도 사용되는 정보
182
+ const user = {
183
+ id: 'user_id_1234', //개발사에서 관리하는 회원고유번호
184
+ username: '홍길동', //구매자명
185
+ email: 'user1234@gmail.com', //구매자 이메일
186
+ gender: 0, //성별, 1:남자 , 0:여자
187
+ birth: '1986-10-14', //생년월일 yyyy-MM-dd
188
+ phone: '01012345678', //전화번호, 페이앱 필수
189
+ area: '서울', // [서울,인천,대구,광주,부산,울산,경기,강원,충청북도,충북,충청남도,충남,전라북도,전북,전라남도,전남,경상북도,경북,경상남도,경남,제주,세종,대전] 중 택 1
190
+ addr: '서울시 동작구 상도로' //주소
191
+ }
192
+
193
+
194
+ //기타 설정
195
+ const extra = {
196
+ card_quota: "0,2,3", //결제금액이 5만원 이상시 할부개월 허용범위를 설정할 수 있음, [0(일시불), 2개월, 3개월] 허용, 미설정시 12개월까지 허용
197
+ app_scheme: "bootpayrnapi", //ios의 경우 카드사 앱 호출 후 되돌아오기 위한 앱 스키마명
198
+ show_close_button: false, // x 닫기 버튼 삽입 (닫기버튼이 없는 PG사를 위한 옵션)
154
199
  }
155
-
156
200
 
157
- if(bootpay != null && bootpay.current != null) bootpay.current.request(payload, items, user, extra);
201
+ if(bootpay != null && bootpay.current != null) bootpay.current.requestSubscription(payload, items, user, extra);
158
202
  }
159
203
 
204
+ const goBootpayAuthTest = () => {
205
+ const payload = {
206
+ pg: '다날', //['kcp', 'danal', 'inicis', 'nicepay', 'lgup', 'toss', 'payapp', 'easypay', 'jtnet', 'tpay', 'mobilians', 'payletter', 'onestore', 'welcome'] 중 택 1
207
+ method: '본인인증',
208
+ order_name: '마스카라', //본인인증 명
209
+ // order_id: '1234_1234', //개발사에 관리하는 주문번호
210
+ // subscription_id: '12345_21345', //개발사에 관리하는 주문번호 (정기결제용)
211
+ authentication_id: '12345_21345', //개발사에 관리하는 주문번호 (본인인증용)
212
+ // method: 'card',
213
+ // methods: ['card', 'vbank', 'bank', 'phone'], // 통합결제창 진행시 사용하고자 하는 결제수단 지정 가능, method와 함께 적용 불가
214
+ // price: 1000, //결제금액
215
+ // taxFree: 0, //면세금액
216
+ }
217
+
218
+
219
+
220
+ //기타 설정
221
+ const extra = {
222
+ app_scheme: "bootpayrnapi", //ios의 경우 카드사 앱 호출 후 되돌아오기 위한 앱 스키마명
223
+ show_close_button: false, // x 닫기 버튼 삽입 (닫기버튼이 없는 PG사를 위한 옵션)
224
+ }
225
+
226
+ if(bootpay != null && bootpay.current != null) bootpay.current.requestAuthentication(payload, [], {}, extra);
160
227
 
161
- const onCancel = (data) => {
162
- console.log('cancel', data);
228
+ }
163
229
 
164
- var json = JSON.stringify(data)
165
- console.log('cancel json', json);
230
+ const onCancel = (data: string) => {
231
+ console.log('cancel', data);
166
232
  }
167
233
 
168
- const onError = (data) => {
234
+ const onError = (data: string) => {
169
235
  console.log('error', data);
170
236
  }
171
237
 
172
- const onReady = (data) => {
238
+ const onIssued = (data: string) => {
173
239
  console.log('ready', data);
174
240
  }
175
241
 
176
- const onConfirm = (data) => {
242
+ const onConfirm = (data: string) => {
177
243
  console.log('confirm', data);
178
244
  if(bootpay != null && bootpay.current != null) bootpay.current.transactionConfirm(data);
179
245
  }
180
246
 
181
- const onDone = (data) => {
247
+ const onDone = (data: string) => {
182
248
  console.log('done', data);
183
249
  }
184
250
 
185
251
  const onClose = () => {
186
- console.log('closed');
252
+ console.log('-- closed');
187
253
  }
188
254
 
255
+ // React.useEffect(() => {
256
+ // BootpayApi.multiply(3, 7).then(setResult);
257
+ // }, []);
258
+
189
259
  return (
190
260
  <View style={styles.container}>
191
261
  <TouchableOpacity
192
262
  style={styles.button}
193
- onPress={onPress}
263
+ onPress={goBootpayTest}
264
+ >
265
+ <Text>일반결제 결제테스트</Text>
266
+ </TouchableOpacity>
267
+ <BootpayWebView
268
+ ref={bootpay}
269
+ ios_application_id={'5b8f6a4d396fa665fdc2b5e9'}
270
+ android_application_id={'5b8f6a4d396fa665fdc2b5e8'}
271
+ // ios_application_id={'5b9f51264457636ab9a07cdd'}
272
+ // android_application_id={'5b9f51264457636ab9a07cdc'}
273
+ onCancel={onCancel}
274
+ onError={onError}
275
+ onIssued={onIssued}
276
+ onConfirm={onConfirm}
277
+ onDone={onDone}
278
+ onClose={onClose}
279
+ />
280
+ <TouchableOpacity
281
+ style={styles.button}
282
+ onPress={goBootpaySubscriptionTest}
283
+ >
284
+ <Text>정기결제 테스트</Text>
285
+ </TouchableOpacity>
286
+ <TouchableOpacity
287
+ style={styles.button}
288
+ onPress={goBootpayAuthTest}
194
289
  >
195
- <Text>Press Here</Text>
196
- </TouchableOpacity>
197
- <BootpayWebView
198
- ref={bootpay}
199
- ios_application_id={'5b8f6a4d396fa665fdc2b5e9'}
200
- android_application_id={'5b8f6a4d396fa665fdc2b5e8'}
201
- onCancel={onCancel}
202
-
203
- onError={onError}
204
- onReady={onReady}
205
- onConfirm={onConfirm}
206
- onDone={onDone}
207
- onClose={onClose}
208
- />
290
+ <Text>본인인증 테스트</Text>
291
+ </TouchableOpacity>
209
292
 
210
293
  </View>
211
294
  );
295
+
296
+
212
297
  }
213
298
 
214
299
  const styles = StyleSheet.create({
@@ -220,9 +305,11 @@ const styles = StyleSheet.create({
220
305
  button: {
221
306
  alignItems: "center",
222
307
  backgroundColor: "#DDDDDD",
223
- padding: 10
308
+ padding: 10,
309
+ margin: 10,
224
310
  },
225
311
  });
312
+
226
313
  ```
227
314
 
228
315
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-bootpay-api",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.7",
4
4
  "description": "React Native를 위한 bootpay 라이브러리 입니다.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -10,27 +10,16 @@ export class BootpayWebView extends Component {
10
10
 
11
11
  webView = useRef<WebView>(null);
12
12
 
13
+ _VERSION = "4.0.7";
14
+ _DEBUG = false;
15
+ _payload = {};
16
+
13
17
 
14
18
  state = {
15
19
  visibility: false,
16
20
  script: '',
17
21
  firstLoad: false
18
- }
19
-
20
- // canGoBack() {
21
- // console.log('canGoBack');
22
- // if(this.webView.current) {
23
- // return this.webView.current.canGoBack();
24
- // }
25
- // return false;
26
- // }
27
-
28
- // goBack() {
29
- // console.log('GoBack');
30
- // if(this.webView.goBack) {
31
- // this.webView.current.goBack();
32
- // }
33
- // }
22
+ }
34
23
 
35
24
  async componentWillUnmount() {
36
25
  this.setState(
@@ -41,8 +30,7 @@ export class BootpayWebView extends Component {
41
30
  }
42
31
  )
43
32
  UserInfo.setBootpayLastTime(Date.now());
44
- }
45
-
33
+ }
46
34
  render() {
47
35
  return <Modal
48
36
  animationType={'slide'}
@@ -76,15 +64,14 @@ export class BootpayWebView extends Component {
76
64
  </TouchableOpacity>
77
65
  }
78
66
  <WebView
79
- ref={(wv) => this.webView = wv}
80
- // ref={btWebView}
67
+ ref={(wv) => this.webView = wv}
81
68
  useWebKit={true}
82
69
  originWhitelist={['*']}
83
70
  source={{
84
- uri: 'https://webview.bootpay.co.kr/4.0.0/'
71
+ uri: 'https://webview.bootpay.co.kr/4.0.6/'
85
72
  }}
86
73
  onRequestClose={()=> {
87
- console.log('onRequestClose');
74
+ // console.log('onRequestClose');
88
75
  this.dismiss();
89
76
  }}
90
77
  injectedJavaScript={this.state.script}
@@ -111,11 +98,42 @@ export class BootpayWebView extends Component {
111
98
  this.bootpayRequest(payload, items, user, extra, "requestAuthentication");
112
99
  }
113
100
 
114
- bootpayRequest = async (payload, items, user, extra, requestMethod) => {
101
+ bootpayRequest = async (payload, items, user, extra, requestMethod) => {
102
+
115
103
  payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
116
104
  payload.items = items;
117
- payload.user_info = user;
118
- payload.extra = extra;
105
+ payload.user = user;
106
+ payload.extra = {
107
+ card_quota: extra.card_quota ?? "",
108
+ seller_name: extra.seller_name ?? "",
109
+ delivery_day: extra.delivery_day ?? 1, //배송일자
110
+ locale: extra.locale ?? "ko",
111
+ offer_period: extra.offer_period ?? "" , //결제창 제공기간에 해당하는 string 값, 지원하는 PG만 적용됨
112
+ disp_cash_result: extra.disp_cash_result ?? true, // 현금영수증 보일지 말지.. 가상계좌 KCP 옵션
113
+ deposit_expiration: extra.deposit_expiration ?? "", //가상계좌 입금 만료일자 설정, yyyy-MM-dd
114
+ app_scheme: extra.app_scheme ?? "", //ios의 경우 카드사 앱 호출 후 되돌아오기 위한 앱 스키마명
115
+ use_card_point: extra.use_card_point ?? true, //카드 포인트 사용 여부 (토스만 가능)
116
+ direct_card: extra.direct_card ?? "", //해당 카드로 바로 결제창 (토스만 가능)
117
+ use_order_id: extra.use_order_id ?? false, //가맹점 order_id로 PG로 전송
118
+ international_card_only: extra.international_card_only ?? false, //해외 결제카드 선택 여부 (토스만 가능)
119
+ // phone_carrier: 'SKT', // ['SKT', 'KT', 'LGT'] 중 택 1
120
+ direct_app_card: extra.direct_app_card ?? false, //카드사앱으로 direct 호출
121
+ direct_samsungpay: extra.direct_samsungpay ?? false, //삼성페이 바로 띄우기
122
+ test_deposit: extra.test_deposit ?? false, //가상계좌 모의 입금
123
+ enable_error_webhook: extra.enable_error_webhook ?? false, //결제 오류시 Feedback URL로 webhook
124
+ separately_confirmed: extra.separately_confirmed ?? true, // confirm 이벤트를 호출할지 말지, false일 경우 자동승인
125
+ confirm_only_rest_api: extra.confirm_only_rest_api ?? false, // REST API로만 승인 처리
126
+ open_type: extra.open_type ?? 'redirect', // [그대로 지정] 페이지 오픈 type [iframe, popup, redirect] 중 택 1, 앱에서는 redriect가 default
127
+ use_bootpay_inapp_sdk: extra.use_bootpay_inapp_sdk ?? true, // [그대로 지정] native app에서는 redirect를 완성도있게 지원하기 위한 옵션
128
+ redirect_url: extra.redirect_url ?? 'https://api.bootpay.co.kr/v2', // [그대로 지정] open_type이 redirect일 경우 페이지 이동할 URL ( 오류 및 결제 완료 모두 수신 가능 )
129
+ display_success_result: extra.display_success_result ?? false, // 결제 완료되면 부트페이가 제공하는 완료창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
130
+ display_error_result: extra.display_error_result ?? true, // 결제가 실패하면 부트페이가 제공하는 실패창으로 보여주기 ( open_type이 iframe, popup 일때만 가능 )
131
+ show_close_button: extra.show_close_button ?? false, // x 닫기 버튼 삽입 (닫기버튼이 없는 PG사를 위한 옵션)
132
+ use_welcomepayment: extra.use_welcomepayment ?? false, // 웰컴에서 스마트로 재판모듈 사용시 true
133
+ };
134
+
135
+
136
+ this._payload = payload;
119
137
 
120
138
 
121
139
  //visibility가 true가 되면 webview onLoaded가 실행됨
@@ -142,13 +160,16 @@ export class BootpayWebView extends Component {
142
160
  visibility: false
143
161
  })
144
162
  )
145
- this.removePaymentWindow();
163
+ // this.removePaymentWindow();
146
164
  }
147
165
 
148
166
 
149
167
  getMountJavascript = async () => {
150
168
  return `
169
+ ${this.getSDKVersion()}
170
+ ${this.getEnvironmentMode()}
151
171
  ${this.getBootpayPlatform()}
172
+ ${this.close()}
152
173
  ${await this.getAnalyticsData()}
153
174
  `;
154
175
  }
@@ -164,62 +185,76 @@ export class BootpayWebView extends Component {
164
185
  "}, function (res) {" +
165
186
  this.error() +
166
187
  this.cancel() +
167
- "})";
188
+ "}); void(0);";
189
+
190
+ return script;
168
191
 
169
- this.callJavaScript(script);
192
+ // return this.generateScript;
170
193
  }
171
194
 
172
195
  onMessage = ({ nativeEvent }) => {
173
- if (nativeEvent == undefined || nativeEvent.data == undefined) return;
196
+ // console.log(`onMessage: ${nativeEvent}, ${JSON.stringify(nativeEvent)}`);
197
+
198
+ if (nativeEvent == undefined) return;
199
+
200
+ const res = JSON.parse(JSON.stringify(nativeEvent));
201
+
174
202
 
175
- if(nativeEvent.data == 'close') {
203
+ if(res.data == 'close') {
176
204
  if(this.props.onClose == undefined) return;
177
205
  var json = {
178
206
  action: 'BootpayClose',
179
207
  message: '결제창이 닫혔습니다'
180
- }
181
- this.setState(
182
- {
183
- visibility: false
184
- }
185
- )
208
+ }
186
209
  this.props.onClose(json);
187
210
  this.dismiss();
188
211
  return;
189
212
  }
190
213
 
191
- const data = JSON.parse(nativeEvent.data);
214
+
215
+ const data = JSON.parse(res.data);
216
+ // console.log(`redirect: ${JSON.stringify(data)}`);
217
+
192
218
  switch (data.event) {
193
219
  case 'cancel':
194
- if(this.props.onCancel != undefined) this.props.onCancel(data);
195
- // this.setState(
196
- // {
197
- // visibility: false
198
- // }
199
- // )
220
+ if(this.props.onCancel != undefined) this.props.onCancel(data);
200
221
  break;
201
222
  case 'error':
202
- if(this.props.onError != undefined) this.props.onError(data);
203
- // this.setState(
204
- // {
205
- // visibility: false
206
- // }
207
- // )
223
+ if(this.props.onError != undefined) this.props.onError(data);
208
224
  break;
209
225
  case 'issued':
210
- if(this.props.onReady != undefined) this.props.onReady(data);
226
+ if(this.props.onIssued != undefined) this.props.onIssued(data);
211
227
  break;
212
228
  case 'confirm':
213
229
  if(this.props.onConfirm != undefined) this.props.onConfirm(data);
214
230
  break;
215
231
  case 'done':
216
- if(this.props.onDone != undefined) this.props.onDone(data);
217
- // this.setState(
218
- // {
219
- // visibility: false
220
- // }
221
- // )
232
+ if(this.props.onDone != undefined) this.props.onDone(data);
222
233
  break;
234
+ case 'close':
235
+ if(this.props.onClose != undefined) this.props.onClose(data);
236
+ this.dismiss();
237
+ break;
238
+ }
239
+
240
+
241
+
242
+ if(this._payload != undefined && this._payload.extra != undefined && this._payload.extra.open_type == 'redirect') {
243
+
244
+
245
+ if(data.event == 'done' && this._payload.extra.display_success_result != true) {
246
+ if(this.props.onClose != undefined) this.props.onClose(data);
247
+ this.dismiss();
248
+ } else if(data.event == 'error' && this._payload.extra.display_error_result != true ) {
249
+ if(this.props.onClose != undefined) this.props.onClose(data);
250
+ this.dismiss();
251
+ } else if(data.event == 'issued' && this._payload.extra.display_success_result != true ) {
252
+ if(this.props.onClose != undefined) this.props.onClose(data);
253
+ this.dismiss();
254
+ } else if(data.event == 'cancel') {
255
+ if(this.props.onClose != undefined) this.props.onClose(data);
256
+ this.dismiss();
257
+ }
223
258
  }
224
259
  }
225
260
 
@@ -227,6 +262,24 @@ export class BootpayWebView extends Component {
227
262
  return true;
228
263
  }
229
264
 
265
+ getSDKVersion = () => {
266
+ if(Platform.OS == 'ios') {
267
+ return "Bootpay.setVersion('" + this._VERSION + "', 'ios_react_native')";
268
+ // return "Bootpay.setDevice('IOS');";
269
+ } else if(Platform.OS == 'android'){
270
+ return "Bootpay.setVersion('" + this._VERSION + "', 'android_react_native')";
271
+ // return "Bootpay.setDevice('ANDROID');";
272
+ }
273
+ }
274
+
275
+ getEnvironmentMode = () => {
276
+ if(this._DEBUG) {
277
+ return "Bootpay.setEnvironmentMode('development');";
278
+
279
+ }
280
+ return "";
281
+ }
282
+
230
283
  getBootpayPlatform = () => {
231
284
  if(Platform.OS == 'ios') {
232
285
  return "Bootpay.setDevice('IOS');";
@@ -245,27 +298,29 @@ export class BootpayWebView extends Component {
245
298
  // }
246
299
 
247
300
  transactionConfirm = () => {
248
- const script = "Bootpay.confirm()" +
249
- ".then( function (res) {" +
250
- this.confirm() +
251
- this.issued() +
252
- this.done() +
253
- "}, function (res) {" +
254
- this.error() +
255
- this.cancel() +
256
- "})";
301
+ const script = "Bootpay.confirm();"
302
+ // +
303
+ // ".then( function (res) {" +
304
+ // this.confirm() +
305
+ // this.issued() +
306
+ // this.done() +
307
+ // "}, function (res) {" +
308
+ // this.error() +
309
+ // this.cancel() +
310
+ // "})";
257
311
 
258
312
  this.callJavaScript(script);
259
313
  }
260
314
 
261
315
  removePaymentWindow = () => {
262
- this.callJavaScript(`
263
- Bootpay.removePaymentWindow();
264
- `);
316
+ this.dismiss();
317
+ // this.callJavaScript(`
318
+ // Bootpay.removePaymentWindow();
319
+ // `);
265
320
  }
266
321
 
267
- callJavaScript = (script) => {
268
- if(this.webView == null || this.webView == undefined) return;
322
+ callJavaScript = (script) => {
323
+ if(this.webView == null || this.webView == undefined || this.webView == false) return;
269
324
 
270
325
  // console.log('callJavascript: ' + script);
271
326
 
package/src/index.d.ts CHANGED
@@ -8,36 +8,4 @@ import { userTrace, pageTrace } from './BootpayAnalytics'
8
8
 
9
9
 
10
10
  export { BootpayWebView, userTrace, pageTrace }
11
-
12
- // interface BootpayWebViewProps {
13
- // ios_application_id: string;
14
- // android_application_id: string;
15
-
16
- // onCancel: (data: string) => void;
17
- // onError: (data: string) => void;
18
- // onReady: (data: string) => void;
19
- // onConfirm: (data: string) => void;
20
- // onDone: (data: string) => void;
21
- // onClose: () => void;
22
- // }
23
-
24
- // export class BootpayWebView extends Component<BootpayWebViewProps> {
25
- // request: (payload: Object, items: Object, user: Object, extra: Object) => Promise<string>;
26
- // dismiss: () => Promise<string>;
27
- // transactionConfirm: (data: string) => Promise<string>;
28
- // }
29
-
30
- // export class BootpayAnalytics {
31
- // static userTrace: () => void;
32
- // static pageTrace: () => void;
33
- // }
34
-
35
- // export const userTrace: () => void;
36
- // export default function pageTrace(): void;
37
- // export const userTrace: () => void;
38
-
39
- // export default function PageTrace() : void;
40
-
41
- // const Bootpay =
42
-
43
- // export { BootpayWebView, userTrace, pageTrace }
11
+
package/src/index.js CHANGED
@@ -3,23 +3,4 @@
3
3
  import { BootpayWebView } from './BootpayWebView'
4
4
  import { userTrace, pageTrace } from './BootpayAnalytics'
5
5
 
6
- export { BootpayWebView, userTrace, pageTrace };
7
- // export { useBootpay };
8
-
9
- // import React, { Component } from 'react';
10
- // import WebView from 'react-native-webview-bootpay';
11
-
12
- // export class BootpayWebView extends Component {
13
- // render() {
14
- // return <WebView
15
- // useWebKit={true}
16
- // originWhitelist={['*']}
17
- // source={{
18
- // uri: 'https://www.google.com'
19
- // }}
20
- // javaScriptEnabled={true}
21
- // javaScriptCanOpenWindowsAutomatically={true}
22
- // scalesPageToFit={true}
23
- // />
24
- // }
25
- // }
6
+ export { BootpayWebView, userTrace, pageTrace };