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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -320
  3. package/android/build.gradle +114 -24
  4. package/android/gradle.properties +4 -0
  5. package/android/src/main/AndroidManifest.xml +1 -3
  6. package/android/src/main/java/com/iamportreactnative/IamportReactNativePackage.kt +17 -0
  7. package/android/src/main/java/com/iamportreactnative/IamportReactNativeViewManager.kt +20 -0
  8. package/iamport-react-native.podspec +19 -0
  9. package/ios/IamportReactNative-Bridging-Header.h +1 -0
  10. package/ios/IamportReactNative.xcodeproj/project.pbxproj +47 -20
  11. package/ios/IamportReactNativeViewManager.m +12 -0
  12. package/ios/IamportReactNativeViewManager.swift +32 -0
  13. package/lib/commonjs/components/Certification/index.js +154 -0
  14. package/lib/commonjs/components/Certification/index.js.map +1 -0
  15. package/lib/commonjs/components/ErrorOnParams/index.js +66 -0
  16. package/lib/commonjs/components/ErrorOnParams/index.js.map +1 -0
  17. package/lib/commonjs/components/Loading/index.js +50 -0
  18. package/lib/commonjs/components/Loading/index.js.map +1 -0
  19. package/lib/commonjs/components/Payment/index.js +288 -0
  20. package/lib/commonjs/components/Payment/index.js.map +1 -0
  21. package/lib/commonjs/constants/index.js +103 -0
  22. package/lib/commonjs/constants/index.js.map +1 -0
  23. package/{android/src/main/assets → lib/commonjs}/img/iamport-logo.png +0 -0
  24. package/lib/commonjs/index.js +36 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/commonjs/styles.js +31 -0
  27. package/lib/commonjs/styles.js.map +1 -0
  28. package/lib/commonjs/utils/IamportUrl.js +334 -0
  29. package/lib/commonjs/utils/IamportUrl.js.map +1 -0
  30. package/lib/commonjs/utils/Validation.js +72 -0
  31. package/lib/commonjs/utils/Validation.js.map +1 -0
  32. package/lib/commonjs/utils/ValidationForPayment.js +143 -0
  33. package/lib/commonjs/utils/ValidationForPayment.js.map +1 -0
  34. package/lib/module/components/Certification/index.js +132 -0
  35. package/lib/module/components/Certification/index.js.map +1 -0
  36. package/lib/module/components/ErrorOnParams/index.js +55 -0
  37. package/lib/module/components/ErrorOnParams/index.js.map +1 -0
  38. package/lib/module/components/Loading/index.js +38 -0
  39. package/lib/module/components/Loading/index.js.map +1 -0
  40. package/lib/module/components/Payment/index.js +266 -0
  41. package/lib/module/components/Payment/index.js.map +1 -0
  42. package/lib/module/constants/index.js +98 -0
  43. package/lib/module/constants/index.js.map +1 -0
  44. package/lib/module/img/iamport-logo.png +0 -0
  45. package/lib/module/index.js +10 -0
  46. package/lib/module/index.js.map +1 -0
  47. package/lib/module/styles.js +21 -0
  48. package/lib/module/styles.js.map +1 -0
  49. package/lib/module/utils/IamportUrl.js +322 -0
  50. package/lib/module/utils/IamportUrl.js.map +1 -0
  51. package/{src → lib/module}/utils/Validation.js +25 -9
  52. package/lib/module/utils/Validation.js.map +1 -0
  53. package/{src → lib/module}/utils/ValidationForPayment.js +23 -13
  54. package/lib/module/utils/ValidationForPayment.js.map +1 -0
  55. package/lib/typescript/components/Certification/index.d.ts +10 -0
  56. package/lib/typescript/components/ErrorOnParams/index.d.ts +5 -0
  57. package/lib/typescript/components/Loading/index.d.ts +2 -0
  58. package/lib/typescript/components/Payment/index.d.ts +10 -0
  59. package/lib/typescript/constants/index.d.ts +76 -0
  60. package/lib/typescript/index.d.ts +9 -0
  61. package/lib/typescript/styles.d.ts +19 -0
  62. package/lib/typescript/utils/IamportUrl.d.ts +19 -0
  63. package/lib/typescript/utils/Validation.d.ts +58 -0
  64. package/lib/typescript/utils/ValidationForPayment.d.ts +7 -0
  65. package/package.json +98 -20
  66. package/src/components/Certification/index.tsx +112 -0
  67. package/src/components/ErrorOnParams/{index.js → index.tsx} +20 -25
  68. package/src/components/Loading/{index.js → index.tsx} +9 -10
  69. package/src/components/Payment/index.tsx +243 -0
  70. package/src/constants/index.ts +150 -0
  71. package/src/{index.js → index.tsx} +4 -1
  72. package/src/{styles.js → styles.ts} +3 -1
  73. package/src/utils/IamportUrl.ts +319 -0
  74. package/src/utils/Validation.ts +101 -0
  75. package/src/utils/ValidationForPayment.ts +146 -0
  76. package/IamportReactNative.podspec +0 -19
  77. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  78. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  79. package/android/gradlew +0 -172
  80. package/android/gradlew.bat +0 -84
  81. package/android/src/main/java/com/iamport/IamportModule.java +0 -88
  82. package/android/src/main/java/com/iamport/IamportPackage.java +0 -23
  83. package/ios/IamportReactNative.h +0 -11
  84. package/ios/IamportReactNative.m +0 -23
  85. package/ios/IamportReactNative.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  86. package/ios/IamportReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  87. package/ios/IamportReactNative.xcworkspace/contents.xcworkspacedata +0 -9
  88. package/manuals/CALLBACK.md +0 -68
  89. package/manuals/EXAMPLE.md +0 -175
  90. package/manuals/EXPO.md +0 -66
  91. package/manuals/INSTALL.md +0 -72
  92. package/manuals/SETTING.md +0 -72
  93. package/manuals/SUPPORT.md +0 -30
  94. package/manuals/TRANS.md +0 -122
  95. package/manuals/VERSION.md +0 -114
  96. package/manuals/assets/webview-peer-dependency.png +0 -0
  97. package/src/components/Certification/index.js +0 -99
  98. package/src/components/Payment/PaymentWebView.js +0 -285
  99. package/src/components/Payment/index.android.js +0 -51
  100. package/src/components/Payment/index.ios.js +0 -30
  101. package/src/constants/index.js +0 -83
  102. package/src/img/after-linking-iamport.png +0 -0
  103. package/src/img/after-linking-webview.png +0 -0
  104. package/src/img/allow-arbitrary.gif +0 -0
  105. package/src/img/android-studio-avd-manager.png +0 -0
  106. package/src/img/android-studio-build.png +0 -0
  107. package/src/img/app-scheme-registry.gif +0 -0
  108. package/src/img/expo-eject.png +0 -0
  109. package/src/img/ios-emulator-certification.png +0 -0
  110. package/src/img/ios-emulator-home.png +0 -0
  111. package/src/img/ios-emulator-payment.png +0 -0
  112. package/src/img/ios-trans-create-header-file-1.png +0 -0
  113. package/src/img/ios-trans-create-header-file-2.png +0 -0
  114. package/src/img/ios-trans-create-objectivec-file-1.png +0 -0
  115. package/src/img/ios-trans-create-objectivec-file-2.png +0 -0
  116. package/src/img/ios-trans-result.png +0 -0
  117. package/src/utils/IamportUrl.js +0 -103
