react-native-hyperkyc-sdk 0.1.6-alpha1 → 0.1.7-alpha1

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
 
60
- implementation('co.hyperverge:hyperkyc:0.0.1-alpha02@aar', {
60
+ implementation('co.hyperverge:hyperkyc:0.0.2-alpha02@aar', {
61
61
  transitive = true
62
62
  })
63
63
  }
@@ -3,7 +3,7 @@ package com.reactnativehyperkycsdk;
3
3
 
4
4
  import android.app.Activity;
5
5
  import android.content.Intent;
6
- import android.support.annotation.NonNull;
6
+
7
7
 
8
8
 
9
9
  import com.facebook.react.ReactActivity;
@@ -19,11 +19,13 @@ import com.facebook.react.bridge.WritableMap;
19
19
  import com.facebook.react.bridge.WritableNativeMap;
20
20
  import com.google.gson.Gson;
21
21
 
22
- import org.json.JSONObject;
22
+
23
23
 
24
24
  import java.util.ArrayList;
25
25
  import java.util.List;
26
-
26
+ import org.json.JSONArray;
27
+ import org.json.JSONException;
28
+ import org.json.JSONObject;
27
29
 
28
30
  import co.hyperverge.hyperkyc.HyperKyc;
29
31
  import co.hyperverge.hyperkyc.data.models.DocFlowConfig;
@@ -31,7 +33,7 @@ import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
31
33
  import co.hyperverge.hyperkyc.data.models.HyperKycData;
32
34
  import co.hyperverge.hyperkyc.data.models.HyperKycFlow;
33
35
  import co.hyperverge.hyperkyc.data.models.HyperKycResult;
34
-
36
+ import androidx.annotation.NonNull;
35
37
 
36
38
 
37
39
  public class HyperkycSdkModule extends ReactContextBaseJavaModule implements ActivityEventListener {
@@ -41,7 +43,7 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
41
43
 
42
44
  private final int HYPERKYC_REQUEST_CODE = 56455;
43
45
  Callback callback;
44
- HyperKYC.Contract contract;
46
+ HyperKyc.Contract contract;
45
47
  Gson gson;
46
48
  WritableMap result;
47
49
 
@@ -111,7 +113,7 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
111
113
  String resultJSON = gson.toJson(hyperKycData);
112
114
  JSONObject result = new JSONObject(resultJSON);
113
115
  result.remove("config");
114
- WritableMap hyperKycDataMap = RNHyperKYCUtils.convertJsonToMap(result);
116
+ WritableMap hyperKycDataMap = HyperkycSdkUtils.convertJsonToMap(result);
115
117
  resultMap.putMap("hyperKycData", hyperKycDataMap);
116
118
  }
117
119
 
@@ -141,9 +143,9 @@ public class HyperkycSdkModule extends ReactContextBaseJavaModule implements Act
141
143
  String flowStr = kycFlow.getString("type");
142
144
  switch (flowStr) {
143
145
  case "document":
144
- String countryId = kycFlow.has(RNHyperKYCConstants.COUNTRY_ID) ? kycFlow.getString(RNHyperKYCConstants.COUNTRY_ID): null;
145
- String documentId = kycFlow.has(RNHyperKYCConstants.DOCUMENT_ID) ? kycFlow.getString(RNHyperKYCConstants.DOCUMENT_ID): null;
146
- boolean useForFaceMatch = kycFlow.has(RNHyperKYCConstants.USE_FOR_FACE_MATCH)? kycFlow.getBoolean(RNHyperKYCConstants.USE_FOR_FACE_MATCH): false;
146
+ String countryId = kycFlow.has(HyperkycConstants.COUNTRY_ID) ? kycFlow.getString(HyperkycConstants.COUNTRY_ID): null;
147
+ String documentId = kycFlow.has(HyperkycConstants.DOCUMENT_ID) ? kycFlow.getString(HyperkycConstants.DOCUMENT_ID): null;
148
+ boolean useForFaceMatch = kycFlow.has(HyperkycConstants.USE_FOR_FACE_MATCH)? kycFlow.getBoolean(HyperkycConstants.USE_FOR_FACE_MATCH): false;
147
149
 
148
150
  workflows.add(new HyperKycFlow.Document(new DocFlowConfig(useForFaceMatch, countryId, documentId )));
149
151
  case "face":
@@ -1,6 +1,5 @@
1
1
  package com.reactnativehyperkycsdk;
2
2
 
3
- import android.support.annotation.NonNull;
4
3
 
5
4
  import androidx.annotation.NonNull;
6
5
 
@@ -6,7 +6,7 @@ import HyperKYC
6
6
  @objc(Hyperkyc)
7
7
  class Hyperkyc: NSObject {
8
8
  @objc static func requiresMainQueueSetup() -> Bool {return true}
9
-
9
+
10
10
  @objc(launch:callback:)
11
11
  func launch(_config: NSDictionary, callback: @escaping RCTResponseSenderBlock) {
12
12
  let appId = _config["appId"] as? String
@@ -156,31 +156,17 @@ class Hyperkyc: NSObject {
156
156
  //
157
157
  func getResponseResultJsonString(docDataResponseResult: DocCaptureApiDetail?, faceDataResponseResult: FaceCaptureApiDetail?, faceMatchDataResponseResult: FaceMatchApiDetail?) -> [String:Any] {
158
158
  let encoder = JSONEncoder()
159
- encoder.outputFormatting = .prettyPrinted
160
159
 
161
- var responseResultJsonString:String = "{}"
162
160
  do {
163
161
  if let responseResult = docDataResponseResult {
164
162
  let responseResultData = try encoder.encode(responseResult)
165
- responseResultJsonString = String(data: responseResultData, encoding: .utf8) ?? "{}"
166
- if let data = responseResultJsonString.data(using: .utf8) {
167
- return try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] ?? [:]
168
- }
169
-
170
-
163
+ return try JSONSerialization.jsonObject(with: responseResultData, options: []) as? [String:Any] ?? [:]
171
164
  } else if let responseResult = faceDataResponseResult {
172
165
  let responseResultData = try encoder.encode(responseResult)
173
- responseResultJsonString = String(data: responseResultData, encoding: .utf8) ?? "{}"
174
- if let data = responseResultJsonString.data(using: .utf8) {
175
- return try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] ?? [:]
176
- }
166
+ return try JSONSerialization.jsonObject(with: responseResultData, options: []) as? [String:Any] ?? [:]
177
167
  } else if let responseResult = faceMatchDataResponseResult {
178
168
  let responseResultData = try encoder.encode(responseResult)
179
- responseResultJsonString = String(data: responseResultData, encoding: .utf8) ?? "{}"
180
-
181
- if let data = responseResultJsonString.data(using: .utf8) {
182
- return try JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] ?? [:]
183
- }
169
+ return try JSONSerialization.jsonObject(with: responseResultData, options: []) as? [String:Any] ?? [:]
184
170
  } else {
185
171
  return [:]
186
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-hyperkyc-sdk",
3
- "version": "0.1.6-alpha1",
3
+ "version": "0.1.7-alpha1",
4
4
  "description": "React Native wrapper for HyperKYC SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",