react-native-hyperkyc-sdk 0.3.3 → 0.3.4

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 ADDED
@@ -0,0 +1,5 @@
1
+ #0.3.4 [28 July 2022]
2
+ 1.Added support to set custom inputs
3
+ #0.3.3 [12 July 2022]
4
+ 1. Added support for workflow builder config
5
+ 2. Restructure of response in both iOS and Android
@@ -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
 
@@ -3,6 +3,7 @@ package com.reactnativehyperkycsdk;
3
3
 
4
4
  import android.app.Activity;
5
5
  import android.content.Intent;
6
+ import android.util.Log;
6
7
 
7
8
 
8
9
 
@@ -22,7 +23,10 @@ import com.google.gson.Gson;
22
23
 
23
24
 
24
25
  import java.util.ArrayList;
26
+ import java.util.HashMap;
25
27
  import java.util.List;
28
+ import java.util.Map;
29
+
26
30
  import org.json.JSONArray;
27
31
  import org.json.JSONException;
28
32
  import org.json.JSONObject;
@@ -30,9 +34,11 @@ import org.json.JSONObject;
30
34
  import co.hyperverge.hyperkyc.HyperKyc;
31
35
  import co.hyperverge.hyperkyc.data.models.DocFlowConfig;
32
36
  import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
33
- import co.hyperverge.hyperkyc.data.models.HyperKycData;
37
+
34
38
  import co.hyperverge.hyperkyc.data.models.HyperKycFlow;
35
- import co.hyperverge.hyperkyc.data.models.HyperKycResult;
39
+
40
+ import co.hyperverge.hyperkyc.data.models.result.HyperKycData;
41
+ import co.hyperverge.hyperkyc.data.models.result.HyperKycResult;
36
42
  import androidx.annotation.NonNull;
37
43
 
38
44
 
@@ -74,6 +80,7 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
74
80
  String appKey = kycConfig.hasKey("appKey") ? kycConfig.getString("appKey") : null;
75
81
  String transactionId = kycConfig.hasKey("transactionId") ? kycConfig.getString("transactionId") : null;
76
82
  String accessToken = kycConfig.hasKey("accessToken")? kycConfig.getString("accessToken") : null;
83
+ ReadableMap inputsMap = kycConfig.hasKey("inputs")?kycConfig.getMap("inputs"): null;
77
84
 
78
85
  HyperKycConfig config = null;
79
86
  if(accessToken != null){
@@ -82,6 +89,10 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
82
89
 
83
90
  config = new HyperKycConfig(appId, appKey, workflowId, transactionId);
84
91
  }
92
+ if(inputsMap != null){
93
+ config.setInputs(processInputsArray(inputsMap));
94
+ }
95
+
85
96
  contract = new HyperKyc.Contract();
86
97
  Intent newIntent = contract.createIntent(currentActivity, config);
87
98
  if(currentActivity != null)
@@ -134,6 +145,21 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
134
145
 
135
146
 
136
147
 
148
+ private Map<String, String> processInputsArray(ReadableMap inputs){
149
+ Map<String, String> inputsMap = new HashMap<>();
150
+
151
+ ReadableMapKeySetIterator iterator = inputs.keySetIterator();
152
+ while(iterator.hasNextKey()){
153
+ String key = iterator.nextKey();
154
+ String value = inputs.getString(key);
155
+ Log.e("TAG", key + "---" + value);
156
+ inputsMap.put(key, value);
157
+ }
158
+
159
+ return inputsMap;
160
+
161
+ }
162
+
137
163
  @Override
138
164
  public void onNewIntent(Intent intent) {
139
165
 
@@ -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",
4
4
  "description": "React Native wrapper for HyperKYC SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",