react-native-smallcase-gateway 1.0.1 → 1.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.
- package/CHANGELOG.md +21 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +50 -41
- package/ios/SmallcaseGateway.m +86 -48
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +1 -1
- package/src/SmallcaseGateway.js +24 -15
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.2.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.1.0...v1.2.0) (2022-05-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* show orders ([5ea8109](https://github.com/smallcase/react-native-smallcase-gateway/commit/5ea8109911ddd1f38dc666fb6815f10112bcce74))
|
|
11
|
+
|
|
12
|
+
## [1.1.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.0.2...v1.1.0) (2022-04-07)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* transaction error response in onSuccess callback ([6d36aeb](https://github.com/smallcase/react-native-smallcase-gateway/commit/6d36aebc0af379d7d7782baa7e59bc3092654d76))
|
|
18
|
+
|
|
19
|
+
### [1.0.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.0.0...v1.0.2) (2022-04-04)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* log SDK version with transactionId ([8b833b3](https://github.com/smallcase/react-native-smallcase-gateway/commit/8b833b366c0b8f9a030f920134d82c0f84fa6c7f))
|
|
25
|
+
|
|
5
26
|
### [1.0.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.0.0...v1.0.1) (2022-03-15)
|
|
6
27
|
|
|
7
28
|
## [1.0.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v0.10.0...v1.0.0) (2022-01-21)
|
package/android/build.gradle
CHANGED
|
@@ -82,7 +82,7 @@ repositories {
|
|
|
82
82
|
dependencies {
|
|
83
83
|
//noinspection GradleDynamicVersion
|
|
84
84
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
85
|
-
implementation 'com.smallcase.gateway:sdk:3.
|
|
85
|
+
implementation 'com.smallcase.gateway:sdk:3.2.0'
|
|
86
86
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
87
87
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
88
88
|
}
|
|
@@ -13,6 +13,7 @@ import com.smallcase.gateway.data.listeners.TransactionResponseListener
|
|
|
13
13
|
import com.smallcase.gateway.data.models.*
|
|
14
14
|
import com.smallcase.gateway.data.requests.InitRequest
|
|
15
15
|
import com.smallcase.gateway.portal.SmallcaseGatewaySdk
|
|
16
|
+
import com.smallcase.gateway.data.listeners.LeadGenResponseListener
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactContextBaseJavaModule(reactContext!!) {
|
|
@@ -32,7 +33,6 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
32
33
|
isAmoEnabled: Boolean,
|
|
33
34
|
preProvidedBrokers: ReadableArray,
|
|
34
35
|
promise: Promise) {
|
|
35
|
-
Log.d(TAG, "setConfigEnvironment: start")
|
|
36
36
|
|
|
37
37
|
try {
|
|
38
38
|
val brokerList = ArrayList<String>()
|
|
@@ -69,6 +69,18 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
@ReactMethod
|
|
73
|
+
fun setHybridSdkVersion(sdkVersion: String) {
|
|
74
|
+
SmallcaseGatewaySdk.setSDKType("react-native")
|
|
75
|
+
SmallcaseGatewaySdk.setHybridSDKVersion(sdkVersion)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@ReactMethod
|
|
79
|
+
fun getSdkVersion(reactNativeSdkVersion: String, promise: Promise) {
|
|
80
|
+
val sdkString = "android:${SmallcaseGatewaySdk.getSdkVersion()},react-native:$reactNativeSdkVersion"
|
|
81
|
+
promise.resolve(sdkString)
|
|
82
|
+
}
|
|
83
|
+
|
|
72
84
|
@ReactMethod
|
|
73
85
|
fun init(sdkToken: String, promise: Promise) {
|
|
74
86
|
Log.d(TAG, "init: start")
|
|
@@ -78,7 +90,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
78
90
|
authRequest = initReq,
|
|
79
91
|
gatewayInitialisationListener = object : DataListener<InitialisationResponse> {
|
|
80
92
|
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
81
|
-
val err = createErrorJSON(errorCode, errorMessage)
|
|
93
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
82
94
|
promise.reject("error", err)
|
|
83
95
|
}
|
|
84
96
|
|
|
@@ -110,21 +122,15 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
110
122
|
preProvidedBrokers = safeBrokerList,
|
|
111
123
|
transactionResponseListener = object : TransactionResponseListener {
|
|
112
124
|
override fun onSuccess(transactionResult: TransactionResult) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
val err = createErrorJSON(
|
|
118
|
-
transactionResult.errorCode,
|
|
119
|
-
transactionResult.error
|
|
120
|
-
)
|
|
121
|
-
promise.reject("error", err)
|
|
122
|
-
}
|
|
125
|
+
|
|
126
|
+
val res = resultToWritableMap(transactionResult)
|
|
127
|
+
promise.resolve(res)
|
|
128
|
+
|
|
123
129
|
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
override fun onError(errorCode: Int, errorMessage: String) {
|
|
127
|
-
val err = createErrorJSON(errorCode, errorMessage)
|
|
132
|
+
override fun onError(errorCode: Int, errorMessage: String, data: String?) {
|
|
133
|
+
val err = createErrorJSON(errorCode, errorMessage, data)
|
|
128
134
|
promise.reject("error", err)
|
|
129
135
|
}
|
|
130
136
|
})
|
|
@@ -133,13 +139,33 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
141
|
|
|
142
|
+
@ReactMethod
|
|
143
|
+
fun showOrders(promise: Promise) {
|
|
144
|
+
val activity = currentActivity;
|
|
145
|
+
if (activity != null) {
|
|
146
|
+
SmallcaseGatewaySdk.showOrders(
|
|
147
|
+
activity = activity,
|
|
148
|
+
showOrdersResponseListener = object : DataListener<Any> {
|
|
149
|
+
override fun onSuccess(response: Any) {
|
|
150
|
+
promise.resolve(true)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
154
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
155
|
+
promise.reject("error", err)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
136
162
|
@ReactMethod
|
|
137
163
|
fun launchSmallplug(targetEndpoint: String, params: String, promise: Promise) {
|
|
138
164
|
Log.d(TAG, "launchSmallplug: start")
|
|
139
165
|
|
|
140
166
|
SmallcaseGatewaySdk.launchSmallPlug(currentActivity!!, SmallplugData(targetEndpoint, params), object : SmallPlugResponseListener {
|
|
141
167
|
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
142
|
-
val err = createErrorJSON(errorCode, errorMessage)
|
|
168
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
143
169
|
|
|
144
170
|
promise.reject("error", err)
|
|
145
171
|
}
|
|
@@ -163,7 +189,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
163
189
|
}
|
|
164
190
|
|
|
165
191
|
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
166
|
-
val err = createErrorJSON(errorCode, errorMessage)
|
|
192
|
+
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
167
193
|
promise.reject("error", err)
|
|
168
194
|
}
|
|
169
195
|
})
|
|
@@ -181,7 +207,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
181
207
|
}
|
|
182
208
|
|
|
183
209
|
override fun onLogoutFailed(errorCode: Int, error: String) {
|
|
184
|
-
val err = createErrorJSON(errorCode, error)
|
|
210
|
+
val err = createErrorJSON(errorCode, error, null)
|
|
185
211
|
promise.reject("error", err)
|
|
186
212
|
}
|
|
187
213
|
})
|
|
@@ -202,27 +228,13 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
202
228
|
|
|
203
229
|
@ReactMethod
|
|
204
230
|
fun triggerLeadGenWithStatus(userDetails: ReadableMap, promise: Promise) {
|
|
205
|
-
val activity = currentActivity
|
|
231
|
+
val activity = currentActivity
|
|
206
232
|
if (activity != null) {
|
|
207
|
-
SmallcaseGatewaySdk.triggerLeadGen(activity,readableMapToStrHashMap(userDetails), object : TransactionResponseListener {
|
|
208
|
-
override fun onSuccess(transactionResult: TransactionResult) {
|
|
209
|
-
if (transactionResult.success) {
|
|
210
|
-
val res = resultToWritableMap(transactionResult)
|
|
211
|
-
promise.resolve(res)
|
|
212
|
-
} else {
|
|
213
|
-
val err = createErrorJSON(
|
|
214
|
-
transactionResult.errorCode,
|
|
215
|
-
transactionResult.error
|
|
216
|
-
)
|
|
217
|
-
promise.reject("error", err)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
233
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
promise.
|
|
234
|
+
SmallcaseGatewaySdk.triggerLeadGen(activity, readableMapToStrHashMap(userDetails), object: LeadGenResponseListener {
|
|
235
|
+
override fun onSuccess(leadResponse: String) {
|
|
236
|
+
promise.resolve(leadResponse)
|
|
224
237
|
}
|
|
225
|
-
|
|
226
238
|
})
|
|
227
239
|
}
|
|
228
240
|
}
|
|
@@ -257,15 +269,11 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
257
269
|
val writableMap: WritableMap = Arguments.createMap()
|
|
258
270
|
|
|
259
271
|
writableMap.putString("data", result.data)
|
|
260
|
-
writableMap.putBoolean("success", result.success)
|
|
261
|
-
writableMap.putString("error", result.error)
|
|
262
|
-
result.errorCode?.let {
|
|
263
|
-
writableMap.putInt("errorCode", it)
|
|
264
|
-
}
|
|
265
272
|
writableMap.putString("transaction", result.transaction.name)
|
|
266
273
|
return writableMap
|
|
267
274
|
}
|
|
268
275
|
|
|
276
|
+
|
|
269
277
|
private fun resultToWritableMap(result: SmallPlugResult): WritableMap {
|
|
270
278
|
val writableMap: WritableMap = Arguments.createMap()
|
|
271
279
|
|
|
@@ -275,11 +283,12 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
275
283
|
return writableMap
|
|
276
284
|
}
|
|
277
285
|
|
|
278
|
-
private fun createErrorJSON(errorCode: Int?, errorMessage: String?): WritableMap {
|
|
286
|
+
private fun createErrorJSON(errorCode: Int?, errorMessage: String?, data: String?): WritableMap {
|
|
279
287
|
val errObj = Arguments.createMap()
|
|
280
288
|
|
|
281
289
|
errorCode?.let { errObj.putInt("errorCode", it) }
|
|
282
290
|
errorMessage?.let { errObj.putString("errorMessage", it) }
|
|
291
|
+
data?.let { errObj.putString("data", it) }
|
|
283
292
|
|
|
284
293
|
return errObj
|
|
285
294
|
}
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -8,6 +8,24 @@
|
|
|
8
8
|
|
|
9
9
|
RCT_EXPORT_MODULE()
|
|
10
10
|
|
|
11
|
+
RCT_REMAP_METHOD(setHybridSdkVersion, sdkVersion: (NSString *)sdkVersion) {
|
|
12
|
+
[SCGateway.shared setSDKTypeWithType:@"react-native"];
|
|
13
|
+
[SCGateway.shared setHybridSDKVersionWithVersion:sdkVersion];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
RCT_REMAP_METHOD(getSdkVersion,
|
|
17
|
+
reactNativeSdkVersion: (NSString *)reactNativeSdkVersion
|
|
18
|
+
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
19
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
20
|
+
|
|
21
|
+
NSString *nativeSdkString = [NSString stringWithFormat: @"ios:%@", [SCGateway.shared getSdkVersion]];
|
|
22
|
+
NSString *reactNativeSdkString = [NSString stringWithFormat: @",react-native:%@", reactNativeSdkVersion];
|
|
23
|
+
|
|
24
|
+
NSString *result = [nativeSdkString stringByAppendingString: reactNativeSdkString];
|
|
25
|
+
|
|
26
|
+
resolve(result);
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
RCT_REMAP_METHOD(setConfigEnvironment,
|
|
12
30
|
envName:(NSString *)envName
|
|
13
31
|
gateway:(NSString *)gateway
|
|
@@ -75,36 +93,6 @@ RCT_REMAP_METHOD(init,
|
|
|
75
93
|
reject(@"init", @"Error during init", error);
|
|
76
94
|
}
|
|
77
95
|
}];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
RCT_REMAP_METHOD(archiveSmallcase,
|
|
83
|
-
iscid:(NSString *)iscid
|
|
84
|
-
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
85
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
86
|
-
{
|
|
87
|
-
[SCGateway.shared markSmallcaseArchiveWithIscid:iscid completion: ^(id response, NSError * error) {
|
|
88
|
-
if(error != nil) {
|
|
89
|
-
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
90
|
-
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
91
|
-
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
92
|
-
|
|
93
|
-
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
94
|
-
|
|
95
|
-
reject(@"archiveSmallcase", @"Error during transaction", err);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
NSString *archiveResponseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
|
100
|
-
|
|
101
|
-
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
102
|
-
[responseDict setValue:[NSNumber numberWithBool:true] forKey:@"success"];
|
|
103
|
-
|
|
104
|
-
[responseDict setObject:archiveResponseString forKey:@"data"];
|
|
105
|
-
resolve(responseDict);
|
|
106
|
-
return;
|
|
107
|
-
}];
|
|
108
96
|
}
|
|
109
97
|
|
|
110
98
|
RCT_REMAP_METHOD(triggerTransaction,
|
|
@@ -238,6 +226,29 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
238
226
|
});
|
|
239
227
|
}
|
|
240
228
|
|
|
229
|
+
RCT_REMAP_METHOD(showOrders,
|
|
230
|
+
showOrdersWithResolver: (RCTPromiseResolveBlock)resolve
|
|
231
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
232
|
+
{
|
|
233
|
+
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
234
|
+
|
|
235
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
236
|
+
|
|
237
|
+
[SCGateway.shared
|
|
238
|
+
showOrdersWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController]
|
|
239
|
+
completion:^(BOOL success, NSError * error) {
|
|
240
|
+
|
|
241
|
+
if(success){
|
|
242
|
+
resolve(@(YES));
|
|
243
|
+
} else {
|
|
244
|
+
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
245
|
+
[responseDict setValue:error.domain forKey:@"error"];
|
|
246
|
+
resolve(responseDict);
|
|
247
|
+
}
|
|
248
|
+
}];
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
241
252
|
RCT_REMAP_METHOD(launchSmallplug,
|
|
242
253
|
targetEndpoint:(NSString *)targetEndpoint
|
|
243
254
|
params:(NSString *)params
|
|
@@ -288,28 +299,38 @@ RCT_REMAP_METHOD(launchSmallplug,
|
|
|
288
299
|
});
|
|
289
300
|
}
|
|
290
301
|
|
|
291
|
-
RCT_REMAP_METHOD(
|
|
292
|
-
|
|
302
|
+
RCT_REMAP_METHOD(archiveSmallcase,
|
|
303
|
+
iscid:(NSString *)iscid
|
|
304
|
+
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
293
305
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
294
306
|
{
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
307
|
+
[SCGateway.shared markSmallcaseArchiveWithIscid:iscid completion: ^(id response, NSError * error) {
|
|
308
|
+
if(error != nil) {
|
|
309
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
310
|
+
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
311
|
+
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
312
|
+
|
|
313
|
+
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
314
|
+
|
|
315
|
+
reject(@"archiveSmallcase", @"Error during transaction", err);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
NSString *archiveResponseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
|
320
|
+
|
|
321
|
+
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
322
|
+
[responseDict setValue:[NSNumber numberWithBool:true] forKey:@"success"];
|
|
323
|
+
|
|
324
|
+
[responseDict setObject:archiveResponseString forKey:@"data"];
|
|
325
|
+
resolve(responseDict);
|
|
326
|
+
return;
|
|
327
|
+
}];
|
|
306
328
|
}
|
|
307
329
|
|
|
308
|
-
|
|
309
330
|
RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
331
|
+
userParams: (NSDictionary *)userParams
|
|
332
|
+
leadGenGenWithResolver: (RCTPromiseResolveBlock)resolve
|
|
333
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
313
334
|
{
|
|
314
335
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
315
336
|
|
|
@@ -317,7 +338,7 @@ RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
|
317
338
|
completion:^(NSString * leadGenResponse) {
|
|
318
339
|
resolve(leadGenResponse);
|
|
319
340
|
}
|
|
320
|
-
|
|
341
|
+
];
|
|
321
342
|
|
|
322
343
|
});
|
|
323
344
|
}
|
|
@@ -329,6 +350,23 @@ RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictio
|
|
|
329
350
|
});
|
|
330
351
|
}
|
|
331
352
|
|
|
353
|
+
RCT_REMAP_METHOD(logoutUser,
|
|
354
|
+
logoutUserWithResolver:(RCTPromiseResolveBlock)resolve
|
|
355
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
356
|
+
{
|
|
357
|
+
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
358
|
+
[SCGateway.shared
|
|
359
|
+
logoutUserWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController]
|
|
360
|
+
completion:^(BOOL success, NSError * error) {
|
|
361
|
+
if(success){
|
|
362
|
+
resolve(@(YES));
|
|
363
|
+
} else {
|
|
364
|
+
reject(@"logout", @"Error during logout", error);
|
|
365
|
+
}
|
|
366
|
+
}];
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
332
370
|
@end
|
|
333
371
|
|
|
334
372
|
|
package/package.json
CHANGED
package/src/SmallcaseGateway.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules } from "react-native";
|
|
2
2
|
import { ENV } from "./constants";
|
|
3
3
|
import { safeObject } from "./util";
|
|
4
|
+
import { version } from "../package.json";
|
|
4
5
|
const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -34,6 +35,8 @@ let defaultBrokerList = [];
|
|
|
34
35
|
const setConfigEnvironment = async (envConfig) => {
|
|
35
36
|
const safeConfig = safeObject(envConfig);
|
|
36
37
|
|
|
38
|
+
await SmallcaseGatewayNative.setHybridSdkVersion(version);
|
|
39
|
+
|
|
37
40
|
const {
|
|
38
41
|
brokerList,
|
|
39
42
|
gatewayName,
|
|
@@ -123,6 +126,15 @@ const logoutUser = async () => {
|
|
|
123
126
|
return SmallcaseGatewayNative.logoutUser();
|
|
124
127
|
};
|
|
125
128
|
|
|
129
|
+
/**
|
|
130
|
+
* This will display a list of all the orders that a user recently placed.
|
|
131
|
+
* This includes pending, successful, and failed orders.
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
const showOrders = async () => {
|
|
135
|
+
return SmallcaseGatewayNative.showOrders();
|
|
136
|
+
};
|
|
137
|
+
|
|
126
138
|
/**
|
|
127
139
|
* triggers the lead gen flow
|
|
128
140
|
*
|
|
@@ -136,20 +148,6 @@ const triggerLeadGen = (userDetails, utmParams) => {
|
|
|
136
148
|
return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);
|
|
137
149
|
};
|
|
138
150
|
|
|
139
|
-
// /**
|
|
140
|
-
// * triggers the lead gen flow
|
|
141
|
-
// *
|
|
142
|
-
// * @param {userDetails} [userDetails]
|
|
143
|
-
// * @param {Object} [utmParams]
|
|
144
|
-
// * * @returns {Promise}
|
|
145
|
-
// */
|
|
146
|
-
// const triggerLeadGen = async (userDetails, utmParams) => {
|
|
147
|
-
// const safeParams = safeObject(userDetails);
|
|
148
|
-
// const safeUtm = safeObject(utmParams);
|
|
149
|
-
|
|
150
|
-
// return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm)
|
|
151
|
-
// }
|
|
152
|
-
|
|
153
151
|
/**
|
|
154
152
|
* triggers the lead gen flow
|
|
155
153
|
*
|
|
@@ -173,6 +171,15 @@ const archiveSmallcase = async (iscid) => {
|
|
|
173
171
|
return SmallcaseGatewayNative.archiveSmallcase(safeIscid);
|
|
174
172
|
};
|
|
175
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Returns the native android/ios and react-native sdk version
|
|
176
|
+
* (internal-tracking)
|
|
177
|
+
* @returns {Promise}
|
|
178
|
+
*/
|
|
179
|
+
const getSdkVersion = async () => {
|
|
180
|
+
return SmallcaseGatewayNative.getSdkVersion(version);
|
|
181
|
+
}
|
|
182
|
+
|
|
176
183
|
const SmallcaseGateway = {
|
|
177
184
|
init,
|
|
178
185
|
logoutUser,
|
|
@@ -181,7 +188,9 @@ const SmallcaseGateway = {
|
|
|
181
188
|
archiveSmallcase,
|
|
182
189
|
triggerTransaction,
|
|
183
190
|
setConfigEnvironment,
|
|
184
|
-
launchSmallplug
|
|
191
|
+
launchSmallplug,
|
|
192
|
+
getSdkVersion,
|
|
193
|
+
showOrders
|
|
185
194
|
};
|
|
186
195
|
|
|
187
196
|
export default SmallcaseGateway;
|