package/android/gradlew DELETED
@@ -1,172 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- ##############################################################################
4
- ##
5
- ## Gradle start up script for UN*X
6
- ##
7
- ##############################################################################
8
-
9
- # Attempt to set APP_HOME
10
- # Resolve links: $0 may be a link
11
- PRG="$0"
12
- # Need this for relative symlinks.
13
- while [ -h "$PRG" ] ; do
14
- ls=`ls -ld "$PRG"`
15
- link=`expr "$ls" : '.*-> \(.*\)$'`
16
- if expr "$link" : '/.*' > /dev/null; then
17
- PRG="$link"
18
- else
19
- PRG=`dirname "$PRG"`"/$link"
20
- fi
21
- done
22
- SAVED="`pwd`"
23
- cd "`dirname \"$PRG\"`/" >/dev/null
24
- APP_HOME="`pwd -P`"
25
- cd "$SAVED" >/dev/null
26
-
27
- APP_NAME="Gradle"
28
- APP_BASE_NAME=`basename "$0"`
29
-
30
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
- DEFAULT_JVM_OPTS=""
32
-
33
- # Use the maximum available, or set MAX_FD != -1 to use that value.
34
- MAX_FD="maximum"
35
-
36
- warn () {
37
- echo "$*"
38
- }
39
-
40
- die () {
41
- echo
42
- echo "$*"
43
- echo
44
- exit 1
45
- }
46
-
47
- # OS specific support (must be 'true' or 'false').
48
- cygwin=false
49
- msys=false
50
- darwin=false
51
- nonstop=false
52
- case "`uname`" in
53
- CYGWIN* )
54
- cygwin=true
55
- ;;
56
- Darwin* )
57
- darwin=true
58
- ;;
59
- MINGW* )
60
- msys=true
61
- ;;
62
- NONSTOP* )
63
- nonstop=true
64
- ;;
65
- esac
66
-
67
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
-
69
- # Determine the Java command to use to start the JVM.
70
- if [ -n "$JAVA_HOME" ] ; then
71
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
- # IBM's JDK on AIX uses strange locations for the executables
73
- JAVACMD="$JAVA_HOME/jre/sh/java"
74
- else
75
- JAVACMD="$JAVA_HOME/bin/java"
76
- fi
77
- if [ ! -x "$JAVACMD" ] ; then
78
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
-
80
- Please set the JAVA_HOME variable in your environment to match the
81
- location of your Java installation."
82
- fi
83
- else
84
- JAVACMD="java"
85
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
-
87
- Please set the JAVA_HOME variable in your environment to match the
88
- location of your Java installation."
89
- fi
90
-
91
- # Increase the maximum file descriptors if we can.
92
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
- MAX_FD_LIMIT=`ulimit -H -n`
94
- if [ $? -eq 0 ] ; then
95
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
- MAX_FD="$MAX_FD_LIMIT"
97
- fi
98
- ulimit -n $MAX_FD
99
- if [ $? -ne 0 ] ; then
100
- warn "Could not set maximum file descriptor limit: $MAX_FD"
101
- fi
102
- else
103
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
- fi
105
- fi
106
-
107
- # For Darwin, add options to specify how the application appears in the dock
108
- if $darwin; then
109
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
- fi
111
-
112
- # For Cygwin, switch paths to Windows format before running java
113
- if $cygwin ; then
114
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
- JAVACMD=`cygpath --unix "$JAVACMD"`
117
-
118
- # We build the pattern for arguments to be converted via cygpath
119
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
- SEP=""
121
- for dir in $ROOTDIRSRAW ; do
122
- ROOTDIRS="$ROOTDIRS$SEP$dir"
123
- SEP="|"
124
- done
125
- OURCYGPATTERN="(^($ROOTDIRS))"
126
- # Add a user-defined pattern to the cygpath arguments
127
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
- fi
130
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
- i=0
132
- for arg in "$@" ; do
133
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
-
136
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
- else
139
- eval `echo args$i`="\"$arg\""
140
- fi
141
- i=$((i+1))
142
- done
143
- case $i in
144
- (0) set -- ;;
145
- (1) set -- "$args0" ;;
146
- (2) set -- "$args0" "$args1" ;;
147
- (3) set -- "$args0" "$args1" "$args2" ;;
148
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
- esac
155
- fi
156
-
157
- # Escape application args
158
- save () {
159
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
- echo " "
161
- }
162
- APP_ARGS=$(save "$@")
163
-
164
- # Collect all arguments for the java command, following the shell quoting and substitution rules
165
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
-
167
- # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
- if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
- cd "$(dirname "$0")"
170
- fi
171
-
172
- exec "$JAVACMD" "$@"
@@ -1,84 +0,0 @@
1
- @if "%DEBUG%" == "" @echo off
2
- @rem ##########################################################################
3
- @rem
4
- @rem Gradle startup script for Windows
5
- @rem
6
- @rem ##########################################################################
7
-
8
- @rem Set local scope for the variables with windows NT shell
9
- if "%OS%"=="Windows_NT" setlocal
10
-
11
- set DIRNAME=%~dp0
12
- if "%DIRNAME%" == "" set DIRNAME=.
13
- set APP_BASE_NAME=%~n0
14
- set APP_HOME=%DIRNAME%
15
-
16
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
- set DEFAULT_JVM_OPTS=
18
-
19
- @rem Find java.exe
20
- if defined JAVA_HOME goto findJavaFromJavaHome
21
-
22
- set JAVA_EXE=java.exe
23
- %JAVA_EXE% -version >NUL 2>&1
24
- if "%ERRORLEVEL%" == "0" goto init
25
-
26
- echo.
27
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
- echo.
29
- echo Please set the JAVA_HOME variable in your environment to match the
30
- echo location of your Java installation.
31
-
32
- goto fail
33
-
34
- :findJavaFromJavaHome
35
- set JAVA_HOME=%JAVA_HOME:"=%
36
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
-
38
- if exist "%JAVA_EXE%" goto init
39
-
40
- echo.
41
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
- echo.
43
- echo Please set the JAVA_HOME variable in your environment to match the
44
- echo location of your Java installation.
45
-
46
- goto fail
47
-
48
- :init
49
- @rem Get command-line arguments, handling Windows variants
50
-
51
- if not "%OS%" == "Windows_NT" goto win9xME_args
52
-
53
- :win9xME_args
54
- @rem Slurp the command line arguments.
55
- set CMD_LINE_ARGS=
56
- set _SKIP=2
57
-
58
- :win9xME_args_slurp
59
- if "x%~1" == "x" goto execute
60
-
61
- set CMD_LINE_ARGS=%*
62
-
63
- :execute
64
- @rem Setup the command line
65
-
66
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
-
68
- @rem Execute Gradle
69
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
-
71
- :end
72
- @rem End local scope for the variables with windows NT shell
73
- if "%ERRORLEVEL%"=="0" goto mainEnd
74
-
75
- :fail
76
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
- rem the _cmd.exe /c_ return code!
78
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
- exit /b 1
80
-
81
- :mainEnd
82
- if "%OS%"=="Windows_NT" endlocal
83
-
84
- :omega
@@ -1,88 +0,0 @@
1
- package com.iamport;
2
-
3
- import android.content.Intent;
4
-
5
- import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
7
- import com.facebook.react.bridge.Promise;
8
- import com.facebook.react.bridge.ReactMethod;
9
- import com.facebook.react.module.annotations.ReactModule;
10
-
11
- import java.net.URISyntaxException;
12
-
13
-
14
- @ReactModule(name = IamportModule.MODULE_NAME)
15
- public class IamportModule extends ReactContextBaseJavaModule {
16
- public static final String MODULE_NAME = "Iamport";
17
-
18
- private final static String BANKPAY = "kftc-bankpay";
19
- private final static String ISP = "ispmobile";
20
- private final static String KB_BANKPAY = "kb-bankpay";
21
- private final static String NH_BANKPAY = "nhb-bankpay";
22
- private final static String MG_BANKPAY = "mg-bankpay";
23
- private final static String KN_BANKPAY = "kn-bankpay";
24
-
25
- private final static String PACKAGE_ISP = "kvp.jjy.MispAndroid320";
26
- private final static String PACKAGE_BANKPAY = "com.kftc.bankpay.android";
27
- private final static String PACKAGE_KB_BANKPAY = "com.kbstar.liivbank";
28
- private final static String PACKAGE_NH_BANKPAY = "com.nh.cashcardapp";
29
- private final static String PACKAGE_MG_BANKPAY = "kr.co.kfcc.mobilebank";
30
- private final static String PACKAGE_KN_BANKPAY = "com.knb.psb";
31
-
32
- public IamportModule(ReactApplicationContext reactContext) {
33
- super(reactContext);
34
- }
35
-
36
- @Override
37
- public String getName() { return MODULE_NAME; }
38
-
39
- @ReactMethod
40
- public void getAppUrl(String url, Promise promise) {
41
- try {
42
- Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
43
- promise.resolve(intent.getDataString());
44
- } catch (URISyntaxException e) {
45
- promise.reject("URISyntaxException", e.getMessage());
46
- }
47
- }
48
-
49
- @ReactMethod
50
- public void getMarketUrl(String url, Promise promise) {
51
- try {
52
- Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
53
- String packageName = getPackageName(intent);
54
- promise.resolve("market://details?id=" + packageName);
55
- } catch (URISyntaxException e) {
56
- promise.reject("URISyntaxException", e.getMessage());
57
- }
58
- }
59
-
60
- public String getPackageName(Intent intent) {
61
- String scheme = intent.getScheme();
62
- if (scheme.equalsIgnoreCase(ISP)) {
63
- return PACKAGE_ISP;
64
- }
65
-
66
- if (scheme.equalsIgnoreCase(BANKPAY)) {
67
- return PACKAGE_BANKPAY;
68
- }
69
-
70
- if (scheme.equalsIgnoreCase(KB_BANKPAY)) {
71
- return PACKAGE_KB_BANKPAY;
72
- }
73
-
74
- if (scheme.equalsIgnoreCase(NH_BANKPAY)) {
75
- return PACKAGE_NH_BANKPAY;
76
- }
77
-
78
- if (scheme.equalsIgnoreCase(MG_BANKPAY)) {
79
- return PACKAGE_MG_BANKPAY;
80
- }
81
-
82
- if (scheme.equalsIgnoreCase(KN_BANKPAY)) {
83
- return PACKAGE_KN_BANKPAY;
84
- }
85
-
86
- return intent.getPackage();
87
- }
88
- }
@@ -1,23 +0,0 @@
1
-
2
- package com.iamport;
3
-
4
- import java.util.Arrays;
5
- import java.util.Collections;
6
- import java.util.List;
7
-
8
- import com.facebook.react.ReactPackage;
9
- import com.facebook.react.bridge.NativeModule;
10
- import com.facebook.react.bridge.ReactApplicationContext;
11
- import com.facebook.react.uimanager.ViewManager;
12
-
13
- public class IamportPackage implements ReactPackage {
14
- @Override
15
- public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16
- return Arrays.<NativeModule>asList(new IamportModule(reactContext));
17
- }
18
-
19
- @Override
20
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
21
- return Collections.emptyList();
22
- }
23
- }
@@ -1,11 +0,0 @@
1
-
2
- #if __has_include(<React/RCTBridgeModule.h>)
3
- #import <React/RCTBridgeModule.h>
4
- #else
5
- #import "RCTBridgeModule.h"
6
- #endif
7
-
8
- @interface IamportReactNative : NSObject <RCTBridgeModule>
9
-
10
- @end
11
-
@@ -1,23 +0,0 @@
1
-
2
- #import "IamportReactNative.h"
3
- #import <React/RCTLinkingManager.h>
4
-
5
- @implementation IamportReactNative
6
-
7
- - (dispatch_queue_t)methodQueue
8
- {
9
- return dispatch_get_main_queue();
10
- }
11
-
12
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
13
- {
14
- // [IOS6] 세션 끊어지는 상황 방지 위한 쿠키 설정 (설정에서 사파리 쿠키 사용 설정도 필요)
15
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
16
-
17
- return YES;
18
- }
19
-
20
- RCT_EXPORT_MODULE() // To export a module named IamportReactNative
21
-
22
- @end
23
-
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </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,9 +0,0 @@
1
- // !$*UTF8*$!
2
- <?xml version="1.0" encoding="UTF-8"?>
3
- <Workspace
4
- version = "1.0">
5
- <FileRef
6
- location = "group:IamportReactNative.xcodeproj">
7
- </FileRef>
8
- </Workspace>
9
-
@@ -1,68 +0,0 @@
1
-
2
- # 콜백 함수 설정하기
3
- 아임포트 리액트 네이티브 모듈 콜백 함수 설정을 위한 안내입니다.
4
-
5
- 콜백 함수는 필수입력 필드로, 결제/본인인증 완료 후 라우트를 이동하도록 로직을 작성해야합니다. [react-navigation](https://github.com/react-navigation/react-navigation)을 통해 라우터를 변경하는 경우, 아래와 같이 [push 함수](https://reactnavigation.org/docs/en/stack-actions.html#push)가 아닌 [replace 함수](https://reactnavigation.org/docs/en/stack-actions.html#replace)를 사용해야 합니다.
6
- push 함수를 사용할 경우, 결제 완료 후 라우터가 변경되더라도 유저가 뒤로가기를 했을 경우 아임포트 모듈이 다시 렌더링됩니다. 하지만 replace 함수를 사용하면, 결제 완료 후 라우터가 변경되고 유저가 뒤로가기를 하면 원래 결제하기 직전 화면으로 넘어가게 됩니다.
7
-
8
- ### 잘못된 사용 예제
9
- ```javascript
10
- function callback(response) {
11
- navigation.push('Result', response); // [에러] push 함수 사용
12
- }
13
- ```
14
-
15
- ### 올바른 사용 예제
16
- ```javascript
17
- function callback(response) {
18
- navigation.replace('Result', response);
19
- }
20
- ```
21
-
22
- ### 결과에 따라 로직 작성하기
23
- 콜백 함수의 첫번째 인자(response)는 결제/본인인증 결과를 담고 있는 오브젝트로 아래와 같이 구성되어 있습니다. 자세한 내용은 아임포트 공식 문서 [IMP.request_pay - param, rsp 객체 - Callback 함수의 rsp 객제](https://docs.iamport.kr/tech/imp#callback)를 참고해주세요.
24
-
25
- | key | Description |
26
- | ------------- | ------------------ |
27
- | success | 성공 여부 |
28
- | imp_uid | 아임포트 번호 |
29
- | merchant_uid | 주문번호 |
30
- | error_msg | 실패한 경우, 에러메시지 |
31
-
32
- response에 따라 결제/본인인증 성공/실패 여부를 판단해 아래와 같이 각기 다른 로직을 구성할 수 있습니다. 아래 코드는 예시일 뿐 실제 결제 성공/실패여부는 결제 유효성 검사 후 아임포트 REST API로 결제내역을 조회해 판단해야 합니다. 자세한 내용은 아임포트 공식 문서 [일반결제 연동하기 - STEP5. 서버에서 거래 검증 및 데이터 동기화](https://docs.iamport.kr/implementation/payment#server-side-logic)를 참고해주세요.
33
-
34
- ```javascript
35
- import React from 'react';
36
- import { View, Text } from 'react-native';
37
-
38
- function Result({ navigation }) {
39
- const success = navigation.getParam('success');
40
- const imp_uid = navigation.getParam('imp_uid');
41
- const merchant_uid = navigation.getParam('merchant_uid');
42
-
43
- return (
44
- <View>
45
- <Text>{`결제/본인인증에 ${success ? '성공' : '실패'}하였습니다.`}</Text>
46
- <View>
47
- <View>
48
- <Text>아임포트 번호</Text>
49
- <Text>{imp_uid || '없음'}</Text>
50
- </View>
51
- <View>
52
- <Text>주문 번호</Text>
53
- <Text>{merchant_uid || '없음'}</Text>
54
- </View>
55
- {
56
- !success &&
57
- <View>
58
- <Text>에러 메시지</Text>
59
- <Text>{error_msg || '없음'}</Text>
60
- </View>
61
- }
62
- </View>
63
- </View>
64
- );
65
- }
66
-
67
- export default Result;
68
- ```
@@ -1,175 +0,0 @@
1
- # 예제 프로젝트
2
-
3
- 아임포트 리액트 네이티브 모듈 예제 안내입니다.
4
-
5
- iamport-react-native 모듈을 clone받아 폴더 위치를 `example` 프로젝트로 이동합니다.
6
-
7
- ```
8
- $ git clone https://github.com/iamport/iamport-react-native.git
9
- $ cd ./iamport-react-native/example
10
- ```
11
-
12
- 필요한 npm 모듈을 설치합니다.
13
-
14
- ```
15
- $ npm install
16
- $ npx jetifier // AndroidX 환경 대비
17
- ```
18
-
19
- 앱을 실행합니다.
20
-
21
- ```
22
- $ npm start -- --reset-cache
23
- ```
24
-
25
- 각 환경에 맞게 앱을 빌드합니다.
26
-
27
- ### IOS
28
- - [XCode를 설치](https://developer.apple.com/xcode)합니다.
29
- - 프로젝트(`[...]/node_modules/iamport-react-native/example/ios/example.xcodeproj`)를 더블클릭해 오픈합니다.
30
- - 빌드 타깃을 선택하고 앱을 빌드(`Cmd+R`)합니다.
31
-
32
- ### Android
33
- - [안드로이드 스튜디오를 설치](https://developer.android.com/studio)합니다.
34
- - 안드로이드 스튜디오에서 프로젝트(`[...]/node_modules/iamport-react-native/example/android`)를 더블클릭해 오픈합니다.
35
- - 빌드 타깃을 선택하고 앱을 빌드(![](../src/img/android-studio-build.png) 또는 `Cmd+F9`)합니다.
36
-
37
- ![](../src/img/ios-emulator-home.png)
38
- ![](../src/img/ios-emulator-payment.png)
39
- ![](../src/img/ios-emulator-certification.png)
40
-
41
-
42
- ### 일반/정기결제 코드 예시
43
- ```javascript
44
- import React from 'react';
45
- /* 아임포트 결제모듈을 불러옵니다. */
46
- import IMP from 'iamport-react-native';
47
-
48
- /* 로딩 컴포넌트를 불러옵니다. */
49
- import Loading from './Loading';
50
-
51
- export function Payment({ navigation }) {
52
- /* [필수입력] 결제 종료 후, 라우터를 변경하고 결과를 전달합니다. */
53
- function callback(response) {
54
- navigation.replace('PaymentResult', response);
55
- }
56
-
57
- /* [필수입력] 결제에 필요한 데이터를 입력합니다. */
58
- const data = {
59
- pg: 'html5_inicis',
60
- pay_method: 'card',
61
- name: '아임포트 결제데이터 분석',
62
- merchant_uid: `mid_${new Date().getTime()}`,
63
- amount: '39000',
64
- buyer_name: '홍길동',
65
- buyer_tel: '01012345678',
66
- buyer_email: 'example@naver.com',
67
- buyer_addr: '서울시 강남구 신사동 661-16',
68
- buyer_postcode: '06018',
69
- app_scheme: 'example',
70
- // [Deprecated v1.0.3]: m_redirect_url
71
- };
72
-
73
- return (
74
- <IMP.Payment
75
- userCode={'iamport'} // 가맹점 식별코드
76
- tierCode={'AAA'} // 티어 코드: agency 기능 사용자에 한함
77
- loading={<Loading />} // 로딩 컴포넌트
78
- data={data} // 결제 데이터
79
- callback={callback} // 결제 종료 후 콜백
80
- />
81
- );
82
- }
83
-
84
- export default Payment;
85
- ```
86
-
87
- | Prop | Type | Description | Required |
88
- | ---------------- | ------------- | ----------------------------------------------------------- | ---------- |
89
- | userCode | string | 가맹점 식별코드 | true |
90
- | tierCode | string | agency 기능 사용자의 하위 가맹점 코드 3자리 | false |
91
- | data | object | 결제에 필요한 정보 [자세히 보기](https://docs.iamport.kr/tech/imp) | true |
92
- | - m_redirect_url | string | [Deprecated] | false |
93
- | callback | function | 결제 후 실행 될 함수 [자세히보기](#callback) | true |
94
- | loading | RN 컴포넌트 | 웹뷰 로드시 보여질 컴포넌트 | false |
95
-
96
-
97
- ### 휴대폰 본인인증 코드 예시
98
- ```javascript
99
- import React from 'react';
100
- /* 아임포트 본인인증 모듈을 불러옵니다. */
101
- import IMP from 'iamport-react-native';
102
-
103
- /* 로딩 컴포넌트를 불러옵니다. */
104
- import Loading from './Loading';
105
-
106
- export function Certification({ navigation }) {
107
- /* [필수입력] 본인인증 종료 후, 라우터를 변경하고 결과를 전달합니다. */
108
- function callback(response) {
109
- navigation.replace('CertificationResult', response);
110
- }
111
-
112
- /* [필수입력] 본인인증에 필요한 데이터를 입력합니다. */
113
- const data = {
114
- merchant_uid: `mid_${new Date().getTime()}`,
115
- company: '아임포트',
116
- carrier: 'SKT',
117
- name: '홍길동',
118
- phone: '01012341234',
119
- min_age: '',
120
- };
121
-
122
- return (
123
- <IMP.Certification
124
- userCode={'iamport'} // 가맹점 식별코드
125
- tierCode={'AAA'} // 티어 코드: agency 기능 사용자에 한함
126
- loading={<Loading />} // 로딩 컴포넌트
127
- data={data} // 본인인증 데이터
128
- callback={callback} // 본인인증 종료 후 콜백
129
- />
130
- );
131
- }
132
-
133
- export default Certification;
134
- ```
135
-
136
- | Prop | Type | Description | Required |
137
- | ------------- | ------------- | ---------------------------------- | ---------- |
138
- | userCode | string | 가맹점 식별코드 | true |
139
- | tierCode | string | agency 기능 사용자의 하위 가맹점 코드 3자리 | false |
140
- | data | object | 본인인증에 필요한 정보 [자세히 보기](https://https://docs.iamport.kr/tech/mobile-authentication#call-authentication) | true |
141
- | - merchant_uid| string | 가맹점 주문번호 | false |
142
- | - company | string | 회사명 또는 URL | false |
143
- | - carrier | string | 통신사 | false |
144
- | - name | string | 본인인증 할 이름 | false |
145
- | - phone | number | 본인인증 할 전화번호 | false |
146
- | - min_age | number | 본인인증 허용 최소 연령 | false |
147
- | callback | function | 본인인증 후 실행 될 함수 | true |
148
- | loading | RN 컴포넌트 | 웹뷰 로드시 보여질 컴포넌트 | false |
149
-
150
- ### 웹뷰 로딩 컴포넌트 코드 예시
151
- 웹뷰가 로드되기 전 보여질 로딩 화면을 컴포넌트로 생성해 loading 파라메터로 넘깁니다. 미 입력시 아임포트가 보여주는 default 로딩 페이지가 렌더링됩니다. 아래는 로딩 컴포넌트 코드 작성 예시입니다.
152
-
153
- ```javascript
154
- import React from 'react';
155
- import { View, Text, StyleSheet } from 'react-native';
156
-
157
- export function Loading() {
158
- const { container } = styles;
159
- return (
160
- <View style={container}>
161
- <Text>잠시만 기다려주세요...</Text>
162
- </View>
163
- );
164
- }
165
-
166
- const styles = StyleSheet.create({
167
- container: {
168
- ...StyleSheet.absoluteFillObject,
169
- },
170
- });
171
-
172
- export default Loading;
173
- ```
174
-
175
- 로딩 컴포넌트를 감싸고 있는 최상단 View 컴포넌트의 스타일 속성을 지정할때 주의해야합니다. 별도의 설정 없이 작성할 경우, 로딩 컴포넌트는 전체 화면의 절반만 차지하게 됩니다. 이는 react-native-webview 모듈 자체의 이슈로, 스타일 속성을 지정할때 위 예시와 같이 `StyleSheet.absoluteFillObject`값을 추가해주면 됩니다. 자세한 내용은 [Fix: Flex loading view](https://github.com/react-native-community/react-native-webview/pull/663)를 참고해주세요.