react-native-smallcase-gateway 1.1.0 → 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
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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
|
+
|
|
5
12
|
## [1.1.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.0.2...v1.1.0) (2022-04-07)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -139,6 +139,26 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
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
|
+
|
|
142
162
|
@ReactMethod
|
|
143
163
|
fun launchSmallplug(targetEndpoint: String, params: String, promise: Promise) {
|
|
144
164
|
Log.d(TAG, "launchSmallplug: start")
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -95,34 +95,6 @@ RCT_REMAP_METHOD(init,
|
|
|
95
95
|
}];
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
RCT_REMAP_METHOD(archiveSmallcase,
|
|
99
|
-
iscid:(NSString *)iscid
|
|
100
|
-
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
101
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
102
|
-
{
|
|
103
|
-
[SCGateway.shared markSmallcaseArchiveWithIscid:iscid completion: ^(id response, NSError * error) {
|
|
104
|
-
if(error != nil) {
|
|
105
|
-
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
106
|
-
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
107
|
-
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
108
|
-
|
|
109
|
-
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
110
|
-
|
|
111
|
-
reject(@"archiveSmallcase", @"Error during transaction", err);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
NSString *archiveResponseString = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];
|
|
116
|
-
|
|
117
|
-
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
118
|
-
[responseDict setValue:[NSNumber numberWithBool:true] forKey:@"success"];
|
|
119
|
-
|
|
120
|
-
[responseDict setObject:archiveResponseString forKey:@"data"];
|
|
121
|
-
resolve(responseDict);
|
|
122
|
-
return;
|
|
123
|
-
}];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
98
|
RCT_REMAP_METHOD(triggerTransaction,
|
|
127
99
|
transactionId:(NSString *)transactionId
|
|
128
100
|
utmParams:(NSDictionary *)utmParams
|
|
@@ -254,6 +226,29 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
254
226
|
});
|
|
255
227
|
}
|
|
256
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
|
+
|
|
257
252
|
RCT_REMAP_METHOD(launchSmallplug,
|
|
258
253
|
targetEndpoint:(NSString *)targetEndpoint
|
|
259
254
|
params:(NSString *)params
|
|
@@ -304,28 +299,38 @@ RCT_REMAP_METHOD(launchSmallplug,
|
|
|
304
299
|
});
|
|
305
300
|
}
|
|
306
301
|
|
|
307
|
-
RCT_REMAP_METHOD(
|
|
308
|
-
|
|
302
|
+
RCT_REMAP_METHOD(archiveSmallcase,
|
|
303
|
+
iscid:(NSString *)iscid
|
|
304
|
+
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
309
305
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
310
306
|
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
+
}];
|
|
322
328
|
}
|
|
323
329
|
|
|
324
|
-
|
|
325
330
|
RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
331
|
+
userParams: (NSDictionary *)userParams
|
|
332
|
+
leadGenGenWithResolver: (RCTPromiseResolveBlock)resolve
|
|
333
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
329
334
|
{
|
|
330
335
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
331
336
|
|
|
@@ -333,7 +338,7 @@ RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
|
333
338
|
completion:^(NSString * leadGenResponse) {
|
|
334
339
|
resolve(leadGenResponse);
|
|
335
340
|
}
|
|
336
|
-
|
|
341
|
+
];
|
|
337
342
|
|
|
338
343
|
});
|
|
339
344
|
}
|
|
@@ -345,6 +350,23 @@ RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictio
|
|
|
345
350
|
});
|
|
346
351
|
}
|
|
347
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
|
+
|
|
348
370
|
@end
|
|
349
371
|
|
|
350
372
|
|
package/package.json
CHANGED
package/src/SmallcaseGateway.js
CHANGED
|
@@ -126,6 +126,15 @@ const logoutUser = async () => {
|
|
|
126
126
|
return SmallcaseGatewayNative.logoutUser();
|
|
127
127
|
};
|
|
128
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
|
+
|
|
129
138
|
/**
|
|
130
139
|
* triggers the lead gen flow
|
|
131
140
|
*
|
|
@@ -180,7 +189,8 @@ const SmallcaseGateway = {
|
|
|
180
189
|
triggerTransaction,
|
|
181
190
|
setConfigEnvironment,
|
|
182
191
|
launchSmallplug,
|
|
183
|
-
getSdkVersion
|
|
192
|
+
getSdkVersion,
|
|
193
|
+
showOrders
|
|
184
194
|
};
|
|
185
195
|
|
|
186
196
|
export default SmallcaseGateway;
|