react-native-smallcase-gateway 7.1.0 → 7.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/android/build.gradle
CHANGED
|
@@ -149,7 +149,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
149
149
|
dependencies {
|
|
150
150
|
//noinspection GradleDynamicVersion
|
|
151
151
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
152
|
-
implementation 'com.smallcase.gateway:sdk:6.0.
|
|
152
|
+
implementation 'com.smallcase.gateway:sdk:6.0.3'
|
|
153
153
|
implementation 'com.smallcase.loans:sdk:5.0.0'
|
|
154
154
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
155
155
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
@@ -97,7 +97,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
|
|
100
|
-
val activity = currentActivity
|
|
100
|
+
val activity = reactApplicationContext.currentActivity
|
|
101
101
|
if (activity != null) {
|
|
102
102
|
val utm = readableMapToStrHashMap(utmParams)
|
|
103
103
|
SmallcaseGatewaySdk.triggerTransaction(utmParams = utm,
|
|
@@ -123,10 +123,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
123
123
|
@ReactMethod
|
|
124
124
|
fun triggerMfTransaction(transactionId: String, promise: Promise) {
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
val activity = reactApplicationContext.currentActivity
|
|
127
|
+
if(activity != null) {
|
|
127
128
|
|
|
128
129
|
SmallcaseGatewaySdk.triggerMfTransaction(
|
|
129
|
-
activity =
|
|
130
|
+
activity = activity,
|
|
130
131
|
transactionId = transactionId,
|
|
131
132
|
listener = object : MFHoldingsResponseListener {
|
|
132
133
|
|
|
@@ -147,7 +148,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
147
148
|
|
|
148
149
|
@ReactMethod
|
|
149
150
|
fun showOrders(promise: Promise) {
|
|
150
|
-
val activity = currentActivity
|
|
151
|
+
val activity = reactApplicationContext.currentActivity
|
|
151
152
|
if (activity != null) {
|
|
152
153
|
SmallcaseGatewaySdk.showOrders(activity = activity, showOrdersResponseListener = object : DataListener<Any> {
|
|
153
154
|
override fun onSuccess(response: Any) {
|
|
@@ -165,9 +166,14 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
165
166
|
@ReactMethod
|
|
166
167
|
fun launchSmallplug(targetEndpoint: String, params: String, promise: Promise) {
|
|
167
168
|
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
val activity = reactApplicationContext.currentActivity ?: run {
|
|
170
|
+
promise.reject(Throwable("no activity"))
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
SmallcaseGatewaySdk.launchSmallPlug(activity, SmallplugData(targetEndpoint, params), object : SmallPlugResponseListener {
|
|
174
|
+
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
170
175
|
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
176
|
+
|
|
171
177
|
promise.reject("error", err)
|
|
172
178
|
}
|
|
173
179
|
|
|
@@ -213,7 +219,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
213
219
|
} catch (e: Throwable) {
|
|
214
220
|
}
|
|
215
221
|
|
|
216
|
-
|
|
222
|
+
val activity = reactApplicationContext.currentActivity ?: run {
|
|
223
|
+
promise.reject(Throwable("no activity"))
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
SmallcaseGatewaySdk.launchSmallPlug(activity, SmallplugData(targetEndpoint, params), object : SmallPlugResponseListener {
|
|
217
227
|
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
218
228
|
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
219
229
|
promise.reject("error", err)
|
|
@@ -244,7 +254,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
244
254
|
|
|
245
255
|
@ReactMethod
|
|
246
256
|
fun logoutUser(promise: Promise) {
|
|
247
|
-
val activity = currentActivity
|
|
257
|
+
val activity = reactApplicationContext.currentActivity
|
|
248
258
|
if (activity != null) {
|
|
249
259
|
SmallcaseGatewaySdk.logoutUser(activity = activity, logoutListener = object : SmallcaseLogoutListener {
|
|
250
260
|
override fun onLogoutSuccessfull() {
|
|
@@ -261,7 +271,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
261
271
|
|
|
262
272
|
@ReactMethod
|
|
263
273
|
fun triggerLeadGen(userDetails: ReadableMap, utmData: ReadableMap) {
|
|
264
|
-
val activity = currentActivity
|
|
274
|
+
val activity = reactApplicationContext.currentActivity
|
|
265
275
|
if (activity != null) {
|
|
266
276
|
SmallcaseGatewaySdk.triggerLeadGen(activity = activity, utmParams = readableMapToStrHashMap(utmData), params = readableMapToStrHashMap(userDetails))
|
|
267
277
|
}
|
|
@@ -269,7 +279,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
269
279
|
|
|
270
280
|
@ReactMethod
|
|
271
281
|
fun triggerLeadGenWithStatus(userDetails: ReadableMap, promise: Promise) {
|
|
272
|
-
val activity = currentActivity
|
|
282
|
+
val activity = reactApplicationContext.currentActivity
|
|
273
283
|
if (activity != null) {
|
|
274
284
|
|
|
275
285
|
SmallcaseGatewaySdk.triggerLeadGen(activity, readableMapToStrHashMap(userDetails), object : LeadGenResponseListener {
|
|
@@ -282,10 +292,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
282
292
|
|
|
283
293
|
@ReactMethod
|
|
284
294
|
fun triggerLeadGenWithLoginCta(userDetails: ReadableMap, utmData: ReadableMap, showLoginCta: Boolean, promise: Promise) {
|
|
285
|
-
|
|
295
|
+
val activity = reactApplicationContext.currentActivity
|
|
296
|
+
if(activity != null) {
|
|
286
297
|
|
|
287
298
|
SmallcaseGatewaySdk.triggerLeadGen(
|
|
288
|
-
activity =
|
|
299
|
+
activity = activity,
|
|
289
300
|
params = readableMapToStrHashMap(userDetails),
|
|
290
301
|
utmParams = readableMapToStrHashMap(utmData),
|
|
291
302
|
retargeting = null,
|
|
@@ -300,7 +311,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
300
311
|
|
|
301
312
|
@ReactMethod
|
|
302
313
|
fun setupLoans(config: ReadableMap, promise: Promise) {
|
|
303
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
314
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
315
|
+
promise.reject(Throwable("no activity"))
|
|
316
|
+
return
|
|
317
|
+
}
|
|
304
318
|
val hashMap = readableMapToStrHashMap(config)
|
|
305
319
|
val gateway = hashMap["gatewayName"]
|
|
306
320
|
val environment = hashMap["environment"]
|
|
@@ -328,7 +342,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
328
342
|
|
|
329
343
|
@ReactMethod
|
|
330
344
|
fun apply(loanConfig: ReadableMap, promise: Promise) {
|
|
331
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
345
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
346
|
+
promise.reject(Throwable("no activity"))
|
|
347
|
+
return
|
|
348
|
+
}
|
|
332
349
|
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
333
350
|
val interactionToken = hashMap["interactionToken"]
|
|
334
351
|
if(interactionToken == null) {
|
|
@@ -349,7 +366,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
349
366
|
|
|
350
367
|
@ReactMethod
|
|
351
368
|
fun pay(loanConfig: ReadableMap, promise: Promise) {
|
|
352
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
369
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
370
|
+
promise.reject(Throwable("no activity"))
|
|
371
|
+
return
|
|
372
|
+
}
|
|
353
373
|
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
354
374
|
val interactionToken = hashMap["interactionToken"]
|
|
355
375
|
if(interactionToken == null) {
|
|
@@ -370,7 +390,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
370
390
|
|
|
371
391
|
@ReactMethod
|
|
372
392
|
fun withdraw(loanConfig: ReadableMap, promise: Promise) {
|
|
373
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
393
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
394
|
+
promise.reject(Throwable("no activity"))
|
|
395
|
+
return
|
|
396
|
+
}
|
|
374
397
|
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
375
398
|
val interactionToken = hashMap["interactionToken"]
|
|
376
399
|
if(interactionToken == null) {
|
|
@@ -391,7 +414,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
391
414
|
|
|
392
415
|
@ReactMethod
|
|
393
416
|
fun service(loanConfig: ReadableMap, promise: Promise) {
|
|
394
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
417
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
418
|
+
promise.reject(Throwable("no activity"))
|
|
419
|
+
return
|
|
420
|
+
}
|
|
395
421
|
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
396
422
|
val interactionToken = hashMap["interactionToken"]
|
|
397
423
|
if(interactionToken == null) {
|
|
@@ -412,7 +438,10 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
412
438
|
|
|
413
439
|
@ReactMethod
|
|
414
440
|
fun triggerInteraction(loanConfig: ReadableMap, promise: Promise) {
|
|
415
|
-
val appCompatActivity = currentActivity as? AppCompatActivity ?:
|
|
441
|
+
val appCompatActivity = reactApplicationContext.currentActivity as? AppCompatActivity ?: run {
|
|
442
|
+
promise.reject(Throwable("no activity"))
|
|
443
|
+
return
|
|
444
|
+
}
|
|
416
445
|
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
417
446
|
val interactionToken = hashMap["interactionToken"]
|
|
418
447
|
if(interactionToken == null) {
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -234,6 +234,21 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
234
234
|
resolve(responseDict);
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
+
|
|
238
|
+
//MARK: intent - mf holdings import
|
|
239
|
+
if ([response isKindOfClass: [ObjCTransactionIntentMfHoldingsImport class]]) {
|
|
240
|
+
ObjCTransactionIntentMfHoldingsImport *trxResponse = response;
|
|
241
|
+
// Use existing responseDict (already has success: true from line 169)
|
|
242
|
+
[responseDict setValue:@"MF_HOLDINGS_IMPORT" forKey:@"transaction"];
|
|
243
|
+
|
|
244
|
+
if (trxResponse.data != nil && trxResponse.data.length > 0) {
|
|
245
|
+
[responseDict setObject:trxResponse.data forKey:@"data"];
|
|
246
|
+
} else {
|
|
247
|
+
[responseDict setObject:@"" forKey:@"data"];
|
|
248
|
+
}
|
|
249
|
+
resolve(responseDict);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
237
252
|
|
|
238
253
|
//MARK: intent - fetch funds
|
|
239
254
|
if([response isKindOfClass: [ObjcTransactionIntentFetchFunds class]]) {
|
package/package.json
CHANGED
|
@@ -27,12 +27,13 @@ Pod::Spec.new do |s|
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
s.dependency "React-Codegen"
|
|
30
|
-
|
|
30
|
+
# RCT-Folly is provided by ReactNativeDependencies in RN 0.81+, so we don't need to declare it
|
|
31
|
+
# s.dependency "RCT-Folly"
|
|
31
32
|
s.dependency "RCTRequired"
|
|
32
33
|
s.dependency "RCTTypeSafety"
|
|
33
34
|
s.dependency "ReactCommon/turbomodule/core"
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
s.dependency 'SCGateway', '7.
|
|
37
|
+
s.dependency 'SCGateway', '7.1.1'
|
|
37
38
|
s.dependency 'SCLoans', '7.0.0'
|
|
38
39
|
end
|