react-native-hyperkyc-sdk 0.3.3 → 0.3.4-alpha01

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.
@@ -57,7 +57,7 @@ dependencies {
57
57
  //noinspection GradleDynamicVersion
58
58
  implementation "com.facebook.react:react-native:+" // From node_modules
59
59
  implementation("com.google.code.gson:gson:2.8.6")
60
- implementation('co.hyperverge:hyperkyc:0.2.0@aar', {
60
+ implementation('co.hyperverge:hyperkyc:0.2.2@aar', {
61
61
  transitive = true
62
62
  })
63
63
 
@@ -22,7 +22,10 @@ import com.google.gson.Gson;
22
22
 
23
23
 
24
24
  import java.util.ArrayList;
25
+ import java.util.HashMap;
25
26
  import java.util.List;
27
+ import java.util.Map;
28
+
26
29
  import org.json.JSONArray;
27
30
  import org.json.JSONException;
28
31
  import org.json.JSONObject;
@@ -30,9 +33,11 @@ import org.json.JSONObject;
30
33
  import co.hyperverge.hyperkyc.HyperKyc;
31
34
  import co.hyperverge.hyperkyc.data.models.DocFlowConfig;
32
35
  import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
33
- import co.hyperverge.hyperkyc.data.models.HyperKycData;
36
+
34
37
  import co.hyperverge.hyperkyc.data.models.HyperKycFlow;
35
- import co.hyperverge.hyperkyc.data.models.HyperKycResult;
38
+
39
+ import co.hyperverge.hyperkyc.data.models.result.HyperKycData;
40
+ import co.hyperverge.hyperkyc.data.models.result.HyperKycResult;
36
41
  import androidx.annotation.NonNull;
37
42
 
38
43
 
@@ -74,6 +79,7 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
74
79
  String appKey = kycConfig.hasKey("appKey") ? kycConfig.getString("appKey") : null;
75
80
  String transactionId = kycConfig.hasKey("transactionId") ? kycConfig.getString("transactionId") : null;
76
81
  String accessToken = kycConfig.hasKey("accessToken")? kycConfig.getString("accessToken") : null;
82
+ ReadableMap inputsMap = kycConfig.hasKey("inputs")?kycConfig.getMap("inputs"): null;
77
83
 
78
84
  HyperKycConfig config = null;
79
85
  if(accessToken != null){
@@ -82,6 +88,10 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
82
88
 
83
89
  config = new HyperKycConfig(appId, appKey, workflowId, transactionId);
84
90
  }
91
+ if(inputsMap != null){
92
+ config.setInputs(processInputsArray(inputsMap));
93
+ }
94
+
85
95
  contract = new HyperKyc.Contract();
86
96
  Intent newIntent = contract.createIntent(currentActivity, config);
87
97
  if(currentActivity != null)
@@ -134,6 +144,20 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
134
144
 
135
145
 
136
146
 
147
+ private Map<String, String> processInputsArray(ReadableMap inputs){
148
+ Map<String, String> inputsMap = new HashMap<>();
149
+
150
+ ReadableMapKeySetIterator iterator = inputs.keySetIterator();
151
+ while(iterator.hasNextKey()){
152
+ String key = iterator.nextKey();
153
+ String value = inputs.getString(key);
154
+ inputsMap.put(key, value);
155
+ }
156
+
157
+ return inputsMap;
158
+
159
+ }
160
+
137
161
  @Override
138
162
  public void onNewIntent(Intent intent) {
139
163
 
@@ -15,6 +15,7 @@ class Hyperkyc: NSObject {
15
15
  let appKey = _config["appKey"] as? String
16
16
  let accessToken = _config["accessToken"] as? String
17
17
  let workflowId = _config["workflowId"] as? String
18
+ let inputs = _config["inputs"] as? [String: String]
18
19
 
19
20
 
20
21
  DispatchQueue.main.async {
@@ -22,6 +23,9 @@ class Hyperkyc: NSObject {
22
23
 
23
24
  if let accessTokenConfig = accessToken{
24
25
  let hyperKYCConfig = HyperKycConfig(accessToken: accessTokenConfig, workflowId: workflowId!, transactionId: transactionId!)
26
+ if let inputs = inputs{
27
+ hyperKYCConfig.setInputs(inputs: inputs)
28
+ }
25
29
  HyperKyc.launch(controller!, hyperKycConfig: hyperKYCConfig) { hyperKycResult in
26
30
 
27
31
  }
@@ -29,7 +33,10 @@ class Hyperkyc: NSObject {
29
33
 
30
34
  if(appKey != nil && appId != nil){
31
35
  let hyperKYCConfig = HyperKycConfig(appId: appId!, appKey: appKey!, workflowId: workflowId!, transactionId: transactionId!)
32
-
36
+ if let inputs = inputs{
37
+ hyperKYCConfig.setInputs(inputs: inputs)
38
+ }
39
+
33
40
  HyperKyc.launch(controller!, hyperKycConfig: hyperKYCConfig) { hyperKycResult in
34
41
 
35
42
  let result = self.processHyperKycResult(hyperKycResult: hyperKycResult)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperkyc-sdk",
3
- "version": "0.3.3",
3
+ "version": "0.3.4-alpha01",
4
4
  "description": "React Native wrapper for HyperKYC SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",