react-native-smallcase-gateway 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
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
+ ### [1.6.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.6.1...v1.6.2) (2022-11-11)
6
+
7
+
8
+ ### Features
9
+
10
+ * added support for MF Holdings import fix ([0bf5388](https://github.com/smallcase/react-native-smallcase-gateway/commit/0bf5388e1ca6ee5534681dfa35bd3f69c3aefd7a))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Data in mf response is null ([bfca609](https://github.com/smallcase/react-native-smallcase-gateway/commit/bfca609a3075a9e45dc63c4fa9e4561ea3b6cd37))
16
+
17
+ ### [1.6.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.4...v1.6.1) (2022-10-19)
18
+
19
+
20
+ ### Features
21
+
22
+ * 1014 err msg added ([04bc4de](https://github.com/smallcase/react-native-smallcase-gateway/commit/04bc4de8dcd3a7a37d6f0d15eee5aeeb34419195))
23
+ * add bridge method for mf holdings ([b68b570](https://github.com/smallcase/react-native-smallcase-gateway/commit/b68b57062ed514dc46404f94191c3ee438f184dc))
24
+
5
25
  ## [1.6.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.4...v1.6.0) (2022-09-23)
6
26
 
7
27
  ### [1.5.4](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.5.2...v1.5.4) (2022-09-08)
@@ -81,7 +81,7 @@ repositories {
81
81
  dependencies {
82
82
  //noinspection GradleDynamicVersion
83
83
  implementation 'com.facebook.react:react-native:+' // From node_modules
84
- implementation 'com.smallcase.gateway:sdk:3.6.1'
84
+ implementation 'com.smallcase.gateway:sdk:3.6.4'
85
85
  implementation "androidx.core:core-ktx:1.3.1"
86
86
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
87
87
  }
@@ -115,30 +115,30 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
115
115
  }
116
116
  }
117
117
 
118
- // @ReactMethod
119
- // fun triggerMfTransaction(transactionId: String, promise: Promise) {
120
-
121
- // if(currentActivity != null) {
122
-
123
- // SmallcaseGatewaySdk.triggerMfTransaction(
124
- // activity = currentActivity!!,
125
- // transactionId = transactionId,
126
- // listener = object : MFHoldingsResponseListener {
127
-
128
- // override fun onSuccess(transactionResult: TransactionResult) {
129
- // val res = resultToWritableMap(transactionResult, true)
130
- // promise.resolve(res)
131
- // }
132
-
133
- // override fun onError(errorCode: Int, errorMessage: String, data: String?) {
134
- // val err = createErrorJSON(errorCode, errorMessage, data)
135
- // promise.reject("error", err)
136
- // }
137
- // })
138
- // } else {
139
- // promise.reject(Throwable("no activity"))
140
- // }
141
- // }
118
+ @ReactMethod
119
+ fun triggerMfTransaction(transactionId: String, promise: Promise) {
120
+
121
+ if(currentActivity != null) {
122
+
123
+ SmallcaseGatewaySdk.triggerMfTransaction(
124
+ activity = currentActivity!!,
125
+ transactionId = transactionId,
126
+ listener = object : MFHoldingsResponseListener {
127
+
128
+ override fun onSuccess(transactionResult: TransactionResult) {
129
+ val res = resultToWritableMap(transactionResult, true)
130
+ promise.resolve(res)
131
+ }
132
+
133
+ override fun onError(errorCode: Int, errorMessage: String, data: String?) {
134
+ val err = createErrorJSON(errorCode, errorMessage, data)
135
+ promise.reject("error", err)
136
+ }
137
+ })
138
+ } else {
139
+ promise.reject(Throwable("no activity"))
140
+ }
141
+ }
142
142
 
143
143
  @ReactMethod
144
144
  fun showOrders(promise: Promise) {
@@ -94,6 +94,50 @@ RCT_REMAP_METHOD(init,
94
94
  }];
95
95
  }
96
96
 
97
+ //MARK: Trigger Transaction
98
+ RCT_REMAP_METHOD(triggerMfTransaction,
99
+ transactionId:(NSString *)transactionId
100
+ triggerTransactionWithResolver:(RCTPromiseResolveBlock)resolve
101
+ rejecter:(RCTPromiseRejectBlock)reject) {
102
+ dispatch_async(dispatch_get_main_queue(), ^(void) {
103
+ [SCGateway.shared
104
+ triggerMfTransactionWithPresentingController:
105
+ [[[UIApplication sharedApplication] keyWindow] rootViewController]
106
+ transactionId: transactionId
107
+ completion: ^(id response, NSError * error) {
108
+ if (error != nil) {
109
+ NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
110
+ [responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
111
+ [responseDict setValue:error.domain forKey:@"errorMessage"];
112
+ [responseDict setValue:[error.userInfo objectForKey: @"data"] forKey:@"data"];
113
+
114
+ NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
115
+
116
+ reject(@"triggerTransaction", @"Error during transaction", err);
117
+ return;
118
+ }
119
+
120
+ //MARK: intent - mf transaction
121
+ if ([response isKindOfClass: [ObjCTransactionIntentMfHoldingsImport class]]) {
122
+ NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
123
+ ObjCTransactionIntentMfHoldingsImport *trxResponse = response;
124
+ [responseDict setObject:@"TRANSACTION" forKey:@"transaction"];
125
+
126
+ NSData *decodedStringData = [[NSData alloc] initWithBase64EncodedString:trxResponse.data options: 0];
127
+ NSString *decodedResponse = [[NSString alloc] initWithData:decodedStringData encoding:1];
128
+
129
+ [responseDict setObject:trxResponse.data forKey:@"data"];
130
+ resolve(responseDict);
131
+ return;
132
+ }
133
+
134
+ // no matching intent type
135
+ NSError *err = [[NSError alloc] initWithDomain:@"com.smallcase.gateway" code:0 userInfo:@{@"Error reason": @"no matching response type"}];
136
+ reject(@"triggerMfTransaction", @"no matching response type", err);
137
+ }];
138
+ });
139
+ }
140
+
97
141
  //MARK: Trigger Transaction
98
142
  RCT_REMAP_METHOD(triggerTransaction,
99
143
  transactionId:(NSString *)transactionId
@@ -47,12 +47,20 @@
47
47
  name = Products;
48
48
  sourceTree = "<group>";
49
49
  };
50
+ 158F56C62901D6B600238D90 /* Frameworks */ = {
51
+ isa = PBXGroup;
52
+ children = (
53
+ );
54
+ name = Frameworks;
55
+ sourceTree = "<group>";
56
+ };
50
57
  58B511D21A9E6C8500147676 = {
51
58
  isa = PBXGroup;
52
59
  children = (
53
60
  134814211AA4EA7D00B7C361 /* Products */,
54
61
  18B09301250F83460012829C /* SmallcaseGateway.h */,
55
62
  18B09300250F83460012829C /* SmallcaseGateway.m */,
63
+ 158F56C62901D6B600238D90 /* Frameworks */,
56
64
  );
57
65
  sourceTree = "<group>";
58
66
  };
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": "1.6.0",
4
+ "version": "1.6.2",
5
5
  "description": "smallcase gateway bindings for react native",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -18,11 +18,11 @@ Pod::Spec.new do |s|
18
18
  s.platforms = { :ios => "11.0" }
19
19
  # s.source = { :git => "https://github.com/mobile/react-native-smallcase-gateway.git", :tag => "#{s.version}" }
20
20
  s.source = { :git => "https://github.com/smallcase/react-native-smallcase-gateway.git", :tag => "#{s.version}" }
21
-
21
+ s.vendored_frameworks = 'SCGateway.xcframework'
22
22
  s.source_files = "ios/**/*.{h,c,m,swift}"
23
23
  s.requires_arc = true
24
24
 
25
25
  s.dependency "React-Core"
26
- s.dependency 'SCGateway', '3.6.1'
26
+ s.dependency 'SCGateway', '3.7.2'
27
27
  end
28
28
 
@@ -110,13 +110,13 @@ const triggerTransaction = async (transactionId, utmParams, brokerList) => {
110
110
  * @param {string} transactionId
111
111
  * @returns {Promise<transactionRes>}
112
112
  */
113
- // const triggerMfTransaction = async (transactionId) => {
114
- // const safeTransactionId = typeof transactionId === "string" ? transactionId : "";
113
+ const triggerMfTransaction = async (transactionId) => {
114
+ const safeTransactionId = typeof transactionId === "string" ? transactionId : "";
115
115
 
116
- // return SmallcaseGatewayNative.triggerMfTransaction(
117
- // safeTransactionId
118
- // );
119
- // }
116
+ return SmallcaseGatewayNative.triggerMfTransaction(
117
+ safeTransactionId
118
+ );
119
+ }
120
120
 
121
121
  /**
122
122
  * launches smallcases module
@@ -267,6 +267,7 @@ const SmallcaseGateway = {
267
267
  triggerLeadGenWithLoginCta,
268
268
  archiveSmallcase,
269
269
  triggerTransaction,
270
+ triggerMfTransaction,
270
271
  setConfigEnvironment,
271
272
  launchSmallplug,
272
273
  launchSmallplugWithBranding,
package/src/constants.js CHANGED
@@ -31,4 +31,5 @@ export const ERROR_MSG = {
31
31
  invalid_transactionId: "invalid_transactionId",
32
32
  insufficient_holdings: "insufficient_holdings",
33
33
  transaction_in_process: "transaction_in_process",
34
+ no_compatible_browser: "no_compatible_browser"
34
35
  };