react-native-smallcase-gateway 4.1.0 → 4.2.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.
@@ -150,7 +150,7 @@ dependencies {
150
150
  //noinspection GradleDynamicVersion
151
151
  implementation 'com.facebook.react:react-native:+' // From node_modules
152
152
  implementation 'com.smallcase.gateway:sdk:4.1.0'
153
- implementation 'com.smallcase.loans:sdk:3.0.3'
153
+ implementation 'com.smallcase.loans:sdk:3.1.0'
154
154
  implementation "androidx.core:core-ktx:1.3.1"
155
155
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
156
156
  }
@@ -407,6 +407,27 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext) : ReactConte
407
407
  })
408
408
  }
409
409
 
410
+ @ReactMethod
411
+ fun triggerInteraction(loanConfig: ReadableMap, promise: Promise) {
412
+ val appCompatActivity = currentActivity as? AppCompatActivity ?: return
413
+ val hashMap = readableMapToStrHashMap(loanConfig)
414
+ val interactionToken = hashMap["interactionToken"]
415
+ if(interactionToken == null) {
416
+ promise.reject(Throwable("Interaction token is null"))
417
+ return
418
+ }
419
+ val loanConfigObj = ScLoanInfo(interactionToken)
420
+ ScLoan.triggerInteraction(appCompatActivity, loanConfigObj, object : ScLoanResult {
421
+ override fun onFailure(error: ScLoanError) {
422
+ promise.reject("${error.code}", scLoanResponseToWritableMap(error) ?: return)
423
+ }
424
+
425
+ override fun onSuccess(response: ScLoanSuccess) {
426
+ promise.resolve(scLoanResponseToWritableMap(response) ?: return)
427
+ }
428
+ })
429
+ }
430
+
410
431
  private fun getProtocol(envName: String): Environment.PROTOCOL {
411
432
  return when (envName) {
412
433
  "production" -> Environment.PROTOCOL.PRODUCTION
@@ -661,6 +661,34 @@ RCT_REMAP_METHOD(service,
661
661
  });
662
662
  }
663
663
 
