iamport-react-native 1.6.4 → 2.0.0-rc.2
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/LICENSE +21 -0
- package/README.md +25 -320
- package/android/build.gradle +114 -24
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/com/iamportreactnative/IamportReactNativePackage.kt +17 -0
- package/android/src/main/java/com/iamportreactnative/IamportReactNativeViewManager.kt +20 -0
- package/iamport-react-native.podspec +19 -0
- package/ios/IamportReactNative-Bridging-Header.h +1 -0
- package/ios/IamportReactNative.xcodeproj/project.pbxproj +47 -20
- package/ios/IamportReactNativeViewManager.m +12 -0
- package/ios/IamportReactNativeViewManager.swift +32 -0
- package/lib/commonjs/components/Certification/index.js +154 -0
- package/lib/commonjs/components/Certification/index.js.map +1 -0
- package/lib/commonjs/components/ErrorOnParams/index.js +66 -0
- package/lib/commonjs/components/ErrorOnParams/index.js.map +1 -0
- package/lib/commonjs/components/Loading/index.js +50 -0
- package/lib/commonjs/components/Loading/index.js.map +1 -0
- package/lib/commonjs/components/Payment/index.js +288 -0
- package/lib/commonjs/components/Payment/index.js.map +1 -0
- package/lib/commonjs/constants/index.js +103 -0
- package/lib/commonjs/constants/index.js.map +1 -0
- package/{android/src/main/assets → lib/commonjs}/img/iamport-logo.png +0 -0
- package/lib/commonjs/index.js +36 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/styles.js +31 -0
- package/lib/commonjs/styles.js.map +1 -0
- package/lib/commonjs/utils/IamportUrl.js +334 -0
- package/lib/commonjs/utils/IamportUrl.js.map +1 -0
- package/lib/commonjs/utils/Validation.js +72 -0
- package/lib/commonjs/utils/Validation.js.map +1 -0
- package/lib/commonjs/utils/ValidationForPayment.js +143 -0
- package/lib/commonjs/utils/ValidationForPayment.js.map +1 -0
- package/lib/module/components/Certification/index.js +132 -0
- package/lib/module/components/Certification/index.js.map +1 -0
- package/lib/module/components/ErrorOnParams/index.js +55 -0
- package/lib/module/components/ErrorOnParams/index.js.map +1 -0
- package/lib/module/components/Loading/index.js +38 -0
- package/lib/module/components/Loading/index.js.map +1 -0
- package/lib/module/components/Payment/index.js +266 -0
- package/lib/module/components/Payment/index.js.map +1 -0
- package/lib/module/constants/index.js +98 -0
- package/lib/module/constants/index.js.map +1 -0
- package/lib/module/img/iamport-logo.png +0 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/styles.js +21 -0
- package/lib/module/styles.js.map +1 -0
- package/lib/module/utils/IamportUrl.js +322 -0
- package/lib/module/utils/IamportUrl.js.map +1 -0
- package/{src → lib/module}/utils/Validation.js +25 -9
- package/lib/module/utils/Validation.js.map +1 -0
- package/{src → lib/module}/utils/ValidationForPayment.js +23 -13
- package/lib/module/utils/ValidationForPayment.js.map +1 -0
- package/lib/typescript/components/Certification/index.d.ts +10 -0
- package/lib/typescript/components/ErrorOnParams/index.d.ts +5 -0
- package/lib/typescript/components/Loading/index.d.ts +2 -0
- package/lib/typescript/components/Payment/index.d.ts +10 -0
- package/lib/typescript/constants/index.d.ts +76 -0
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/styles.d.ts +19 -0
- package/lib/typescript/utils/IamportUrl.d.ts +19 -0
- package/lib/typescript/utils/Validation.d.ts +58 -0
- package/lib/typescript/utils/ValidationForPayment.d.ts +7 -0
- package/package.json +98 -20
- package/src/components/Certification/index.tsx +112 -0
- package/src/components/ErrorOnParams/{index.js → index.tsx} +20 -25
- package/src/components/Loading/{index.js → index.tsx} +9 -10
- package/src/components/Payment/index.tsx +243 -0
- package/src/constants/index.ts +150 -0
- package/src/{index.js → index.tsx} +4 -1
- package/src/{styles.js → styles.ts} +3 -1
- package/src/utils/IamportUrl.ts +319 -0
- package/src/utils/Validation.ts +101 -0
- package/src/utils/ValidationForPayment.ts +146 -0
- package/IamportReactNative.podspec +0 -19
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/gradlew +0 -172
- package/android/gradlew.bat +0 -84
- package/android/src/main/java/com/iamport/IamportModule.java +0 -88
- package/android/src/main/java/com/iamport/IamportPackage.java +0 -23
- package/ios/IamportReactNative.h +0 -11
- package/ios/IamportReactNative.m +0 -23
- package/ios/IamportReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/IamportReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/IamportReactNative.xcworkspace/contents.xcworkspacedata +0 -9
- package/manuals/CALLBACK.md +0 -68
- package/manuals/EXAMPLE.md +0 -175
- package/manuals/EXPO.md +0 -66
- package/manuals/INSTALL.md +0 -72
- package/manuals/SETTING.md +0 -72
- package/manuals/SUPPORT.md +0 -30
- package/manuals/TRANS.md +0 -122
- package/manuals/VERSION.md +0 -114
- package/manuals/assets/webview-peer-dependency.png +0 -0
- package/src/components/Certification/index.js +0 -99
- package/src/components/Payment/PaymentWebView.js +0 -285
- package/src/components/Payment/index.android.js +0 -51
- package/src/components/Payment/index.ios.js +0 -30
- package/src/constants/index.js +0 -83
- package/src/img/after-linking-iamport.png +0 -0
- package/src/img/after-linking-webview.png +0 -0
- package/src/img/allow-arbitrary.gif +0 -0
- package/src/img/android-studio-avd-manager.png +0 -0
- package/src/img/android-studio-build.png +0 -0
- package/src/img/app-scheme-registry.gif +0 -0
- package/src/img/expo-eject.png +0 -0
- package/src/img/ios-emulator-certification.png +0 -0
- package/src/img/ios-emulator-home.png +0 -0
- package/src/img/ios-emulator-payment.png +0 -0
- package/src/img/ios-trans-create-header-file-1.png +0 -0
- package/src/img/ios-trans-create-header-file-2.png +0 -0
- package/src/img/ios-trans-create-objectivec-file-1.png +0 -0
- package/src/img/ios-trans-create-objectivec-file-2.png +0 -0
- package/src/img/ios-trans-result.png +0 -0
- package/src/utils/IamportUrl.js +0 -103
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import queryString from 'query-string';
|
|
2
|
+
import { Linking, Platform } from 'react-native';
|
|
3
|
+
import { IMPConst } from '../constants';
|
|
4
|
+
|
|
5
|
+
class IamportUrl {
|
|
6
|
+
url: string;
|
|
7
|
+
scheme: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
package?: string; // Android only
|
|
10
|
+
|
|
11
|
+
constructor(url: string) {
|
|
12
|
+
this.url = url;
|
|
13
|
+
let splittedUrl = url.replace('://', ' ').split(' ');
|
|
14
|
+
this.scheme = splittedUrl[0];
|
|
15
|
+
if (Platform.OS === 'ios') {
|
|
16
|
+
this.path =
|
|
17
|
+
this.scheme === 'itmss' ? `https://${splittedUrl[1]}` : this.url;
|
|
18
|
+
} else if (Platform.OS === 'android') {
|
|
19
|
+
if (this.isAppUrl()) {
|
|
20
|
+
if (this.scheme.includes('intent')) {
|
|
21
|
+
let intentUrl = splittedUrl[1].split('#Intent;');
|
|
22
|
+
let host = intentUrl[0];
|
|
23
|
+
let args = intentUrl[1].split(';');
|
|
24
|
+
|
|
25
|
+
if (this.scheme !== 'intent') {
|
|
26
|
+
this.scheme = this.scheme.split(':')[1];
|
|
27
|
+
this.path = this.scheme + '://' + host;
|
|
28
|
+
}
|
|
29
|
+
args.forEach((s) => {
|
|
30
|
+
if (s.startsWith('scheme')) {
|
|
31
|
+
let scheme = s.split('=')[1];
|
|
32
|
+
this.path = scheme + '://' + host;
|
|
33
|
+
this.scheme = scheme;
|
|
34
|
+
} else if (s.startsWith('package')) {
|
|
35
|
+
let p = s.split('=')[1];
|
|
36
|
+
this.package = p;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
this.path = this.url;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
this.path = this.url;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getUrl() {
|
|
49
|
+
return this.url;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
isPaymentOver() {
|
|
53
|
+
return this.url.includes(IMPConst.M_REDIRECT_URL);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
isAppUrl() {
|
|
57
|
+
return !['http', 'https', 'about:blank'].includes(this.scheme);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
isIframeLoaded() {
|
|
61
|
+
return (
|
|
62
|
+
this.url !== 'about:blank' && !this.url.startsWith(IMPConst.IMP_SDK_URL)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getAppUrl() {
|
|
67
|
+
return this.path;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getMarketUrl() {
|
|
71
|
+
if (Platform.OS === 'ios') {
|
|
72
|
+
switch (this.scheme) {
|
|
73
|
+
case 'kftc-bankpay': // 뱅크페이
|
|
74
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id398456030';
|
|
75
|
+
case 'ispmobile': // ISP/페이북
|
|
76
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id369125087';
|
|
77
|
+
case 'hdcardappcardansimclick': // 현대카드 앱카드
|
|
78
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id702653088';
|
|
79
|
+
case 'shinhan-sr-ansimclick': // 신한 앱카드
|
|
80
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id572462317';
|
|
81
|
+
case 'kb-acp': // KB국민 앱카드
|
|
82
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id695436326';
|
|
83
|
+
case 'mpocket.online.ansimclick': // 삼성앱카드
|
|
84
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id535125356';
|
|
85
|
+
case 'lottesmartpay': // 롯데 모바일결제
|
|
86
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id668497947';
|
|
87
|
+
case 'lotteappcard': // 롯데 앱카드
|
|
88
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id688047200';
|
|
89
|
+
case 'cloudpay': // 하나1Q페이(앱카드)
|
|
90
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id847268987';
|
|
91
|
+
case 'citimobileapp': // 시티은행 앱카드
|
|
92
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1179759666';
|
|
93
|
+
case 'payco': // 페이코
|
|
94
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id924292102';
|
|
95
|
+
case 'kakaotalk': // 카카오톡
|
|
96
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id362057947';
|
|
97
|
+
case 'lpayapp': // 롯데 L.pay
|
|
98
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1036098908';
|
|
99
|
+
case 'wooripay': // 우리페이
|
|
100
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1201113419';
|
|
101
|
+
case 'com.wooricard.wcard':
|
|
102
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1499598869';
|
|
103
|
+
case 'nhallonepayansimclick': // NH농협카드 올원페이(앱카드)
|
|
104
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1177889176';
|
|
105
|
+
case 'hanawalletmembers': // 하나카드(하나멤버스 월렛)
|
|
106
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1038288833';
|
|
107
|
+
case 'shinsegaeeasypayment': // 신세계 SSGPAY
|
|
108
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id666237916';
|
|
109
|
+
case 'naversearchthirdlogin': // 네이버페이 앱 로그인
|
|
110
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id393499958';
|
|
111
|
+
case 'lguthepay-xpay': // 페이나우
|
|
112
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id760098906';
|
|
113
|
+
case 'lmslpay': // 롯데 L.POINT
|
|
114
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id473250588';
|
|
115
|
+
case 'liivbank': // Liiv 국민
|
|
116
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id1126232922';
|
|
117
|
+
case 'supertoss': // 토스
|
|
118
|
+
return IMPConst.IOS_MARKET_PREFIX + 'id839333328';
|
|
119
|
+
default:
|
|
120
|
+
return this.url;
|
|
121
|
+
}
|
|
122
|
+
} else if (Platform.OS === 'android') {
|
|
123
|
+
if (this.package != null) {
|
|
124
|
+
return IMPConst.ANDROID_MARKET_PREFIX + this.package;
|
|
125
|
+
}
|
|
126
|
+
switch (this.scheme) {
|
|
127
|
+
case IMPConst.ANDROID_APPSCHEME.ISP:
|
|
128
|
+
return (
|
|
129
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
130
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_ISP
|
|
131
|
+
);
|
|
132
|
+
case IMPConst.ANDROID_APPSCHEME.BANKPAY:
|
|
133
|
+
return (
|
|
134
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
135
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_BANKPAY
|
|
136
|
+
);
|
|
137
|
+
case IMPConst.ANDROID_APPSCHEME.KB_BANKPAY:
|
|
138
|
+
return (
|
|
139
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
140
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KB_BANKPAY
|
|
141
|
+
);
|
|
142
|
+
case IMPConst.ANDROID_APPSCHEME.NH_BANKPAY:
|
|
143
|
+
return (
|
|
144
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
145
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_NH_BANKPAY
|
|
146
|
+
);
|
|
147
|
+
case IMPConst.ANDROID_APPSCHEME.MG_BANKPAY:
|
|
148
|
+
return (
|
|
149
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
150
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_MG_BANKPAY
|
|
151
|
+
);
|
|
152
|
+
case IMPConst.ANDROID_APPSCHEME.KN_BANKPAY:
|
|
153
|
+
return (
|
|
154
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
155
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KN_BANKPAY
|
|
156
|
+
);
|
|
157
|
+
case IMPConst.ANDROID_APPSCHEME.KAKAOPAY:
|
|
158
|
+
return (
|
|
159
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
160
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KAKAOPAY
|
|
161
|
+
);
|
|
162
|
+
case IMPConst.ANDROID_APPSCHEME.SMILEPAY:
|
|
163
|
+
return (
|
|
164
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
165
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SMILEPAY
|
|
166
|
+
);
|
|
167
|
+
case IMPConst.ANDROID_APPSCHEME.CHAIPAY:
|
|
168
|
+
return (
|
|
169
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
170
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_CHAIPAY
|
|
171
|
+
);
|
|
172
|
+
case IMPConst.ANDROID_APPSCHEME.PAYCO:
|
|
173
|
+
return (
|
|
174
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
175
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_PAYCO
|
|
176
|
+
);
|
|
177
|
+
case IMPConst.ANDROID_APPSCHEME.HYUNDAICARD:
|
|
178
|
+
return (
|
|
179
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
180
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_HYUNDAICARD
|
|
181
|
+
);
|
|
182
|
+
case IMPConst.ANDROID_APPSCHEME.TOSS:
|
|
183
|
+
return (
|
|
184
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
185
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_TOSS
|
|
186
|
+
);
|
|
187
|
+
case IMPConst.ANDROID_APPSCHEME.SHINHANCARD:
|
|
188
|
+
return (
|
|
189
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
190
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SHINHANCARD
|
|
191
|
+
);
|
|
192
|
+
case IMPConst.ANDROID_APPSCHEME.HANACARD:
|
|
193
|
+
return (
|
|
194
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
195
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_HANACARD
|
|
196
|
+
);
|
|
197
|
+
case IMPConst.ANDROID_APPSCHEME.SAMSUNGCARD:
|
|
198
|
+
return (
|
|
199
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
200
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SAMSUNGCARD
|
|
201
|
+
);
|
|
202
|
+
case IMPConst.ANDROID_APPSCHEME.KBCARD:
|
|
203
|
+
return (
|
|
204
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
205
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KBCARD
|
|
206
|
+
);
|
|
207
|
+
case IMPConst.ANDROID_APPSCHEME.NHCARD:
|
|
208
|
+
return (
|
|
209
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
210
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_NHCARD
|
|
211
|
+
);
|
|
212
|
+
case IMPConst.ANDROID_APPSCHEME.CITICARD:
|
|
213
|
+
return (
|
|
214
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
215
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_CITICARD
|
|
216
|
+
);
|
|
217
|
+
case IMPConst.ANDROID_APPSCHEME.LOTTECARD:
|
|
218
|
+
return (
|
|
219
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
220
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_LOTTECARD
|
|
221
|
+
);
|
|
222
|
+
case IMPConst.ANDROID_APPSCHEME.LPAY:
|
|
223
|
+
return (
|
|
224
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
225
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_LPAY
|
|
226
|
+
);
|
|
227
|
+
case IMPConst.ANDROID_APPSCHEME.SSGPAY:
|
|
228
|
+
return (
|
|
229
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
230
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SSGPAY
|
|
231
|
+
);
|
|
232
|
+
case IMPConst.ANDROID_APPSCHEME.KPAY:
|
|
233
|
+
return (
|
|
234
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
235
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KPAY
|
|
236
|
+
);
|
|
237
|
+
case IMPConst.ANDROID_APPSCHEME.PAYNOW:
|
|
238
|
+
return (
|
|
239
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
240
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_PAYNOW
|
|
241
|
+
);
|
|
242
|
+
case IMPConst.ANDROID_APPSCHEME.WOORIWONCARD:
|
|
243
|
+
return (
|
|
244
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
245
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_WOORIWONCARD
|
|
246
|
+
);
|
|
247
|
+
case IMPConst.ANDROID_APPSCHEME.LPOINT:
|
|
248
|
+
return (
|
|
249
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
250
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_LPOINT
|
|
251
|
+
);
|
|
252
|
+
case IMPConst.ANDROID_APPSCHEME.KTFAUTH:
|
|
253
|
+
return (
|
|
254
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
255
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_KTFAUTH
|
|
256
|
+
);
|
|
257
|
+
case IMPConst.ANDROID_APPSCHEME.LGTAUTH:
|
|
258
|
+
return (
|
|
259
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
260
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_LGTAUTH
|
|
261
|
+
);
|
|
262
|
+
case IMPConst.ANDROID_APPSCHEME.SKTAUTH:
|
|
263
|
+
return (
|
|
264
|
+
IMPConst.ANDROID_MARKET_PREFIX +
|
|
265
|
+
IMPConst.ANDROID_PACKAGE.PACKAGE_SKTAUTH
|
|
266
|
+
);
|
|
267
|
+
default:
|
|
268
|
+
return this.url;
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
return this.url;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
getQuery() {
|
|
276
|
+
return queryString.parse(this.getStringifiedQuery());
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
getStringifiedQuery() {
|
|
280
|
+
const decodedUrl = decodeURIComponent(this.url);
|
|
281
|
+
return queryString.extract(decodedUrl);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
getInicisTransQuery() {
|
|
285
|
+
const { m_redirect_url, imp_uid, merchant_uid } = this.getQuery();
|
|
286
|
+
const inicisTransQuery = {
|
|
287
|
+
imp_uid: imp_uid,
|
|
288
|
+
merchant_uid,
|
|
289
|
+
};
|
|
290
|
+
if (m_redirect_url?.includes(IMPConst.M_REDIRECT_URL)) {
|
|
291
|
+
inicisTransQuery.merchant_uid =
|
|
292
|
+
typeof merchant_uid === 'object' ? merchant_uid![0] : merchant_uid;
|
|
293
|
+
} else {
|
|
294
|
+
inicisTransQuery.merchant_uid = merchant_uid;
|
|
295
|
+
}
|
|
296
|
+
return queryString.stringify(inicisTransQuery);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async launchApp() {
|
|
300
|
+
if (Platform.OS === 'ios') {
|
|
301
|
+
if (await Linking.canOpenURL(this.url)) {
|
|
302
|
+
return await Linking.openURL(this.getAppUrl() as string);
|
|
303
|
+
}
|
|
304
|
+
try {
|
|
305
|
+
return await Linking.openURL(this.getAppUrl() as string);
|
|
306
|
+
} catch (e) {
|
|
307
|
+
return await Linking.openURL(this.getMarketUrl());
|
|
308
|
+
}
|
|
309
|
+
} else if (Platform.OS === 'android') {
|
|
310
|
+
try {
|
|
311
|
+
return await Linking.openURL(this.getAppUrl() as string);
|
|
312
|
+
} catch (e) {
|
|
313
|
+
return await Linking.openURL(this.getMarketUrl());
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export default IamportUrl;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
class Validation {
|
|
2
|
+
userCode: string;
|
|
3
|
+
loading: object;
|
|
4
|
+
callback: ((response: any) => any) | undefined;
|
|
5
|
+
data: IMPData.CertificationData | IMPData.PaymentData | undefined;
|
|
6
|
+
isValid: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
userCode: string,
|
|
11
|
+
loading: object,
|
|
12
|
+
callback?: (response: any) => any,
|
|
13
|
+
data?: IMPData.CertificationData | IMPData.PaymentData
|
|
14
|
+
) {
|
|
15
|
+
this.userCode = userCode;
|
|
16
|
+
this.loading = loading;
|
|
17
|
+
this.callback = callback;
|
|
18
|
+
this.data = data;
|
|
19
|
+
|
|
20
|
+
this.isValid = true;
|
|
21
|
+
this.message = '';
|
|
22
|
+
|
|
23
|
+
this.validateUserCode();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
validateUserCode() {
|
|
27
|
+
if (!this.userCode) {
|
|
28
|
+
this.isValid = false;
|
|
29
|
+
this.message = '가맹점 식별코드(userCode)는 필수입력입니다.';
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.validateLoading();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
validateLoading() {
|
|
36
|
+
if (this.loading !== undefined && typeof this.loading !== 'object') {
|
|
37
|
+
this.isValid = false;
|
|
38
|
+
this.message = '로딩(loading) 컴포넌트가 올바르지 않습니다.';
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.validateCallback();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
validateCallback() {}
|
|
45
|
+
|
|
46
|
+
validateData() {}
|
|
47
|
+
|
|
48
|
+
getIsValid() {
|
|
49
|
+
return this.isValid;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getMessage() {
|
|
53
|
+
return this.message;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
namespace IMPData {
|
|
58
|
+
export interface CertificationData {
|
|
59
|
+
merchant_uid: string;
|
|
60
|
+
company: string;
|
|
61
|
+
carrier: string;
|
|
62
|
+
name: string;
|
|
63
|
+
phone: string;
|
|
64
|
+
min_age?: string;
|
|
65
|
+
m_redirect_url?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface PaymentData {
|
|
69
|
+
pg: string;
|
|
70
|
+
pay_method: string;
|
|
71
|
+
currency?: string;
|
|
72
|
+
notice_url?: string | string[];
|
|
73
|
+
display?: {
|
|
74
|
+
card_quota: number[];
|
|
75
|
+
};
|
|
76
|
+
merchant_uid: string;
|
|
77
|
+
amount: string | number;
|
|
78
|
+
buyer_tel: string;
|
|
79
|
+
app_scheme?: string;
|
|
80
|
+
escrow: boolean;
|
|
81
|
+
name: string;
|
|
82
|
+
tax_free?: number;
|
|
83
|
+
buyer_name: string;
|
|
84
|
+
buyer_email: string;
|
|
85
|
+
buyer_addr?: string;
|
|
86
|
+
buyer_postcode?: string;
|
|
87
|
+
custom_data?: object;
|
|
88
|
+
vbank_due?: string;
|
|
89
|
+
popup?: boolean;
|
|
90
|
+
digital?: boolean;
|
|
91
|
+
language?: string;
|
|
92
|
+
biz_num?: string;
|
|
93
|
+
customer_uid?: string;
|
|
94
|
+
naverPopupMode?: boolean;
|
|
95
|
+
naverUseCfm?: string;
|
|
96
|
+
naverProducts?: object[];
|
|
97
|
+
m_redirect_url?: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { Validation, IMPData };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Validation, IMPData } from './Validation';
|
|
2
|
+
import { IMPConst } from '../constants';
|
|
3
|
+
|
|
4
|
+
class ValidationForPayment extends Validation {
|
|
5
|
+
constructor(
|
|
6
|
+
userCode: string,
|
|
7
|
+
loading: object,
|
|
8
|
+
callback: (response: any) => any,
|
|
9
|
+
data: IMPData.PaymentData,
|
|
10
|
+
) {
|
|
11
|
+
super(userCode, loading, callback, data);
|
|
12
|
+
}
|
|
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
|
+
validateData() {
|
|
24
|
+
const {
|
|
25
|
+
pg,
|
|
26
|
+
pay_method,
|
|
27
|
+
merchant_uid,
|
|
28
|
+
amount,
|
|
29
|
+
buyer_tel,
|
|
30
|
+
app_scheme,
|
|
31
|
+
language,
|
|
32
|
+
digital,
|
|
33
|
+
biz_num,
|
|
34
|
+
customer_uid,
|
|
35
|
+
naverPopupMode,
|
|
36
|
+
popup,
|
|
37
|
+
} = <IMPData.PaymentData>this.data;
|
|
38
|
+
|
|
39
|
+
if (this.data === undefined) {
|
|
40
|
+
this.isValid = false;
|
|
41
|
+
this.message = '결제 파라미터(data)는 필수입력입니다.';
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (merchant_uid === undefined) {
|
|
46
|
+
this.isValid = false;
|
|
47
|
+
this.message = '주문번호(merchant_uid)는 필수입력입니다.';
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (amount === undefined) {
|
|
52
|
+
this.isValid = false;
|
|
53
|
+
this.message = '결제금액(amount)은 필수입력입니다.';
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (buyer_tel === undefined) {
|
|
58
|
+
this.isValid = false;
|
|
59
|
+
this.message = '구매자 번호(buyer_tel)는 필수입력입니다.';
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (app_scheme === undefined) {
|
|
64
|
+
this.isValid = false;
|
|
65
|
+
this.message = 'app_scheme은 필수입력입니다.';
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (pg) {
|
|
70
|
+
const [pgProvider] = pg.split('.');
|
|
71
|
+
if (IMPConst.PG.indexOf(pgProvider as any) === -1) {
|
|
72
|
+
this.isValid = false;
|
|
73
|
+
this.message = 'PG사가 올바르지 않습니다.';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (language && pg !== 'paypal') {
|
|
78
|
+
if (IMPConst.EN_AVAILABLE_PG.indexOf(pg as any) !== -1) {
|
|
79
|
+
if (pg === 'eximbay') {
|
|
80
|
+
if (!['ko', 'en', 'zh', 'jp'].includes(language)) {
|
|
81
|
+
this.isValid = false;
|
|
82
|
+
this.message =
|
|
83
|
+
'올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko, en, zh jp 옵션을 지원합니다.';
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
} else if (IMPConst.LANGUAGE.indexOf(language as any) !== -1) {
|
|
87
|
+
this.isValid = false;
|
|
88
|
+
this.message =
|
|
89
|
+
'올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko 또는 en 옵션을 지원합니다.';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
} else if (language !== 'ko') {
|
|
93
|
+
this.isValid = false;
|
|
94
|
+
this.message =
|
|
95
|
+
'올바르지 않은 언어 설정입니다.\n 선택하신 PG사는 ko 옵션만 지원합니다.';
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (pay_method === 'phone' && digital === undefined) {
|
|
101
|
+
this.isValid = false;
|
|
102
|
+
this.message = '휴대폰 소액결제시 digital은 필수입력입니다.';
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (pg === 'syrup') {
|
|
107
|
+
this.isValid = false;
|
|
108
|
+
this.message = '해당 모듈은 현재 시럽페이를 지원하지 않습니다.';
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (pg === 'paypal' && popup) {
|
|
113
|
+
this.isValid = false;
|
|
114
|
+
this.message = '해당 모듈에서 popup은\n페이팔 결제시 지원하지 않습니다.';
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if ((pg === 'naverpay') && naverPopupMode) {
|
|
119
|
+
this.isValid = false;
|
|
120
|
+
this.message =
|
|
121
|
+
'해당 모듈에서 popup은\n네이버 페이 결제시 지원하지 않습니다.';
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (
|
|
126
|
+
pg === 'danal_tpay' &&
|
|
127
|
+
pay_method === 'vbank' &&
|
|
128
|
+
biz_num === undefined
|
|
129
|
+
) {
|
|
130
|
+
this.isValid = false;
|
|
131
|
+
this.message = '다날-가상계좌시 biz_num은 필수입력입니다.';
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (
|
|
136
|
+
(pg === 'kcp_billing' || pg === 'syrup') &&
|
|
137
|
+
customer_uid === undefined
|
|
138
|
+
) {
|
|
139
|
+
this.isValid = false;
|
|
140
|
+
this.message = '정기결제시 customer_uid는 필수입력입니다.';
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export default ValidationForPayment;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "IamportReactNative"
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.homepage = package['homepage']
|
|
10
|
-
s.license = package['license']
|
|
11
|
-
s.author = package['author']
|
|
12
|
-
s.platform = :ios, "7.0"
|
|
13
|
-
s.source = { :git => "https://github.com/iamport/iamport-react-native.git", :tag => "master" }
|
|
14
|
-
s.source_files = "IamportReactNative/**/*.{h,m}"
|
|
15
|
-
s.requires_arc = true
|
|
16
|
-
|
|
17
|
-
s.dependency "React"
|
|
18
|
-
|
|
19
|
-
end
|
|
Binary file
|