react-native-smallcase-gateway 2.2.2 → 2.3.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.
- package/CHANGELOG.md +14 -0
- package/android/build.gradle +7 -15
- package/android/src/main/java/com/reactnativesmallcasegateway/SmallcaseGatewayModule.kt +50 -30
- package/ios/SmallcaseGateway.m +43 -15
- package/lib/commonjs/ScLoan.js +18 -7
- package/lib/commonjs/ScLoan.js.map +1 -1
- package/lib/commonjs/SmallcaseGateway.js +1 -2
- package/lib/commonjs/SmallcaseGateway.js.map +1 -1
- package/lib/commonjs/constants.js +3 -6
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/index.js +1 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/ScLoan.js +17 -5
- package/lib/module/ScLoan.js.map +1 -1
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +1 -1
- package/src/ScLoan.js +18 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.3.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.2.2...v2.3.0) (2023-10-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add service method to ScLoan ([3c25226](https://github.com/smallcase/react-native-smallcase-gateway/commit/3c252265aed8f8279491e139a212cced686da80d))
|
|
11
|
+
* ios loans servicing ([50e7cb2](https://github.com/smallcase/react-native-smallcase-gateway/commit/50e7cb2375fe0d35e227576c207b7552eeb3371a))
|
|
12
|
+
* loans servicing android ([ea3f211](https://github.com/smallcase/react-native-smallcase-gateway/commit/ea3f211f729af45cda2bfb95e53d7259102978dc))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* update .m file for ios loans refactor changes ([11a2c21](https://github.com/smallcase/react-native-smallcase-gateway/commit/11a2c21990d164928c5f1088eb515d73db6bc09f))
|
|
18
|
+
|
|
5
19
|
### [2.2.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.2.1...v2.2.2) (2023-08-03)
|
|
6
20
|
|
|
7
21
|
### [2.2.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v2.1.1...v2.2.1) (2023-07-25)
|
package/android/build.gradle
CHANGED
|
@@ -69,21 +69,13 @@ repositories {
|
|
|
69
69
|
password "reactNativeUser123"
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
maven {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
maven {
|
|
81
|
-
url "${artifactory_contextUrl}/SCLoans-internal"
|
|
82
|
-
credentials {
|
|
83
|
-
username "${artifactory_user}"
|
|
84
|
-
password "${artifactory_password}"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
73
|
+
url "https://artifactory.smallcase.com/artifactory/SCGateway"
|
|
74
|
+
credentials {
|
|
75
|
+
username "react_native_user"
|
|
76
|
+
password "reactNativeUser123"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
87
79
|
|
|
88
80
|
def found = false
|
|
89
81
|
def defaultDir = null
|
|
@@ -156,7 +148,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
156
148
|
dependencies {
|
|
157
149
|
//noinspection GradleDynamicVersion
|
|
158
150
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
159
|
-
implementation 'com.smallcase.gateway:sdk:3.
|
|
151
|
+
implementation 'com.smallcase.gateway:sdk:3.11.0'
|
|
160
152
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
161
153
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
162
154
|
}
|
|
@@ -307,29 +307,26 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
307
307
|
return
|
|
308
308
|
}
|
|
309
309
|
val scEnvironment = when(environment) {
|
|
310
|
-
"
|
|
311
|
-
"
|
|
312
|
-
|
|
310
|
+
"production" -> ScLoanEnvironment.PRODUCTION
|
|
311
|
+
"staging" -> ScLoanEnvironment.STAGING
|
|
312
|
+
"development" -> ScLoanEnvironment.DEVELOPMENT
|
|
313
|
+
else -> ScLoanEnvironment.PRODUCTION
|
|
313
314
|
}
|
|
314
|
-
val
|
|
315
|
-
val
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
val errorWritableMap = createErrorJSON(error.errorCode, error.errorMessage, error.data)
|
|
315
|
+
val scGatewayConfig = ScLoanConfig(gateway, scEnvironment)
|
|
316
|
+
val setupResponse = ScLoan.setup(scGatewayConfig, object : ScLoanResult {
|
|
317
|
+
override fun onFailure(error: ScLoanError) {
|
|
318
|
+
val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
|
|
319
319
|
promise.reject("error", errorWritableMap)
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
override fun onSuccess(response:
|
|
323
|
-
|
|
324
|
-
promise.resolve(Gson().toJson(writableMap.toHashMap()))
|
|
322
|
+
override fun onSuccess(response: ScLoanSuccess) {
|
|
323
|
+
promise.resolve(response.toString())
|
|
325
324
|
}
|
|
326
|
-
|
|
327
325
|
})
|
|
328
|
-
|
|
329
|
-
// writableMap.putBoolean("success", true)
|
|
326
|
+
// val writableMap: WritableMap = Arguments.createMap()
|
|
330
327
|
// writableMap.putString("version", setupResponse.version)
|
|
331
328
|
// writableMap.putInt("versionCode", setupResponse.versionCode.toInt())
|
|
332
|
-
|
|
329
|
+
// promise.resolve(Gson().toJson(writableMap.toHashMap()))
|
|
333
330
|
}
|
|
334
331
|
|
|
335
332
|
@ReactMethod
|
|
@@ -341,14 +338,14 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
341
338
|
promise.reject(Throwable("Interaction token is null"))
|
|
342
339
|
return
|
|
343
340
|
}
|
|
344
|
-
val loanConfigObj =
|
|
345
|
-
|
|
346
|
-
override fun onFailure(error:
|
|
347
|
-
val errorWritableMap = createErrorJSON(error.
|
|
341
|
+
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
342
|
+
ScLoan.apply(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
343
|
+
override fun onFailure(error: ScLoanError) {
|
|
344
|
+
val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
|
|
348
345
|
promise.reject("error", errorWritableMap)
|
|
349
346
|
}
|
|
350
347
|
|
|
351
|
-
override fun onSuccess(response:
|
|
348
|
+
override fun onSuccess(response: ScLoanSuccess) {
|
|
352
349
|
promise.resolve(response.toString())
|
|
353
350
|
}
|
|
354
351
|
})
|
|
@@ -363,14 +360,14 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
363
360
|
promise.reject(Throwable("Interaction token is null"))
|
|
364
361
|
return
|
|
365
362
|
}
|
|
366
|
-
val loanConfigObj =
|
|
367
|
-
|
|
368
|
-
override fun onFailure(error:
|
|
369
|
-
val errorWritableMap = createErrorJSON(error.
|
|
363
|
+
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
364
|
+
ScLoan.pay(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
365
|
+
override fun onFailure(error: ScLoanError) {
|
|
366
|
+
val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
|
|
370
367
|
promise.reject("error", errorWritableMap)
|
|
371
368
|
}
|
|
372
369
|
|
|
373
|
-
override fun onSuccess(response:
|
|
370
|
+
override fun onSuccess(response: ScLoanSuccess) {
|
|
374
371
|
promise.resolve(response.toString())
|
|
375
372
|
}
|
|
376
373
|
})
|
|
@@ -385,14 +382,36 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
385
382
|
promise.reject(Throwable("Interaction token is null"))
|
|
386
383
|
return
|
|
387
384
|
}
|
|
388
|
-
val loanConfigObj =
|
|
389
|
-
|
|
390
|
-
override fun onFailure(error:
|
|
391
|
-
val errorWritableMap = createErrorJSON(error.
|
|
385
|
+
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
386
|
+
ScLoan.withdraw(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
387
|
+
override fun onFailure(error: ScLoanError) {
|
|
388
|
+
val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
|
|
389
|
+
promise.reject("error", errorWritableMap)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
override fun onSuccess(response: ScLoanSuccess) {
|
|
393
|
+
promise.resolve(response.toString())
|
|
394
|
+
}
|
|
395
|
+
})
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@ReactMethod
|
|
399
|
+
fun service(loanConfig: ReadableMap, promise: Promise) {
|
|
400
|
+
val appCompatActivity = currentActivity as? AppCompatActivity ?: return
|
|
401
|
+
val hashMap = readableMapToStrHashMap(loanConfig)
|
|
402
|
+
val interactionToken = hashMap["interactionToken"]
|
|
403
|
+
if(interactionToken == null) {
|
|
404
|
+
promise.reject(Throwable("Interaction token is null"))
|
|
405
|
+
return
|
|
406
|
+
}
|
|
407
|
+
val loanConfigObj = ScLoanInfo(interactionToken)
|
|
408
|
+
ScLoan.service(appCompatActivity, loanConfigObj, object : ScLoanResult {
|
|
409
|
+
override fun onFailure(error: ScLoanError) {
|
|
410
|
+
val errorWritableMap = createErrorJSON(error.code, error.message, error.data)
|
|
392
411
|
promise.reject("error", errorWritableMap)
|
|
393
412
|
}
|
|
394
413
|
|
|
395
|
-
override fun onSuccess(response:
|
|
414
|
+
override fun onSuccess(response: ScLoanSuccess) {
|
|
396
415
|
promise.resolve(response.toString())
|
|
397
416
|
}
|
|
398
417
|
})
|
|
@@ -454,3 +473,4 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
|
|
|
454
473
|
}
|
|
455
474
|
|
|
456
475
|
}
|
|
476
|
+
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -513,14 +513,13 @@ RCT_REMAP_METHOD(setupLoans,
|
|
|
513
513
|
lasEnv = @2;
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
|
|
516
|
+
ScLoanConfig *gatewayLoanConfig = [[ScLoanConfig alloc] initWithGatewayName:gatewayName environment:lasEnv];
|
|
517
517
|
|
|
518
|
-
[
|
|
518
|
+
[ScLoan.instance setupWithConfig:gatewayLoanConfig completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
519
519
|
|
|
520
520
|
if(error != nil) {
|
|
521
521
|
if(error != nil) {
|
|
522
522
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
523
|
-
[responseDict setValue:false forKey:@"isSuccess"];
|
|
524
523
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
525
524
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
526
525
|
|
|
@@ -550,16 +549,14 @@ RCT_REMAP_METHOD(apply,
|
|
|
550
549
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
551
550
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
552
551
|
|
|
553
|
-
|
|
552
|
+
ScLoanInfo *gatewayLoanInfo = [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
|
|
554
553
|
|
|
555
|
-
[
|
|
554
|
+
[ScLoan.instance applyWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
556
555
|
|
|
557
556
|
if(error != nil) {
|
|
558
557
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
559
|
-
[responseDict setValue:false forKey:@"isSuccess"];
|
|
560
558
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
561
559
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
562
|
-
[responseDict setValue:error.userInfo forKey:@"data"];
|
|
563
560
|
|
|
564
561
|
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
565
562
|
|
|
@@ -586,16 +583,14 @@ RCT_REMAP_METHOD(pay,
|
|
|
586
583
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
587
584
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
588
585
|
|
|
589
|
-
|
|
586
|
+
ScLoanInfo *gatewayLoanInfo = [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
|
|
590
587
|
|
|
591
|
-
[
|
|
588
|
+
[ScLoan.instance payWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
592
589
|
|
|
593
590
|
if(error != nil) {
|
|
594
591
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
595
|
-
[responseDict setValue:false forKey:@"isSuccess"];
|
|
596
592
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
597
593
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
598
|
-
[responseDict setValue:error.userInfo forKey:@"data"];
|
|
599
594
|
|
|
600
595
|
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
601
596
|
|
|
@@ -622,16 +617,48 @@ RCT_REMAP_METHOD(withdraw,
|
|
|
622
617
|
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
623
618
|
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
624
619
|
|
|
625
|
-
|
|
620
|
+
ScLoanInfo *gatewayLoanInfo = [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
|
|
626
621
|
|
|
627
|
-
[
|
|
622
|
+
[ScLoan.instance withdrawWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
623
|
+
|
|
624
|
+
if(error != nil) {
|
|
625
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
626
|
+
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
627
|
+
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
628
|
+
|
|
629
|
+
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
630
|
+
|
|
631
|
+
reject(@"apply", @"Error while applying for Loan", err);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
resolve(success.data);
|
|
636
|
+
}];
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
RCT_REMAP_METHOD(service,
|
|
643
|
+
loanInfo: (NSDictionary *)loanInfo
|
|
644
|
+
serviceWithResolver:(RCTPromiseResolveBlock)resolve
|
|
645
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
646
|
+
) {
|
|
647
|
+
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
648
|
+
|
|
649
|
+
if(loanInfo != nil && loanInfo[@"interactionToken"] != nil) {
|
|
650
|
+
|
|
651
|
+
NSString *interactionToken = loanInfo[@"interactionToken"];
|
|
652
|
+
NSLog(@" ----------- Interaction Token: %@", interactionToken);
|
|
653
|
+
|
|
654
|
+
ScLoanInfo *gatewayLoanInfo = [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
|
|
655
|
+
|
|
656
|
+
[ScLoan.instance serviceWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
|
|
628
657
|
|
|
629
658
|
if(error != nil) {
|
|
630
659
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
631
|
-
[responseDict setValue:false forKey:@"isSuccess"];
|
|
632
660
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
633
661
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
634
|
-
[responseDict setValue:error.userInfo forKey:@"data"];
|
|
635
662
|
|
|
636
663
|
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
637
664
|
|
|
@@ -647,3 +674,4 @@ RCT_REMAP_METHOD(withdraw,
|
|
|
647
674
|
}
|
|
648
675
|
|
|
649
676
|
@end
|
|
677
|
+
|
package/lib/commonjs/ScLoan.js
CHANGED
|
@@ -16,7 +16,7 @@ const {
|
|
|
16
16
|
* @property {String} gatewayName
|
|
17
17
|
* @property {'production' | 'staging' | 'development'} environment - environment
|
|
18
18
|
*
|
|
19
|
-
* @typedef {Object}
|
|
19
|
+
* @typedef {Object} ScLoanInfo
|
|
20
20
|
* @property {String} interactionToken
|
|
21
21
|
*/
|
|
22
22
|
|
|
@@ -35,7 +35,7 @@ const setup = async config => {
|
|
|
35
35
|
/**
|
|
36
36
|
* Triggers the LOS Journey
|
|
37
37
|
*
|
|
38
|
-
* @param {
|
|
38
|
+
* @param {ScLoanInfo} loanInfo
|
|
39
39
|
* @returns {Promise<String>}
|
|
40
40
|
*/
|
|
41
41
|
const apply = async loanInfo => {
|
|
@@ -46,7 +46,7 @@ const apply = async loanInfo => {
|
|
|
46
46
|
/**
|
|
47
47
|
* Triggers the Repayment Journey
|
|
48
48
|
*
|
|
49
|
-
* @param {
|
|
49
|
+
* @param {ScLoanInfo} loanInfo
|
|
50
50
|
* @returns {Promise<String>}
|
|
51
51
|
*/
|
|
52
52
|
const pay = async loanInfo => {
|
|
@@ -57,19 +57,30 @@ const pay = async loanInfo => {
|
|
|
57
57
|
/**
|
|
58
58
|
* Triggers the Withdraw Journey
|
|
59
59
|
*
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {ScLoanInfo} loanInfo
|
|
61
61
|
* @returns {Promise<String>}
|
|
62
62
|
*/
|
|
63
63
|
const withdraw = async loanInfo => {
|
|
64
64
|
const safeLoanInfo = (0, _util.safeObject)(loanInfo);
|
|
65
65
|
return SmallcaseGatewayNative.withdraw(safeLoanInfo);
|
|
66
66
|
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Triggers the Servicing Journey
|
|
70
|
+
*
|
|
71
|
+
* @param {ScLoanInfo} loanInfo
|
|
72
|
+
* @returns {Promise<String>}
|
|
73
|
+
*/
|
|
74
|
+
const service = async loanInfo => {
|
|
75
|
+
const safeLoanInfo = (0, _util.safeObject)(loanInfo);
|
|
76
|
+
return SmallcaseGatewayNative.service(safeLoanInfo);
|
|
77
|
+
};
|
|
67
78
|
const ScLoan = {
|
|
68
79
|
setup,
|
|
69
80
|
apply,
|
|
70
81
|
pay,
|
|
71
|
-
withdraw
|
|
82
|
+
withdraw,
|
|
83
|
+
service
|
|
72
84
|
};
|
|
73
|
-
var _default = ScLoan;
|
|
74
|
-
exports.default = _default;
|
|
85
|
+
var _default = exports.default = ScLoan;
|
|
75
86
|
//# sourceMappingURL=ScLoan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_util","_constants","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","setup","config","safeConfig","safeObject","environment","undefined","ENV","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","ScLoan","_default","exports","default"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_util","_constants","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","setup","config","safeConfig","safeObject","environment","undefined","ENV","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","ScLoan","_default","exports","default"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<String>}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if(safeConfig.environment === undefined || safeConfig.environment === null) safeConfig.environment = ENV.PROD\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n };\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n };\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n };\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n };\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\n}\n\nexport default ScLoan;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAA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AY,CAAC;AACrD,CAAC;AAEH,MAAMI,MAAM,GAAG;EACXf,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC;AACJ,CAAC;AAAA,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcH,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_constants","_util","_package","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","safeObject","setHybridSdkVersion","version","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","ENV","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","platformSpecificColorHex","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","Platform","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion","_default","exports","default"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n showOrders\n};\n\nexport default SmallcaseGateway;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,MAAM;EAAEI,gBAAgB,EAAEC;AAAuB,CAAC,GAAGC,0BAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,iBAAiB,GAAG,EAAE;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,MAAOC,SAAS,IAAK;EAChD,MAAMC,UAAU,GAAG,IAAAC,gBAAU,EAACF,SAAS,CAAC;EAExC,MAAMJ,sBAAsB,CAACO,mBAAmB,CAACC,gBAAO,CAAC;EAEzD,MAAM;IACJC,UAAU;IACVC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC;EACF,CAAC,GAAGR,UAAU;EAEd,MAAMS,gBAAgB,GAAGC,OAAO,CAACJ,YAAY,CAAC;EAC9C,MAAMK,gBAAgB,GAAGD,OAAO,CAACH,YAAY,CAAC;EAC9C,MAAMK,cAAc,GAAGC,KAAK,CAACC,OAAO,CAACV,UAAU,CAAC,GAAGA,UAAU,GAAG,EAAE;EAClE,MAAMW,eAAe,GAAG,OAAOV,WAAW,KAAK,QAAQ,GAAGA,WAAW,GAAG,EAAE;EAC1E,MAAMW,WAAW,GACf,OAAOR,eAAe,KAAK,QAA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B,UAAU,EACVT,OAAO,EACP6B,gBACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,MAAOC,KAAK,IAAK;EACxC,MAAMC,SAAS,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,EAAE;EAExD,OAAO7D,sBAAsB,CAAC4D,gBAAgB,CAACE,SAAS,CAAC;AAC3D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,MAAAA,CAAA,KAAY;EAChC,OAAO/D,sBAAsB,CAAC+D,aAAa,CAACvD,gBAAO,CAAC;AACtD,CAAC;AAED,MAAMT,gBAAgB,GAAG;EACvByB,IAAI;EACJ4B,UAAU;EACVE,cAAc;EACdE,wBAAwB;EACxBC,0BAA0B;EAC1BG,gBAAgB;EAChBjC,kBAAkB;EAClBM,oBAAoB;EACpB9B,oBAAoB;EACpBgC,eAAe;EACfK,2BAA2B;EAC3BuB,aAAa;EACbV;AACF,CAAC;AAAC,IAAAW,QAAA,GAEajE,gBAAgB;AAAAkE,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_constants","_util","_package","SmallcaseGateway","SmallcaseGatewayNative","NativeModules","defaultBrokerList","setConfigEnvironment","envConfig","safeConfig","safeObject","setHybridSdkVersion","version","brokerList","gatewayName","isLeprechaun","isAmoEnabled","environmentName","safeIsLeprechaun","Boolean","safeIsAmoEnabled","safeBrokerList","Array","isArray","safeGatewayName","safeEnvName","ENV","PROD","init","sdkToken","safeToken","triggerTransaction","transactionId","utmParams","safeUtm","safeId","length","triggerMfTransaction","safeTransactionId","launchSmallplug","targetEndpoint","params","safeEndpoint","safeParams","launchSmallplugWithBranding","headerColor","headerOpacity","backIconColor","backIconOpacity","safeHeaderColor","platformSpecificColorHex","safeHeaderOpacity","safeBackIconColor","safeBackIconOpacity","Platform","OS","logoutUser","showOrders","triggerLeadGen","userDetails","triggerLeadGenWithStatus","triggerLeadGenWithLoginCta","showLoginCta","safeShowLoginCta","archiveSmallcase","iscid","safeIscid","getSdkVersion","_default","exports","default"],"sources":["SmallcaseGateway.js"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport { ENV } from './constants';\nimport { safeObject, platformSpecificColorHex } from './util';\nimport { version } from '../package.json';\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n *\n * @typedef {Object} envConfig\n * @property {string} gatewayName - unique name on consumer\n * @property {boolean} isLeprechaun - leprechaun mode toggle\n * @property {boolean} isAmoEnabled - support AMO (subject to broker support)\n * @property {Array<string>} brokerList - list of broker names\n * @property {'production' | 'staging' | 'development'} environmentName - environment name\n *\n * @typedef {Object} transactionRes\n * @property {string} data - response data\n * @property {boolean} success - success flag\n * @property {Number} [errorCode] - error code\n * @property {string} transaction - transaction name\n *\n * @typedef {Object} userDetails\n * @property {String} name - name of user\n * @property {String} email - email of user\n * @property {String} contact - contact of user\n * @property {String} pinCode - pin-code of user\n *\n * @typedef {Object} SmallplugUiConfig\n * @property {String} headerColor - color of the header background\n * @property {Number} headerOpacity - opacity of the header background\n * @property {String} backIconColor - color of the back icon\n * @property {Number} backIconOpacity - opacity of the back icon\n *\n */\n\nlet defaultBrokerList = [];\n\n/**\n * configure the sdk with\n * @param {envConfig} envConfig\n */\nconst setConfigEnvironment = async (envConfig) => {\n const safeConfig = safeObject(envConfig);\n\n await SmallcaseGatewayNative.setHybridSdkVersion(version);\n\n const {\n brokerList,\n gatewayName,\n isLeprechaun,\n isAmoEnabled,\n environmentName,\n } = safeConfig;\n\n const safeIsLeprechaun = Boolean(isLeprechaun);\n const safeIsAmoEnabled = Boolean(isAmoEnabled);\n const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];\n const safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n const safeEnvName =\n typeof environmentName === 'string' ? environmentName : ENV.PROD;\n\n defaultBrokerList = safeBrokerList;\n\n await SmallcaseGatewayNative.setConfigEnvironment(\n safeEnvName,\n safeGatewayName,\n safeIsLeprechaun,\n safeIsAmoEnabled,\n safeBrokerList\n );\n};\n\n/**\n * initialize sdk with a session\n *\n * note: this must be called after `setConfigEnvironment()`\n * @param {string} sdkToken\n */\nconst init = async (sdkToken) => {\n const safeToken = typeof sdkToken === \"string\" ? sdkToken : \"\";\n return SmallcaseGatewayNative.init(safeToken);\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @param {Object} [utmParams]\n * @param {Array<string>} [brokerList]\n * @returns {Promise<transactionRes>}\n */\nconst triggerTransaction = async (transactionId, utmParams, brokerList) => {\n const safeUtm = safeObject(utmParams);\n const safeId = typeof transactionId === 'string' ? transactionId : '';\n\n const safeBrokerList =\n Array.isArray(brokerList) && brokerList.length\n ? brokerList\n : defaultBrokerList;\n\n return SmallcaseGatewayNative.triggerTransaction(\n safeId,\n safeUtm,\n safeBrokerList\n );\n};\n\n/**\n * triggers a transaction with a transaction id\n *\n * @param {string} transactionId\n * @returns {Promise<transactionRes>}\n */\nconst triggerMfTransaction = async (transactionId) => {\n const safeTransactionId =\n typeof transactionId === 'string' ? transactionId : '';\n\n return SmallcaseGatewayNative.triggerMfTransaction(safeTransactionId);\n};\n\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n */\nconst launchSmallplug = async (targetEndpoint, params) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n\n return SmallcaseGatewayNative.launchSmallplug(safeEndpoint, safeParams);\n};\n\nconst safeGatewayName = typeof gatewayName === 'string' ? gatewayName : '';\n/**\n * launches smallcases module\n *\n * @param {string} targetEndpoint\n * @param {string} params\n * @param {string} headerColor\n * @param {number} headerOpacity\n * @param {string} backIconColor\n * @param {number} backIconOpacity\n */\nconst launchSmallplugWithBranding = async (\n targetEndpoint,\n params,\n headerColor,\n headerOpacity,\n backIconColor,\n backIconOpacity\n) => {\n const safeEndpoint = typeof targetEndpoint === 'string' ? targetEndpoint : '';\n const safeParams = typeof params === 'string' ? params : '';\n const safeHeaderColor =\n typeof headerColor === 'string'\n ? headerColor\n : platformSpecificColorHex('2F363F');\n const safeHeaderOpacity =\n typeof headerOpacity === 'number' ? headerOpacity : 1;\n const safeBackIconColor =\n typeof backIconColor === 'string'\n ? backIconColor\n : platformSpecificColorHex('FFFFFF');\n const safeBackIconOpacity =\n typeof backIconOpacity === 'number' ? backIconOpacity : 1;\n\n return Platform.OS === 'android'\n ? SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n {\n headerColor: safeHeaderColor,\n headerOpacity: safeHeaderOpacity,\n backIconColor: safeBackIconColor,\n backIconOpacity: safeBackIconOpacity,\n }\n )\n : SmallcaseGatewayNative.launchSmallplugWithBranding(\n safeEndpoint,\n safeParams,\n safeHeaderColor,\n safeHeaderOpacity,\n safeBackIconColor,\n safeBackIconOpacity\n );\n};\n\n/**\n * Logs the user out and removes the web session.\n *\n * This promise will be rejected if logout was unsuccessful\n *\n * @returns {Promise}\n */\nconst logoutUser = async () => {\n return SmallcaseGatewayNative.logoutUser();\n};\n\n/**\n * This will display a list of all the orders that a user recently placed.\n * This includes pending, successful, and failed orders.\n * @returns\n */\nconst showOrders = async () => {\n return SmallcaseGatewayNative.showOrders();\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n */\nconst triggerLeadGen = (userDetails, utmParams) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n\n return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);\n};\n\n/**\n * triggers the lead gen flow\n *\n * @param {userDetails} [userDetails]\n * * @returns {Promise}\n */\nconst triggerLeadGenWithStatus = async (userDetails) => {\n const safeParams = safeObject(userDetails);\n\n return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);\n};\n\n/**\n * triggers the lead gen flow with an option of \"login here\" cta\n *\n * @param {userDetails} [userDetails]\n * @param {Object} [utmParams]\n * @param {boolean} [showLoginCta]\n * @returns {Promise}\n */\nconst triggerLeadGenWithLoginCta = async (\n userDetails,\n utmParams,\n showLoginCta\n) => {\n const safeParams = safeObject(userDetails);\n const safeUtm = safeObject(utmParams);\n const safeShowLoginCta = Boolean(showLoginCta);\n\n return SmallcaseGatewayNative.triggerLeadGenWithLoginCta(\n safeParams,\n safeUtm,\n safeShowLoginCta\n );\n};\n\n/**\n * Marks a smallcase as archived\n *\n * @param {String} iscid\n */\nconst archiveSmallcase = async (iscid) => {\n const safeIscid = typeof iscid === 'string' ? iscid : '';\n\n return SmallcaseGatewayNative.archiveSmallcase(safeIscid);\n};\n\n/**\n * Returns the native android/ios and react-native sdk version\n * (internal-tracking)\n * @returns {Promise}\n */\nconst getSdkVersion = async () => {\n return SmallcaseGatewayNative.getSdkVersion(version);\n};\n\nconst SmallcaseGateway = {\n init,\n logoutUser,\n triggerLeadGen,\n triggerLeadGenWithStatus,\n triggerLeadGenWithLoginCta,\n archiveSmallcase,\n triggerTransaction,\n triggerMfTransaction,\n setConfigEnvironment,\n launchSmallplug,\n launchSmallplugWithBranding,\n getSdkVersion,\n showOrders\n};\n\nexport default SmallcaseGateway;\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,MAAM;EAAEI,gBAAgB,EAAEC;AAAuB,CAAC,GAAGC,0BAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIC,iBAAiB,GAAG,EAAE;;AAE1B;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,GAAG,MAAOC,SAAS,IAAK;EAChD,MAAMC,UA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Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TRANSACTION_TYPE = exports.ERROR_MSG = exports.ENV = void 0;
|
|
7
|
-
const ENV = {
|
|
7
|
+
const ENV = exports.ENV = {
|
|
8
8
|
STAG: "staging",
|
|
9
9
|
DEV: "development",
|
|
10
10
|
PROD: "production"
|
|
11
11
|
};
|
|
12
|
-
exports.
|
|
13
|
-
const TRANSACTION_TYPE = {
|
|
12
|
+
const TRANSACTION_TYPE = exports.TRANSACTION_TYPE = {
|
|
14
13
|
connect: "CONNECT",
|
|
15
14
|
sipSetup: "SIP_SETUP",
|
|
16
15
|
fetchFunds: "FETCH_FUNDS",
|
|
@@ -19,8 +18,7 @@ const TRANSACTION_TYPE = {
|
|
|
19
18
|
authorizeHoldings: "AUTHORISE_HOLDINGS",
|
|
20
19
|
mfHoldingsImport: "MF_HOLDINGS_IMPORT"
|
|
21
20
|
};
|
|
22
|
-
exports.
|
|
23
|
-
const ERROR_MSG = {
|
|
21
|
+
const ERROR_MSG = exports.ERROR_MSG = {
|
|
24
22
|
init_sdk: "init_sdk",
|
|
25
23
|
no_order: "no_order",
|
|
26
24
|
no_broker: "no_broker",
|
|
@@ -39,5 +37,4 @@ const ERROR_MSG = {
|
|
|
39
37
|
transaction_in_process: "transaction_in_process",
|
|
40
38
|
no_compatible_browser: "no_compatible_browser"
|
|
41
39
|
};
|
|
42
|
-
exports.ERROR_MSG = ERROR_MSG;
|
|
43
40
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENV","STAG","DEV","PROD","
|
|
1
|
+
{"version":3,"names":["ENV","exports","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":";;;;;;AAAO,MAAMA,GAAG,GAAAC,OAAA,CAAAD,GAAA,GAAG;EACjBE,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAEM,MAAMC,SAAS,GAAAZ,OAAA,CAAAY,SAAA,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -14,11 +14,10 @@ var _SmallcaseGateway = _interopRequireDefault(require("./SmallcaseGateway"));
|
|
|
14
14
|
var _ScLoan = _interopRequireDefault(require("./ScLoan"));
|
|
15
15
|
var _constants = require("./constants");
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
var _default = {
|
|
17
|
+
var _default = exports.default = {
|
|
18
18
|
..._SmallcaseGateway.default,
|
|
19
19
|
ENV: _constants.ENV,
|
|
20
20
|
ERROR_MSG: _constants.ERROR_MSG,
|
|
21
21
|
TRANSACTION_TYPE: _constants.TRANSACTION_TYPE
|
|
22
22
|
};
|
|
23
|
-
exports.default = _default;
|
|
24
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_SmallcaseGateway","_interopRequireDefault","require","_ScLoan","_constants","obj","__esModule","default","_default","SmallcaseGateway","ENV","ERROR_MSG","TRANSACTION_TYPE"
|
|
1
|
+
{"version":3,"names":["_SmallcaseGateway","_interopRequireDefault","require","_ScLoan","_constants","obj","__esModule","default","_default","exports","SmallcaseGateway","ENV","ERROR_MSG","TRANSACTION_TYPE"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport ScLoan from \"./ScLoan\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport { ScLoan }\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA+D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAGhD;EAAE,GAAGG,yBAAgB;EAAEC,GAAG,EAAHA,cAAG;EAAEC,SAAS,EAATA,oBAAS;EAAEC,gBAAgB,EAAhBA;AAAiB,CAAC"}
|
package/lib/module/ScLoan.js
CHANGED
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
* @property {String} gatewayName
|
|
11
11
|
* @property {'production' | 'staging' | 'development'} environment - environment
|
|
12
12
|
*
|
|
13
|
-
* @typedef {Object}
|
|
13
|
+
* @typedef {Object} ScLoanInfo
|
|
14
14
|
* @property {String} interactionToken
|
|
15
15
|
*/
|
|
16
16
|
|
|
@@ -29,7 +29,7 @@ const setup = async config => {
|
|
|
29
29
|
/**
|
|
30
30
|
* Triggers the LOS Journey
|
|
31
31
|
*
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {ScLoanInfo} loanInfo
|
|
33
33
|
* @returns {Promise<String>}
|
|
34
34
|
*/
|
|
35
35
|
const apply = async loanInfo => {
|
|
@@ -40,7 +40,7 @@ const apply = async loanInfo => {
|
|
|
40
40
|
/**
|
|
41
41
|
* Triggers the Repayment Journey
|
|
42
42
|
*
|
|
43
|
-
* @param {
|
|
43
|
+
* @param {ScLoanInfo} loanInfo
|
|
44
44
|
* @returns {Promise<String>}
|
|
45
45
|
*/
|
|
46
46
|
const pay = async loanInfo => {
|
|
@@ -51,18 +51,30 @@ const pay = async loanInfo => {
|
|
|
51
51
|
/**
|
|
52
52
|
* Triggers the Withdraw Journey
|
|
53
53
|
*
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {ScLoanInfo} loanInfo
|
|
55
55
|
* @returns {Promise<String>}
|
|
56
56
|
*/
|
|
57
57
|
const withdraw = async loanInfo => {
|
|
58
58
|
const safeLoanInfo = safeObject(loanInfo);
|
|
59
59
|
return SmallcaseGatewayNative.withdraw(safeLoanInfo);
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Triggers the Servicing Journey
|
|
64
|
+
*
|
|
65
|
+
* @param {ScLoanInfo} loanInfo
|
|
66
|
+
* @returns {Promise<String>}
|
|
67
|
+
*/
|
|
68
|
+
const service = async loanInfo => {
|
|
69
|
+
const safeLoanInfo = safeObject(loanInfo);
|
|
70
|
+
return SmallcaseGatewayNative.service(safeLoanInfo);
|
|
71
|
+
};
|
|
61
72
|
const ScLoan = {
|
|
62
73
|
setup,
|
|
63
74
|
apply,
|
|
64
75
|
pay,
|
|
65
|
-
withdraw
|
|
76
|
+
withdraw,
|
|
77
|
+
service
|
|
66
78
|
};
|
|
67
79
|
export default ScLoan;
|
|
68
80
|
//# sourceMappingURL=ScLoan.js.map
|
package/lib/module/ScLoan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","ScLoan"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object}
|
|
1
|
+
{"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","ScLoan"],"sources":["ScLoan.js"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport { safeObject } from './util';\nimport { ENV } from './constants';\n\nconst { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;\n\n/**\n * @typedef {Object} ScLoanConfig\n * @property {String} gatewayName\n * @property {'production' | 'staging' | 'development'} environment - environment\n *\n * @typedef {Object} ScLoanInfo\n * @property {String} interactionToken\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<String>}\n */\nconst setup = async (config) => {\n const safeConfig = safeObject(config);\n if(safeConfig.environment === undefined || safeConfig.environment === null) safeConfig.environment = ENV.PROD\n\n return SmallcaseGatewayNative.setupLoans(safeConfig);\n };\n\n/**\n * Triggers the LOS Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst apply = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.apply(safeLoanInfo);\n };\n\n/**\n * Triggers the Repayment Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst pay = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.pay(safeLoanInfo);\n };\n\n/**\n * Triggers the Withdraw Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst withdraw = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.withdraw(safeLoanInfo);\n };\n\n/**\n * Triggers the Servicing Journey\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<String>}\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service\n}\n\nexport default ScLoan;\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C,SAASC,UAAU,QAAQ,QAAQ;AACnC,SAASC,GAAG,QAAQ,aAAa;AAEjC,MAAM;EAAEC,gBAAgB,EAAEC;AAAuB,CAAC,GAAGJ,aAAa;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,MAAM,IAAK;EAC5B,MAAMC,UAAU,GAAGN,UAAU,CAACK,MAAM,CAAC;EACrC,IAAGC,UAAU,CAACC,WAAW,KAAKC,SAAS,IAAIF,UAAU,CAACC,WAAW,KAAK,IAAI,EAAED,UAAU,CAACC,WAAW,GAAGN,GAAG,CAACQ,IAAI;EAE7G,OAAON,sBAAsB,CAACO,UAAU,CAACJ,UAAU,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,KAAK,GAAG,MAAOC,QAAQ,IAAK;EAC9B,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACQ,KAAK,CAACE,YAAY,CAAC;AACnD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,GAAG,GAAG,MAAOF,QAAQ,IAAK;EAC5B,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACW,GAAG,CAACD,YAAY,CAAC;AACjD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,QAAQ,GAAG,MAAOH,QAAQ,IAAK;EACjC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACY,QAAQ,CAACF,YAAY,CAAC;AACtD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACa,OAAO,CAACH,YAAY,CAAC;AACrD,CAAC;AAEH,MAAMI,MAAM,GAAG;EACXb,KAAK;EACLO,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC;AACJ,CAAC;AAED,eAAeC,MAAM"}
|
package/package.json
CHANGED
package/src/ScLoan.js
CHANGED
|
@@ -9,7 +9,7 @@ const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
|
9
9
|
* @property {String} gatewayName
|
|
10
10
|
* @property {'production' | 'staging' | 'development'} environment - environment
|
|
11
11
|
*
|
|
12
|
-
* @typedef {Object}
|
|
12
|
+
* @typedef {Object} ScLoanInfo
|
|
13
13
|
* @property {String} interactionToken
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ const setup = async (config) => {
|
|
|
29
29
|
/**
|
|
30
30
|
* Triggers the LOS Journey
|
|
31
31
|
*
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {ScLoanInfo} loanInfo
|
|
33
33
|
* @returns {Promise<String>}
|
|
34
34
|
*/
|
|
35
35
|
const apply = async (loanInfo) => {
|
|
@@ -41,7 +41,7 @@ const apply = async (loanInfo) => {
|
|
|
41
41
|
/**
|
|
42
42
|
* Triggers the Repayment Journey
|
|
43
43
|
*
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {ScLoanInfo} loanInfo
|
|
45
45
|
* @returns {Promise<String>}
|
|
46
46
|
*/
|
|
47
47
|
const pay = async (loanInfo) => {
|
|
@@ -53,7 +53,7 @@ const pay = async (loanInfo) => {
|
|
|
53
53
|
/**
|
|
54
54
|
* Triggers the Withdraw Journey
|
|
55
55
|
*
|
|
56
|
-
* @param {
|
|
56
|
+
* @param {ScLoanInfo} loanInfo
|
|
57
57
|
* @returns {Promise<String>}
|
|
58
58
|
*/
|
|
59
59
|
const withdraw = async (loanInfo) => {
|
|
@@ -62,11 +62,24 @@ const withdraw = async (loanInfo) => {
|
|
|
62
62
|
return SmallcaseGatewayNative.withdraw(safeLoanInfo);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Triggers the Servicing Journey
|
|
67
|
+
*
|
|
68
|
+
* @param {ScLoanInfo} loanInfo
|
|
69
|
+
* @returns {Promise<String>}
|
|
70
|
+
*/
|
|
71
|
+
const service = async (loanInfo) => {
|
|
72
|
+
const safeLoanInfo = safeObject(loanInfo);
|
|
73
|
+
|
|
74
|
+
return SmallcaseGatewayNative.service(safeLoanInfo);
|
|
75
|
+
};
|
|
76
|
+
|
|
65
77
|
const ScLoan = {
|
|
66
78
|
setup,
|
|
67
79
|
apply,
|
|
68
80
|
pay,
|
|
69
|
-
withdraw
|
|
81
|
+
withdraw,
|
|
82
|
+
service
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
export default ScLoan;
|