664
+ RCT_REMAP_METHOD(triggerInteraction,
665
+ loanInfo: (NSDictionary *)loanInfo
666
+ triggerInteractionWithResolver:(RCTPromiseResolveBlock)resolve
667
+ rejecter:(RCTPromiseRejectBlock)reject
668
+ ) {
669
+ dispatch_async(dispatch_get_main_queue(), ^(void) {
670
+
671
+ if(loanInfo != nil && loanInfo[@"interactionToken"] != nil) {
672
+
673
+ NSString *interactionToken = loanInfo[@"interactionToken"];
674
+ NSLog(@" ----------- Interaction Token: %@", interactionToken);
675
+
676
+ ScLoanInfo *gatewayLoanInfo = [[ScLoanInfo alloc] initWithInteractionToken:interactionToken];
677
+
678
+ [ScLoan.instance triggerInteractionWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] loanInfo:gatewayLoanInfo completion:^(ScLoanSuccess * success, ScLoanError * error) {
679
+
680
+ if(error != nil) {
681
+ reject([NSString stringWithFormat:@"%li", (long)error.errorCode], error.errorMessage, [self scLoanErrorToDict:error]);
682
+ return;
683
+ }
684
+ resolve([self scLoanSuccessToDict:success]);
685
+
686
+ }];
687
+ }
688
+
689
+ });
690
+ }
691
+
664
692
  - (NSDictionary *)scLoanSuccessToDict:(ScLoanSuccess *)success {
665
693
  NSMutableDictionary *successDict = [NSMutableDictionary dictionary];
666
694
  successDict[@"isSuccess"] = @(success.isSuccess);
@@ -49,6 +49,7 @@ const setup = async config => {
49
49
  * @param {ScLoanInfo} loanInfo
50
50
  * @returns {Promise<ScLoanSuccess>}
51
51
  * @throws {ScLoanError}
52
+ * @deprecated This method is deprecated use triggerInteraction() instead.
52
53
  */
53
54
  const apply = async loanInfo => {
54
55
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -61,6 +62,7 @@ const apply = async loanInfo => {
61
62
  * @param {ScLoanInfo} loanInfo
62
63
  * @returns {Promise<ScLoanSuccess>}
63
64
  * @throws {ScLoanError}
65
+ * @deprecated This method is deprecated use triggerInteraction() instead.
64
66
  */
65
67
  const pay = async loanInfo => {
66
68
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -73,6 +75,7 @@ const pay = async loanInfo => {
73
75
  * @param {ScLoanInfo} loanInfo
74
76
  * @returns {Promise<ScLoanSuccess>}
75
77
  * @throws {ScLoanError}
78
+ * @deprecated This method is deprecated use triggerInteraction() instead.
76
79
  */
77
80
  const withdraw = async loanInfo => {
78
81
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
@@ -85,17 +88,31 @@ const withdraw = async loanInfo => {
85
88
  * @param {ScLoanInfo} loanInfo
86
89
  * @returns {Promise<ScLoanSuccess>}
87
90
  * @throws {ScLoanError}
91
+ * @deprecated This method is deprecated use triggerInteraction() instead.
88
92
  */
89
93
  const service = async loanInfo => {
90
94
  const safeLoanInfo = (0, _util.safeObject)(loanInfo);
91
95
  return SmallcaseGatewayNative.service(safeLoanInfo);
92
96
  };
97
+
98
+ /**
99
+ * Triggers the triggerInteraction function
100
+ *
101
+ * @param {ScLoanInfo} loanInfo
102
+ * @returns {Promise<ScLoanSuccess>}
103
+ * @throws {ScLoanError}
104
+ */
105
+ const triggerInteraction = async loanInfo => {
106
+ const safeLoanInfo = (0, _util.safeObject)(loanInfo);
107
+ return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);
108
+ };
93
109
  const ScLoan = {
94
110
  setup,
95
111
  apply,
96
112
  pay,
97
113
  withdraw,
98
- service
114
+ service,
115
+ triggerInteraction
99
116
  };
100
117
  var _default = exports.default = ScLoan;
101
118
  //# 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","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 * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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,IA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ACA,MAAMG,OAAO,GAAG,MAAOJ,QAAQ,IAAK;EAChC,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACgB,OAAO,CAACH,YAAY,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","ignoreList":[]}
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","triggerInteraction","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 * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,MAAM;EAAEG,gBAAgB,EAAEC;AAAuB,CAAC,GAAGC,0BAAa;;AAElE;AACA;AACA;AACA;A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CAAC;AACrD,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GAAG,MAAOL,QAAQ,IAAK;EAC7C,MAAMC,YAAY,GAAG,IAAAR,gBAAU,EAACO,QAAQ,CAAC;EAEzC,OAAOZ,sBAAsB,CAACiB,kBAAkB,CAACJ,YAAY,CAAC;AAChE,CAAC;AAED,MAAMK,MAAM,GAAG;EACbhB,KAAK;EACLS,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC,OAAO;EACPC;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaH,MAAM","ignoreList":[]}
@@ -43,6 +43,7 @@ const setup = async config => {
43
43
  * @param {ScLoanInfo} loanInfo
44
44
  * @returns {Promise<ScLoanSuccess>}
45
45
  * @throws {ScLoanError}
46
+ * @deprecated This method is deprecated use triggerInteraction() instead.
46
47
  */
47
48
  const apply = async loanInfo => {
48
49
  const safeLoanInfo = safeObject(loanInfo);
@@ -55,6 +56,7 @@ const apply = async loanInfo => {
55
56
  * @param {ScLoanInfo} loanInfo
56
57
  * @returns {Promise<ScLoanSuccess>}
57
58
  * @throws {ScLoanError}
59
+ * @deprecated This method is deprecated use triggerInteraction() instead.
58
60
  */
59
61
  const pay = async loanInfo => {
60
62
  const safeLoanInfo = safeObject(loanInfo);
@@ -67,6 +69,7 @@ const pay = async loanInfo => {
67
69
  * @param {ScLoanInfo} loanInfo
68
70
  * @returns {Promise<ScLoanSuccess>}
69
71
  * @throws {ScLoanError}
72
+ * @deprecated This method is deprecated use triggerInteraction() instead.
70
73
  */
71
74
  const withdraw = async loanInfo => {
72
75
  const safeLoanInfo = safeObject(loanInfo);
@@ -79,17 +82,31 @@ const withdraw = async loanInfo => {
79
82
  * @param {ScLoanInfo} loanInfo
80
83
  * @returns {Promise<ScLoanSuccess>}
81
84
  * @throws {ScLoanError}
85
+ * @deprecated This method is deprecated use triggerInteraction() instead.
82
86
  */
83
87
  const service = async loanInfo => {
84
88
  const safeLoanInfo = safeObject(loanInfo);
85
89
  return SmallcaseGatewayNative.service(safeLoanInfo);
86
90
  };
91
+
92
+ /**
93
+ * Triggers the triggerInteraction function
94
+ *
95
+ * @param {ScLoanInfo} loanInfo
96
+ * @returns {Promise<ScLoanSuccess>}
97
+ * @throws {ScLoanError}
98
+ */
99
+ const triggerInteraction = async loanInfo => {
100
+ const safeLoanInfo = safeObject(loanInfo);
101
+ return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);
102
+ };
87
103
  const ScLoan = {
88
104
  setup,
89
105
  apply,
90
106
  pay,
91
107
  withdraw,
92
- service
108
+ service,
109
+ triggerInteraction
93
110
  };
94
111
  export default ScLoan;
95
112
  //# sourceMappingURL=ScLoan.js.map
@@ -1 +1 @@
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 * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;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;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;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","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","safeObject","ENV","SmallcaseGateway","SmallcaseGatewayNative","setup","config","safeConfig","environment","undefined","PROD","setupLoans","apply","loanInfo","safeLoanInfo","pay","withdraw","service","triggerInteraction","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 * @typedef {Object} ScLoanSuccess\n * @property {boolean} isSuccess\n * @property {string} data\n *\n * @typedef {Object} ScLoanError\n * @property {boolean} isSuccess\n * @property {number} code\n * @property {string} message\n * @property {string} data\n */\n\n/**\n * Setup ScLoans\n *\n * @param {ScLoanConfig} config\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\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<ScLoanSuccess>}\n * @throws {ScLoanError}\n * @deprecated This method is deprecated use triggerInteraction() instead.\n */\nconst service = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.service(safeLoanInfo);\n };\n\n/**\n * Triggers the triggerInteraction function\n *\n * @param {ScLoanInfo} loanInfo\n * @returns {Promise<ScLoanSuccess>}\n * @throws {ScLoanError}\n */\nconst triggerInteraction = async (loanInfo) => {\n const safeLoanInfo = safeObject(loanInfo);\n\n return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);\n};\n\nconst ScLoan = {\n setup,\n apply,\n pay,\n withdraw,\n service,\n triggerInteraction,\n};\n\nexport default ScLoan;"],"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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,kBAAkB,GAAG,MAAOL,QAAQ,IAAK;EAC7C,MAAMC,YAAY,GAAGb,UAAU,CAACY,QAAQ,CAAC;EAEzC,OAAOT,sBAAsB,CAACc,kBAAkB,CAACJ,YAAY,CAAC;AAChE,CAAC;AAED,MAAMK,MAAM,GAAG;EACbd,KAAK;EACLO,KAAK;EACLG,GAAG;EACHC,QAAQ;EACRC,OAAO;EACPC;AACF,CAAC;AAED,eAAeC,MAAM","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-smallcase-gateway",
3
3
  "title": "React Native Smallcase Gateway",
4
- "version": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "description": "smallcase gateway bindings for react native",
6
6
  "main": "src/index.js",
7
7
  "files": [
@@ -34,5 +34,5 @@ Pod::Spec.new do |s|
34
34
  end
35
35
 
36
36
  s.dependency 'SCGateway', '4.0.1'
37
- s.dependency 'SCLoans', '3.0.0'
37
+ s.dependency 'SCLoans', '3.1.0'
38
38
  end
package/src/ScLoan.js CHANGED
@@ -43,6 +43,7 @@ const setup = async (config) => {
43
43
  * @param {ScLoanInfo} loanInfo
44
44
  * @returns {Promise<ScLoanSuccess>}
45
45
  * @throws {ScLoanError}
46
+ * @deprecated This method is deprecated use triggerInteraction() instead.
46
47
  */
47
48
  const apply = async (loanInfo) => {
48
49
  const safeLoanInfo = safeObject(loanInfo);
@@ -56,6 +57,7 @@ const apply = async (loanInfo) => {
56
57
  * @param {ScLoanInfo} loanInfo
57
58
  * @returns {Promise<ScLoanSuccess>}
58
59
  * @throws {ScLoanError}
60
+ * @deprecated This method is deprecated use triggerInteraction() instead.
59
61
  */
60
62
  const pay = async (loanInfo) => {
61
63
  const safeLoanInfo = safeObject(loanInfo);
@@ -69,6 +71,7 @@ const pay = async (loanInfo) => {
69
71
  * @param {ScLoanInfo} loanInfo
70
72
  * @returns {Promise<ScLoanSuccess>}
71
73
  * @throws {ScLoanError}
74
+ * @deprecated This method is deprecated use triggerInteraction() instead.
72
75
  */
73
76
  const withdraw = async (loanInfo) => {
74
77
  const safeLoanInfo = safeObject(loanInfo);
@@ -82,6 +85,7 @@ const withdraw = async (loanInfo) => {
82
85
  * @param {ScLoanInfo} loanInfo
83
86
  * @returns {Promise<ScLoanSuccess>}
84
87
  * @throws {ScLoanError}
88
+ * @deprecated This method is deprecated use triggerInteraction() instead.
85
89
  */
86
90
  const service = async (loanInfo) => {
87
91
  const safeLoanInfo = safeObject(loanInfo);
@@ -89,12 +93,26 @@ const service = async (loanInfo) => {
89
93
  return SmallcaseGatewayNative.service(safeLoanInfo);
90
94
  };
91
95
 
96
+ /**
97
+ * Triggers the triggerInteraction function
98
+ *
99
+ * @param {ScLoanInfo} loanInfo
100
+ * @returns {Promise<ScLoanSuccess>}
101
+ * @throws {ScLoanError}
102
+ */
103
+ const triggerInteraction = async (loanInfo) => {
104
+ const safeLoanInfo = safeObject(loanInfo);
105
+
106
+ return SmallcaseGatewayNative.triggerInteraction(safeLoanInfo);
107
+ };
108
+
92
109
  const ScLoan = {
93
- setup,
94
- apply,
95
- pay,
96
- withdraw,
97
- service
98
- }
99
-
100
- export default ScLoan;
110
+ setup,
111
+ apply,
112
+ pay,
113
+ withdraw,
114
+ service,
115
+ triggerInteraction,
116
+ };
117
+
118
+ export default ScLoan;
package/types/ScLoan.d.ts CHANGED
@@ -25,6 +25,7 @@ declare namespace ScLoan {
25
25
  export { pay };
26
26
  export { withdraw };
27
27
  export { service };
28
+ export { triggerInteraction };
28
29
  }
29
30
  /**
30
31
  * @typedef {Object} ScLoanConfig
@@ -84,3 +85,12 @@ declare function withdraw(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
84
85
  * @throws {ScLoanError}
85
86
  */
86
87
  declare function service(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;
88
+
89
+ /**
90
+ * Triggers the triggerInteraction Journey
91
+ *
92
+ * @param {ScLoanInfo} loanInfo
93
+ * @returns {Promise<ScLoanSuccess>}
94
+ * @throws {ScLoanError}
95
+ */
96
+ declare function triggerInteraction(loanInfo: ScLoanInfo): Promise<ScLoanSuccess>;