react-native-smallcase-gateway 1.4.0 → 1.5.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 +27 -0
- package/android/build.gradle +3 -77
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +5 -5
- package/ios/SmallcaseGateway.m +38 -33
- package/package.json +1 -1
- package/react-native-smallcase-gateway.podspec +1 -2
- package/src/SmallcaseGateway.js +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
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.5.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.4.2...v1.5.0) (2022-08-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added error data for transactional errors ([e50e977](https://github.com/smallcase/react-native-smallcase-gateway/commit/e50e977dda6c15f4ed3c4e40932f851e7a3bebce))
|
|
11
|
+
* added signup key for all transactional intents ([6f00f57](https://github.com/smallcase/react-native-smallcase-gateway/commit/6f00f57cf2f24f6896019ca17f7603508477161d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* added `data` in DataListener error callback ([0481520](https://github.com/smallcase/react-native-smallcase-gateway/commit/0481520ace7730d137400808b05b037787d73296))
|
|
17
|
+
* build fails on gradle 7 ([28f79fd](https://github.com/smallcase/react-native-smallcase-gateway/commit/28f79fd53dd2400412f7286442f7b6031287c063))
|
|
18
|
+
* data not appended in init and show orders ([07a2a61](https://github.com/smallcase/react-native-smallcase-gateway/commit/07a2a61dd2add4a3cf7b7e4d59a70bb6c750c0bc))
|
|
19
|
+
* error data not being returned for intent_not_enabled_for_broker 3000 error ([53b4bfd](https://github.com/smallcase/react-native-smallcase-gateway/commit/53b4bfd52c7dee4aed647e04493e4d1e23402406))
|
|
20
|
+
* http for artifactory url ([b7934dc](https://github.com/smallcase/react-native-smallcase-gateway/commit/b7934dc28353508f36aa9ec23d1ebac36d74bf29))
|
|
21
|
+
* unsafe params on launchSmallplug ([a6752cb](https://github.com/smallcase/react-native-smallcase-gateway/commit/a6752cb9d41eb0f55c997fa1712a26c0e72d7472))
|
|
22
|
+
|
|
23
|
+
### [1.4.2](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.4.0...v1.4.2) (2022-07-21)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* version not null ([479109d](https://github.com/smallcase/react-native-smallcase-gateway/commit/479109d9d491a853f1d09744fe2f36fffb1409dc))
|
|
29
|
+
|
|
30
|
+
### [1.4.1](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.4.0...v1.4.1) (2022-06-27)
|
|
31
|
+
|
|
5
32
|
## [1.4.0](https://github.com/smallcase/react-native-smallcase-gateway/compare/v1.3.3...v1.4.0) (2022-06-23)
|
|
6
33
|
|
|
7
34
|
|
package/android/build.gradle
CHANGED
|
@@ -10,7 +10,7 @@ def safeExtGet(prop, fallback) {
|
|
|
10
10
|
def kotlin_version = safeExtGet('kotlinVersion', '1.3.71')
|
|
11
11
|
|
|
12
12
|
apply plugin: 'com.android.library'
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
|
|
15
15
|
buildscript {
|
|
16
16
|
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
@@ -39,7 +39,6 @@ buildscript {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
apply plugin: 'com.android.library'
|
|
42
|
-
apply plugin: 'maven'
|
|
43
42
|
apply plugin: 'kotlin-android'
|
|
44
43
|
apply plugin: 'kotlin-android-extensions'
|
|
45
44
|
|
|
@@ -61,7 +60,7 @@ repositories {
|
|
|
61
60
|
// ref: https://www.baeldung.com/maven-local-repository
|
|
62
61
|
mavenLocal()
|
|
63
62
|
maven {
|
|
64
|
-
url "
|
|
63
|
+
url "https://artifactory.smallcase.com/artifactory/gradle-dev-local"
|
|
65
64
|
credentials {
|
|
66
65
|
username "react_native_user"
|
|
67
66
|
password "reactNativeUser123"
|
|
@@ -82,80 +81,7 @@ repositories {
|
|
|
82
81
|
dependencies {
|
|
83
82
|
//noinspection GradleDynamicVersion
|
|
84
83
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
85
|
-
implementation 'com.smallcase.gateway:sdk:3.
|
|
84
|
+
implementation 'com.smallcase.gateway:sdk:3.5.2'
|
|
86
85
|
implementation "androidx.core:core-ktx:1.3.1"
|
|
87
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
88
87
|
}
|
|
89
|
-
|
|
90
|
-
def configureReactNativePom(def pom) {
|
|
91
|
-
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
|
|
92
|
-
|
|
93
|
-
pom.project {
|
|
94
|
-
name packageJson.title
|
|
95
|
-
artifactId packageJson.name
|
|
96
|
-
version = packageJson.version
|
|
97
|
-
group = "com.smallcase.gateway.reactnative"
|
|
98
|
-
description packageJson.description
|
|
99
|
-
url packageJson.repository.baseUrl
|
|
100
|
-
|
|
101
|
-
licenses {
|
|
102
|
-
license {
|
|
103
|
-
name packageJson.license
|
|
104
|
-
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
|
|
105
|
-
distribution 'repo'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
developers {
|
|
110
|
-
developer {
|
|
111
|
-
id packageJson.author.username
|
|
112
|
-
name packageJson.author.name
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
afterEvaluate { project ->
|
|
119
|
-
// some Gradle build hooks ref:
|
|
120
|
-
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
|
|
121
|
-
task androidJavadoc(type: Javadoc) {
|
|
122
|
-
source = android.sourceSets.main.java.srcDirs
|
|
123
|
-
classpath += files(android.bootClasspath)
|
|
124
|
-
classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
125
|
-
include '**/*.java'
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
129
|
-
classifier = 'javadoc'
|
|
130
|
-
from androidJavadoc.destinationDir
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
task androidSourcesJar(type: Jar) {
|
|
134
|
-
classifier = 'sources'
|
|
135
|
-
from android.sourceSets.main.java.srcDirs
|
|
136
|
-
include '**/*.java'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
android.libraryVariants.all { variant ->
|
|
140
|
-
def name = variant.name.capitalize()
|
|
141
|
-
def javaCompileTask = variant.javaCompileProvider.get()
|
|
142
|
-
|
|
143
|
-
task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
|
|
144
|
-
from javaCompileTask.destinationDir
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
artifacts {
|
|
149
|
-
archives androidSourcesJar
|
|
150
|
-
archives androidJavadocJar
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
task installArchives(type: Upload) {
|
|
154
|
-
configuration = configurations.archives
|
|
155
|
-
repositories.mavenDeployer {
|
|
156
|
-
// Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
157
|
-
repository url: "file://${projectDir}/../android/maven"
|
|
158
|
-
configureReactNativePom pom
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -72,8 +72,8 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
72
72
|
|
|
73
73
|
val initReq = InitRequest(sdkToken)
|
|
74
74
|
SmallcaseGatewaySdk.init(authRequest = initReq, gatewayInitialisationListener = object : DataListener<InitialisationResponse> {
|
|
75
|
-
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
76
|
-
val err = createErrorJSON(errorCode, errorMessage,
|
|
75
|
+
override fun onFailure(errorCode: Int, errorMessage: String, data: String?) {
|
|
76
|
+
val err = createErrorJSON(errorCode, errorMessage, data)
|
|
77
77
|
promise.reject("error", err)
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -127,8 +127,8 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
127
127
|
promise.resolve(true)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
131
|
-
val err = createErrorJSON(errorCode, errorMessage,
|
|
130
|
+
override fun onFailure(errorCode: Int, errorMessage: String, data: String?) {
|
|
131
|
+
val err = createErrorJSON(errorCode, errorMessage, data)
|
|
132
132
|
promise.reject("error", err)
|
|
133
133
|
}
|
|
134
134
|
})
|
|
@@ -208,7 +208,7 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
|
|
|
208
208
|
promise.resolve(response)
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
override fun onFailure(errorCode: Int, errorMessage: String) {
|
|
211
|
+
override fun onFailure(errorCode: Int, errorMessage: String, data: String?) {
|
|
212
212
|
val err = createErrorJSON(errorCode, errorMessage, null)
|
|
213
213
|
promise.reject("error", err)
|
|
214
214
|
}
|
package/ios/SmallcaseGateway.m
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
RCT_EXPORT_MODULE()
|
|
10
10
|
|
|
11
|
+
//MARK: SDK version helpers
|
|
11
12
|
RCT_REMAP_METHOD(setHybridSdkVersion, sdkVersion: (NSString *)sdkVersion) {
|
|
12
13
|
[SCGateway.shared setSDKTypeWithType:@"react-native"];
|
|
13
14
|
[SCGateway.shared setHybridSDKVersionWithVersion:sdkVersion];
|
|
@@ -26,6 +27,7 @@ RCT_REMAP_METHOD(getSdkVersion,
|
|
|
26
27
|
resolve(result);
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
//MARK: SDK setup
|
|
29
31
|
RCT_REMAP_METHOD(setConfigEnvironment,
|
|
30
32
|
envName:(NSString *)envName
|
|
31
33
|
gateway:(NSString *)gateway
|
|
@@ -33,8 +35,7 @@ RCT_REMAP_METHOD(setConfigEnvironment,
|
|
|
33
35
|
isAmoEnabled: (BOOL *)isAmoEnabled
|
|
34
36
|
preProvidedBrokers: (NSArray *)preProvidedBrokers
|
|
35
37
|
setConfigEnvironmentWithResolver:(RCTPromiseResolveBlock)resolve
|
|
36
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
37
|
-
{
|
|
38
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
38
39
|
NSInteger environment = EnvironmentProduction;
|
|
39
40
|
|
|
40
41
|
if([envName isEqualToString:@"production"]) {
|
|
@@ -53,10 +54,8 @@ RCT_REMAP_METHOD(setConfigEnvironment,
|
|
|
53
54
|
isLeprechaunActive:isLeprechaunActive
|
|
54
55
|
isAmoEnabled:isAmoEnabled];
|
|
55
56
|
|
|
56
|
-
[SCGateway.shared setupWithConfig: config completion:^(BOOL success,NSError * error)
|
|
57
|
-
|
|
58
|
-
if(success)
|
|
59
|
-
{
|
|
57
|
+
[SCGateway.shared setupWithConfig: config completion:^(BOOL success,NSError * error) {
|
|
58
|
+
if(success) {
|
|
60
59
|
resolve(@(YES));
|
|
61
60
|
} else {
|
|
62
61
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
@@ -67,20 +66,20 @@ RCT_REMAP_METHOD(setConfigEnvironment,
|
|
|
67
66
|
|
|
68
67
|
reject(@"setConfigEnvironment", @"Env setup failed", err);
|
|
69
68
|
}
|
|
69
|
+
|
|
70
70
|
}];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
//MARK: SDK init
|
|
73
74
|
RCT_REMAP_METHOD(init,
|
|
74
75
|
sdkToken:(NSString *)sdkToken
|
|
75
76
|
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
76
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
77
|
-
{
|
|
77
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
78
78
|
[SCGateway.shared initializeGatewayWithSdkToken:sdkToken completion:^(BOOL success, NSError * error) {
|
|
79
|
-
if(success){
|
|
79
|
+
if(success) {
|
|
80
80
|
resolve(@(YES));
|
|
81
81
|
} else {
|
|
82
|
-
if(error != nil)
|
|
83
|
-
{
|
|
82
|
+
if(error != nil) {
|
|
84
83
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
85
84
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
86
85
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
@@ -95,13 +94,13 @@ RCT_REMAP_METHOD(init,
|
|
|
95
94
|
}];
|
|
96
95
|
}
|
|
97
96
|
|
|
97
|
+
//MARK: Trigger Transaction
|
|
98
98
|
RCT_REMAP_METHOD(triggerTransaction,
|
|
99
99
|
transactionId:(NSString *)transactionId
|
|
100
100
|
utmParams:(NSDictionary *)utmParams
|
|
101
101
|
brokerList:(NSArray *)brokerList
|
|
102
102
|
triggerTransactionWithResolver:(RCTPromiseResolveBlock)resolve
|
|
103
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
104
|
-
{
|
|
103
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
105
104
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
106
105
|
[SCGateway.shared
|
|
107
106
|
triggerTransactionFlowWithTransactionId:transactionId
|
|
@@ -113,6 +112,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
113
112
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
114
113
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
115
114
|
[responseDict setValue:error.domain forKey:@"errorMessage"];
|
|
115
|
+
[responseDict setValue:[error.userInfo objectForKey: @"data"] forKey:@"data"];
|
|
116
116
|
|
|
117
117
|
NSError *err = [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:responseDict];
|
|
118
118
|
|
|
@@ -123,7 +123,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
123
123
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
124
124
|
[responseDict setValue:[NSNumber numberWithBool:true] forKey:@"success"];
|
|
125
125
|
|
|
126
|
-
// intent - transaction
|
|
126
|
+
//MARK: intent - transaction
|
|
127
127
|
if ([response isKindOfClass: [ObjcTransactionIntentTransaction class]]) {
|
|
128
128
|
ObjcTransactionIntentTransaction *trxResponse = response;
|
|
129
129
|
[responseDict setObject:@"TRANSACTION" forKey:@"transaction"];
|
|
@@ -136,7 +136,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
// intent - connect
|
|
139
|
+
//MARK: intent - connect
|
|
140
140
|
if([response isKindOfClass: [ObjCTransactionIntentConnect class]]) {
|
|
141
141
|
ObjCTransactionIntentConnect *trxResponse = response;
|
|
142
142
|
[responseDict setValue:@"CONNECT" forKey:@"transaction"];
|
|
@@ -149,7 +149,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// intent - holdings import
|
|
152
|
+
//MARK: intent - holdings import
|
|
153
153
|
if([response isKindOfClass: [ObjcTransactionIntentHoldingsImport class]]) {
|
|
154
154
|
ObjcTransactionIntentHoldingsImport *trxResponse = response;
|
|
155
155
|
[responseDict setValue:@"HOLDING_IMPORT" forKey:@"transaction"];
|
|
@@ -158,13 +158,14 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
158
158
|
[dict setValue: trxResponse.authToken forKey:@"smallcaseAuthToken"];
|
|
159
159
|
[dict setValue: trxResponse.transactionId forKey:@"transactionId"];
|
|
160
160
|
[dict setValue: trxResponse.broker forKey:@"broker"];
|
|
161
|
+
[dict setValue: trxResponse.signup forKey:@"signup"];
|
|
161
162
|
|
|
162
163
|
[responseDict setValue:dict forKey:@"data"];
|
|
163
164
|
resolve(responseDict);
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
// intent - fetch funds
|
|
168
|
+
//MARK: intent - fetch funds
|
|
168
169
|
if([response isKindOfClass: [ObjcTransactionIntentFetchFunds class]]) {
|
|
169
170
|
ObjcTransactionIntentFetchFunds *trxResponse = response;
|
|
170
171
|
[responseDict setValue:@"FETCH_FUNDS" forKey:@"transaction"];
|
|
@@ -172,7 +173,8 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
172
173
|
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
|
173
174
|
[dict setValue: trxResponse.authToken forKey:@"smallcaseAuthToken"];
|
|
174
175
|
[dict setValue: trxResponse.transactionId forKey:@"transactionId"];
|
|
175
|
-
|
|
176
|
+
[dict setValue: trxResponse.signup forKey:@"signup"];
|
|
177
|
+
|
|
176
178
|
[dict setValue:[NSNumber numberWithDouble:trxResponse.fund] forKey:@"fund"];
|
|
177
179
|
|
|
178
180
|
[responseDict setValue:dict forKey:@"data"];
|
|
@@ -180,7 +182,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
180
182
|
return;
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
// intent - sip setup
|
|
185
|
+
//MARK: intent - sip setup
|
|
184
186
|
if([response isKindOfClass: [ObjcTransactionIntentSipSetup class]]) {
|
|
185
187
|
ObjcTransactionIntentSipSetup *trxResponse = response;
|
|
186
188
|
[responseDict setValue:@"SIP_SETUP" forKey:@"transaction"];
|
|
@@ -196,6 +198,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
196
198
|
[dict setValue: trxResponse.scid forKey:@"scid"];
|
|
197
199
|
[dict setValue: trxResponse.sipActive ? @"YES" : @"NO" forKey:@"sipActive"];
|
|
198
200
|
[dict setValue: [NSNumber numberWithDouble: trxResponse.sipAmount] forKey:@"sipAmount"];
|
|
201
|
+
[dict setValue: trxResponse.signup forKey:@"signup"];
|
|
199
202
|
|
|
200
203
|
[responseDict setValue:dict forKey:@"data"];
|
|
201
204
|
resolve(responseDict);
|
|
@@ -203,7 +206,7 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
|
|
206
|
-
// intent - authorize holdings
|
|
209
|
+
//MARK: intent - authorize holdings
|
|
207
210
|
if([response isKindOfClass: [ObjcTransactionIntentAuthoriseHoldings class]]) {
|
|
208
211
|
ObjcTransactionIntentAuthoriseHoldings *trxResponse = response;
|
|
209
212
|
[responseDict setValue:@"AUTHORISE_HOLDINGS" forKey:@"transaction"];
|
|
@@ -211,7 +214,8 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
211
214
|
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
|
|
212
215
|
[dict setValue: trxResponse.authToken forKey:@"smallcaseAuthToken"];
|
|
213
216
|
[dict setValue: trxResponse.transactionId forKey:@"transactionId"];
|
|
214
|
-
|
|
217
|
+
[dict setValue: trxResponse.signup forKey:@"signup"];
|
|
218
|
+
|
|
215
219
|
[dict setValue: [NSNumber numberWithBool:trxResponse.status] forKey:@"status"];
|
|
216
220
|
|
|
217
221
|
[responseDict setValue:dict forKey:@"data"];
|
|
@@ -226,10 +230,10 @@ RCT_REMAP_METHOD(triggerTransaction,
|
|
|
226
230
|
});
|
|
227
231
|
}
|
|
228
232
|
|
|
233
|
+
//MARK: Show orders
|
|
229
234
|
RCT_REMAP_METHOD(showOrders,
|
|
230
235
|
showOrdersWithResolver: (RCTPromiseResolveBlock)resolve
|
|
231
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
232
|
-
{
|
|
236
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
233
237
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
234
238
|
|
|
235
239
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
@@ -243,18 +247,19 @@ RCT_REMAP_METHOD(showOrders,
|
|
|
243
247
|
} else {
|
|
244
248
|
[responseDict setValue:[NSNumber numberWithInteger:error.code] forKey:@"errorCode"];
|
|
245
249
|
[responseDict setValue:error.domain forKey:@"error"];
|
|
250
|
+
[responseDict setValue:[error.userInfo objectForKey: @"data"] forKey:@"data"];
|
|
246
251
|
resolve(responseDict);
|
|
247
252
|
}
|
|
248
253
|
}];
|
|
249
254
|
});
|
|
250
255
|
}
|
|
251
256
|
|
|
257
|
+
//MARK: smallplug
|
|
252
258
|
RCT_REMAP_METHOD(launchSmallplug,
|
|
253
259
|
targetEndpoint:(NSString *)targetEndpoint
|
|
254
260
|
params:(NSString *)params
|
|
255
261
|
launchSmallplugWithResolver:(RCTPromiseResolveBlock)resolve
|
|
256
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
257
|
-
{
|
|
262
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
258
263
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
259
264
|
|
|
260
265
|
SmallplugData *smallplugData = [[SmallplugData alloc] init:targetEndpoint :params];
|
|
@@ -299,6 +304,7 @@ RCT_REMAP_METHOD(launchSmallplug,
|
|
|
299
304
|
});
|
|
300
305
|
}
|
|
301
306
|
|
|
307
|
+
//MARK: smallplug with branding
|
|
302
308
|
RCT_REMAP_METHOD(launchSmallplugWithBranding,
|
|
303
309
|
targetEndpoint:(NSString *)targetEndpoint
|
|
304
310
|
params:(NSString *)params
|
|
@@ -354,11 +360,11 @@ RCT_REMAP_METHOD(launchSmallplugWithBranding,
|
|
|
354
360
|
});
|
|
355
361
|
}
|
|
356
362
|
|
|
363
|
+
//MARK: Archive smallcase
|
|
357
364
|
RCT_REMAP_METHOD(archiveSmallcase,
|
|
358
365
|
iscid:(NSString *)iscid
|
|
359
366
|
initWithResolver:(RCTPromiseResolveBlock)resolve
|
|
360
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
361
|
-
{
|
|
367
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
362
368
|
[SCGateway.shared markSmallcaseArchiveWithIscid:iscid completion: ^(id response, NSError * error) {
|
|
363
369
|
if(error != nil) {
|
|
364
370
|
NSMutableDictionary *responseDict = [[NSMutableDictionary alloc] init];
|
|
@@ -382,11 +388,11 @@ RCT_REMAP_METHOD(archiveSmallcase,
|
|
|
382
388
|
}];
|
|
383
389
|
}
|
|
384
390
|
|
|
391
|
+
//MARK: Lead Gen
|
|
385
392
|
RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
386
393
|
userParams: (NSDictionary *)userParams
|
|
387
394
|
leadGenGenWithResolver: (RCTPromiseResolveBlock)resolve
|
|
388
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
389
|
-
{
|
|
395
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
390
396
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
391
397
|
|
|
392
398
|
[SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams
|
|
@@ -398,17 +404,16 @@ RCT_REMAP_METHOD(triggerLeadGenWithStatus,
|
|
|
398
404
|
});
|
|
399
405
|
}
|
|
400
406
|
|
|
401
|
-
RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictionary *)utmParams)
|
|
402
|
-
{
|
|
407
|
+
RCT_EXPORT_METHOD(triggerLeadGen: (NSDictionary *)userParams utmParams:(NSDictionary *)utmParams) {
|
|
403
408
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
404
409
|
[SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:userParams utmParams: utmParams];
|
|
405
410
|
});
|
|
406
411
|
}
|
|
407
412
|
|
|
413
|
+
//MARK: User logout
|
|
408
414
|
RCT_REMAP_METHOD(logoutUser,
|
|
409
415
|
logoutUserWithResolver:(RCTPromiseResolveBlock)resolve
|
|
410
|
-
rejecter:(RCTPromiseRejectBlock)reject)
|
|
411
|
-
{
|
|
416
|
+
rejecter:(RCTPromiseRejectBlock)reject) {
|
|
412
417
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
|
413
418
|
[SCGateway.shared
|
|
414
419
|
logoutUserWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController]
|
package/package.json
CHANGED
package/src/SmallcaseGateway.js
CHANGED
|
@@ -110,13 +110,13 @@ const triggerTransaction = async (transactionId, utmParams, brokerList) => {
|
|
|
110
110
|
* @param {string} targetEndpoint
|
|
111
111
|
* @param {string} params
|
|
112
112
|
*/
|
|
113
|
-
const launchSmallplug = async (targetEndpoint, params) => {
|
|
114
|
-
const safeEndpoint =
|
|
115
|
-
const safeParams =
|
|
113
|
+
const launchSmallplug = async (targetEndpoint, params) => {
|
|
114
|
+
const safeEndpoint = typeof targetEndpoint === "string" ? targetEndpoint : ""
|
|
115
|
+
const safeParams = typeof params === "string" ? params : ""
|
|
116
116
|
|
|
117
117
|
return SmallcaseGatewayNative.launchSmallplug(
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
safeEndpoint,
|
|
119
|
+
safeParams
|
|
120
120
|
);
|
|
121
121
|
|
|
122
122
|
}
|