react-native-hyperkyc-sdk 0.3.1-alpha05 → 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)
@@ -108,6 +118,7 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
108
118
  WritableMap resultMap = new WritableNativeMap();
109
119
  resultMap.putString("status", hyperKycResult.getStatus().toString());
110
120
  resultMap.putString("reason", hyperKycResult.getReason());
121
+ resultMap.putString("applicationStatus", hyperKycResult.getApplicationStatus());
111
122
  try {
112
123
  if (hyperKycData != null) {
113
124
 
@@ -133,6 +144,20 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
133
144
 
134
145
 
135
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
+
136
161
  @Override
137
162
  public void onNewIntent(Intent intent) {
138
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)
@@ -47,6 +54,7 @@ class Hyperkyc: NSObject {
47
54
  var resultEnumString = ""
48
55
  var kycData = [:] as [String: Any]
49
56
  var errorMessage = ""
57
+ var applicationStatus = ""
50
58
 
51
59
  resultEnumString = String(describing: resultEnum)
52
60
 
@@ -140,10 +148,15 @@ class Hyperkyc: NSObject {
140
148
  if let errorMsg = hyperKycResult.reason {
141
149
  errorMessage = errorMsg
142
150
  }
151
+ if let applStatus = hyperKycResult.applicationStatus {
152
+ applicationStatus = applStatus
153
+ }
154
+
143
155
 
144
156
  let resultMap = [
145
157
  "status" : resultEnumString,
146
158
  "reason" : errorMessage,
159
+ "applicationStatus":applicationStatus,
147
160
  "hyperKycData" : kycData
148
161
 
149
162
  ] as [String : Any]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperkyc-sdk",
3
- "version": "0.3.1-alpha05",
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",