iamport-react-native 2.0.15 → 3.0.1-alpha.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.
Files changed (430) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +12 -2
  3. package/lib/module/components/Certification/index.js +75 -72
  4. package/lib/module/components/Certification/index.js.map +1 -1
  5. package/lib/module/components/ErrorOnParams/index.js +13 -9
  6. package/lib/module/components/ErrorOnParams/index.js.map +1 -1
  7. package/lib/module/components/Loading/index.js +13 -9
  8. package/lib/module/components/Loading/index.js.map +1 -1
  9. package/lib/module/components/Payment/index.js +111 -93
  10. package/lib/module/components/Payment/index.js.map +1 -1
  11. package/lib/module/constants/index.js +2 -0
  12. package/lib/module/constants/index.js.map +1 -1
  13. package/lib/module/index.js +6 -4
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/package.json +1 -0
  16. package/lib/module/styles.js +2 -0
  17. package/lib/module/styles.js.map +1 -1
  18. package/lib/module/utils/IamportUrl.js +51 -29
  19. package/lib/module/utils/IamportUrl.js.map +1 -1
  20. package/lib/module/utils/Validation.js +3 -2
  21. package/lib/module/utils/Validation.js.map +1 -1
  22. package/lib/module/utils/ValidationForPayment.js +4 -2
  23. package/lib/module/utils/ValidationForPayment.js.map +1 -1
  24. package/lib/typescript/package.json +1 -0
  25. package/lib/typescript/{components → src/components}/Certification/index.d.ts +1 -2
  26. package/lib/typescript/src/components/Certification/index.d.ts.map +1 -0
  27. package/lib/typescript/src/components/ErrorOnParams/index.d.ts +6 -0
  28. package/lib/typescript/src/components/ErrorOnParams/index.d.ts.map +1 -0
  29. package/lib/typescript/src/components/Loading/index.d.ts +3 -0
  30. package/lib/typescript/src/components/Loading/index.d.ts.map +1 -0
  31. package/lib/typescript/{components → src/components}/Payment/index.d.ts +1 -2
  32. package/lib/typescript/src/components/Payment/index.d.ts.map +1 -0
  33. package/lib/typescript/src/constants/index.d.ts.map +1 -0
  34. package/lib/typescript/src/index.d.ts.map +1 -0
  35. package/lib/typescript/{styles.d.ts → src/styles.d.ts} +2 -2
  36. package/lib/typescript/src/styles.d.ts.map +1 -0
  37. package/lib/typescript/{utils → src/utils}/IamportUrl.d.ts +8 -7
  38. package/lib/typescript/src/utils/IamportUrl.d.ts.map +1 -0
  39. package/lib/typescript/src/utils/Validation.d.ts.map +1 -0
  40. package/lib/typescript/src/utils/ValidationForPayment.d.ts.map +1 -0
  41. package/package.json +81 -74
  42. package/src/components/Certification/index.tsx +7 -7
  43. package/src/components/ErrorOnParams/index.tsx +1 -2
  44. package/src/components/Loading/index.tsx +1 -2
  45. package/src/components/Payment/index.tsx +31 -7
  46. package/src/utils/IamportUrl.ts +54 -26
  47. package/.circleci/config.yml +0 -98
  48. package/.editorconfig +0 -15
  49. package/.gitattributes +0 -3
  50. package/.gitignore +0 -69
  51. package/.yarnrc +0 -3
  52. package/.yarnrc.yml +0 -1
  53. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  54. package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
  55. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  56. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  57. package/android/.gradle/8.9/executionHistory/executionHistory.lock +0 -0
  58. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  59. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  60. package/android/.gradle/8.9/gc.properties +0 -0
  61. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  62. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  63. package/android/.gradle/vcs-1/gc.properties +0 -0
  64. package/android/build.gradle +0 -128
  65. package/android/gradle.properties +0 -4
  66. package/android/src/main/AndroidManifest.xml +0 -4
  67. package/android/src/main/java/com/iamportreactnative/IamportReactNativePackage.kt +0 -17
  68. package/android/src/main/java/com/iamportreactnative/IamportReactNativeViewManager.kt +0 -20
  69. package/babel.config.js +0 -3
  70. package/example/.gitignore +0 -69
  71. package/example/README.md +0 -44
  72. package/example/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  73. package/example/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  74. package/example/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  75. package/example/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  76. package/example/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  77. package/example/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  78. package/example/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  79. package/example/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  80. package/example/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  81. package/example/android/.gradle/7.5.1/gc.properties +0 -0
  82. package/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  83. package/example/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  84. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  85. package/example/android/app/build.gradle +0 -183
  86. package/example/android/app/debug.keystore +0 -0
  87. package/example/android/app/proguard-rules.pro +0 -10
  88. package/example/android/app/src/debug/AndroidManifest.xml +0 -8
  89. package/example/android/app/src/debug/java/com/example/iamportreactnative/ReactNativeFlipper.java +0 -69
  90. package/example/android/app/src/main/AndroidManifest.xml +0 -34
  91. package/example/android/app/src/main/java/com/example/iamportreactnative/MainActivity.java +0 -15
  92. package/example/android/app/src/main/java/com/example/iamportreactnative/MainApplication.java +0 -80
  93. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  94. package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  95. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  96. package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  97. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  98. package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  99. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  100. package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  101. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  102. package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  103. package/example/android/app/src/main/res/values/strings.xml +0 -3
  104. package/example/android/app/src/main/res/values/styles.xml +0 -9
  105. package/example/android/build.gradle +0 -21
  106. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  107. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  108. package/example/android/gradle.properties +0 -44
  109. package/example/android/gradlew +0 -183
  110. package/example/android/gradlew.bat +0 -103
  111. package/example/android/settings.gradle +0 -9
  112. package/example/app.json +0 -4
  113. package/example/babel.config.js +0 -11
  114. package/example/index.js +0 -5
  115. package/example/ios/File.swift +0 -8
  116. package/example/ios/Gemfile +0 -7
  117. package/example/ios/Gemfile.lock +0 -99
  118. package/example/ios/IamportReactNativeExample/AppDelegate.h +0 -15
  119. package/example/ios/IamportReactNativeExample/AppDelegate.mm +0 -138
  120. package/example/ios/IamportReactNativeExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  121. package/example/ios/IamportReactNativeExample/Images.xcassets/Contents.json +0 -6
  122. package/example/ios/IamportReactNativeExample/Info.plist +0 -121
  123. package/example/ios/IamportReactNativeExample/LaunchScreen.storyboard +0 -58
  124. package/example/ios/IamportReactNativeExample/main.m +0 -16
  125. package/example/ios/IamportReactNativeExample-Bridging-Header.h +0 -3
  126. package/example/ios/IamportReactNativeExample.xcodeproj/project.pbxproj +0 -969
  127. package/example/ios/IamportReactNativeExample.xcodeproj/xcshareddata/xcschemes/IamportReactNativeExample.xcscheme +0 -99
  128. package/example/ios/IamportReactNativeExample.xcworkspace/contents.xcworkspacedata +0 -10
  129. package/example/ios/IamportReactNativeExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  130. package/example/ios/Podfile +0 -57
  131. package/example/ios/Podfile.lock +0 -756
  132. package/example/metro.config.js +0 -66
  133. package/example/package.json +0 -40
  134. package/example/src/App.tsx +0 -17
  135. package/example/src/Certification/index.tsx +0 -30
  136. package/example/src/CertificationResult/index.tsx +0 -79
  137. package/example/src/CertificationTest/index.tsx +0 -214
  138. package/example/src/Home/index.tsx +0 -87
  139. package/example/src/Loading/index.tsx +0 -12
  140. package/example/src/NavigationService.tsx +0 -127
  141. package/example/src/Payment/index.tsx +0 -28
  142. package/example/src/PaymentResult/index.tsx +0 -96
  143. package/example/src/PaymentTest/index.tsx +0 -383
  144. package/example/src/Picker/index.tsx +0 -60
  145. package/example/src/constants.ts +0 -274
  146. package/example/src/utils.ts +0 -83
  147. package/example/yarn.lock +0 -7358
  148. package/exampleForExpo/.buckconfig +0 -6
  149. package/exampleForExpo/.expo/README.md +0 -8
  150. package/exampleForExpo/.expo/devices.json +0 -3
  151. package/exampleForExpo/.gitattributes +0 -1
  152. package/exampleForExpo/.gitignore +0 -125
  153. package/exampleForExpo/.idea/.gitignore +0 -3
  154. package/exampleForExpo/.idea/caches/deviceStreaming.xml +0 -549
  155. package/exampleForExpo/.idea/exampleForExpo.iml +0 -9
  156. package/exampleForExpo/.idea/misc.xml +0 -6
  157. package/exampleForExpo/.idea/modules.xml +0 -8
  158. package/exampleForExpo/.idea/vcs.xml +0 -6
  159. package/exampleForExpo/.idea/workspace.xml +0 -53
  160. package/exampleForExpo/README.md +0 -58
  161. package/exampleForExpo/__tests__/App.js +0 -10
  162. package/exampleForExpo/android/.gitignore +0 -21
  163. package/exampleForExpo/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  164. package/exampleForExpo/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  165. package/exampleForExpo/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  166. package/exampleForExpo/android/.gradle/7.5.1/gc.properties +0 -0
  167. package/exampleForExpo/android/.gradle/vcs-1/gc.properties +0 -0
  168. package/exampleForExpo/android/app/BUCK +0 -55
  169. package/exampleForExpo/android/app/build.gradle +0 -362
  170. package/exampleForExpo/android/app/build_defs.bzl +0 -19
  171. package/exampleForExpo/android/app/debug.keystore +0 -0
  172. package/exampleForExpo/android/app/proguard-rules.pro +0 -14
  173. package/exampleForExpo/android/app/src/debug/AndroidManifest.xml +0 -7
  174. package/exampleForExpo/android/app/src/debug/java/kr/iamport/exampleForExpo/ReactNativeFlipper.java +0 -69
  175. package/exampleForExpo/android/app/src/main/AndroidManifest.xml +0 -34
  176. package/exampleForExpo/android/app/src/main/java/kr/iamport/exampleForExpo/MainActivity.java +0 -83
  177. package/exampleForExpo/android/app/src/main/java/kr/iamport/exampleForExpo/MainApplication.java +0 -106
  178. package/exampleForExpo/android/app/src/main/java/kr/iamport/exampleForExpo/newarchitecture/MainApplicationReactNativeHost.java +0 -117
  179. package/exampleForExpo/android/app/src/main/java/kr/iamport/exampleForExpo/newarchitecture/components/MainComponentsRegistry.java +0 -36
  180. package/exampleForExpo/android/app/src/main/java/kr/iamport/exampleForExpo/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +0 -48
  181. package/exampleForExpo/android/app/src/main/jni/CMakeLists.txt +0 -7
  182. package/exampleForExpo/android/app/src/main/jni/MainApplicationModuleProvider.cpp +0 -32
  183. package/exampleForExpo/android/app/src/main/jni/MainApplicationModuleProvider.h +0 -16
  184. package/exampleForExpo/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +0 -45
  185. package/exampleForExpo/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +0 -38
  186. package/exampleForExpo/android/app/src/main/jni/MainComponentsRegistry.cpp +0 -65
  187. package/exampleForExpo/android/app/src/main/jni/MainComponentsRegistry.h +0 -32
  188. package/exampleForExpo/android/app/src/main/jni/OnLoad.cpp +0 -11
  189. package/exampleForExpo/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
  190. package/exampleForExpo/android/app/src/main/res/drawable/splashscreen.xml +0 -4
  191. package/exampleForExpo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  192. package/exampleForExpo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  193. package/exampleForExpo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  194. package/exampleForExpo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  195. package/exampleForExpo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  196. package/exampleForExpo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  197. package/exampleForExpo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  198. package/exampleForExpo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  199. package/exampleForExpo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  200. package/exampleForExpo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  201. package/exampleForExpo/android/app/src/main/res/values/colors.xml +0 -4
  202. package/exampleForExpo/android/app/src/main/res/values/strings.xml +0 -3
  203. package/exampleForExpo/android/app/src/main/res/values/styles.xml +0 -17
  204. package/exampleForExpo/android/app/src/main/res/values-night/colors.xml +0 -1
  205. package/exampleForExpo/android/build.gradle +0 -65
  206. package/exampleForExpo/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  207. package/exampleForExpo/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  208. package/exampleForExpo/android/gradle.properties +0 -53
  209. package/exampleForExpo/android/gradlew +0 -240
  210. package/exampleForExpo/android/gradlew.bat +0 -91
  211. package/exampleForExpo/android/settings.gradle +0 -17
  212. package/exampleForExpo/app.json +0 -16
  213. package/exampleForExpo/babel.config.js +0 -11
  214. package/exampleForExpo/index.js +0 -9
  215. package/exampleForExpo/ios/.gitignore +0 -30
  216. package/exampleForExpo/ios/.xcode.env +0 -11
  217. package/exampleForExpo/ios/Podfile +0 -61
  218. package/exampleForExpo/ios/Podfile.lock +0 -734
  219. package/exampleForExpo/ios/Podfile.properties.json +0 -3
  220. package/exampleForExpo/ios/exampleForExpo/AppDelegate.h +0 -9
  221. package/exampleForExpo/ios/exampleForExpo/AppDelegate.mm +0 -166
  222. package/exampleForExpo/ios/exampleForExpo/Images.xcassets/AppIcon.appiconset/Contents.json +0 -38
  223. package/exampleForExpo/ios/exampleForExpo/Images.xcassets/Contents.json +0 -6
  224. package/exampleForExpo/ios/exampleForExpo/Images.xcassets/SplashScreenBackground.imageset/Contents.json +0 -21
  225. package/exampleForExpo/ios/exampleForExpo/Images.xcassets/SplashScreenBackground.imageset/image.png +0 -0
  226. package/exampleForExpo/ios/exampleForExpo/Info.plist +0 -118
  227. package/exampleForExpo/ios/exampleForExpo/SplashScreen.storyboard +0 -43
  228. package/exampleForExpo/ios/exampleForExpo/Supporting/Expo.plist +0 -16
  229. package/exampleForExpo/ios/exampleForExpo/exampleForExpo.entitlements +0 -8
  230. package/exampleForExpo/ios/exampleForExpo/main.m +0 -10
  231. package/exampleForExpo/ios/exampleForExpo/noop-file.swift +0 -4
  232. package/exampleForExpo/ios/exampleForExpo.xcodeproj/project.pbxproj +0 -544
  233. package/exampleForExpo/ios/exampleForExpo.xcodeproj/xcshareddata/xcschemes/exampleForExpo.xcscheme +0 -88
  234. package/exampleForExpo/ios/exampleForExpo.xcworkspace/contents.xcworkspacedata +0 -10
  235. package/exampleForExpo/ios/exampleForExpo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  236. package/exampleForExpo/metro.config.js +0 -62
  237. package/exampleForExpo/package.json +0 -40
  238. package/exampleForExpo/src/App.js +0 -14
  239. package/exampleForExpo/src/Certification/index.js +0 -25
  240. package/exampleForExpo/src/CertificationResult/index.js +0 -61
  241. package/exampleForExpo/src/CertificationTest/index.js +0 -151
  242. package/exampleForExpo/src/Home/index.js +0 -80
  243. package/exampleForExpo/src/Loading/index.js +0 -10
  244. package/exampleForExpo/src/NavigationService.js +0 -102
  245. package/exampleForExpo/src/Payment/index.js +0 -23
  246. package/exampleForExpo/src/PaymentResult/index.js +0 -82
  247. package/exampleForExpo/src/PaymentTest/index.js +0 -313
  248. package/exampleForExpo/src/Picker/index.js +0 -19
  249. package/exampleForExpo/src/constants.js +0 -322
  250. package/exampleForExpo/src/utils.js +0 -116
  251. package/exampleForExpo/yarn.lock +0 -9498
  252. package/exampleForManagedExpo/.expo-shared/assets.json +0 -4
  253. package/exampleForManagedExpo/.gitignore +0 -22
  254. package/exampleForManagedExpo/App.js +0 -11
  255. package/exampleForManagedExpo/README.md +0 -33
  256. package/exampleForManagedExpo/app.json +0 -90
  257. package/exampleForManagedExpo/assets/adaptive-icon.png +0 -0
  258. package/exampleForManagedExpo/assets/favicon.png +0 -0
  259. package/exampleForManagedExpo/assets/icon.png +0 -0
  260. package/exampleForManagedExpo/assets/splash.png +0 -0
  261. package/exampleForManagedExpo/babel.config.js +0 -11
  262. package/exampleForManagedExpo/metro.config.js +0 -62
  263. package/exampleForManagedExpo/package.json +0 -36
  264. package/exampleForManagedExpo/src/Certification/index.js +0 -25
  265. package/exampleForManagedExpo/src/CertificationResult/index.js +0 -61
  266. package/exampleForManagedExpo/src/CertificationTest/index.js +0 -151
  267. package/exampleForManagedExpo/src/Home/index.js +0 -80
  268. package/exampleForManagedExpo/src/Loading/index.js +0 -10
  269. package/exampleForManagedExpo/src/NavigationService.js +0 -102
  270. package/exampleForManagedExpo/src/Payment/index.js +0 -23
  271. package/exampleForManagedExpo/src/PaymentResult/index.js +0 -82
  272. package/exampleForManagedExpo/src/PaymentTest/index.js +0 -313
  273. package/exampleForManagedExpo/src/Picker/index.js +0 -19
  274. package/exampleForManagedExpo/src/constants.js +0 -322
  275. package/exampleForManagedExpo/src/utils.js +0 -116
  276. package/exampleForManagedExpo/yarn.lock +0 -9411
  277. package/exampleForWebView/.buckconfig +0 -6
  278. package/exampleForWebView/.eslintrc.js +0 -4
  279. package/exampleForWebView/.gitattributes +0 -3
  280. package/exampleForWebView/.gitignore +0 -68
  281. package/exampleForWebView/.prettierrc.js +0 -7
  282. package/exampleForWebView/.watchmanconfig +0 -1
  283. package/exampleForWebView/README.md +0 -77
  284. package/exampleForWebView/__tests__/App-test.tsx +0 -14
  285. package/exampleForWebView/_editorconfig +0 -3
  286. package/exampleForWebView/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  287. package/exampleForWebView/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  288. package/exampleForWebView/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  289. package/exampleForWebView/android/.gradle/7.5.1/gc.properties +0 -0
  290. package/exampleForWebView/android/.gradle/vcs-1/gc.properties +0 -0
  291. package/exampleForWebView/android/app/BUCK +0 -55
  292. package/exampleForWebView/android/app/build.gradle +0 -313
  293. package/exampleForWebView/android/app/build_defs.bzl +0 -19
  294. package/exampleForWebView/android/app/debug.keystore +0 -0
  295. package/exampleForWebView/android/app/proguard-rules.pro +0 -10
  296. package/exampleForWebView/android/app/src/debug/AndroidManifest.xml +0 -13
  297. package/exampleForWebView/android/app/src/debug/java/com/exampleforwebview/ReactNativeFlipper.java +0 -73
  298. package/exampleForWebView/android/app/src/main/AndroidManifest.xml +0 -26
  299. package/exampleForWebView/android/app/src/main/java/com/exampleforwebview/MainActivity.java +0 -48
  300. package/exampleForWebView/android/app/src/main/java/com/exampleforwebview/MainApplication.java +0 -91
  301. package/exampleForWebView/android/app/src/main/java/com/exampleforwebview/newarchitecture/MainApplicationReactNativeHost.java +0 -116
  302. package/exampleForWebView/android/app/src/main/java/com/exampleforwebview/newarchitecture/components/MainComponentsRegistry.java +0 -36
  303. package/exampleForWebView/android/app/src/main/java/com/exampleforwebview/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +0 -48
  304. package/exampleForWebView/android/app/src/main/jni/CMakeLists.txt +0 -7
  305. package/exampleForWebView/android/app/src/main/jni/MainApplicationModuleProvider.cpp +0 -32
  306. package/exampleForWebView/android/app/src/main/jni/MainApplicationModuleProvider.h +0 -16
  307. package/exampleForWebView/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +0 -45
  308. package/exampleForWebView/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +0 -38
  309. package/exampleForWebView/android/app/src/main/jni/MainComponentsRegistry.cpp +0 -65
  310. package/exampleForWebView/android/app/src/main/jni/MainComponentsRegistry.h +0 -32
  311. package/exampleForWebView/android/app/src/main/jni/OnLoad.cpp +0 -11
  312. package/exampleForWebView/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
  313. package/exampleForWebView/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  314. package/exampleForWebView/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  315. package/exampleForWebView/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  316. package/exampleForWebView/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  317. package/exampleForWebView/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  318. package/exampleForWebView/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  319. package/exampleForWebView/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  320. package/exampleForWebView/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  321. package/exampleForWebView/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  322. package/exampleForWebView/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  323. package/exampleForWebView/android/app/src/main/res/values/strings.xml +0 -3
  324. package/exampleForWebView/android/app/src/main/res/values/styles.xml +0 -9
  325. package/exampleForWebView/android/build.gradle +0 -51
  326. package/exampleForWebView/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  327. package/exampleForWebView/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  328. package/exampleForWebView/android/gradle.properties +0 -40
  329. package/exampleForWebView/android/gradlew +0 -234
  330. package/exampleForWebView/android/gradlew.bat +0 -89
  331. package/exampleForWebView/android/settings.gradle +0 -11
  332. package/exampleForWebView/app.json +0 -4
  333. package/exampleForWebView/babel.config.js +0 -11
  334. package/exampleForWebView/index.js +0 -9
  335. package/exampleForWebView/ios/.xcode.env +0 -11
  336. package/exampleForWebView/ios/Podfile +0 -43
  337. package/exampleForWebView/ios/Podfile.lock +0 -748
  338. package/exampleForWebView/ios/exampleForWebView/AppDelegate.h +0 -8
  339. package/exampleForWebView/ios/exampleForWebView/AppDelegate.mm +0 -133
  340. package/exampleForWebView/ios/exampleForWebView/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
  341. package/exampleForWebView/ios/exampleForWebView/Images.xcassets/Contents.json +0 -6
  342. package/exampleForWebView/ios/exampleForWebView/Info.plist +0 -96
  343. package/exampleForWebView/ios/exampleForWebView/LaunchScreen.storyboard +0 -47
  344. package/exampleForWebView/ios/exampleForWebView/main.m +0 -10
  345. package/exampleForWebView/ios/exampleForWebView.xcodeproj/project.pbxproj +0 -723
  346. package/exampleForWebView/ios/exampleForWebView.xcodeproj/xcshareddata/xcschemes/exampleForWebView.xcscheme +0 -88
  347. package/exampleForWebView/ios/exampleForWebView.xcworkspace/contents.xcworkspacedata +0 -10
  348. package/exampleForWebView/ios/exampleForWebView.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  349. package/exampleForWebView/ios/exampleForWebViewTests/Info.plist +0 -24
  350. package/exampleForWebView/ios/exampleForWebViewTests/exampleForWebViewTests.m +0 -66
  351. package/exampleForWebView/manuals/CERTIFICATION.md +0 -223
  352. package/exampleForWebView/manuals/PAYMENT.md +0 -232
  353. package/exampleForWebView/metro.config.js +0 -61
  354. package/exampleForWebView/package.json +0 -54
  355. package/exampleForWebView/src/App.tsx +0 -50
  356. package/exampleForWebView/src/Certification.tsx +0 -54
  357. package/exampleForWebView/src/Home.tsx +0 -49
  358. package/exampleForWebView/src/Loading.tsx +0 -23
  359. package/exampleForWebView/src/Payment.tsx +0 -65
  360. package/exampleForWebView/yarn.lock +0 -7362
  361. package/iamport-react-native.podspec +0 -19
  362. package/ios/IamportReactNative-Bridging-Header.h +0 -1
  363. package/ios/IamportReactNative.xcodeproj/project.pbxproj +0 -293
  364. package/ios/IamportReactNativeViewManager.m +0 -12
  365. package/ios/IamportReactNativeViewManager.swift +0 -32
  366. package/lib/commonjs/components/Certification/index.js +0 -121
  367. package/lib/commonjs/components/Certification/index.js.map +0 -1
  368. package/lib/commonjs/components/ErrorOnParams/index.js +0 -50
  369. package/lib/commonjs/components/ErrorOnParams/index.js.map +0 -1
  370. package/lib/commonjs/components/Loading/index.js +0 -34
  371. package/lib/commonjs/components/Loading/index.js.map +0 -1
  372. package/lib/commonjs/components/Payment/index.js +0 -225
  373. package/lib/commonjs/components/Payment/index.js.map +0 -1
  374. package/lib/commonjs/constants/index.js +0 -114
  375. package/lib/commonjs/constants/index.js.map +0 -1
  376. package/lib/commonjs/img/iamport-logo.png +0 -0
  377. package/lib/commonjs/index.js +0 -29
  378. package/lib/commonjs/index.js.map +0 -1
  379. package/lib/commonjs/styles.js +0 -27
  380. package/lib/commonjs/styles.js.map +0 -1
  381. package/lib/commonjs/utils/IamportUrl.js +0 -289
  382. package/lib/commonjs/utils/IamportUrl.js.map +0 -1
  383. package/lib/commonjs/utils/Validation.js +0 -109
  384. package/lib/commonjs/utils/Validation.js.map +0 -1
  385. package/lib/commonjs/utils/ValidationForPayment.js +0 -112
  386. package/lib/commonjs/utils/ValidationForPayment.js.map +0 -1
  387. package/lib/typescript/components/Certification/index.d.ts.map +0 -1
  388. package/lib/typescript/components/ErrorOnParams/index.d.ts +0 -7
  389. package/lib/typescript/components/ErrorOnParams/index.d.ts.map +0 -1
  390. package/lib/typescript/components/Loading/index.d.ts +0 -4
  391. package/lib/typescript/components/Loading/index.d.ts.map +0 -1
  392. package/lib/typescript/components/Payment/index.d.ts.map +0 -1
  393. package/lib/typescript/constants/index.d.ts.map +0 -1
  394. package/lib/typescript/index.d.ts.map +0 -1
  395. package/lib/typescript/styles.d.ts.map +0 -1
  396. package/lib/typescript/utils/IamportUrl.d.ts.map +0 -1
  397. package/lib/typescript/utils/Validation.d.ts.map +0 -1
  398. package/lib/typescript/utils/ValidationForPayment.d.ts.map +0 -1
  399. package/manuals/CALLBACK.md +0 -72
  400. package/manuals/EXAMPLE.md +0 -168
  401. package/manuals/EXPO.md +0 -246
  402. package/manuals/INSTALL.md +0 -31
  403. package/manuals/SETTING.md +0 -140
  404. package/manuals/SUPPORT.md +0 -35
  405. package/manuals/TRANS.md +0 -77
  406. package/manuals/VERSION.md +0 -187
  407. package/manuals/assets/after-linking-iamport.png +0 -0
  408. package/manuals/assets/after-linking-webview.png +0 -0
  409. package/manuals/assets/allow-arbitrary.gif +0 -0
  410. package/manuals/assets/android-studio-avd-manager.png +0 -0
  411. package/manuals/assets/android-studio-build.png +0 -0
  412. package/manuals/assets/app-scheme-registry.gif +0 -0
  413. package/manuals/assets/expo-eject.png +0 -0
  414. package/manuals/assets/ios-emulator-certification.png +0 -0
  415. package/manuals/assets/ios-emulator-home.png +0 -0
  416. package/manuals/assets/ios-emulator-payment.png +0 -0
  417. package/manuals/assets/ios-trans-create-header-file-1.png +0 -0
  418. package/manuals/assets/ios-trans-create-header-file-2.png +0 -0
  419. package/manuals/assets/ios-trans-create-objectivec-file-1.png +0 -0
  420. package/manuals/assets/ios-trans-create-objectivec-file-2.png +0 -0
  421. package/manuals/assets/ios-trans-result.png +0 -0
  422. package/manuals/assets/webview-peer-dependency.png +0 -0
  423. package/scripts/bootstrap.js +0 -24
  424. package/tsconfig.build.json +0 -9
  425. package/tsconfig.json +0 -26
  426. package/yarn.lock +0 -6174
  427. /package/lib/typescript/{constants → src/constants}/index.d.ts +0 -0
  428. /package/lib/typescript/{index.d.ts → src/index.d.ts} +0 -0
  429. /package/lib/typescript/{utils → src/utils}/Validation.d.ts +0 -0
  430. /package/lib/typescript/{utils → src/utils}/ValidationForPayment.d.ts +0 -0
