iamport-react-native 2.0.0-rc.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/build.gradle +1 -3
- package/ios/IamportReactNativeViewManager.m +5 -0
- package/lib/commonjs/components/Certification/index.js +20 -24
- 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 +25 -25
- package/lib/commonjs/components/Payment/index.js.map +1 -1
- package/lib/commonjs/constants/index.js +8 -4
- 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 +4 -14
- package/lib/commonjs/utils/ValidationForPayment.js.map +1 -1
- package/lib/module/components/Certification/index.js +21 -25
- 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 +25 -25
- package/lib/module/components/Payment/index.js.map +1 -1
- package/lib/module/constants/index.js +8 -4
- 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 +4 -14
- 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 +6 -2
- 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 +66 -66
- package/src/components/ErrorOnParams/index.tsx +4 -23
- package/src/components/Loading/index.tsx +3 -11
- package/src/components/Payment/index.tsx +82 -81
- package/src/constants/index.ts +6 -1
- package/src/utils/IamportUrl.ts +27 -22
- package/src/utils/Validation.ts +141 -4
- package/src/utils/ValidationForPayment.ts +5 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { createRef, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { WebView } from 'react-native-webview';
|
|
4
4
|
|
|
@@ -15,93 +15,93 @@ type Props = {
|
|
|
15
15
|
userCode: string;
|
|
16
16
|
tierCode?: string;
|
|
17
17
|
data: IMPData.CertificationData;
|
|
18
|
-
loading
|
|
18
|
+
loading?: any;
|
|
19
19
|
callback: (response: any) => any;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
function Certification({ userCode, tierCode, data, loading, callback }: Props) {
|
|
23
23
|
const [isWebViewLoaded, setIsWebViewLoaded] = useState(false);
|
|
24
|
-
const webview =
|
|
24
|
+
const webview = createRef<WebView>();
|
|
25
|
+
const validation = new Validation(userCode, loading, callback, data);
|
|
26
|
+
let redirectUrl = IMPConst.M_REDIRECT_URL;
|
|
27
|
+
if (data.m_redirect_url !== undefined && data.m_redirect_url.trim() !== '') {
|
|
28
|
+
redirectUrl = data.m_redirect_url;
|
|
29
|
+
} else {
|
|
30
|
+
data.m_redirect_url = redirectUrl;
|
|
31
|
+
}
|
|
25
32
|
|
|
26
|
-
const validation = new Validation(userCode, loading);
|
|
27
33
|
if (validation.getIsValid()) {
|
|
28
|
-
const {
|
|
34
|
+
const { loadingContainer, webViewContainer } = viewStyles;
|
|
29
35
|
return (
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onLoadEnd={() => {
|
|
41
|
-
if (!isWebViewLoaded) {
|
|
42
|
-
// html이 load되고 최초 한번만 inject javascript
|
|
43
|
-
if (tierCode) {
|
|
44
|
-
webview.current?.injectJavaScript(`
|
|
36
|
+
<>
|
|
37
|
+
<WebView
|
|
38
|
+
containerStyle={webViewContainer}
|
|
39
|
+
ref={webview}
|
|
40
|
+
source={{ html: IMPConst.WEBVIEW_SOURCE_HTML }}
|
|
41
|
+
onLoadEnd={() => {
|
|
42
|
+
if (!isWebViewLoaded) {
|
|
43
|
+
// html이 load되고 최초 한번만 inject javascript
|
|
44
|
+
if (tierCode) {
|
|
45
|
+
webview.current?.injectJavaScript(`
|
|
45
46
|
setTimeout(function() { IMP.agency("${userCode}", "${tierCode}"); });
|
|
46
47
|
`);
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
} else {
|
|
49
|
+
webview.current?.injectJavaScript(`
|
|
49
50
|
setTimeout(function() { IMP.init("${userCode}"); });
|
|
50
51
|
`);
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
}
|
|
53
|
+
webview.current?.injectJavaScript(`
|
|
53
54
|
setTimeout(function() {
|
|
54
55
|
IMP.certification(${JSON.stringify(data)}, function(response) {
|
|
55
56
|
window.ReactNativeWebView.postMessage(JSON.stringify(response));
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
`);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
response = JSON.parse(response);
|
|
60
|
+
setIsWebViewLoaded(true);
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
onMessage={(e) => {
|
|
64
|
+
let data = e.nativeEvent.data;
|
|
65
|
+
if (decodeURIComponent(data) !== data) {
|
|
66
|
+
data = decodeURIComponent(data);
|
|
67
|
+
}
|
|
68
|
+
let response = JSON.parse(data);
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
70
|
+
if (typeof callback === 'function') {
|
|
71
|
+
callback(response);
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
startInLoadingState
|
|
75
|
+
renderLoading={() => (
|
|
76
|
+
<View style={loadingContainer}>{loading || <Loading />}</View>
|
|
77
|
+
)}
|
|
78
|
+
originWhitelist={['*']} // https://github.com/facebook/react-native/issues/19986
|
|
79
|
+
onShouldStartLoadWithRequest={(request) => {
|
|
80
|
+
const { url } = request;
|
|
81
|
+
// console.log('url: ' + url);
|
|
82
|
+
const iamportUrl = new IamportUrl(url);
|
|
83
|
+
if (iamportUrl.isAppUrl()) {
|
|
84
|
+
/* 3rd-party 앱 오픈 */
|
|
85
|
+
iamportUrl.launchApp().catch((e) => {
|
|
86
|
+
const { code, message } = e;
|
|
87
|
+
callback({
|
|
88
|
+
imp_success: false,
|
|
89
|
+
error_code: code,
|
|
90
|
+
error_msg: message,
|
|
91
91
|
});
|
|
92
|
+
});
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (iamportUrl.isPaymentOver(redirectUrl)) {
|
|
97
|
+
callback(iamportUrl.getQuery());
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</View>
|
|
101
|
+
return true;
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
</>
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -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,12 @@ 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
|
+
} else {
|
|
34
|
+
data.m_redirect_url = redirectUrl;
|
|
35
|
+
}
|
|
30
36
|
|
|
31
37
|
useEffect(() => {
|
|
32
38
|
const { pg } = data;
|
|
@@ -68,9 +74,9 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
68
74
|
if (pg.startsWith('html5_inicis') && Platform.OS === 'ios') {
|
|
69
75
|
if (isInicisTransPaid) {
|
|
70
76
|
webview.current?.injectJavaScript(`
|
|
71
|
-
window.location.href = "${
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
window.location.href = "${redirectUrl}?${iamportUrl.getInicisTransQuery(
|
|
78
|
+
redirectUrl
|
|
79
|
+
)}";
|
|
74
80
|
`);
|
|
75
81
|
} else {
|
|
76
82
|
setIsInicisTransPaid(true);
|
|
@@ -94,7 +100,7 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
94
100
|
}
|
|
95
101
|
};
|
|
96
102
|
Linking.addEventListener('url', handleOpenURL);
|
|
97
|
-
}, [data, isInicisTransPaid, webview]);
|
|
103
|
+
}, [data, isInicisTransPaid, redirectUrl, webview]);
|
|
98
104
|
|
|
99
105
|
const removeLoadingNeeded = () => {
|
|
100
106
|
if (showLoading && Platform.OS === 'android') {
|
|
@@ -135,30 +141,29 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
135
141
|
data
|
|
136
142
|
);
|
|
137
143
|
if (validation.getIsValid()) {
|
|
138
|
-
const {
|
|
144
|
+
const { loadingContainer, webViewContainer } = viewStyles;
|
|
139
145
|
return (
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
146
|
+
<>
|
|
147
|
+
<WebView
|
|
148
|
+
containerStyle={webViewContainer}
|
|
149
|
+
ref={webview}
|
|
150
|
+
source={webviewSource}
|
|
151
|
+
onLoadEnd={() => {
|
|
152
|
+
if (!isWebViewLoaded) {
|
|
153
|
+
if (data.pg.startsWith('eximbay')) {
|
|
154
|
+
data.popup = false;
|
|
155
|
+
}
|
|
151
156
|
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
if (tierCode) {
|
|
158
|
+
webview.current?.injectJavaScript(`
|
|
154
159
|
setTimeout(function() { IMP.agency("${userCode}", "${tierCode}"); });
|
|
155
160
|
`);
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
} else {
|
|
162
|
+
webview.current?.injectJavaScript(`
|
|
158
163
|
setTimeout(function() { IMP.init("${userCode}"); });
|
|
159
164
|
`);
|
|
160
|
-
|
|
161
|
-
|
|
165
|
+
}
|
|
166
|
+
webview.current?.injectJavaScript(`
|
|
162
167
|
setTimeout(function() {
|
|
163
168
|
IMP.request_pay(${JSON.stringify(
|
|
164
169
|
data
|
|
@@ -167,73 +172,69 @@ function Payment({ userCode, tierCode, data, loading, callback }: Props) {
|
|
|
167
172
|
});
|
|
168
173
|
});
|
|
169
174
|
`);
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
setIsWebViewLoaded(true);
|
|
176
|
+
}
|
|
172
177
|
|
|
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);
|
|
178
|
+
// only for Android
|
|
179
|
+
if (removeLoadingNeeded()) {
|
|
180
|
+
setShowLoading(false);
|
|
181
|
+
}
|
|
182
|
+
}}
|
|
183
|
+
/* PG사가 callback을 지원하는 경우, 결제결과를 받아 callback을 실행한다 */
|
|
184
|
+
onMessage={(e) => {
|
|
185
|
+
/**
|
|
186
|
+
* [v1.6.0] 다날의 경우 response에 주문명(name)이 포함되어 있는데
|
|
187
|
+
* 주문명에 %가 들어갈 경우, decodeURIComponent시 URI malformed 에러가 발생하는 것 대비해
|
|
188
|
+
* 우선 encodeURIComponent를 한 후, decodeURIComponent가 끝나면
|
|
189
|
+
* 최종적으로 decodeURIComponent를 한 번 더 한다
|
|
190
|
+
*/
|
|
191
|
+
const encoded = encodeURIComponent(e.nativeEvent.data);
|
|
192
|
+
const decoded = decodeURIComponent(encoded);
|
|
193
|
+
const response = JSON.parse(decoded);
|
|
194
|
+
if (typeof callback === 'function') {
|
|
193
195
|
callback(response);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
196
|
+
}
|
|
197
|
+
}}
|
|
198
|
+
originWhitelist={['*']} // https://github.com/facebook/react-native/issues/19986
|
|
199
|
+
sharedCookiesEnabled={true}
|
|
200
|
+
onShouldStartLoadWithRequest={(request) => {
|
|
201
|
+
const { url } = request;
|
|
202
|
+
// console.log(`url: ${url}`);
|
|
203
|
+
const iamportUrl = new IamportUrl(url);
|
|
204
|
+
if (iamportUrl.isAppUrl()) {
|
|
205
|
+
/* 3rd-party 앱 오픈 */
|
|
206
|
+
iamportUrl.launchApp().catch((e) => {
|
|
207
|
+
const { code, message } = e;
|
|
208
|
+
callback({
|
|
209
|
+
imp_success: false,
|
|
210
|
+
error_code: code,
|
|
211
|
+
error_msg: message,
|
|
209
212
|
});
|
|
213
|
+
});
|
|
210
214
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
if (iamportUrl.isPaymentOver(redirectUrl)) {
|
|
218
|
+
if (typeof callback === 'function') {
|
|
214
219
|
callback(iamportUrl.getQuery());
|
|
215
|
-
return false;
|
|
216
220
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}}
|
|
231
|
-
/>
|
|
232
|
-
</View>
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
if (isWebViewLoaded && showLoading && iamportUrl.isIframeLoaded()) {
|
|
224
|
+
/**
|
|
225
|
+
* only for IOS
|
|
226
|
+
* iframe이 load되면(url이 about:blank 또는 https://service.iamport.kr이 아니면)
|
|
227
|
+
* webview의 loading 상태를 해제한다
|
|
228
|
+
*/
|
|
229
|
+
setShowLoading(false);
|
|
230
|
+
}
|
|
231
|
+
return true;
|
|
232
|
+
}}
|
|
233
|
+
/>
|
|
233
234
|
{showLoading && (
|
|
234
235
|
<View style={loadingContainer}>{loading || <Loading />}</View>
|
|
235
236
|
)}
|
|
236
|
-
|
|
237
|
+
</>
|
|
237
238
|
);
|
|
238
239
|
}
|
|
239
240
|
|
package/src/constants/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ namespace IMPConst {
|
|
|
25
25
|
'alipay',
|
|
26
26
|
'bluewalnut',
|
|
27
27
|
'tosspay',
|
|
28
|
+
'smartro',
|
|
28
29
|
] as const;
|
|
29
30
|
|
|
30
31
|
export const PAY_METHOD = [
|
|
@@ -77,7 +78,7 @@ namespace IMPConst {
|
|
|
77
78
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
78
79
|
|
|
79
80
|
<script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js' ></script>
|
|
80
|
-
<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>
|
|
81
82
|
</head>
|
|
82
83
|
<body></body>
|
|
83
84
|
</html>
|
|
@@ -106,12 +107,14 @@ namespace IMPConst {
|
|
|
106
107
|
LPAY: 'lpayapp',
|
|
107
108
|
SSGPAY: 'shinsegaeeasypayment',
|
|
108
109
|
KPAY: 'kpay',
|
|
110
|
+
KBANKPAY: 'ukbanksmartbanknonloginpay',
|
|
109
111
|
PAYNOW: 'lguthepay-xpay',
|
|
110
112
|
WOORIWONCARD: 'com.wooricard.smartapp',
|
|
111
113
|
LPOINT: 'lmslpay',
|
|
112
114
|
KTFAUTH: 'ktauthexternalcall',
|
|
113
115
|
LGTAUTH: 'upluscorporation',
|
|
114
116
|
SKTAUTH: 'tauthlink',
|
|
117
|
+
WOORIWONBANK: 'wooribank',
|
|
115
118
|
} as const;
|
|
116
119
|
|
|
117
120
|
export const ANDROID_PACKAGE = {
|
|
@@ -137,12 +140,14 @@ namespace IMPConst {
|
|
|
137
140
|
PACKAGE_LPAY: 'com.lotte.lpay',
|
|
138
141
|
PACKAGE_SSGPAY: 'com.ssg.serviceapp.android.egiftcertificate',
|
|
139
142
|
PACKAGE_KPAY: 'com.inicis.kpay',
|
|
143
|
+
PACKAGE_KBANKPAY: 'com.kbankwith.smartbank',
|
|
140
144
|
PACKAGE_PAYNOW: 'com.lguplus.paynow',
|
|
141
145
|
PACKAGE_WOORIWONCARD: 'com.wooricard.smartapp',
|
|
142
146
|
PACKAGE_LPOINT: 'com.lottemembers.android',
|
|
143
147
|
PACKAGE_KTFAUTH: 'com.kt.ktauth',
|
|
144
148
|
PACKAGE_LGTAUTH: 'com.lguplus.smartotp',
|
|
145
149
|
PACKAGE_SKTAUTH: 'com.sktelecom.tauth',
|
|
150
|
+
PACKAGE_WOORIWONBANK: 'com.wooribank.smart.npib',
|
|
146
151
|
} as const;
|
|
147
152
|
}
|
|
148
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
|
}
|