@idnow/react-idcheckio 7.1.11
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/.gitattributes +1 -0
- package/README.md +234 -0
- package/ReactIdcheckio.podspec +15 -0
- package/android/.project +17 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/build.gradle +51 -0
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioActivity.java +133 -0
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioConst.java +39 -0
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioModule.java +189 -0
- package/android/src/main/java/com/ariadnext/idcheckio/IdcheckioPackage.java +22 -0
- package/android/src/main/java/com/ariadnext/idcheckio/ParameterUtils.java +251 -0
- package/idcheckio_params.js +343 -0
- package/index.js +6 -0
- package/ios/Idcheckio.h +11 -0
- package/ios/Idcheckio.m +301 -0
- package/ios/Idcheckio.xcodeproj/project.pbxproj +340 -0
- package/ios/Idcheckio.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/Idcheckio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/IdcheckioKeys.h +49 -0
- package/ios/IdcheckioSdk+Utils.swift +35 -0
- package/package.json +22 -0
- package/release-public.sh +89 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
package com.ariadnext.idcheckio;
|
|
2
|
+
|
|
3
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.FOLDER_UID;
|
|
4
|
+
|
|
5
|
+
import android.app.Activity;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
import android.net.Uri;
|
|
8
|
+
import androidx.annotation.NonNull;
|
|
9
|
+
import com.ariadnext.idcheckio.sdk.bean.CaptureParams;
|
|
10
|
+
import com.ariadnext.idcheckio.sdk.bean.OnlineContext;
|
|
11
|
+
import com.ariadnext.idcheckio.sdk.component.Idcheckio;
|
|
12
|
+
import com.ariadnext.idcheckio.sdk.interfaces.ErrorMsg;
|
|
13
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioCallback;
|
|
14
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioError;
|
|
15
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioErrorCause;
|
|
16
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioErrorKt;
|
|
17
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioInteraction;
|
|
18
|
+
import com.ariadnext.idcheckio.sdk.interfaces.IdcheckioInteractionInterface;
|
|
19
|
+
import com.ariadnext.idcheckio.sdk.interfaces.result.IdcheckioResult;
|
|
20
|
+
import com.ariadnext.idcheckio.sdk.utils.extension.JsonExtensionKt;
|
|
21
|
+
import com.facebook.react.bridge.ActivityEventListener;
|
|
22
|
+
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
23
|
+
import com.facebook.react.bridge.Promise;
|
|
24
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
25
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
26
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
27
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
28
|
+
|
|
29
|
+
public class IdcheckioModule extends ReactContextBaseJavaModule implements IdcheckioCallback, IdcheckioInteractionInterface {
|
|
30
|
+
/**
|
|
31
|
+
* React context, used to start activity
|
|
32
|
+
*/
|
|
33
|
+
private final ReactApplicationContext reactContext;
|
|
34
|
+
/**
|
|
35
|
+
* Promise to send results back to js
|
|
36
|
+
*/
|
|
37
|
+
private Promise mPromise;
|
|
38
|
+
/**
|
|
39
|
+
* TAG
|
|
40
|
+
*/
|
|
41
|
+
private static final String TAG = "IdcheckioModule";
|
|
42
|
+
/**
|
|
43
|
+
* Flag to retrieve activity result
|
|
44
|
+
*/
|
|
45
|
+
private final static int START_REQUEST = 5;
|
|
46
|
+
|
|
47
|
+
public IdcheckioModule(ReactApplicationContext reactContext) {
|
|
48
|
+
super(reactContext);
|
|
49
|
+
this.reactContext = reactContext;
|
|
50
|
+
ActivityEventListener mActivityEventListener = new BaseActivityEventListener() {
|
|
51
|
+
@Override
|
|
52
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent intent) {
|
|
53
|
+
if (requestCode == START_REQUEST) {
|
|
54
|
+
if (resultCode == Activity.RESULT_OK) {
|
|
55
|
+
String result = intent.getExtras().getString("IDCHECKIO_RESULT", "{}");
|
|
56
|
+
mPromise.resolve(result);
|
|
57
|
+
} else if(resultCode == Activity.RESULT_CANCELED){
|
|
58
|
+
if(intent != null){
|
|
59
|
+
String error = intent.getExtras().getString("ERROR_MSG", "{}");
|
|
60
|
+
mPromise.reject(TAG, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
reactContext.addActivityEventListener(mActivityEventListener);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@NonNull
|
|
70
|
+
@Override
|
|
71
|
+
public String getName() {
|
|
72
|
+
return TAG;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@ReactMethod
|
|
76
|
+
public void preload(Boolean extractData){
|
|
77
|
+
Idcheckio.preload(reactContext, extractData);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private boolean checkContext() {
|
|
81
|
+
if(getCurrentActivity() == null) {
|
|
82
|
+
onIdcheckioInteraction(IdcheckioInteraction.ERROR, IdcheckioErrorKt.toErrorMsg(IdcheckioError.CONTEXT_LOST,
|
|
83
|
+
"Fail to find a usable activity to start the sdk.", null));
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@ReactMethod
|
|
90
|
+
public void activate(String idToken, Boolean extractData, Promise promise){
|
|
91
|
+
mPromise = promise;
|
|
92
|
+
Idcheckio.activate(idToken, reactContext, this, extractData);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@ReactMethod
|
|
96
|
+
public void start(ReadableMap map, Promise promise){
|
|
97
|
+
mPromise = promise;
|
|
98
|
+
if(!checkContext()) return;
|
|
99
|
+
Intent intent = new Intent(getCurrentActivity(), IdcheckioActivity.class);
|
|
100
|
+
intent.putExtra("PARAMS", map.toHashMap());
|
|
101
|
+
intent.putExtra("isOnline", false);
|
|
102
|
+
getCurrentActivity().startActivityForResult(intent, START_REQUEST);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@ReactMethod
|
|
106
|
+
public void startOnline(ReadableMap params, ReadableMap onlineContext, Promise promise){
|
|
107
|
+
mPromise = promise;
|
|
108
|
+
if(!checkContext()) return;
|
|
109
|
+
Intent intent = new Intent(this.getCurrentActivity(), IdcheckioActivity.class);
|
|
110
|
+
intent.putExtra("PARAMS", params.toHashMap());
|
|
111
|
+
intent.putExtra("isOnline", true);
|
|
112
|
+
intent.putExtra("ONLINE", (onlineContext != null)? onlineContext.toHashMap().toString() : null);
|
|
113
|
+
getCurrentActivity().startActivityForResult(intent, START_REQUEST);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@ReactMethod
|
|
117
|
+
public void startIps(String folderUid, Promise promise){
|
|
118
|
+
mPromise = promise;
|
|
119
|
+
if(!checkContext()) return;
|
|
120
|
+
if(folderUid == null || folderUid.isEmpty()) {
|
|
121
|
+
onIdcheckioInteraction(IdcheckioInteraction.ERROR, new ErrorMsg(IdcheckioErrorCause.CUSTOMER_ERROR, "MISSING_FOLDER_UID",
|
|
122
|
+
"The ips folderUid is mandatory to start an ips session.", null));
|
|
123
|
+
} else {
|
|
124
|
+
Intent intent = new Intent(getCurrentActivity(), IdcheckioActivity.class);
|
|
125
|
+
intent.putExtra(FOLDER_UID, folderUid);
|
|
126
|
+
intent.putExtra("isIps", true);
|
|
127
|
+
getCurrentActivity().startActivityForResult(intent, START_REQUEST);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@ReactMethod
|
|
132
|
+
public void analyze(ReadableMap params, String side1ToUpload, String side2ToUpload, Boolean isOnline, ReadableMap context, Promise promise){
|
|
133
|
+
mPromise = promise;
|
|
134
|
+
Uri side1Uri, side2Uri = null;
|
|
135
|
+
CaptureParams captureParams = ParameterUtils.getIDCheckioViewFromCall(params.toHashMap()).captureParams();
|
|
136
|
+
OnlineContext onlineContext = null;
|
|
137
|
+
if(context != null) {
|
|
138
|
+
onlineContext = OnlineContext.createFrom(context.toHashMap().toString());
|
|
139
|
+
}
|
|
140
|
+
if(side1ToUpload != null){
|
|
141
|
+
if(side1ToUpload.startsWith("/data")) {
|
|
142
|
+
side1Uri = Uri.parse(side1ToUpload+"file://");
|
|
143
|
+
} else {
|
|
144
|
+
side1Uri = Uri.parse(side1ToUpload);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
onIdcheckioInteraction(IdcheckioInteraction.ERROR, IdcheckioErrorKt.toErrorMsg(IdcheckioError.FAILED_TO_RETRIEVE_IMAGE_FROM_GALLERY, "Image path is empty.", null));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if(side2ToUpload != null){
|
|
151
|
+
if(side2ToUpload.startsWith("/data")) {
|
|
152
|
+
side2Uri = Uri.parse(side2ToUpload+"file://");
|
|
153
|
+
} else {
|
|
154
|
+
side2Uri = Uri.parse(side2ToUpload);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//Start in a custom thread
|
|
158
|
+
Idcheckio.analyze(reactContext,
|
|
159
|
+
this,
|
|
160
|
+
captureParams,
|
|
161
|
+
side1Uri,
|
|
162
|
+
side2Uri,
|
|
163
|
+
isOnline,
|
|
164
|
+
onlineContext);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@Override
|
|
168
|
+
public void onInitEnd(boolean success, ErrorMsg errorMsg) {
|
|
169
|
+
if(success){
|
|
170
|
+
mPromise.resolve(null);
|
|
171
|
+
} else {
|
|
172
|
+
mPromise.reject(TAG, JsonExtensionKt.toJson(errorMsg));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@Override
|
|
177
|
+
public void onIdcheckioInteraction(IdcheckioInteraction idcheckioInteraction, Object data) {
|
|
178
|
+
switch (idcheckioInteraction) {
|
|
179
|
+
case RESULT:
|
|
180
|
+
mPromise.resolve(JsonExtensionKt.toJson((IdcheckioResult) data));
|
|
181
|
+
break;
|
|
182
|
+
case ERROR:
|
|
183
|
+
mPromise.reject(TAG, JsonExtensionKt.toJson((ErrorMsg) data));
|
|
184
|
+
break;
|
|
185
|
+
default:
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.ariadnext.idcheckio;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage;
|
|
4
|
+
import com.facebook.react.bridge.NativeModule;
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
7
|
+
|
|
8
|
+
import java.util.Arrays;
|
|
9
|
+
import java.util.Collections;
|
|
10
|
+
import java.util.List;
|
|
11
|
+
|
|
12
|
+
public class IdcheckioPackage implements ReactPackage {
|
|
13
|
+
@Override
|
|
14
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
15
|
+
return Arrays.<NativeModule>asList(new IdcheckioModule(reactContext));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Override
|
|
19
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
20
|
+
return Collections.emptyList();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
package com.ariadnext.idcheckio;
|
|
2
|
+
|
|
3
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.ADJUST_CROP;
|
|
4
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.BACKGROUND_COLOR;
|
|
5
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.BIOMETRIC_CONSENT;
|
|
6
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.BORDER_COLOR;
|
|
7
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.CAPTURE_MODE;
|
|
8
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.CIS_TYPE;
|
|
9
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.CONFIRM_ABORT;
|
|
10
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.CONFIRM_TYPE;
|
|
11
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.DATA_REQUIREMENT;
|
|
12
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.DOCUMENT_TYPE;
|
|
13
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.DOC_LIVENESS;
|
|
14
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.ENABLE_MANUAL_ANALYSIS;
|
|
15
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.FACE_DETECTION;
|
|
16
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.FEEDBACK_LEVEL;
|
|
17
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.FOLDER_UID;
|
|
18
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.FOREGROUND_COLOR;
|
|
19
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.INTEGRITY_CHECK;
|
|
20
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.IS_REFERENCE_DOC;
|
|
21
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.LANGUAGE;
|
|
22
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.MANUAL_BUTTON_TIMER;
|
|
23
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.MAX_PICTURE_FILESIZE;
|
|
24
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.ONLINE_CONFIG;
|
|
25
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.ORIENTATION;
|
|
26
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.PRIMARY_COLOR;
|
|
27
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.READ_EMRTD;
|
|
28
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.SCAN_BOTH_SIDES;
|
|
29
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.SIDE_1_EXTRACTION;
|
|
30
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.SIDE_2_EXTRACTION;
|
|
31
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.TEXT_COLOR;
|
|
32
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.THEME;
|
|
33
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.TITLE_COLOR;
|
|
34
|
+
import static com.ariadnext.idcheckio.IdcheckioConst.USE_HD;
|
|
35
|
+
|
|
36
|
+
import android.graphics.Color;
|
|
37
|
+
|
|
38
|
+
import com.ariadnext.idcheckio.sdk.bean.CaptureMode;
|
|
39
|
+
import com.ariadnext.idcheckio.sdk.bean.ConfirmationType;
|
|
40
|
+
import com.ariadnext.idcheckio.sdk.bean.DataRequirement;
|
|
41
|
+
import com.ariadnext.idcheckio.sdk.bean.DocumentType;
|
|
42
|
+
import com.ariadnext.idcheckio.sdk.bean.Extraction;
|
|
43
|
+
import com.ariadnext.idcheckio.sdk.bean.FaceDetection;
|
|
44
|
+
import com.ariadnext.idcheckio.sdk.bean.FeedbackLevel;
|
|
45
|
+
import com.ariadnext.idcheckio.sdk.bean.FileSize;
|
|
46
|
+
import com.ariadnext.idcheckio.sdk.bean.Forceable;
|
|
47
|
+
import com.ariadnext.idcheckio.sdk.bean.IntegrityCheck;
|
|
48
|
+
import com.ariadnext.idcheckio.sdk.bean.Language;
|
|
49
|
+
import com.ariadnext.idcheckio.sdk.bean.OnlineConfig;
|
|
50
|
+
import com.ariadnext.idcheckio.sdk.bean.Orientation;
|
|
51
|
+
import com.ariadnext.idcheckio.sdk.bean.Theme;
|
|
52
|
+
import com.ariadnext.idcheckio.sdk.component.IdcheckioView;
|
|
53
|
+
import com.ariadnext.idcheckio.sdk.interfaces.cis.CISType;
|
|
54
|
+
|
|
55
|
+
import java.util.HashMap;
|
|
56
|
+
import java.util.Map;
|
|
57
|
+
|
|
58
|
+
public class ParameterUtils {
|
|
59
|
+
|
|
60
|
+
public static IdcheckioView.Builder getIDCheckioViewFromCall(HashMap<String, Object> params) {
|
|
61
|
+
IdcheckioView.Builder idcheckioView = new IdcheckioView.Builder();
|
|
62
|
+
for (Map.Entry<String, Object> entries : params.entrySet()) {
|
|
63
|
+
String key = entries.getKey();
|
|
64
|
+
Object value = entries.getValue();
|
|
65
|
+
switch (key) {
|
|
66
|
+
case DOCUMENT_TYPE:
|
|
67
|
+
idcheckioView.docType(DocumentType.valueOf(value.toString()));
|
|
68
|
+
break;
|
|
69
|
+
case ORIENTATION:
|
|
70
|
+
idcheckioView.orientation(Orientation.valueOf(value.toString()));
|
|
71
|
+
break;
|
|
72
|
+
case CONFIRM_TYPE:
|
|
73
|
+
idcheckioView.confirmType(ConfirmationType.valueOf(value.toString()));
|
|
74
|
+
break;
|
|
75
|
+
case INTEGRITY_CHECK:
|
|
76
|
+
idcheckioView.integrityCheck(getIntegrityCheck((HashMap<String, Object>) value));
|
|
77
|
+
break;
|
|
78
|
+
case USE_HD:
|
|
79
|
+
idcheckioView.useHd(Boolean.parseBoolean(value.toString()));
|
|
80
|
+
break;
|
|
81
|
+
case SCAN_BOTH_SIDES:
|
|
82
|
+
idcheckioView.scanBothSides(Forceable.valueOf(value.toString()));
|
|
83
|
+
break;
|
|
84
|
+
case SIDE_1_EXTRACTION:
|
|
85
|
+
idcheckioView.sideOneExtraction(getExtraction((HashMap<String, String>) value));
|
|
86
|
+
break;
|
|
87
|
+
case SIDE_2_EXTRACTION:
|
|
88
|
+
idcheckioView.sideTwoExtraction(getExtraction((HashMap<String, String>) value));
|
|
89
|
+
break;
|
|
90
|
+
case ONLINE_CONFIG:
|
|
91
|
+
idcheckioView.onlineConfig(getOnlineConfig((HashMap<String, Object>) value));
|
|
92
|
+
break;
|
|
93
|
+
case LANGUAGE:
|
|
94
|
+
idcheckioView.language(Language.valueOf(value.toString()));
|
|
95
|
+
break;
|
|
96
|
+
case MANUAL_BUTTON_TIMER:
|
|
97
|
+
double doubleValue = Double.parseDouble(value.toString());
|
|
98
|
+
idcheckioView.manualButtonTimer((int) doubleValue);
|
|
99
|
+
break;
|
|
100
|
+
case FEEDBACK_LEVEL:
|
|
101
|
+
idcheckioView.feedbackLevel(FeedbackLevel.valueOf(value.toString()));
|
|
102
|
+
break;
|
|
103
|
+
case ADJUST_CROP:
|
|
104
|
+
idcheckioView.adjustCrop(Boolean.parseBoolean(value.toString()));
|
|
105
|
+
break;
|
|
106
|
+
case MAX_PICTURE_FILESIZE:
|
|
107
|
+
idcheckioView.maxPictureFilesize(FileSize.valueOf(value.toString()));
|
|
108
|
+
break;
|
|
109
|
+
case CONFIRM_ABORT:
|
|
110
|
+
idcheckioView.confirmAbort(Boolean.parseBoolean(value.toString()));
|
|
111
|
+
break;
|
|
112
|
+
case CAPTURE_MODE:
|
|
113
|
+
idcheckioView.captureMode(CaptureMode.valueOf(value.toString()));
|
|
114
|
+
break;
|
|
115
|
+
case THEME:
|
|
116
|
+
idcheckioView.theme(getTheme((HashMap<String, Object>) value));
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return idcheckioView;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private static IntegrityCheck getIntegrityCheck(HashMap<String, Object> integrityMap) {
|
|
124
|
+
boolean readEmrtd = false;
|
|
125
|
+
boolean docLiveness = false;
|
|
126
|
+
|
|
127
|
+
if(integrityMap.containsKey(READ_EMRTD)) {
|
|
128
|
+
Object readEmrtdOpt = integrityMap.get(READ_EMRTD);
|
|
129
|
+
if(readEmrtdOpt != null) {
|
|
130
|
+
readEmrtd = Boolean.parseBoolean(readEmrtdOpt.toString());
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if(integrityMap.containsKey(DOC_LIVENESS)) {
|
|
134
|
+
Object docLivenessOpt = integrityMap.get(DOC_LIVENESS);
|
|
135
|
+
if(docLivenessOpt != null) {
|
|
136
|
+
docLiveness = Boolean.parseBoolean(docLivenessOpt.toString());
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return new IntegrityCheck(readEmrtd, docLiveness);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private static Extraction getExtraction(HashMap<String, String> integrityMap) {
|
|
143
|
+
DataRequirement dataRequirement = DataRequirement.DISABLED;
|
|
144
|
+
FaceDetection faceDetection = FaceDetection.DISABLED;
|
|
145
|
+
|
|
146
|
+
if(integrityMap.containsKey(DATA_REQUIREMENT)) {
|
|
147
|
+
String dataOpt = integrityMap.get(DATA_REQUIREMENT);
|
|
148
|
+
if(dataOpt != null) {
|
|
149
|
+
dataRequirement = DataRequirement.valueOf(dataOpt);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if(integrityMap.containsKey(FACE_DETECTION)) {
|
|
153
|
+
String faceOpt = integrityMap.get(FACE_DETECTION);
|
|
154
|
+
if(faceOpt != null) {
|
|
155
|
+
faceDetection = FaceDetection.valueOf(faceOpt);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return new Extraction(dataRequirement, faceDetection);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private static OnlineConfig getOnlineConfig(HashMap<String, Object> configMap) {
|
|
162
|
+
OnlineConfig onlineConfig = new OnlineConfig();
|
|
163
|
+
|
|
164
|
+
if(configMap.containsKey(BIOMETRIC_CONSENT)) {
|
|
165
|
+
Object bioOpt = configMap.get(BIOMETRIC_CONSENT);
|
|
166
|
+
if(bioOpt != null) {
|
|
167
|
+
onlineConfig.setBiometricConsent(Boolean.parseBoolean(bioOpt.toString()));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if(configMap.containsKey(IS_REFERENCE_DOC)) {
|
|
172
|
+
Object refDocOpt = configMap.get(IS_REFERENCE_DOC);
|
|
173
|
+
if(refDocOpt != null) {
|
|
174
|
+
onlineConfig.setReferenceDocument(Boolean.parseBoolean(refDocOpt.toString()));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if(configMap.containsKey(ENABLE_MANUAL_ANALYSIS)) {
|
|
179
|
+
Object manualOpt = configMap.get(ENABLE_MANUAL_ANALYSIS);
|
|
180
|
+
if(manualOpt != null) {
|
|
181
|
+
onlineConfig.setEnableManualAnalysis(Boolean.parseBoolean(manualOpt.toString()));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if(configMap.containsKey(FOLDER_UID)) {
|
|
186
|
+
Object folderOpt = configMap.get(FOLDER_UID);
|
|
187
|
+
if(folderOpt != null) {
|
|
188
|
+
onlineConfig.setFolderUid(folderOpt.toString());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if(configMap.containsKey(CIS_TYPE)) {
|
|
193
|
+
Object cisOpt = configMap.get(CIS_TYPE);
|
|
194
|
+
if(cisOpt != null) {
|
|
195
|
+
onlineConfig.setCisType(CISType.valueOf(cisOpt.toString()));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return onlineConfig;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private static Theme getTheme(HashMap<String, Object> themeMap) {
|
|
202
|
+
Integer primaryColor = null;
|
|
203
|
+
Integer foregroundColor = null;
|
|
204
|
+
Integer backgroundColor = null;
|
|
205
|
+
Integer borderColor = null;
|
|
206
|
+
Integer textColor = null;
|
|
207
|
+
Integer titleColor = null;
|
|
208
|
+
if(themeMap.containsKey(PRIMARY_COLOR)) {
|
|
209
|
+
Object primaryColorOpt = themeMap.get(PRIMARY_COLOR);
|
|
210
|
+
if(primaryColorOpt != null) {
|
|
211
|
+
primaryColor = Color.parseColor(primaryColorOpt.toString());
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if(themeMap.containsKey(FOREGROUND_COLOR)) {
|
|
216
|
+
Object foregroundColorOpt = themeMap.get(FOREGROUND_COLOR);
|
|
217
|
+
if(foregroundColorOpt != null) {
|
|
218
|
+
foregroundColor = Color.parseColor(foregroundColorOpt.toString());
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if(themeMap.containsKey(BACKGROUND_COLOR)) {
|
|
223
|
+
Object backgroundColorOpt = themeMap.get(BACKGROUND_COLOR);
|
|
224
|
+
if(backgroundColorOpt != null) {
|
|
225
|
+
backgroundColor = Color.parseColor(backgroundColorOpt.toString());
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if(themeMap.containsKey(BORDER_COLOR)) {
|
|
230
|
+
Object borderColorOpt = themeMap.get(BORDER_COLOR);
|
|
231
|
+
if(borderColorOpt != null) {
|
|
232
|
+
borderColor = Color.parseColor(borderColorOpt.toString());
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if(themeMap.containsKey(TEXT_COLOR)) {
|
|
237
|
+
Object textColorOpt = themeMap.get(TEXT_COLOR);
|
|
238
|
+
if(textColorOpt != null) {
|
|
239
|
+
textColor = Color.parseColor(textColorOpt.toString());
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if(themeMap.containsKey(TITLE_COLOR)) {
|
|
244
|
+
Object titleColorOpt = themeMap.get(TITLE_COLOR);
|
|
245
|
+
if(titleColorOpt != null) {
|
|
246
|
+
titleColor = Color.parseColor(titleColorOpt.toString());
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return new Theme(foregroundColor, borderColor, backgroundColor, primaryColor, titleColor, textColor);
|
|
250
|
+
}
|
|
251
|
+
}
|