iamport-react-native 2.0.0-rc.0 → 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/ios/IamportReactNativeViewManager.m +5 -0
- package/lib/commonjs/components/Certification/index.js +36 -30
- 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 +14 -4
- package/lib/commonjs/constants/index.js.map +1 -1
- package/lib/commonjs/utils/IamportUrl.js +36 -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 +36 -29
- 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 +14 -4
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/utils/IamportUrl.js +36 -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 +12 -2
- package/lib/typescript/utils/IamportUrl.d.ts +2 -2
- package/lib/typescript/utils/Validation.d.ts +52 -2
- package/lib/typescript/utils/ValidationForPayment.d.ts +0 -1
- package/package.json +18 -18
- package/src/components/Certification/index.tsx +69 -59
- 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 +12 -1
- package/src/utils/IamportUrl.ts +42 -22
- package/src/utils/Validation.ts +142 -4
- package/src/utils/ValidationForPayment.ts +5 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
1
|
+
import React, { createRef, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { WebView } from 'react-native-webview';
|
|
4
4
|
|
|
5
5
|
import Loading from '../Loading';
|
|
@@ -9,87 +9,97 @@ import { IMPData, Validation } from '../../utils/Validation';
|
|
|
9
9
|
import { IMPConst } from '../../constants';
|
|
10
10
|
|
|
11
11
|
import viewStyles from '../../styles';
|
|
12
|
+
import IamportUrl from '../../utils/IamportUrl';
|
|
12
13
|
|
|
13
14
|
type Props = {
|
|
14
15
|
userCode: string;
|
|
15
16
|
tierCode?: string;
|
|
16
17
|
data: IMPData.CertificationData;
|
|
17
|
-
loading
|
|
18
|
+
loading?: any;
|
|
18
19
|
callback: (response: any) => any;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
function Certification({ userCode, tierCode, data, loading, callback }: Props) {
|
|
22
23
|
const [isWebViewLoaded, setIsWebViewLoaded] = useState(false);
|
|
23
|
-
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
|
+
}
|
|
24
30
|
|
|
25
|
-
const validation = new Validation(userCode, loading);
|
|
26
31
|
if (validation.getIsValid()) {
|
|
27
|
-
const {
|
|
32
|
+
const { loadingContainer, webViewContainer } = viewStyles;
|
|
28
33
|
return (
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onLoadEnd={() => {
|
|
40
|
-
if (!isWebViewLoaded) {
|
|
41
|
-
// html이 load되고 최초 한번만 inject javascript
|
|
42
|
-
if (tierCode) {
|
|
43
|
-
webview.current?.injectJavaScript(`
|
|
34
|
+
<>
|
|
35
|
+
<WebView
|
|
36
|
+
containerStyle={webViewContainer}
|
|
37
|
+
ref={webview}
|
|
38
|
+
source={{ html: IMPConst.WEBVIEW_SOURCE_HTML }}
|
|
39
|
+
onLoadEnd={() => {
|
|
40
|
+
if (!isWebViewLoaded) {
|
|
41
|
+
// html이 load되고 최초 한번만 inject javascript
|
|
42
|
+
if (tierCode) {
|
|
43
|
+
webview.current?.injectJavaScript(`
|
|
44
44
|
setTimeout(function() { IMP.agency("${userCode}", "${tierCode}"); });
|
|
45
45
|
`);
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
} else {
|
|
47
|
+
webview.current?.injectJavaScript(`
|
|
48
48
|
setTimeout(function() { IMP.init("${userCode}"); });
|
|
49
49
|
`);
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
}
|
|
51
|
+
webview.current?.injectJavaScript(`
|
|
52
52
|
setTimeout(function() {
|
|
53
53
|
IMP.certification(${JSON.stringify(data)}, function(response) {
|
|
54
54
|
window.ReactNativeWebView.postMessage(JSON.stringify(response));
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
`);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
response = JSON.parse(response);
|
|
58
|
+
setIsWebViewLoaded(true);
|
|
59
|
+
}
|
|
60
|
+
}}
|
|
61
|
+
onMessage={(e) => {
|
|
62
|
+
let data = e.nativeEvent.data;
|
|
63
|
+
if (decodeURIComponent(data) !== data) {
|
|
64
|
+
data = decodeURIComponent(data);
|
|
65
|
+
}
|
|
66
|
+
let response = JSON.parse(data);
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
68
|
+
if (typeof callback === 'function') {
|
|
69
|
+
callback(response);
|
|
70
|
+
}
|
|
71
|
+
}}
|
|
72
|
+
startInLoadingState
|
|
73
|
+
renderLoading={() => (
|
|
74
|
+
<View style={loadingContainer}>{loading || <Loading />}</View>
|
|
75
|
+
)}
|
|
76
|
+
originWhitelist={['*']} // https://github.com/facebook/react-native/issues/19986
|
|
77
|
+
onShouldStartLoadWithRequest={(request) => {
|
|
78
|
+
const { url } = request;
|
|
79
|
+
// console.log('url: ' + url);
|
|
80
|
+
const iamportUrl = new IamportUrl(url);
|
|
81
|
+
if (iamportUrl.isAppUrl()) {
|
|
82
|
+
/* 3rd-party 앱 오픈 */
|
|
83
|
+
iamportUrl.launchApp().catch((e) => {
|
|
84
|
+
const { code, message } = e;
|
|
85
|
+
callback({
|
|
86
|
+
imp_success: false,
|
|
87
|
+
error_code: code,
|
|
88
|
+
error_msg: message,
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
if (iamportUrl.isPaymentOver(redirectUrl)) {
|
|
95
|
+
callback(iamportUrl.getQuery());
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return true;
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
</>
|
|
93
103
|
);
|
|
94
104
|
}
|
|
95
105
|
|
|
@@ -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
|
@@ -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,9 +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',
|
|
114
|
+
KTFAUTH: 'ktauthexternalcall',
|
|
115
|
+
LGTAUTH: 'upluscorporation',
|
|
116
|
+
SKTAUTH: 'tauthlink',
|
|
117
|
+
WOORIWONBANK: 'wooribank',
|
|
112
118
|
} as const;
|
|
113
119
|
|
|
114
120
|
export const ANDROID_PACKAGE = {
|
|
@@ -134,9 +140,14 @@ namespace IMPConst {
|
|
|
134
140
|
PACKAGE_LPAY: 'com.lotte.lpay',
|
|
135
141
|
PACKAGE_SSGPAY: 'com.ssg.serviceapp.android.egiftcertificate',
|
|
136
142
|
PACKAGE_KPAY: 'com.inicis.kpay',
|
|
143
|
+
PACKAGE_KBANKPAY: 'com.kbankwith.smartbank',
|
|
137
144
|
PACKAGE_PAYNOW: 'com.lguplus.paynow',
|
|
138
145
|
PACKAGE_WOORIWONCARD: 'com.wooricard.smartapp',
|
|
139
146
|
PACKAGE_LPOINT: 'com.lottemembers.android',
|
|
147
|
+
PACKAGE_KTFAUTH: 'com.kt.ktauth',
|
|
148
|
+
PACKAGE_LGTAUTH: 'com.lguplus.smartotp',
|
|
149
|
+
PACKAGE_SKTAUTH: 'com.sktelecom.tauth',
|
|
150
|
+
PACKAGE_WOORIWONBANK: 'com.wooribank.smart.npib',
|
|
140
151
|
} as const;
|
|
141
152
|
}
|
|
142
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 +
|
|
@@ -249,6 +257,26 @@ class IamportUrl {
|
|
|
249
257
|
IMPConst.ANDROID_MARKET_PREFIX +
|
|
250
258
|
IMPConst.ANDROID_PACKAGE.PACKAGE_LPOINT
|
|
251
259
|
);
|
|
260
|
+
case IMPConst.ANDROID_APPSCHEME.KTFAUTH:
|
|
261
|
+
return (
|
|
262
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
263
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KTFAUTH
|
|
264
|
+
);
|
|
265
|
+
case IMPConst.ANDROID_APPSCHEME.LGTAUTH:
|
|
266
|
+
return (
|
|
267
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
268
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_LGTAUTH
|
|
269
|
+
);
|
|
270
|
+
case IMPConst.ANDROID_APPSCHEME.SKTAUTH:
|
|
271
|
+
return (
|
|
272
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
273
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SKTAUTH
|
|
274
|
+
);
|
|
275
|
+
case IMPConst.ANDROID_APPSCHEME.WOORIWONBANK:
|
|
276
|
+
return (
|
|
277
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
278
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_WOORIWONBANK
|
|
279
|
+
);
|
|
252
280
|
default:
|
|
253
281
|
return this.url;
|
|
254
282
|
}
|
|
@@ -266,13 +294,10 @@ class IamportUrl {
|
|
|
266
294
|
return queryString.extract(decodedUrl);
|
|
267
295
|
}
|
|
268
296
|
|
|
269
|
-
getInicisTransQuery() {
|
|
297
|
+
getInicisTransQuery(redirectUrl: string) {
|
|
270
298
|
const { m_redirect_url, imp_uid, merchant_uid } = this.getQuery();
|
|
271
|
-
const inicisTransQuery = {
|
|
272
|
-
|
|
273
|
-
merchant_uid,
|
|
274
|
-
};
|
|
275
|
-
if (m_redirect_url?.includes(IMPConst.M_REDIRECT_URL)) {
|
|
299
|
+
const inicisTransQuery = { imp_uid, merchant_uid };
|
|
300
|
+
if (m_redirect_url?.includes(redirectUrl)) {
|
|
276
301
|
inicisTransQuery.merchant_uid =
|
|
277
302
|
typeof merchant_uid === 'object' ? merchant_uid![0] : merchant_uid;
|
|
278
303
|
} else {
|
|
@@ -282,18 +307,13 @@ class IamportUrl {
|
|
|
282
307
|
}
|
|
283
308
|
|
|
284
309
|
async launchApp() {
|
|
285
|
-
if (Platform.OS === 'ios') {
|
|
286
|
-
if (await Linking.canOpenURL(this.url)) {
|
|
287
|
-
return await Linking.openURL(this.getAppUrl() as string);
|
|
288
|
-
}
|
|
289
|
-
try {
|
|
290
|
-
return await Linking.openURL(this.getAppUrl() as string);
|
|
291
|
-
} catch (e) {
|
|
292
|
-
return await Linking.openURL(this.getMarketUrl());
|
|
293
|
-
}
|
|
294
|
-
} else if (Platform.OS === 'android') {
|
|
310
|
+
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
295
311
|
try {
|
|
296
|
-
|
|
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
|
+
}
|
|
297
317
|
} catch (e) {
|
|
298
318
|
return await Linking.openURL(this.getMarketUrl());
|
|
299
319
|
}
|