@@ -1,88 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Scheme
3
- LastUpgradeVersion = "1210"
4
- version = "1.3">
5
- <BuildAction
6
- parallelizeBuildables = "YES"
7
- buildImplicitDependencies = "YES">
8
- <BuildActionEntries>
9
- <BuildActionEntry
10
- buildForTesting = "YES"
11
- buildForRunning = "YES"
12
- buildForProfiling = "YES"
13
- buildForArchiving = "YES"
14
- buildForAnalyzing = "YES">
15
- <BuildableReference
16
- BuildableIdentifier = "primary"
17
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18
- BuildableName = "exampleForWebView.app"
19
- BlueprintName = "exampleForWebView"
20
- ReferencedContainer = "container:exampleForWebView.xcodeproj">
21
- </BuildableReference>
22
- </BuildActionEntry>
23
- </BuildActionEntries>
24
- </BuildAction>
25
- <TestAction
26
- buildConfiguration = "Debug"
27
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
- shouldUseLaunchSchemeArgsEnv = "YES">
30
- <Testables>
31
- <TestableReference
32
- skipped = "NO">
33
- <BuildableReference
34
- BuildableIdentifier = "primary"
35
- BlueprintIdentifier = "00E356ED1AD99517003FC87E"
36
- BuildableName = "exampleForWebViewTests.xctest"
37
- BlueprintName = "exampleForWebViewTests"
38
- ReferencedContainer = "container:exampleForWebView.xcodeproj">
39
- </BuildableReference>
40
- </TestableReference>
41
- </Testables>
42
- </TestAction>
43
- <LaunchAction
44
- buildConfiguration = "Debug"
45
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47
- launchStyle = "0"
48
- useCustomWorkingDirectory = "NO"
49
- ignoresPersistentStateOnLaunch = "NO"
50
- debugDocumentVersioning = "YES"
51
- debugServiceExtension = "internal"
52
- allowLocationSimulation = "YES">
53
- <BuildableProductRunnable
54
- runnableDebuggingMode = "0">
55
- <BuildableReference
56
- BuildableIdentifier = "primary"
57
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
58
- BuildableName = "exampleForWebView.app"
59
- BlueprintName = "exampleForWebView"
60
- ReferencedContainer = "container:exampleForWebView.xcodeproj">
61
- </BuildableReference>
62
- </BuildableProductRunnable>
63
- </LaunchAction>
64
- <ProfileAction
65
- buildConfiguration = "Release"
66
- shouldUseLaunchSchemeArgsEnv = "YES"
67
- savedToolIdentifier = ""
68
- useCustomWorkingDirectory = "NO"
69
- debugDocumentVersioning = "YES">
70
- <BuildableProductRunnable
71
- runnableDebuggingMode = "0">
72
- <BuildableReference
73
- BuildableIdentifier = "primary"
74
- BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
75
- BuildableName = "exampleForWebView.app"
76
- BlueprintName = "exampleForWebView"
77
- ReferencedContainer = "container:exampleForWebView.xcodeproj">
78
- </BuildableReference>
79
- </BuildableProductRunnable>
80
- </ProfileAction>
81
- <AnalyzeAction
82
- buildConfiguration = "Debug">
83
- </AnalyzeAction>
84
- <ArchiveAction
85
- buildConfiguration = "Release"
86
- revealArchiveInOrganizer = "YES">
87
- </ArchiveAction>
88
- </Scheme>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "group:exampleForWebView.xcodeproj">
6
- </FileRef>
7
- <FileRef
8
- location = "group:Pods/Pods.xcodeproj">
9
- </FileRef>
10
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>en</string>
7
- <key>CFBundleExecutable</key>
8
- <string>$(EXECUTABLE_NAME)</string>
9
- <key>CFBundleIdentifier</key>
10
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
- <key>CFBundleInfoDictionaryVersion</key>
12
- <string>6.0</string>
13
- <key>CFBundleName</key>
14
- <string>$(PRODUCT_NAME)</string>
15
- <key>CFBundlePackageType</key>
16
- <string>BNDL</string>
17
- <key>CFBundleShortVersionString</key>
18
- <string>1.0</string>
19
- <key>CFBundleSignature</key>
20
- <string>????</string>
21
- <key>CFBundleVersion</key>
22
- <string>1</string>
23
- </dict>
24
- </plist>
@@ -1,66 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import <XCTest/XCTest.h>
3
-
4
- #import <React/RCTLog.h>
5
- #import <React/RCTRootView.h>
6
-
7
- #define TIMEOUT_SECONDS 600
8
- #define TEXT_TO_LOOK_FOR @"Welcome to React"
9
-
10
- @interface exampleForWebViewTests : XCTestCase
11
-
12
- @end
13
-
14
- @implementation exampleForWebViewTests
15
-
16
- - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17
- {
18
- if (test(view)) {
19
- return YES;
20
- }
21
- for (UIView *subview in [view subviews]) {
22
- if ([self findSubviewInView:subview matching:test]) {
23
- return YES;
24
- }
25
- }
26
- return NO;
27
- }
28
-
29
- - (void)testRendersWelcomeScreen
30
- {
31
- UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32
- NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33
- BOOL foundElement = NO;
34
-
35
- __block NSString *redboxError = nil;
36
- #ifdef DEBUG
37
- RCTSetLogFunction(
38
- ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39
- if (level >= RCTLogLevelError) {
40
- redboxError = message;
41
- }
42
- });
43
- #endif
44
-
45
- while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46
- [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47
- [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48
-
49
- foundElement = [self findSubviewInView:vc.view
50
- matching:^BOOL(UIView *view) {
51
- if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52
- return YES;
53
- }
54
- return NO;
55
- }];
56
- }
57
-
58
- #ifdef DEBUG
59
- RCTSetLogFunction(RCTDefaultLogFunction);
60
- #endif
61
-
62
- XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63
- XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64
- }
65
-
66
- @end
@@ -1,223 +0,0 @@
1
- # 휴대폰 본인인증 웹 페이지 재활용하기
2
-
3
- 웹 페이지로 작성한 본인인증 화면을 리액트 네이티브에서 웹뷰로 띄워 재사용하는 경우가 있습니다. 이 경우 본인인증 하기 버튼을 눌렀을때 본인인증 환경이 리액트 네이티브인지 판단해 **리액트 네이티브로 post message를 보내야** 합니다.
4
-
5
- 리액트 네이티브 프로젝트에 아임포트 리액트 네이티브 모듈(`iamport-react-native`)을 설치한 후, 리액트로부터 `post message`를 받으면 해당 본인인증 화면을 렌더링 하도록 로직을 작성해야 합니다.
6
-
7
- ### 1. 리액트 네이티브로 `post message` 보내기
8
-
9
- 본인인증 하기 버튼을 눌렀을 때 본인인증 환경이 리액트 네이티브인지 여부를 먼저 판단해야 합니다. 본인인증 환경이 리액트 네이티브인 경우, **리액트 네이티브로 `가맹점 식별코드`, `본인인증 데이터` 그리고 `액션 유형`을 post message로 보냅니다.**
10
-
11
- ```javascript
12
- // iamport-react-example/src/Certification/index.js
13
- import React from 'react';
14
-
15
- function Certification() {
16
- function onClickCertification() {
17
- /* 가맹점 식별코드 */
18
- const userCode = 'imp00000000';
19
-
20
- /* 본인인증 데이터 정의하기 */
21
- const data = {
22
- merchant_uid: `mid_${new Date().getTime()}` // 주문번호
23
- name: '홍길동', // 이름
24
- phone: '01012341234', // 전화번호
25
- ...
26
- };
27
-
28
- if (isReactNative()) {
29
- /* 리액트 네이티브 환경에 대응하기 */
30
- const params = {
31
- userCode, // 가맹점 식별코드
32
- data, // 본인인증 데이터
33
- type: 'certification', // 결제와 본인인증 구분을 위한 필드
34
- };
35
- const paramsToString = JSON.stringify(params);
36
- window.ReactNativeWebView.postMessage(paramsToString);
37
- } else {
38
- /* 그 외 환경의 경우 */
39
- /* 가맹점 식별하기 */
40
- const { IMP } = window;
41
- IMP.init(userCode);
42
- /* 본인인증 창 호출하기 */
43
- IMP.certification(data, callback);
44
- }
45
- }
46
-
47
- /* 콜백 함수 정의하기 */
48
- function callback(response) {
49
- ...
50
- }
51
-
52
- function isReactNative() {
53
- /*
54
- 리액트 네이티브 환경인지 여부를 판단해
55
- 리액트 네이티브의 경우 IMP.certification()를 호출하는 대신
56
- 리액트 네이티브로 post message를 보낸다
57
-
58
- 아래 예시는 모든 모바일 환경을 리액트 네이티브로 인식한 것으로
59
- 실제로는 user agent에 값을 추가해 정확히 판단해야 한다
60
- */
61
- if (ua.mobile) return true;
62
- return false;
63
- }
64
-
65
- return (
66
- ...
67
- <button onClick={onClickCertification}>본인인증 하기</button>
68
- ...
69
- );
70
- }
71
- ```
72
-
73
- ### 2. 리액트 네이티브에서 `post message`를 받았을때 본인인증 화면 렌더링하기
74
-
75
- 리액트에서 `post message`를 보내면, 리액트 네이티브 `WebView`의 `onMessage` 함수가 이를 트리거합니다. 메시지 내용 중 액션 유형(`type`)이 `payment`면 결제 화면을, `certification`이면 본인인증 화면을 렌더링 하기 위해 해당 라우트로 이동합니다. 이때 **post message로 전달 받은 `가맹점 식별코드`와 `본인인증 데이터`를 `query`로 전달**합니다.
76
-
77
- ```javascript
78
- // iamport-react-native/exampleForWebView/src/Home.js
79
- import React from 'react';
80
- import WebView from 'react-native-webview';
81
-
82
- function Home({ navigation }) {
83
- const domain = `http://${가맹점 IP}:3000`;
84
- function onMessage(e) {
85
- /* 리액트로부터 post message를 받았을때 트리거 된다 */
86
- try {
87
- /* post message에서 가맹점 식별코드, 본인인증 데이터 그리고 액션 유형을 추출한다 */
88
- const { userCode, data, type } = JSON.parse(e.nativeEvent.data);
89
- const params = { userCode, data };
90
- /* 액션 유형이 certification이면 본인인증 화면으로 이동한다 */
91
- navigation.push(type === 'payment' ? 'Payment' : 'Certification', params);
92
- } catch (e) {}
93
- }
94
-
95
- return (
96
- <WebView
97
- source={{ uri: domain }}
98
- onMessage={onMessage}
99
- style={{ flex: 1 }}
100
- injectedJavascript={`(function() {
101
- window.postMessage = function(data) {
102
- window.ReactNativeWebView.postMessage(data);
103
- };
104
- })()`}
105
- />
106
- );
107
- }
108
-
109
- export default Home;
110
- ```
111
-
112
- ### 3. 리액트 네이티브에 본인인증 화면 추가하기
113
-
114
- `가맹점 식별코드`와 `본인인증 데이터`를 쿼리에서 추출해 `IMP.Certification`에 prop 형태로 전달합니다. 이때 본인인증 후 실행될 로직을 작성한 콜백 함수도 함께 전달합니다. 콜백함수에서 본인인증 결과에 따라 로직을 다르게 작성할 수 있습니다. 아래는 본인인증 성공시 웹뷰를 띄운 Home으로 돌아가고, 본인인증 실패시 바로 이전 화면으로 돌아가는 예시입니다.
115
-
116
- ```javascript
117
- // iamport-react-native/exampleForWebView/Certification.js
118
- import React from 'react';
119
- import IMP from 'iamport-react-native';
120
-
121
- function Certification({ navigation }) {
122
- /* 가맹점 식별코드, 본인인증 데이터 추출 */
123
- const userCode = navigation.getParam('userCode');
124
- const data = navigation.getParam('data');
125
-
126
- /* 본인인증 후 실행될 콜백 함수 입력 */
127
- function callback(response) {
128
- const isSuccessed = getIsSuccessed(response);
129
- if (isSuccessed) {
130
- /* 본인인증 성공한 경우, 리디렉션 위해 홈으로 이동한다 */
131
- const params = {
132
- ...response,
133
- type: 'certification', // 결제와 본인인증 구분을 위한 필드
134
- };
135
- navigation.replace('Home', params);
136
- } else {
137
- /* 본인인증 실패한 경우, 이전 화면으로 돌아간다 */
138
- navigation.goBack();
139
- }
140
- }
141
-
142
- function getIsSuccessed(response) {
143
- const { success } = response;
144
-
145
- if (typeof success === 'string') return success === 'true';
146
- if (typeof success === 'boolean') return success === true;
147
- }
148
-
149
- return (
150
- <IMP.Certification
151
- userCode={userCode}
152
- data={{
153
- ...data,
154
- app_scheme: 'test',
155
- }}
156
- callback={callback}
157
- />
158
- );
159
- }
160
-
161
- export default Certification;
162
- ```
163
-
164
- ### 5. 본인인증 후 리디렉션 설정하기
165
-
166
- 위의 예시에 따라 본인인증 후, 웹뷰를 띄운 Home으로 돌아갔을때 리디렉션을 위한 추가 로직을 작성해야 합니다. 아래와 같은 경우를 가정합니다.
167
-
168
- | 유형 | 도메인 |
169
- | ---------- | ------------------------------------------ |
170
- | 홈 | https://example.com |
171
- | 본인인증 | https://example.com/certification |
172
- | 본인인증 완료 | https://example.com/certification/result |
173
-
174
- 위와 같은 경우, 본인인증 후 홈으로 렌더링 시 웹뷰의 도메인은 다시 `https://example.com`이 됩니다. 이를 `https://example.com/certification/result`로 리디렉션 하기 위해 홈 컴포넌트에 아래와 같은 로직을 작성합니다.
175
-
176
- ```javascript
177
- // iamport-react-native/exampelForWebView/Home.js
178
- import React, { useState, useEffect } from 'react';
179
- import WebView from 'react-native-webview';
180
- import queryString from 'query-string';
181
-
182
- const domain = 'https://example.com'; // 가맹점 도메인
183
- function Home({ navigation }) {
184
- const [uri, setUri] = useState(domain);
185
-
186
- useEffect(() => {
187
- /* navigation이 바뀌었을때를 트리거 */
188
- const response = navigation.getParam('response');
189
- if (response) {
190
- const query = queryString.stringify(response);
191
- const { type } = query;
192
- if (type === 'certification') {
193
- /* 본인인증 후 렌더링 되었을 경우, https://example.com/certification/result로 리디렉션 시킨다 */
194
- setUri(`${domain}/certification/result?${query}`);
195
- }
196
- ...
197
- }
198
- }, [navigation]);
199
-
200
- function onMessage(e) {
201
- try {
202
- const { userCode, data, type } = JSON.parse(e.nativeEvent.data);
203
- const params = { userCode, data };
204
- navigation.push(type === 'payment' ? 'Payment' : 'Certification', params);
205
- } catch (e) {}
206
- }
207
-
208
- return (
209
- <WebView
210
- source={{ uri }}
211
- onMessage={onMessage}
212
- style={{ flex: 1 }}
213
- injectedJavascript={`(function() {
214
- window.postMessage = function(data) {
215
- window.ReactNativeWebView.postMessage(data);
216
- };
217
- })()`}
218
- />
219
- );
220
- }
221
-
222
- export default Home;
223
- ```
@@ -1,232 +0,0 @@
1
- # 결제 웹 페이지 재활용하기
2
-
3
- 웹 페이지로 작성한 결제 화면을 리액트 네이티브에서 웹뷰로 띄워 재사용하는 경우가 있습니다. 이 경우 결제하기 버튼을 눌렀을때 결제 환경이 리액트 네이티브인지 판단해 **리액트 네이티브로 post message를 보내야** 합니다.
4
-
5
- 리액트 네이티브 프로젝트에 아임포트 리액트 네이티브 모듈(`iamport-react-native`)을 설치한 후, 리액트로부터 `post message`를 받으면 해당 결제 화면을 렌더링 하도록 로직을 작성해야 합니다.
6
-
7
- ### 1. 리액트 네이티브로 `post message` 보내기
8
-
9
- 결제 하기 버튼을 눌렀을 때 결제 환경이 리액트 네이티브인지 여부를 먼저 판단해야 합니다. 결제 환경이 리액트 네이티브인 경우, **리액트 네이티브로 `가맹점 식별코드`, `결제 데이터` 그리고 `액션 유형`을 post message로 보냅니다.**
10
-
11
- ```javascript
12
- // iamport-react-example/src/Payment/index.js
13
- import React from 'react';
14
-
15
- function Payment() {
16
- function onClickPayment() {
17
- /* 가맹점 식별코드 */
18
- const userCode = 'imp00000000';
19
-
20
- /* 결제 데이터 정의하기 */
21
- const data = {
22
- pg: 'html5_inicis', // PG사
23
- pay_method: 'card', // 결제수단
24
- merchant_uid: `mid_${new Date().getTime()}` // 주문번호
25
- amount: 1000, // 결제금액
26
- name: '아임포트 결제 데이터 분석', // 주문명
27
- buyer_name: '홍길동', // 구매자 이름
28
- buyer_tel: '01012341234', // 구매자 전화번호
29
- buyer_email: 'example@example', // 구매자 이메일
30
- buyer_addr: '신사동 661-16', // 구매자 주소
31
- buyer_postcode: '06018', // 구매자 우편번호
32
- ...
33
- };
34
-
35
- if (isReactNative()) {
36
- /* 리액트 네이티브 환경에 대응하기 */
37
- const params = {
38
- userCode, // 가맹점 식별코드
39
- data, // 결제 데이터
40
- type: 'payment', // 결제와 본인인증 구분을 위한 필드
41
- };
42
- const paramsToString = JSON.stringify(params);
43
- window.ReactNativeWebView.postMessage(paramsToString);
44
- } else {
45
- /* 그 외 환경의 경우 */
46
- /* 가맹점 식별하기 */
47
- const { IMP } = window;
48
- IMP.init(userCode);
49
- /* 결제 창 호출하기 */
50
- IMP.request_pay(data, callback);
51
- }
52
- }
53
-
54
- /* 콜백 함수 정의하기 */
55
- function callback(response) {
56
- ...
57
- }
58
-
59
- function isReactNative() {
60
- /*
61
- 리액트 네이티브 환경인지 여부를 판단해
62
- 리액트 네이티브의 경우 IMP.payment()를 호출하는 대신
63
- 리액트 네이티브로 post message를 보낸다
64
-
65
- 아래 예시는 모든 모바일 환경을 리액트 네이티브로 인식한 것으로
66
- 실제로는 user agent에 값을 추가해 정확히 판단해야 한다
67
- */
68
- if (ua.mobile) return true;
69
- return false;
70
- }
71
-
72
- return (
73
- ...
74
- <button onClick={onClickPayment}>결제하기</button>
75
- ...
76
- );
77
- }
78
- ```
79
-
80
- ### 2. 리액트 네이티브에서 `post message`를 받았을때 결제 화면 렌더링하기
81
-
82
- 리액트에서 `post message`를 보내면, 리액트 네이티브 WebView의 `onMessage` 함수가 이를 트리거합니다. 메시지 내용 중 액션 유형(`type`)이 `payment`면 결제 화면을, `certification`이면 본인인증 화면을 렌더링 하기 위해 해당 라우트로 이동합니다. 이때 **post message로 전달 받은 `가맹점 식별코드`와 `결제 데이터`를 `query`로 전달**합니다.
83
-
84
- ```javascript
85
- // iamport-react-native/exampleForWebView/src/Home.js
86
- import React from 'react';
87
- import WebView from 'react-native-webview';
88
-
89
- function Home({ navigation }) {
90
- const domain = `http://${가맹점 IP}:3000`;
91
- function onMessage(e) {
92
- /* 리액트로부터 post message를 받았을때 트리거 된다 */
93
- try {
94
- /* post message에서 가맹점 식별코드, 결제 데이터 그리고 액션 유형을 추출한다 */
95
- const { userCode, data, type } = JSON.parse(e.nativeEvent.data);
96
- const params = { userCode, data };
97
- /* 결제 화면으로 이동한다 */
98
- navigation.push(type === 'payment' ? 'Payment' : 'Certification', params);
99
- } catch (e) {}
100
- }
101
-
102
- return (
103
- <WebView
104
- source={{ uri: domain }}
105
- onMessage={onMessage}
106
- style={{ flex: 1 }}
107
- injectedJavascript={`(function() {
108
- window.postMessage = function(data) {
109
- window.ReactNativeWebView.postMessage(data);
110
- };
111
- })()`}
112
- />
113
- );
114
- }
115
-
116
- export default Home;
117
- ```
118
-
119
- ### 3. 리액트 네이티브에 결제 화면 추가하기
120
-
121
- `가맹점 식별코드`와 `결제 데이터`를 쿼리에서 추출해 `IMP.Payment`에 prop 형태로 전달합니다. 이때 결제 후 실행될 로직을 작성한 콜백 함수도 함께 전달합니다. 콜백함수에서 결제 결과에 따라 로직을 다르게 작성할 수 있습니다. 아래는 결제 성공시 웹뷰를 띄운 Home으로 돌아가고, 결제 실패시 바로 이전 화면으로 돌아가는 예시입니다.
122
-
123
- ```javascript
124
- // iamport-react-native/exampleForWebView/Payment.js
125
- import React from 'react';
126
- import IMP from 'iamport-react-native';
127
-
128
- function Payment({ navigation }) {
129
- /* 가맹점 식별코드, 결제 데이터 추출 */
130
- const userCode = navigation.getParam('userCode');
131
- const data = navigation.getParam('data');
132
-
133
- /* 결제 후 실행될 콜백 함수 입력 */
134
- function callback(response) {
135
- const isSuccessed = getIsSuccessed(response);
136
- if (isSuccessed) {
137
- /* 결제 성공한 경우, 리디렉션 위해 홈으로 이동한다 */
138
- const params = {
139
- ...response,
140
- type: 'payment', // 결제와 본인인증 구분을 위한 필드
141
- };
142
- navigation.replace('Home', params);
143
- } else {
144
- /* 결제 실패한 경우, 이전 화면으로 돌아간다 */
145
- navigation.goBack();
146
- }
147
- }
148
-
149
- function getIsSuccessed(response) {
150
- const { imp_success, success } = response;
151
-
152
- if (typeof imp_success === 'string') return imp_success === 'true';
153
- if (typeof imp_success === 'boolean') return imp_success === true;
154
- if (typeof success === 'string') return success === 'true';
155
- if (typeof success === 'boolean') return success === true;
156
- }
157
-
158
- return (
159
- <IMP.Payment
160
- userCode={userCode}
161
- data={{
162
- ...data,
163
- app_scheme: 'exampleForWebView',
164
- }}
165
- callback={callback}
166
- />
167
- );
168
- }
169
-
170
- export default Payment;
171
- ```
172
-
173
- ### 5. 결제 후 리디렉션 설정하기
174
-
175
- 위의 예시에 따라 결제 후, 웹뷰를 띄운 Home으로 돌아갔을때 리디렉션을 위한 추가 로직을 작성해야 합니다. 아래와 같은 경우를 가정합니다.
176
-
177
- | 유형 | 도메인 |
178
- | ------ | ----------------------------------- |
179
- | 홈 | https://example.com |
180
- | 결제 | https://example.com/payment |
181
- | 결제완료 | https://example.com/payment/result |
182
-
183
- 위와 같은 경우, 결제 후 홈으로 렌더링 시 웹뷰의 도메인은 다시 `https://example.com`이 됩니다. 이를 `https://example.com/payment/result`로 리디렉션 하기 위해 홈 컴포넌트에 아래와 같은 로직을 작성합니다.
184
-
185
- ```javascript
186
- // iamport-react-native/exampelForWebView/Home.js
187
- import React, { useState, useEffect } from 'react';
188
- import WebView from 'react-native-webview';
189
- import queryString from 'query-string';
190
-
191
- const domain = 'https://example.com'; // 가맹점 도메인
192
- function Home({ navigation }) {
193
- const [uri, setUri] = useState(domain);
194
-
195
- useEffect(() => {
196
- /* navigation이 바뀌었을때를 트리거 */
197
- const response = navigation.getParam('response');
198
- if (response) {
199
- const query = queryString.stringify(response);
200
- const { type } = query;
201
- if (type === 'payment') {
202
- /* 결제 후 렌더링 되었을 경우, https://example.com/payment/result로 리디렉션 시킨다 */
203
- setUri(`${domain}/payment/result?${query}`);
204
- }
205
- ...
206
- }
207
- }, [navigation]);
208
-
209
- function onMessage(e) {
210
- try {
211
- const { userCode, data, type } = JSON.parse(e.nativeEvent.data);
212
- const params = { userCode, data };
213
- navigation.push(type === 'payment' ? 'Payment' : 'Certification', params);
214
- } catch (e) {}
215
- }
216
-
217
- return (
218
- <WebView
219
- source={{ uri }}
220
- onMessage={onMessage}
221
- style={{ flex: 1 }}
222
- injectedJavascript={`(function() {
223
- window.postMessage = function(data) {
224
- window.ReactNativeWebView.postMessage(data);
225
- };
226
- })()`}
227
- />
228
- );
229
- }
230
-
231
- export default Home;
232
- ```