react-native-smallcase-gateway 2.1.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,74 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.2.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.1.1...v2.2.1) (2023-07-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * add artifactory creds in gradle.properties ([4da3731](https://github.com/smallcase/react-native-smallcase-gateway/commit/4da3731d6530d6b8981ba2808b12fafc90fa6b07))
11
+ * android bridge SetupResponse ([a9ef115](https://github.com/smallcase/react-native-smallcase-gateway/commit/a9ef11535640cf13c86cc5a188f649e9afb2bbf6))
12
+ * las internal android ([0d7da50](https://github.com/smallcase/react-native-smallcase-gateway/commit/0d7da503b69f93ce2fe7652c9f219491b41dfc6a))
13
+ * **las:** withdraw servicing method ([3eb4b89](https://github.com/smallcase/react-native-smallcase-gateway/commit/3eb4b8976bc03d05165c54f726749816a98d6b75))
14
+ * **Loans:** added repayment Loans Servicing method ([702eb0b](https://github.com/smallcase/react-native-smallcase-gateway/commit/702eb0b0140679a333183144fd8d0a6a77932024))
15
+ * ScLoan environment ([fc6c1be](https://github.com/smallcase/react-native-smallcase-gateway/commit/fc6c1be22c6e479667af816a250d40ef014c2012))
16
+ * ScLoan withdraw flow ([04b26da](https://github.com/smallcase/react-native-smallcase-gateway/commit/04b26da5de347ff1e954b8779b46540070c36c0b))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * android bridge loans params ([51e8430](https://github.com/smallcase/react-native-smallcase-gateway/commit/51e84308152a37935cfd23ffc3dd677a24deaa96))
22
+ * android bridge setup response to json ([c1a0bd6](https://github.com/smallcase/react-native-smallcase-gateway/commit/c1a0bd675e4d706b6471fa436e34bd85202ebb43))
23
+ * android bridge setupLoans - scGatewayConfig ([0068c83](https://github.com/smallcase/react-native-smallcase-gateway/commit/0068c834813efe664b56f639c13d39c6c3643a90))
24
+ * android bridge setupLoans versionCode key ([a0d71d3](https://github.com/smallcase/react-native-smallcase-gateway/commit/a0d71d3bb1daf02c88882821483d8c54b91d8a75))
25
+ * bug fixes for WITHDRAW intent ([8e76670](https://github.com/smallcase/react-native-smallcase-gateway/commit/8e76670db5bf78294ce6063be3b774f7c295c06e))
26
+ * environment mismatch ([fdb16dc](https://github.com/smallcase/react-native-smallcase-gateway/commit/fdb16dc83a7e4dd9d2d3b65fb153159f3ee971b9))
27
+ * export ScLoan ([33a1d75](https://github.com/smallcase/react-native-smallcase-gateway/commit/33a1d7504d01dc06b56d1e2c92aa543b28afd046))
28
+ * interaction updation race condition ([390c377](https://github.com/smallcase/react-native-smallcase-gateway/commit/390c377abd2bbca0b0a26c6737f49b390295ccd0))
29
+ * iOS nil error data with SCLoan error ([5f8f589](https://github.com/smallcase/react-native-smallcase-gateway/commit/5f8f589d053a37703aec8b81bd6e9b06a9edaea0))
30
+ * loans internal SDK version number ([6b35d6c](https://github.com/smallcase/react-native-smallcase-gateway/commit/6b35d6c484d90b4340e1ade8e03197bb698baae7))
31
+ * loans setup being called on platform, inc. in js ([6cf7c46](https://github.com/smallcase/react-native-smallcase-gateway/commit/6cf7c462dc2ff2afbc9280698d68a7c40518d58d))
32
+ * **loans:** response parse error in loans setup ([67350f8](https://github.com/smallcase/react-native-smallcase-gateway/commit/67350f821d0af43b290bff72f49188853638c401))
33
+ * refactoring SDK contracts ([c0602ce](https://github.com/smallcase/react-native-smallcase-gateway/commit/c0602ce1ee2b31c4eccbbb43f9a76934f183b8dd))
34
+ * ScGatewayConfig to ScLoanConfig ([ef3a90b](https://github.com/smallcase/react-native-smallcase-gateway/commit/ef3a90bc52ed1206102d1cc3d99996dfc4f5a944))
35
+ * ScLoanConfig to ScLoanInfo for flow methods ([31741c2](https://github.com/smallcase/react-native-smallcase-gateway/commit/31741c2e8dd9f1e654fcf4b7debfe7d7cf7d8852))
36
+ * setup loans environment mismatch ([906e27c](https://github.com/smallcase/react-native-smallcase-gateway/commit/906e27c5343ae2dfb17682af7cdb075c9ddfcde4))
37
+ * unknown envrionment reference ([576c840](https://github.com/smallcase/react-native-smallcase-gateway/commit/576c840355f88f931bd57d4c002f6ffacc35be6d))
38
+
39
+ ## [2.2.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.1.1...v2.2.0) (2023-07-13)
40
+
41
+
42
+ ### Features
43
+
44
+ * add artifactory creds in gradle.properties ([4da3731](https://github.com/smallcase/react-native-smallcase-gateway/commit/4da3731d6530d6b8981ba2808b12fafc90fa6b07))
45
+ * android bridge SetupResponse ([a9ef115](https://github.com/smallcase/react-native-smallcase-gateway/commit/a9ef11535640cf13c86cc5a188f649e9afb2bbf6))
46
+ * las internal android ([0d7da50](https://github.com/smallcase/react-native-smallcase-gateway/commit/0d7da503b69f93ce2fe7652c9f219491b41dfc6a))
47
+ * **las:** withdraw servicing method ([3eb4b89](https://github.com/smallcase/react-native-smallcase-gateway/commit/3eb4b8976bc03d05165c54f726749816a98d6b75))
48
+ * **Loans:** added repayment Loans Servicing method ([702eb0b](https://github.com/smallcase/react-native-smallcase-gateway/commit/702eb0b0140679a333183144fd8d0a6a77932024))
49
+ * ScLoan environment ([fc6c1be](https://github.com/smallcase/react-native-smallcase-gateway/commit/fc6c1be22c6e479667af816a250d40ef014c2012))
50
+ * ScLoan withdraw flow ([04b26da](https://github.com/smallcase/react-native-smallcase-gateway/commit/04b26da5de347ff1e954b8779b46540070c36c0b))
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * android bridge loans params ([51e8430](https://github.com/smallcase/react-native-smallcase-gateway/commit/51e84308152a37935cfd23ffc3dd677a24deaa96))
56
+ * android bridge setup response to json ([c1a0bd6](https://github.com/smallcase/react-native-smallcase-gateway/commit/c1a0bd675e4d706b6471fa436e34bd85202ebb43))
57
+ * android bridge setupLoans - scGatewayConfig ([0068c83](https://github.com/smallcase/react-native-smallcase-gateway/commit/0068c834813efe664b56f639c13d39c6c3643a90))
58
+ * android bridge setupLoans versionCode key ([a0d71d3](https://github.com/smallcase/react-native-smallcase-gateway/commit/a0d71d3bb1daf02c88882821483d8c54b91d8a75))
59
+ * bug fixes for WITHDRAW intent ([8e76670](https://github.com/smallcase/react-native-smallcase-gateway/commit/8e76670db5bf78294ce6063be3b774f7c295c06e))
60
+ * environment mismatch ([fdb16dc](https://github.com/smallcase/react-native-smallcase-gateway/commit/fdb16dc83a7e4dd9d2d3b65fb153159f3ee971b9))
61
+ * export ScLoan ([33a1d75](https://github.com/smallcase/react-native-smallcase-gateway/commit/33a1d7504d01dc06b56d1e2c92aa543b28afd046))
62
+ * interaction updation race condition ([390c377](https://github.com/smallcase/react-native-smallcase-gateway/commit/390c377abd2bbca0b0a26c6737f49b390295ccd0))
63
+ * iOS nil error data with SCLoan error ([5f8f589](https://github.com/smallcase/react-native-smallcase-gateway/commit/5f8f589d053a37703aec8b81bd6e9b06a9edaea0))
64
+ * loans internal SDK version number ([6b35d6c](https://github.com/smallcase/react-native-smallcase-gateway/commit/6b35d6c484d90b4340e1ade8e03197bb698baae7))
65
+ * loans setup being called on platform, inc. in js ([6cf7c46](https://github.com/smallcase/react-native-smallcase-gateway/commit/6cf7c462dc2ff2afbc9280698d68a7c40518d58d))
66
+ * **loans:** response parse error in loans setup ([67350f8](https://github.com/smallcase/react-native-smallcase-gateway/commit/67350f821d0af43b290bff72f49188853638c401))
67
+ * refactoring SDK contracts ([c0602ce](https://github.com/smallcase/react-native-smallcase-gateway/commit/c0602ce1ee2b31c4eccbbb43f9a76934f183b8dd))
68
+ * ScGatewayConfig to ScLoanConfig ([ef3a90b](https://github.com/smallcase/react-native-smallcase-gateway/commit/ef3a90bc52ed1206102d1cc3d99996dfc4f5a944))
69
+ * ScLoanConfig to ScLoanInfo for flow methods ([31741c2](https://github.com/smallcase/react-native-smallcase-gateway/commit/31741c2e8dd9f1e654fcf4b7debfe7d7cf7d8852))
70
+ * setup loans environment mismatch ([906e27c](https://github.com/smallcase/react-native-smallcase-gateway/commit/906e27c5343ae2dfb17682af7cdb075c9ddfcde4))
71
+ * unknown envrionment reference ([576c840](https://github.com/smallcase/react-native-smallcase-gateway/commit/576c840355f88f931bd57d4c002f6ffacc35be6d))
72
+
5
73
  ### [2.1.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.0.0...v2.1.1) (2023-05-17)
6
74
 
7
75
 
@@ -60,6 +60,7 @@ android {
60
60
  repositories {
61
61
  mavenCentral()
62
62
  google()
63
+ mavenLocal()
63
64
 
64
65
  maven {
65
66
  url "https://artifactory.smallcase.com/artifactory/gradle-dev-local"
@@ -69,6 +70,21 @@ repositories {
69
70
  }
70
71
  }
71
72
 
73
+ maven {
74
+ url "${artifactory_contextUrl}/SCGateway-internal"
75
+ credentials {
76
+ username "${artifactory_user}"
77
+ password "${artifactory_password}"
78
+ }
79
+ }
80
+ maven {
81
+ url "${artifactory_contextUrl}/SCLoans-internal"
82
+ credentials {
83
+ username "${artifactory_user}"
84
+ password "${artifactory_password}"
85
+ }
86
+ }
87
+
72
88
  def found = false
73
89
  def defaultDir = null
74
90
  def androidSourcesName = 'React Native sources'
@@ -140,7 +156,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
140
156
  dependencies {
141
157
  //noinspection GradleDynamicVersion
142
158
  implementation 'com.facebook.react:react-native:+' // From node_modules
143
- implementation 'com.smallcase.gateway:sdk:3.9.0'
159
+ implementation 'com.smallcase.gateway:sdk:3.9.6-loans-internal-release-12'
144
160
  implementation "androidx.core:core-ktx:1.3.1"
145
161
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
146
162
  }
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4
+ zipStoreBase=GRADLE_USER_HOME
5
+ zipStorePath=wrapper/dists
@@ -3,3 +3,7 @@ SmallcaseGateway_minSdkVersion=21
3
3
  SmallcaseGateway_targetSdkVersion=31
4
4
  SmallcaseGateway_compileSdkVersion=31
5
5
  SmallcaseGateway_ndkversion=21.4.7075529
6
+
7
+ artifactory_contextUrl=https\://artifactory.smallcase.com/artifactory
8
+ artifactory_password=reactNativeUser123
9
+ artifactory_user=react_native_user
@@ -0,0 +1,234 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015-2021 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ ##############################################################################
20
+ #
21
+ # Gradle start up script for POSIX generated by Gradle.
22
+ #
23
+ # Important for running:
24
+ #
25
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+ # noncompliant, but you have some other compliant shell such as ksh or
27
+ # bash, then to run this script, type that shell name before the whole
28
+ # command line, like:
29
+ #
30
+ # ksh Gradle
31
+ #
32
+ # Busybox and similar reduced shells will NOT work, because this script
33
+ # requires all of these POSIX shell features:
34
+ # * functions;
35
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+ # * compound commands having a testable exit status, especially «case»;
38
+ # * various built-in commands including «command», «set», and «ulimit».
39
+ #
40
+ # Important for patching:
41
+ #
42
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
43
+ # by Bash, Ksh, etc; in particular arrays are avoided.
44
+ #
45
+ # The "traditional" practice of packing multiple parameters into a
46
+ # space-separated string is a well documented source of bugs and security
47
+ # problems, so this is (mostly) avoided, by progressively accumulating
48
+ # options in "$@", and eventually passing that to Java.
49
+ #
50
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52
+ # see the in-line comments for details.
53
+ #
54
+ # There are tweaks for specific operating systems such as AIX, CygWin,
55
+ # Darwin, MinGW, and NonStop.
56
+ #
57
+ # (3) This script is generated from the Groovy template
58
+ # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+ # within the Gradle project.
60
+ #
61
+ # You can find Gradle at https://github.com/gradle/gradle/.
62
+ #
63
+ ##############################################################################
64
+
65
+ # Attempt to set APP_HOME
66
+
67
+ # Resolve links: $0 may be a link
68
+ app_path=$0
69
+
70
+ # Need this for daisy-chained symlinks.
71
+ while
72
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73
+ [ -h "$app_path" ]
74
+ do
75
+ ls=$( ls -ld "$app_path" )
76
+ link=${ls#*' -> '}
77
+ case $link in #(
78
+ /*) app_path=$link ;; #(
79
+ *) app_path=$APP_HOME$link ;;
80
+ esac
81
+ done
82
+
83
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84
+
85
+ APP_NAME="Gradle"
86
+ APP_BASE_NAME=${0##*/}
87
+
88
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118
+
119
+
120
+ # Determine the Java command to use to start the JVM.
121
+ if [ -n "$JAVA_HOME" ] ; then
122
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123
+ # IBM's JDK on AIX uses strange locations for the executables
124
+ JAVACMD=$JAVA_HOME/jre/sh/java
125
+ else
126
+ JAVACMD=$JAVA_HOME/bin/java
127
+ fi
128
+ if [ ! -x "$JAVACMD" ] ; then
129
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130
+
131
+ Please set the JAVA_HOME variable in your environment to match the
132
+ location of your Java installation."
133
+ fi
134
+ else
135
+ JAVACMD=java
136
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
+
138
+ Please set the JAVA_HOME variable in your environment to match the
139
+ location of your Java installation."
140
+ fi
141
+
142
+ # Increase the maximum file descriptors if we can.
143
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
+ case $MAX_FD in #(
145
+ max*)
146
+ MAX_FD=$( ulimit -H -n ) ||
147
+ warn "Could not query maximum file descriptor limit"
148
+ esac
149
+ case $MAX_FD in #(
150
+ '' | soft) :;; #(
151
+ *)
152
+ ulimit -n "$MAX_FD" ||
153
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
154
+ esac
155
+ fi
156
+
157
+ # Collect all arguments for the java command, stacking in reverse order:
158
+ # * args from the command line
159
+ # * the main class name
160
+ # * -classpath
161
+ # * -D...appname settings
162
+ # * --module-path (only if needed)
163
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164
+
165
+ # For Cygwin or MSYS, switch paths to Windows format before running java
166
+ if "$cygwin" || "$msys" ; then
167
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169
+
170
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
171
+
172
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
173
+ for arg do
174
+ if
175
+ case $arg in #(
176
+ -*) false ;; # don't mess with options #(
177
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178
+ [ -e "$t" ] ;; #(
179
+ *) false ;;
180
+ esac
181
+ then
182
+ arg=$( cygpath --path --ignore --mixed "$arg" )
183
+ fi
184
+ # Roll the args list around exactly as many times as the number of
185
+ # args, so each arg winds up back in the position where it started, but
186
+ # possibly modified.
187
+ #
188
+ # NB: a `for` loop captures its iteration list before it begins, so
189
+ # changing the positional parameters here affects neither the number of
190
+ # iterations, nor the values presented in `arg`.
191
+ shift # remove old arg
192
+ set -- "$@" "$arg" # push replacement arg
193
+ done
194
+ fi
195
+
196
+ # Collect all arguments for the java command;
197
+ # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
+ # shell script including quotes and variable substitutions, so put them in
199
+ # double quotes to make sure that they get re-expanded; and
200
+ # * put everything else in single quotes, so that it's not re-expanded.
201
+
202
+ set -- \
203
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
204
+ -classpath "$CLASSPATH" \
205
+ org.gradle.wrapper.GradleWrapperMain \
206
+ "$@"
207
+
208
+ # Use "xargs" to parse quoted args.
209
+ #
210
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211
+ #
212
+ # In Bash we could simply go:
213
+ #
214
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215
+ # set -- "${ARGS[@]}" "$@"
216
+ #
217
+ # but POSIX shell has neither arrays nor command substitution, so instead we
218
+ # post-process each arg (as a line of input to sed) to backslash-escape any
219
+ # character that might be a shell metacharacter, then use eval to reverse
220
+ # that process (while maintaining the separation between arguments), and wrap
221
+ # the whole thing up as a single "set" statement.
222
+ #
223
+ # This will of course break if any of these variables contains a newline or
224
+ # an unmatched quote.
225
+ #
226
+
227
+ eval "set -- $(
228
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229
+ xargs -n1 |
230
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231
+ tr '\n' ' '
232
+ )" '"$@"'
233
+
234
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,89 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega
@@ -1,6 +1,7 @@
1
1
  package com.reactnativesmallcasegateway
2
2
 
3
3
  import android.util.Log
4
+ import androidx.appcompat.app.AppCompatActivity
4
5
  import com.facebook.react.bridge.*
5
6
  import com.smallcase.gateway.data.SmallcaseGatewayListeners
6
7
  import com.smallcase.gateway.data.SmallcaseLogoutListener
@@ -9,7 +10,9 @@ import com.smallcase.gateway.data.models.*
9
10
  import com.smallcase.gateway.data.requests.InitRequest
10
11
  import com.smallcase.gateway.portal.SmallcaseGatewaySdk
11
12
  import com.smallcase.gateway.portal.SmallplugPartnerProps
12
- import kotlin.Error
13
+ import com.smallcase.loans.core.external.*
14
+ import com.smallcase.loans.core.internal.*
15
+ import com.google.gson.Gson
13
16
 
14
17
  class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
15
18
  companion object {
@@ -293,6 +296,108 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
293
296
  }
294
297
  }
295
298
 
299
+ @ReactMethod
300
+ fun setupLoans(config: ReadableMap, promise: Promise) {
301
+ val appCompatActivity = currentActivity as? AppCompatActivity ?: return
302
+ val hashMap = readableMapToStrHashMap(config)
303
+ val gateway = hashMap["gatewayName"]
304
+ val environment = hashMap["environment"]
305
+ if(gateway == null) {
306
+ promise.reject(Throwable("gatewayName is null"))
307
+ return
308
+ }
309
+ val scEnvironment = when(environment) {
310
+ "staging" -> SCLoanEnvironment.STAGING
311
+ "development" -> SCLoanEnvironment.DEVELOPMENT
312
+ else -> SCLoanEnvironment.PRODUCTION
313
+ }
314
+ val writableMap: WritableMap = Arguments.createMap()
315
+ val scGatewayConfig = SCLoanConfig(gateway, scEnvironment)
316
+ SCLoan.setup(scGatewayConfig, object : SCLoanResult {
317
+ override fun onFailure(error: SCLoanError) {
318
+ val errorWritableMap = createErrorJSON(error.errorCode, error.errorMessage, error.data)
319
+ promise.reject("error", errorWritableMap)
320
+ }
321
+
322
+ override fun onSuccess(response: SCLoanSuccess) {
323
+ writableMap.putBoolean("success", true)
324
+ promise.resolve(Gson().toJson(writableMap.toHashMap()))
325
+ }
326
+
327
+ })
328
+
329
+ // writableMap.putBoolean("success", true)
330
+ // writableMap.putString("version", setupResponse.version)
331
+ // writableMap.putInt("versionCode", setupResponse.versionCode.toInt())
332
+
333
+ }
334
+
335
+ @ReactMethod
336
+ fun apply(loanConfig: ReadableMap, promise: Promise) {
337
+ val appCompatActivity = currentActivity as? AppCompatActivity ?: return
338
+ val hashMap = readableMapToStrHashMap(loanConfig)
339
+ val interactionToken = hashMap["interactionToken"]
340
+ if(interactionToken == null) {
341
+ promise.reject(Throwable("Interaction token is null"))
342
+ return
343
+ }
344
+ val loanConfigObj = SCLoanInfo(interactionToken)
345
+ SCLoan.apply(appCompatActivity, loanConfigObj, object : SCLoanResult {
346
+ override fun onFailure(error: SCLoanError) {
347
+ val errorWritableMap = createErrorJSON(error.errorCode, error.errorMessage, error.data)
348
+ promise.reject("error", errorWritableMap)
349
+ }
350
+
351
+ override fun onSuccess(response: SCLoanSuccess) {
352
+ promise.resolve(response.toString())
353
+ }
354
+ })
355
+ }
356
+
357
+ @ReactMethod
358
+ fun pay(loanConfig: ReadableMap, promise: Promise) {
359
+ val appCompatActivity = currentActivity as? AppCompatActivity ?: return
360
+ val hashMap = readableMapToStrHashMap(loanConfig)
361
+ val interactionToken = hashMap["interactionToken"]
362
+ if(interactionToken == null) {
363
+ promise.reject(Throwable("Interaction token is null"))
364
+ return
365
+ }
366
+ val loanConfigObj = SCLoanInfo(interactionToken)
367
+ SCLoan.pay(appCompatActivity, loanConfigObj, object : SCLoanResult {
368
+ override fun onFailure(error: SCLoanError) {
369
+ val errorWritableMap = createErrorJSON(error.errorCode, error.errorMessage, error.data)
370
+ promise.reject("error", errorWritableMap)
371
+ }
372
+
373
+ override fun onSuccess(response: SCLoanSuccess) {
374
+ promise.resolve(response.toString())
375
+ }
376
+ })
377
+ }
378
+
379
+ @ReactMethod
380
+ fun withdraw(loanConfig: ReadableMap, promise: Promise) {
381
+ val appCompatActivity = currentActivity as? AppCompatActivity ?: return
382
+ val hashMap = readableMapToStrHashMap(loanConfig)
383
+ val interactionToken = hashMap["interactionToken"]
384
+ if(interactionToken == null) {
385
+ promise.reject(Throwable("Interaction token is null"))
386
+ return
387
+ }
388
+ val loanConfigObj = SCLoanInfo(interactionToken)
389
+ SCLoan.withdraw(appCompatActivity, loanConfigObj, object : SCLoanResult {
390
+ override fun onFailure(error: SCLoanError) {
391
+ val errorWritableMap = createErrorJSON(error.errorCode, error.errorMessage, error.data)
392
+ promise.reject("error", errorWritableMap)
393
+ }
394
+
395
+ override fun onSuccess(response: SCLoanSuccess) {
396
+ promise.resolve(response.toString())
397
+ }
398
+ })
399
+ }
400
+
296
401
  private fun getProtocol(envName: String): Environment.PROTOCOL {
297
402
  return when (envName) {
298
403
  "production" -> Environment.PROTOCOL.PRODUCTION