iamport-react-native 2.0.0-rc.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/build.gradle +1 -3
- package/lib/commonjs/components/Certification/index.js +16 -23
- package/lib/commonjs/components/Certification/index.js.map +1 -1
- package/lib/commonjs/components/ErrorOnParams/index.js +2 -10
- package/lib/commonjs/components/ErrorOnParams/index.js.map +1 -1
- package/lib/commonjs/components/Loading/index.js +3 -11
- package/lib/commonjs/components/Loading/index.js.map +1 -1
- package/lib/commonjs/components/Payment/index.js +23 -25
- package/lib/commonjs/components/Payment/index.js.map +1 -1
- package/lib/commonjs/constants/index.js +7 -3
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/utils/IamportUrl.js +27 -19
- package/lib/commonjs/utils/IamportUrl.js.map +1 -1
- package/lib/commonjs/utils/Validation.js +143 -3
- package/lib/commonjs/utils/Validation.js.map +1 -1
- package/lib/commonjs/utils/ValidationForPayment.js +3 -13
- package/lib/commonjs/utils/ValidationForPayment.js.map +1 -1
- package/lib/module/components/Certification/index.js +17 -24
- package/lib/module/components/Certification/index.js.map +1 -1
- package/lib/module/components/ErrorOnParams/index.js +3 -12
- package/lib/module/components/ErrorOnParams/index.js.map +1 -1
- package/lib/module/components/Loading/index.js +3 -11
- package/lib/module/components/Loading/index.js.map +1 -1
- package/lib/module/components/Payment/index.js +23 -25
- package/lib/module/components/Payment/index.js.map +1 -1
- package/lib/module/constants/index.js +7 -3
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/utils/IamportUrl.js +27 -19
- package/lib/module/utils/IamportUrl.js.map +1 -1
- package/lib/module/utils/Validation.js +143 -3
- package/lib/module/utils/Validation.js.map +1 -1
- package/lib/module/utils/ValidationForPayment.js +3 -13
- package/lib/module/utils/ValidationForPayment.js.map +1 -1
- package/lib/typescript/components/Certification/index.d.ts +1 -1
- package/lib/typescript/components/Payment/index.d.ts +1 -1
- package/lib/typescript/constants/index.d.ts +5 -1
- package/lib/typescript/utils/IamportUrl.d.ts +2 -2
- package/lib/typescript/utils/Validation.d.ts +51 -2
- package/lib/typescript/utils/ValidationForPayment.d.ts +0 -1
- package/package.json +18 -18
- package/src/components/Certification/index.tsx +64 -67
- package/src/components/ErrorOnParams/index.tsx +4 -23
- package/src/components/Loading/index.tsx +3 -11
- package/src/components/Payment/index.tsx +80 -81
- package/src/constants/index.ts +5 -1
- package/src/utils/IamportUrl.ts +27 -22
- package/src/utils/Validation.ts +141 -4
- package/src/utils/ValidationForPayment.ts +5 -14
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Image,
|
|
5
|
-
Text,
|
|
6
|
-
// TouchableOpacity,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
} from 'react-native';
|
|
2
|
+
import { View, Image, Text, StyleSheet } from 'react-native';
|
|
9
3
|
|
|
10
4
|
const logo = require('../../img/iamport-logo.png');
|
|
11
5
|
|
|
@@ -14,33 +8,20 @@ type ErrorProps = { message: string };
|
|
|
14
8
|
function ErrorOnParams({ message }: ErrorProps) {
|
|
15
9
|
return (
|
|
16
10
|
<View style={styles.container}>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
<Text style={styles.text}>{message}</Text>
|
|
20
|
-
{/*<TouchableOpacity
|
|
21
|
-
style={button}
|
|
22
|
-
onPress={}
|
|
23
|
-
>
|
|
24
|
-
<Text>돌아가기</Text>
|
|
25
|
-
</TouchableOpacity>*/}
|
|
26
|
-
</View>
|
|
11
|
+
<Image source={logo} />
|
|
12
|
+
<Text style={styles.text}>{message}</Text>
|
|
27
13
|
</View>
|
|
28
14
|
);
|
|
29
15
|
}
|
|
30
16
|
|
|
31
17
|
const styles = StyleSheet.create({
|
|
32
18
|
container: {
|
|
33
|
-
flex: 1,
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
justifyContent: 'center',
|
|
37
|
-
},
|
|
38
|
-
contents: {
|
|
39
19
|
flex: 1,
|
|
40
20
|
alignItems: 'center',
|
|
41
21
|
justifyContent: 'center',
|
|
42
22
|
},
|
|
43
23
|
text: {
|
|
24
|
+
textAlign: 'center',
|
|
44
25
|
fontSize: 16,
|
|
45
26
|
marginTop: 20,
|
|
46
27
|
lineHeight: 25,
|
|
@@ -6,25 +6,17 @@ const logo = require('../../img/iamport-logo.png');
|
|
|
6
6
|
function Loading() {
|
|
7
7
|
return (
|
|
8
8
|
<View style={styles.container}>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
<Text style={styles.text}>잠시만 기다려주세요...</Text>
|
|
12
|
-
</View>
|
|
9
|
+
<Image source={logo} />
|
|
10
|
+
<Text style={styles.text}>잠시만 기다려주세요...</Text>
|
|
13
11
|
</View>
|
|
14
12
|
);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
const styles = StyleSheet.create({
|
|
18
16
|
container: {
|
|
19
|
-
...StyleSheet.absoluteFillObject,
|
|
20
|
-
flex: 1,
|
|
21
|
-
alignItems: 'center',
|
|
22
|
-
flexDirection: 'row',
|
|
23
|
-
justifyContent: 'center',
|
|
24
|
-
},
|
|
25
|
-
contents: {
|
|
26
17
|
flex: 1,
|
|
27
18
|
alignItems: 'center',
|
|
19
|
+
flexDirection: 'column',
|
|
28
20
|
justifyContent: 'center',
|
|
29
21
|
},
|
|
30
22
|
text: {
|
|
@@ -14,7 +14,7 @@ type Props = {
|
|
|
14
14
|
userCode: string;
|
|
15
15
|
tierCode?: string;
|
|
16
16
|
data: IMPData.PaymentData;
|
|
17
|
-
loading
|
|
17
|
+
loading?: any;
|
|
18
18
|
callback: (response: any) => any;
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -27,6 +27,10 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
27
27
|
const [isInicisTransPaid, setIsInicisTransPaid] = useState(false);
|
|
28
28
|
const webview = createRef<WebView>();
|
|
29
29
|
const smilepayRef = useRef(false);
|
|
30
|
+
let redirectUrl = IMPConst.M_REDIRECT_URL;
|
|
31
|
+
if (data.m_redirect_url !== undefined && data.m_redirect_url.trim() !== '') {
|
|
32
|
+
redirectUrl = data.m_redirect_url;
|
|
33
|
+
}
|
|
30
34
|
|
|
31
35
|
useEffect(() => {
|
|
32
36
|
const { pg } = data;
|
|
@@ -68,9 +72,9 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
68
72
|
if (pg.startsWith('html5_inicis') && Platform.OS === 'ios') {
|
|
69
73
|
if (isInicisTransPaid) {
|
|
70
74
|
webview.current?.injectJavaScript(`
|
|
71
|
-
window.location.href = "${
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
window.location.href = "${redirectUrl}?${iamportUrl.getInicisTransQuery(
|
|
76
|
+
redirectUrl
|
|
77
|
+
)}";
|
|
74
78
|
`);
|
|
75
79
|
} else {
|
|
76
80
|
setIsInicisTransPaid(true);
|
|
@@ -94,7 +98,7 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
94
98
|
}
|
|
95
99
|
};
|
|
96
100
|
Linking.addEventListener('url', handleOpenURL);
|
|
97
|
-
}, [data, isInicisTransPaid, webview]);
|
|
101
|
+
}, [data, isInicisTransPaid, redirectUrl, webview]);
|
|
98
102
|
|
|
99
103
|
const removeLoadingNeeded = () => {
|
|
100
104
|
if (showLoading && Platform.OS === 'android') {
|
|
@@ -135,30 +139,29 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
135
139
|
data
|
|
136
140
|
);
|
|
137
141
|
if (validation.getIsValid()) {
|
|
138
|
-
const {
|
|
142
|
+
const { loadingContainer, webViewContainer } = viewStyles;
|
|
139
143
|
return (
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
144
|
+
<>
|
|
145
|
+
<WebView
|
|
146
|
+
containerStyle={webViewContainer}
|
|
147
|
+
ref={webview}
|
|
148
|
+
source={webviewSource}
|
|
149
|
+
onLoadEnd={() => {
|
|
150
|
+
if (!isWebViewLoaded) {
|
|
151
|
+
if (data.pg.startsWith('eximbay')) {
|
|
152
|
+
data.popup = false;
|
|
153
|
+
}
|
|
151
154
|
|
|
152
|
-
|
|
153
|
-
|
|
155
|
+
if (tierCode) {
|
|
156
|
+
webview.current?.injectJavaScript(`
|
|
154
157
|
setTimeout(function() { IMP.agency("${userCode}", "${tierCode}"); });
|
|
155
158
|
`);
|
|
156
|
-
|
|
157
|
-
|
|
159
|
+
} else {
|
|
160
|
+
webview.current?.injectJavaScript(`
|
|
158
161
|
setTimeout(function() { IMP.init("${userCode}"); });
|
|
159
162
|
`);
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
}
|
|
164
|
+
webview.current?.injectJavaScript(`
|
|
162
165
|
setTimeout(function() {
|
|
163
166
|
IMP.request_pay(${JSON.stringify(
|
|
164
167
|
data
|
|
@@ -167,73 +170,69 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
167
170
|
});
|
|
168
171
|
});
|
|
169
172
|
`);
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
setIsWebViewLoaded(true);
|
|
174
|
+
}
|
|
172
175
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
response = decodeURIComponent(response);
|
|
192
|
-
response = JSON.parse(response);
|
|
176
|
+
// only for Android
|
|
177
|
+
if (removeLoadingNeeded()) {
|
|
178
|
+
setShowLoading(false);
|
|
179
|
+
}
|
|
180
|
+
}}
|
|
181
|
+
/* PG사가 callback을 지원하는 경우, 결제결과를 받아 callback을 실행한다 */
|
|
182
|
+
onMessage={(e) => {
|
|
183
|
+
/**
|
|
184
|
+
* [v1.6.0] 다날의 경우 response에 주문명(name)이 포함되어 있는데
|
|
185
|
+
* 주문명에 %가 들어갈 경우, decodeURIComponent시 URI malformed 에러가 발생하는 것 대비해
|
|
186
|
+
* 우선 encodeURIComponent를 한 후, decodeURIComponent가 끝나면
|
|
187
|
+
* 최종적으로 decodeURIComponent를 한 번 더 한다
|
|
188
|
+
*/
|
|
189
|
+
const encoded = encodeURIComponent(e.nativeEvent.data);
|
|
190
|
+
const decoded = decodeURIComponent(encoded);
|
|
191
|
+
const response = JSON.parse(decoded);
|
|
192
|
+
if (typeof callback === 'function') {
|
|
193
193
|
callback(response);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
originWhitelist={['*']} // https://github.com/facebook/react-native/issues/19986
|
|
197
|
+
sharedCookiesEnabled={true}
|
|
198
|
+
onShouldStartLoadWithRequest={(request) => {
|
|
199
|
+
const { url } = request;
|
|
200
|
+
// console.log(`url: ${url}`);
|
|
201
|
+
const iamportUrl = new IamportUrl(url);
|
|
202
|
+
if (iamportUrl.isAppUrl()) {
|
|
203
|
+
/* 3rd-party 앱 오픈 */
|
|
204
|
+
iamportUrl.launchApp().catch((e) => {
|
|
205
|
+
const { code, message } = e;
|
|
206
|
+
callback({
|
|
207
|
+
imp_success: false,
|
|
208
|
+
error_code: code,
|
|
209
|
+
error_msg: message,
|
|
209
210
|
});
|
|
211
|
+
});
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
if (iamportUrl.isPaymentOver(redirectUrl)) {
|
|
216
|
+
if (typeof callback === 'function') {
|
|
214
217
|
callback(iamportUrl.getQuery());
|
|
215
|
-
return false;
|
|
216
218
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}}
|
|
231
|
-
/>
|
|
232
|
-
</View>
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
if (isWebViewLoaded && showLoading && iamportUrl.isIframeLoaded()) {
|
|
222
|
+
/**
|
|
223
|
+
* only for IOS
|
|
224
|
+
* iframe이 load되면(url이 about:blank 또는 https://service.iamport.kr이 아니면)
|
|
225
|
+
* webview의 loading 상태를 해제한다
|
|
226
|
+
*/
|
|
227
|
+
setShowLoading(false);
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
233
232
|
{showLoading && (
|
|
234
233
|
<View style={loadingContainer}>{loading || <Loading />}</View>
|
|
235
234
|
)}
|
|
236
|
-
|
|
235
|
+
</>
|
|
237
236
|
);
|
|
238
237
|
}
|
|
239
238
|
|
package/src/constants/index.ts
CHANGED
|
@@ -78,7 +78,7 @@ namespace IMPConst {
|
|
|
78
78
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
79
79
|
|
|
80
80
|
<script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js' ></script>
|
|
81
|
-
<script type='text/javascript' src='https://cdn.iamport.kr/js/iamport.payment-1.
|
|
81
|
+
<script type='text/javascript' src='https://cdn.iamport.kr/js/iamport.payment-1.2.0.js'></script>
|
|
82
82
|
</head>
|
|
83
83
|
<body></body>
|
|
84
84
|
</html>
|
|
@@ -107,12 +107,14 @@ namespace IMPConst {
|
|
|
107
107
|
LPAY: 'lpayapp',
|
|
108
108
|
SSGPAY: 'shinsegaeeasypayment',
|
|
109
109
|
KPAY: 'kpay',
|
|
110
|
+
KBANKPAY: 'ukbanksmartbanknonloginpay',
|
|
110
111
|
PAYNOW: 'lguthepay-xpay',
|
|
111
112
|
WOORIWONCARD: 'com.wooricard.smartapp',
|
|
112
113
|
LPOINT: 'lmslpay',
|
|
113
114
|
KTFAUTH: 'ktauthexternalcall',
|
|
114
115
|
LGTAUTH: 'upluscorporation',
|
|
115
116
|
SKTAUTH: 'tauthlink',
|
|
117
|
+
WOORIWONBANK: 'wooribank',
|
|
116
118
|
} as const;
|
|
117
119
|
|
|
118
120
|
export const ANDROID_PACKAGE = {
|
|
@@ -138,12 +140,14 @@ namespace IMPConst {
|
|
|
138
140
|
PACKAGE_LPAY: 'com.lotte.lpay',
|
|
139
141
|
PACKAGE_SSGPAY: 'com.ssg.serviceapp.android.egiftcertificate',
|
|
140
142
|
PACKAGE_KPAY: 'com.inicis.kpay',
|
|
143
|
+
PACKAGE_KBANKPAY: 'com.kbankwith.smartbank',
|
|
141
144
|
PACKAGE_PAYNOW: 'com.lguplus.paynow',
|
|
142
145
|
PACKAGE_WOORIWONCARD: 'com.wooricard.smartapp',
|
|
143
146
|
PACKAGE_LPOINT: 'com.lottemembers.android',
|
|
144
147
|
PACKAGE_KTFAUTH: 'com.kt.ktauth',
|
|
145
148
|
PACKAGE_LGTAUTH: 'com.lguplus.smartotp',
|
|
146
149
|
PACKAGE_SKTAUTH: 'com.sktelecom.tauth',
|
|
150
|
+
PACKAGE_WOORIWONBANK: 'com.wooribank.smart.npib',
|
|
147
151
|
} as const;
|
|
148
152
|
}
|
|
149
153
|
|
package/src/utils/IamportUrl.ts
CHANGED
|
@@ -32,8 +32,7 @@ class IamportUrl {
|
|
|
32
32
|
this.path = scheme + '://' + host;
|
|
33
33
|
this.scheme = scheme;
|
|
34
34
|
} else if (s.startsWith('package')) {
|
|
35
|
-
|
|
36
|
-
this.package = p;
|
|
35
|
+
this.package = s.split('=')[1];
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
} else {
|
|
@@ -49,8 +48,8 @@ class IamportUrl {
|
|
|
49
48
|
return this.url;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
isPaymentOver() {
|
|
53
|
-
return this.url.includes(
|
|
51
|
+
isPaymentOver(redirectUrl: string) {
|
|
52
|
+
return this.url.includes(redirectUrl);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
isAppUrl() {
|
|
@@ -98,7 +97,7 @@ class IamportUrl {
|
|
|
98
97
|
return IMPConst.IOS_MARKET_PREFIX + 'id1036098908';
|
|
99
98
|
case 'wooripay': // 우리페이
|
|
100
99
|
return IMPConst.IOS_MARKET_PREFIX + 'id1201113419';
|
|
101
|
-
case 'com.wooricard.wcard':
|
|
100
|
+
case 'com.wooricard.wcard': // 우리WON카드
|
|
102
101
|
return IMPConst.IOS_MARKET_PREFIX + 'id1499598869';
|
|
103
102
|
case 'nhallonepayansimclick': // NH농협카드 올원페이(앱카드)
|
|
104
103
|
return IMPConst.IOS_MARKET_PREFIX + 'id1177889176';
|
|
@@ -116,6 +115,10 @@ class IamportUrl {
|
|
|
116
115
|
return IMPConst.IOS_MARKET_PREFIX + 'id1126232922';
|
|
117
116
|
case 'supertoss': // 토스
|
|
118
117
|
return IMPConst.IOS_MARKET_PREFIX + 'id839333328';
|
|
118
|
+
case 'newsmartpib': // 우리WON뱅킹
|
|
119
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1470181651';
|
|
120
|
+
case 'ukbanksmartbanknonloginpay': // 케이뱅크 페이
|
|
121
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1178872627';
|
|
119
122
|
default:
|
|
120
123
|
return this.url;
|
|
121
124
|
}
|
|
@@ -234,6 +237,11 @@ class IamportUrl {
|
|
|
234
237
|
IMPConst.ANDROID_MARKET_PREFIX +
|
|
235
238
|
IMPConst.ANDROID_PACKAGE.PACKAGE_KPAY
|
|
236
239
|
);
|
|
240
|
+
case IMPConst.ANDROID_APPSCHEME.KBANKPAY:
|
|
241
|
+
return (
|
|
242
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
243
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KBANKPAY
|
|
244
|
+
);
|
|
237
245
|
case IMPConst.ANDROID_APPSCHEME.PAYNOW:
|
|
238
246
|
return (
|
|
239
247
|
IMPConst.ANDROID_MARKET_PREFIX +
|
|
@@ -264,6 +272,11 @@ class IamportUrl {
|
|
|
264
272
|
IMPConst.ANDROID_MARKET_PREFIX +
|
|
265
273
|
IMPConst.ANDROID_PACKAGE.PACKAGE_SKTAUTH
|
|
266
274
|
);
|
|
275
|
+
case IMPConst.ANDROID_APPSCHEME.WOORIWONBANK:
|
|
276
|
+
return (
|
|
277
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
278
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_WOORIWONBANK
|
|
279
|
+
);
|
|
267
280
|
default:
|
|
268
281
|
return this.url;
|
|
269
282
|
}
|
|
@@ -281,13 +294,10 @@ class IamportUrl {
|
|
|
281
294
|
return queryString.extract(decodedUrl);
|
|
282
295
|
}
|
|
283
296
|
|
|
284
|
-
getInicisTransQuery() {
|
|
297
|
+
getInicisTransQuery(redirectUrl: string) {
|
|
285
298
|
const { m_redirect_url, imp_uid, merchant_uid } = this.getQuery();
|
|
286
|
-
const inicisTransQuery = {
|
|
287
|
-
|
|
288
|
-
merchant_uid,
|
|
289
|
-
};
|
|
290
|
-
if (m_redirect_url?.includes(IMPConst.M_REDIRECT_URL)) {
|
|
299
|
+
const inicisTransQuery = { imp_uid, merchant_uid };
|
|
300
|
+
if (m_redirect_url?.includes(redirectUrl)) {
|
|
291
301
|
inicisTransQuery.merchant_uid =
|
|
292
302
|
typeof merchant_uid === 'object' ? merchant_uid![0] : merchant_uid;
|
|
293
303
|
} else {
|
|
@@ -297,18 +307,13 @@ class IamportUrl {
|
|
|
297
307
|
}
|
|
298
308
|
|
|
299
309
|
async launchApp() {
|
|
300
|
-
if (Platform.OS === 'ios') {
|
|
301
|
-
if (await Linking.canOpenURL(this.url)) {
|
|
302
|
-
return await Linking.openURL(this.getAppUrl() as string);
|
|
303
|
-
}
|
|
310
|
+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
304
311
|
try {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
try {
|
|
311
|
-
return await Linking.openURL(this.getAppUrl() as string);
|
|
312
|
+
if (await Linking.canOpenURL(this.url)) {
|
|
313
|
+
return await Linking.openURL(this.getAppUrl() as string);
|
|
314
|
+
} else {
|
|
315
|
+
return await Linking.openURL(this.getAppUrl() as string);
|
|
316
|
+
}
|
|
312
317
|
} catch (e) {
|
|
313
318
|
return await Linking.openURL(this.getMarketUrl());
|
|
314
319
|
}
|
package/src/utils/Validation.ts
CHANGED
|
@@ -41,9 +41,22 @@ class Validation {
|
|
|
41
41
|
this.validateCallback();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
validateCallback() {
|
|
44
|
+
validateCallback() {
|
|
45
|
+
if (this.callback !== undefined && typeof this.callback !== 'function') {
|
|
46
|
+
this.isValid = false;
|
|
47
|
+
this.message = '콜백 함수(callback)가 올바르지 않습니다.';
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.validateData();
|
|
51
|
+
}
|
|
45
52
|
|
|
46
|
-
validateData() {
|
|
53
|
+
validateData() {
|
|
54
|
+
if (this.data?.popup) {
|
|
55
|
+
this.isValid = false;
|
|
56
|
+
this.message = '해당 모듈은 팝업을 지원하지 않습니다.';
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
47
60
|
|
|
48
61
|
getIsValid() {
|
|
49
62
|
return this.isValid;
|
|
@@ -55,17 +68,49 @@ class Validation {
|
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
namespace IMPData {
|
|
58
|
-
|
|
71
|
+
interface ICertificationData {
|
|
59
72
|
merchant_uid: string;
|
|
60
73
|
company: string;
|
|
61
74
|
carrier: string;
|
|
62
75
|
name: string;
|
|
63
76
|
phone: string;
|
|
64
77
|
min_age?: string;
|
|
78
|
+
popup?: boolean;
|
|
79
|
+
m_redirect_url?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export class CertificationData implements ICertificationData {
|
|
83
|
+
constructor(
|
|
84
|
+
carrier: string,
|
|
85
|
+
company: string,
|
|
86
|
+
merchant_uid: string,
|
|
87
|
+
name: string,
|
|
88
|
+
phone: string,
|
|
89
|
+
min_age?: string,
|
|
90
|
+
popup?: boolean,
|
|
91
|
+
m_redirect_url?: string
|
|
92
|
+
) {
|
|
93
|
+
this.carrier = carrier;
|
|
94
|
+
this.company = company;
|
|
95
|
+
this.merchant_uid = merchant_uid;
|
|
96
|
+
this.name = name;
|
|
97
|
+
this.phone = phone;
|
|
98
|
+
this.min_age = min_age;
|
|
99
|
+
this.popup = popup;
|
|
100
|
+
this.m_redirect_url = m_redirect_url;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
carrier: string;
|
|
104
|
+
company: string;
|
|
105
|
+
merchant_uid: string;
|
|
106
|
+
name: string;
|
|
107
|
+
phone: string;
|
|
108
|
+
min_age?: string;
|
|
109
|
+
popup?: boolean;
|
|
65
110
|
m_redirect_url?: string;
|
|
66
111
|
}
|
|
67
112
|
|
|
68
|
-
|
|
113
|
+
interface IPaymentData {
|
|
69
114
|
pg: string;
|
|
70
115
|
pay_method: string;
|
|
71
116
|
currency?: string;
|
|
@@ -95,6 +140,98 @@ namespace IMPData {
|
|
|
95
140
|
naverUseCfm?: string;
|
|
96
141
|
naverProducts?: object[];
|
|
97
142
|
m_redirect_url?: string;
|
|
143
|
+
niceMobileV2?: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export class PaymentData implements IPaymentData {
|
|
147
|
+
constructor(
|
|
148
|
+
amount: string | number,
|
|
149
|
+
buyer_email: string,
|
|
150
|
+
buyer_name: string,
|
|
151
|
+
buyer_tel: string,
|
|
152
|
+
escrow: boolean,
|
|
153
|
+
merchant_uid: string,
|
|
154
|
+
name: string,
|
|
155
|
+
pay_method: string,
|
|
156
|
+
pg: string,
|
|
157
|
+
language?: string,
|
|
158
|
+
naverPopupMode?: boolean,
|
|
159
|
+
naverProducts?: object[],
|
|
160
|
+
naverUseCfm?: string,
|
|
161
|
+
niceMobileV2?: boolean,
|
|
162
|
+
notice_url?: string | string[],
|
|
163
|
+
m_redirect_url?: string,
|
|
164
|
+
currency?: string,
|
|
165
|
+
custom_data?: object,
|
|
166
|
+
customer_uid?: string,
|
|
167
|
+
digital?: boolean,
|
|
168
|
+
display?: { card_quota: number[] },
|
|
169
|
+
buyer_postcode?: string,
|
|
170
|
+
app_scheme?: string,
|
|
171
|
+
biz_num?: string,
|
|
172
|
+
buyer_addr?: string,
|
|
173
|
+
popup?: boolean,
|
|
174
|
+
tax_free?: number,
|
|
175
|
+
vbank_due?: string
|
|
176
|
+
) {
|
|
177
|
+
this.amount = amount;
|
|
178
|
+
this.app_scheme = app_scheme;
|
|
179
|
+
this.biz_num = biz_num;
|
|
180
|
+
this.buyer_addr = buyer_addr;
|
|
181
|
+
this.buyer_email = buyer_email;
|
|
182
|
+
this.buyer_name = buyer_name;
|
|
183
|
+
this.buyer_postcode = buyer_postcode;
|
|
184
|
+
this.buyer_tel = buyer_tel;
|
|
185
|
+
this.currency = currency;
|
|
186
|
+
this.custom_data = custom_data;
|
|
187
|
+
this.customer_uid = customer_uid;
|
|
188
|
+
this.digital = digital;
|
|
189
|
+
this.display = display;
|
|
190
|
+
this.escrow = escrow;
|
|
191
|
+
this.language = language;
|
|
192
|
+
this.m_redirect_url = m_redirect_url;
|
|
193
|
+
this.merchant_uid = merchant_uid;
|
|
194
|
+
this.name = name;
|
|
195
|
+
this.naverPopupMode = naverPopupMode;
|
|
196
|
+
this.naverProducts = naverProducts;
|
|
197
|
+
this.naverUseCfm = naverUseCfm;
|
|
198
|
+
this.niceMobileV2 = niceMobileV2;
|
|
199
|
+
this.notice_url = notice_url;
|
|
200
|
+
this.pay_method = pay_method;
|
|
201
|
+
this.pg = pg;
|
|
202
|
+
this.popup = popup;
|
|
203
|
+
this.tax_free = tax_free;
|
|
204
|
+
this.vbank_due = vbank_due;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
amount: string | number;
|
|
208
|
+
app_scheme?: string;
|
|
209
|
+
biz_num?: string;
|
|
210
|
+
buyer_addr?: string;
|
|
211
|
+
buyer_email: string;
|
|
212
|
+
buyer_name: string;
|
|
213
|
+
buyer_postcode?: string;
|
|
214
|
+
buyer_tel: string;
|
|
215
|
+
currency?: string;
|
|
216
|
+
custom_data?: object;
|
|
217
|
+
customer_uid?: string;
|
|
218
|
+
digital?: boolean;
|
|
219
|
+
display?: { card_quota: number[] };
|
|
220
|
+
escrow: boolean;
|
|
221
|
+
language?: string;
|
|
222
|
+
m_redirect_url?: string;
|
|
223
|
+
merchant_uid: string;
|
|
224
|
+
name: string;
|
|
225
|
+
naverPopupMode?: boolean;
|
|
226
|
+
naverProducts?: object[];
|
|
227
|
+
naverUseCfm?: string;
|
|
228
|
+
niceMobileV2?: boolean = true;
|
|
229
|
+
notice_url?: string | string[];
|
|
230
|
+
pay_method: string;
|
|
231
|
+
pg: string;
|
|
232
|
+
popup?: boolean;
|
|
233
|
+
tax_free?: number;
|
|
234
|
+
vbank_due?: string;
|
|
98
235
|
}
|
|
99
236
|
}
|
|
100
237
|
|
|
@@ -6,20 +6,11 @@ class ValidationForPayment extends Validation {
|
|
|
6
6
|
userCode: string,
|
|
7
7
|
loading: object,
|
|
8
8
|
callback: (response: any) => any,
|
|
9
|
-
data: IMPData.PaymentData
|
|
9
|
+
data: IMPData.PaymentData
|
|
10
10
|
) {
|
|
11
11
|
super(userCode, loading, callback, data);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
validateCallback() {
|
|
15
|
-
if (this.callback !== undefined && typeof this.callback !== 'function') {
|
|
16
|
-
this.isValid = false;
|
|
17
|
-
this.message = '콜백 함수(callback)가 올바르지 않습니다.';
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this.validateData();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
14
|
validateData() {
|
|
24
15
|
const {
|
|
25
16
|
pg,
|
|
@@ -83,7 +74,7 @@ class ValidationForPayment extends Validation {
|
|
|
83
74
|
'올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko, en, zh jp 옵션을 지원합니다.';
|
|
84
75
|
return;
|
|
85
76
|
}
|
|
86
|
-
} else if (IMPConst.LANGUAGE.indexOf(language as any)
|
|
77
|
+
} else if (IMPConst.LANGUAGE.indexOf(language as any) === -1) {
|
|
87
78
|
this.isValid = false;
|
|
88
79
|
this.message =
|
|
89
80
|
'올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko 또는 en 옵션을 지원합니다.';
|
|
@@ -109,13 +100,13 @@ class ValidationForPayment extends Validation {
|
|
|
109
100
|
return;
|
|
110
101
|
}
|
|
111
102
|
|
|
112
|
-
if (
|
|
103
|
+
if (popup) {
|
|
113
104
|
this.isValid = false;
|
|
114
|
-
this.message = '해당
|
|
105
|
+
this.message = '해당 모듈은 팝업을 지원하지 않습니다.';
|
|
115
106
|
return;
|
|
116
107
|
}
|
|
117
108
|
|
|
118
|
-
if (
|
|
109
|
+
if (pg === 'naverpay' && naverPopupMode) {
|
|
119
110
|
this.isValid = false;
|
|
120
111
|
this.message =
|
|
121
112
|
'해당 모듈에서 popup은\n네이버 페이 결제시 지원하지 않습니다.';
|