@regulaforensics/cordova-plugin-document-reader-api 5.8.0 → 6.1.0
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/README.md +1 -1
- package/example/package.json +2 -2
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/src/android/DocumentReader.java +8 -12
- package/src/android/Helpers.java +1 -3
- package/src/android/JSONConstructor.java +110 -10
- package/src/android/RegulaConfig.java +3 -0
- package/src/android/build.gradle +1 -1
- package/src/ios/RGLDocumentReader.m +5 -5
- package/src/ios/RGLWJSONConstructor.h +6 -0
- package/src/ios/RGLWJSONConstructor.m +92 -0
- package/src/ios/RegulaConfig.m +3 -0
- package/www/DocumentReader.js +661 -510
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ If you have issues with license verification when running the application, pleas
|
|
|
42
42
|
6. You placed the `license` into the correct folder as described [here](#how-to-build-demo-application).
|
|
43
43
|
|
|
44
44
|
## Documentation
|
|
45
|
-
You can find documentation on API [here](https://docs.regulaforensics.com/cordova).
|
|
45
|
+
You can find documentation on API [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile/cordova).
|
|
46
46
|
|
|
47
47
|
## Additional information
|
|
48
48
|
If you have any technical questions, feel free to [contact](mailto:cordova.support@regulaforensics.com) us or create issue [here](https://github.com/regulaforensics/DocumentReader-Cordova-Plugin/issues).
|
package/example/package.json
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"cordova-android": "^9.0.0",
|
|
17
17
|
"cordova-ios": "^6.1.1",
|
|
18
18
|
"cordova-plugin-add-swift-support": "^2.0.2",
|
|
19
|
-
"@regulaforensics/cordova-plugin-document-reader-api": "^
|
|
20
|
-
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^
|
|
19
|
+
"@regulaforensics/cordova-plugin-document-reader-api": "^6.1.0",
|
|
20
|
+
"@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "^6.1.0",
|
|
21
21
|
"cordova-plugin-file": "^6.0.2",
|
|
22
22
|
"cordova-plugin-image-picker": "^1.1.3",
|
|
23
23
|
"cordova-plugin-android-permissions": "1.1.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/cordova-plugin-document-reader-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Cordova plugin for reading and validation of identification documents (API framework)",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "@regulaforensics/cordova-plugin-document-reader-api",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-document-reader-api" version="
|
|
2
|
+
<plugin id="cordova-plugin-document-reader-api" version="6.1.0"
|
|
3
3
|
xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
4
4
|
<name>DocumentReaderApi</name>
|
|
5
5
|
<description>Cordova plugin Document reader api</description>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<podspec>
|
|
26
26
|
<config/>
|
|
27
27
|
<pods>
|
|
28
|
-
<pod name="DocumentReader" spec="~>
|
|
28
|
+
<pod name="DocumentReader" spec="~> 6.1.2358" />
|
|
29
29
|
</pods>
|
|
30
30
|
</podspec>
|
|
31
31
|
</platform>
|
|
@@ -10,17 +10,18 @@ import android.graphics.Bitmap;
|
|
|
10
10
|
import android.nfc.NfcAdapter;
|
|
11
11
|
import android.nfc.tech.IsoDep;
|
|
12
12
|
import android.support.annotation.NonNull;
|
|
13
|
+
import android.os.Bundle;
|
|
13
14
|
import android.util.Base64;
|
|
14
15
|
|
|
15
16
|
import com.regula.documentreader.api.completions.IDocumentReaderCompletion;
|
|
16
17
|
import com.regula.documentreader.api.completions.IDocumentReaderInitCompletion;
|
|
17
18
|
import com.regula.documentreader.api.completions.IDocumentReaderPrepareCompletion;
|
|
18
|
-
import com.regula.documentreader.api.completions.IRfidNotificationCompletion;
|
|
19
19
|
import com.regula.documentreader.api.completions.IRfidPKDCertificateCompletion;
|
|
20
20
|
import com.regula.documentreader.api.completions.IRfidReaderRequest;
|
|
21
21
|
import com.regula.documentreader.api.completions.IRfidTASignatureCompletion;
|
|
22
22
|
import com.regula.documentreader.api.enums.DocReaderAction;
|
|
23
23
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
24
|
+
import com.regula.documentreader.api.internal.core.CoreScenarioUtil;
|
|
24
25
|
import com.regula.documentreader.api.params.DocReaderConfig;
|
|
25
26
|
import com.regula.documentreader.api.params.ImageInputParam;
|
|
26
27
|
import com.regula.documentreader.api.params.rfid.PKDCertificate;
|
|
@@ -114,8 +115,8 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
114
115
|
callbackContext.sendPluginResult(pluginResult);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
private void sendIRfidNotificationCompletion(int notification) {
|
|
118
|
-
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, rfidNotificationCompletionEvent + notification);
|
|
118
|
+
private void sendIRfidNotificationCompletion(int notification, Bundle value) {
|
|
119
|
+
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, rfidNotificationCompletionEvent + JSONConstructor.generateRfidNotificationCompletion(notification, value).toString());
|
|
119
120
|
pluginResult.setKeepCallback(true);
|
|
120
121
|
callbackContext.sendPluginResult(pluginResult);
|
|
121
122
|
}
|
|
@@ -456,11 +457,11 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
456
457
|
}
|
|
457
458
|
|
|
458
459
|
private void selectedScenario(Callback callback) {
|
|
459
|
-
callback.success(JSONConstructor.
|
|
460
|
+
callback.success(JSONConstructor.generateCoreDetailedScenario(CoreScenarioUtil.getScenario(Instance().processParams().getScenario())).toString());
|
|
460
461
|
}
|
|
461
462
|
|
|
462
463
|
private void getScenario(Callback callback, String scenario) {
|
|
463
|
-
callback.success(JSONConstructor.
|
|
464
|
+
callback.success(JSONConstructor.generateCoreDetailedScenario(CoreScenarioUtil.getScenario(scenario)).toString());
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
private void getLicenseExpiryDate(Callback callback) {
|
|
@@ -608,7 +609,7 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
608
609
|
delegate = getIRfidReaderRequestNoPA();
|
|
609
610
|
if (rfidDelegate == RFIDDelegate.FULL)
|
|
610
611
|
delegate = getIRfidReaderRequest();
|
|
611
|
-
Instance().startRFIDReader(getContext(), getCompletion(), delegate,
|
|
612
|
+
Instance().startRFIDReader(getContext(), getCompletion(), delegate, this::sendIRfidNotificationCompletion);
|
|
612
613
|
}
|
|
613
614
|
|
|
614
615
|
private void stopRFIDReader(Callback callback) {
|
|
@@ -716,7 +717,7 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
716
717
|
private IDocumentReaderCompletion getCompletion() {
|
|
717
718
|
return (action, results, error) -> {
|
|
718
719
|
sendCompletion(action, results, error);
|
|
719
|
-
if (action == DocReaderAction.ERROR || action == DocReaderAction.CANCEL || (action == DocReaderAction.COMPLETE && results.rfidResult == 1))
|
|
720
|
+
if (action == DocReaderAction.ERROR || action == DocReaderAction.CANCEL || (action == DocReaderAction.COMPLETE && results != null && results.rfidResult == 1))
|
|
720
721
|
stopBackgroundRFID();
|
|
721
722
|
};
|
|
722
723
|
}
|
|
@@ -803,9 +804,4 @@ public class DocumentReader extends CordovaPlugin {
|
|
|
803
804
|
public static final int NO_PA = 1;
|
|
804
805
|
public static final int FULL = 2;
|
|
805
806
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
private IRfidNotificationCompletion getIRfidNotificationCompletion() {
|
|
809
|
-
return (notificationType, value) -> sendIRfidNotificationCompletion(notificationType);
|
|
810
|
-
}
|
|
811
807
|
}
|
package/src/android/Helpers.java
CHANGED
|
@@ -24,9 +24,7 @@ import java.util.List;
|
|
|
24
24
|
class Helpers {
|
|
25
25
|
static Bitmap bitmapFromBase64(String base64) {
|
|
26
26
|
byte[] decodedString = Base64.decode(base64, Base64.DEFAULT);
|
|
27
|
-
|
|
28
|
-
options.inPreferredConfig = Bitmap.Config.RGB_565;
|
|
29
|
-
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length, options);
|
|
27
|
+
Bitmap result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
|
|
30
28
|
int sizeMultiplier = result.getByteCount() / 5000000;
|
|
31
29
|
if (result.getByteCount() > 5000000)
|
|
32
30
|
result = Bitmap.createScaledBitmap(result, result.getWidth() / (int) Math.sqrt(sizeMultiplier), result.getHeight() / (int) Math.sqrt(sizeMultiplier), false);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
package cordova.plugin.documentreader;
|
|
2
2
|
|
|
3
|
+
import static com.regula.documentreader.api.completions.IRfidNotificationCompletion.RFID_EXTRA_ERROR_CODE;
|
|
4
|
+
|
|
3
5
|
import android.content.Context;
|
|
4
6
|
import android.graphics.Bitmap;
|
|
5
7
|
import android.graphics.BitmapFactory;
|
|
6
8
|
import android.graphics.Rect;
|
|
9
|
+
import android.os.Bundle;
|
|
7
10
|
import android.util.Base64;
|
|
8
11
|
|
|
9
12
|
import com.regula.documentreader.api.enums.DocReaderAction;
|
|
@@ -11,11 +14,13 @@ import com.regula.documentreader.api.enums.PDF417Info;
|
|
|
11
14
|
import com.regula.documentreader.api.enums.eGraphicFieldType;
|
|
12
15
|
import com.regula.documentreader.api.enums.eRPRM_Lights;
|
|
13
16
|
import com.regula.documentreader.api.errors.DocumentReaderException;
|
|
17
|
+
import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
|
|
14
18
|
import com.regula.documentreader.api.params.FaceMetaData;
|
|
15
19
|
import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
|
|
16
20
|
import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
|
|
17
21
|
import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
|
|
18
22
|
import com.regula.documentreader.api.results.Bounds;
|
|
23
|
+
import com.regula.documentreader.api.results.BytesData;
|
|
19
24
|
import com.regula.documentreader.api.results.Coordinate;
|
|
20
25
|
import com.regula.documentreader.api.results.DocReaderFieldRect;
|
|
21
26
|
import com.regula.documentreader.api.results.DocumentReaderBarcodeField;
|
|
@@ -25,14 +30,15 @@ import com.regula.documentreader.api.results.DocumentReaderGraphicField;
|
|
|
25
30
|
import com.regula.documentreader.api.results.DocumentReaderGraphicResult;
|
|
26
31
|
import com.regula.documentreader.api.results.DocumentReaderNotification;
|
|
27
32
|
import com.regula.documentreader.api.results.DocumentReaderResults;
|
|
33
|
+
import com.regula.documentreader.api.results.DocumentReaderResultsStatus;
|
|
28
34
|
import com.regula.documentreader.api.results.DocumentReaderScenario;
|
|
29
|
-
import com.regula.documentreader.api.results.DocumentReaderScenarioFull;
|
|
30
35
|
import com.regula.documentreader.api.results.DocumentReaderTextField;
|
|
31
36
|
import com.regula.documentreader.api.results.DocumentReaderTextResult;
|
|
32
37
|
import com.regula.documentreader.api.results.DocumentReaderValue;
|
|
33
38
|
import com.regula.documentreader.api.results.ElementPosition;
|
|
34
39
|
import com.regula.documentreader.api.results.ImageQuality;
|
|
35
40
|
import com.regula.documentreader.api.results.ImageQualityGroup;
|
|
41
|
+
import com.regula.documentreader.api.results.VDSNCData;
|
|
36
42
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityCheck;
|
|
37
43
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityElement;
|
|
38
44
|
import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityResult;
|
|
@@ -294,6 +300,18 @@ class JSONConstructor {
|
|
|
294
300
|
return result;
|
|
295
301
|
}
|
|
296
302
|
|
|
303
|
+
static JSONObject generateRfidNotificationCompletion(int notification, Bundle value) {
|
|
304
|
+
JSONObject result = new JSONObject();
|
|
305
|
+
try {
|
|
306
|
+
result.put("notification", notification);
|
|
307
|
+
if(value != null)
|
|
308
|
+
result.put("value", value.get(RFID_EXTRA_ERROR_CODE));
|
|
309
|
+
} catch (JSONException ignored) {
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
297
315
|
static JSONObject generatePACertificateCompletion(byte[] serialNumber, PAResourcesIssuer issuer) {
|
|
298
316
|
JSONObject result = new JSONObject();
|
|
299
317
|
try {
|
|
@@ -335,8 +353,6 @@ class JSONConstructor {
|
|
|
335
353
|
JSONObject result = new JSONObject();
|
|
336
354
|
if (input == null) return result;
|
|
337
355
|
try {
|
|
338
|
-
result.put("uvTorch", input.uvTorch);
|
|
339
|
-
result.put("seriesProcessMode", input.seriesProcessMode);
|
|
340
356
|
result.put("name", input.name);
|
|
341
357
|
result.put("caption", input.caption);
|
|
342
358
|
result.put("description", input.description);
|
|
@@ -346,7 +362,7 @@ class JSONConstructor {
|
|
|
346
362
|
return result;
|
|
347
363
|
}
|
|
348
364
|
|
|
349
|
-
static JSONObject
|
|
365
|
+
static JSONObject generateCoreDetailedScenario(CoreDetailedScenario input) {
|
|
350
366
|
JSONObject result = new JSONObject();
|
|
351
367
|
if (input == null) return result;
|
|
352
368
|
try {
|
|
@@ -1039,6 +1055,92 @@ class JSONConstructor {
|
|
|
1039
1055
|
return result;
|
|
1040
1056
|
}
|
|
1041
1057
|
|
|
1058
|
+
static JSONObject generateDocumentReaderResultsStatus(DocumentReaderResultsStatus input) {
|
|
1059
|
+
JSONObject result = new JSONObject();
|
|
1060
|
+
if (input == null) return result;
|
|
1061
|
+
try {
|
|
1062
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1063
|
+
result.put("optical", input.getOptical());
|
|
1064
|
+
result.put("detailsOptical", generateDetailsOptical(input.getDetailsOptical()));
|
|
1065
|
+
result.put("rfid", input.getRfid());
|
|
1066
|
+
result.put("detailsRFID", generateDetailsRFID(input.getDetailsRFID()));
|
|
1067
|
+
result.put("portrait", input.getPortrait());
|
|
1068
|
+
result.put("stopList", input.getStopList());
|
|
1069
|
+
} catch (JSONException e) {
|
|
1070
|
+
e.printStackTrace();
|
|
1071
|
+
}
|
|
1072
|
+
return result;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
static JSONObject generateDetailsOptical(DocumentReaderResultsStatus.DetailsOptical input) {
|
|
1076
|
+
JSONObject result = new JSONObject();
|
|
1077
|
+
if (input == null) return result;
|
|
1078
|
+
try {
|
|
1079
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1080
|
+
result.put("mrz", input.getMrz());
|
|
1081
|
+
result.put("text", input.getText());
|
|
1082
|
+
result.put("docType", input.getDocType());
|
|
1083
|
+
result.put("security", input.getSecurity());
|
|
1084
|
+
result.put("imageQA", input.getImageQA());
|
|
1085
|
+
result.put("expiry", input.getExpiry());
|
|
1086
|
+
result.put("vds", input.getVds());
|
|
1087
|
+
result.put("pagesCount", input.getPagesCount());
|
|
1088
|
+
} catch (JSONException e) {
|
|
1089
|
+
e.printStackTrace();
|
|
1090
|
+
}
|
|
1091
|
+
return result;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
static JSONObject generateDetailsRFID(DocumentReaderResultsStatus.DetailsRFID input) {
|
|
1095
|
+
JSONObject result = new JSONObject();
|
|
1096
|
+
if (input == null) return result;
|
|
1097
|
+
try {
|
|
1098
|
+
result.put("pa", input.getPA());
|
|
1099
|
+
result.put("ca", input.getCA());
|
|
1100
|
+
result.put("aa", input.getAA());
|
|
1101
|
+
result.put("ta", input.getTA());
|
|
1102
|
+
result.put("bac", input.getBAC());
|
|
1103
|
+
result.put("pace", input.getPACE());
|
|
1104
|
+
result.put("overallStatus", input.getOverallStatus());
|
|
1105
|
+
} catch (JSONException e) {
|
|
1106
|
+
e.printStackTrace();
|
|
1107
|
+
}
|
|
1108
|
+
return result;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
static JSONObject generateVDSNCData(VDSNCData input) {
|
|
1112
|
+
JSONObject result = new JSONObject();
|
|
1113
|
+
if (input == null) return result;
|
|
1114
|
+
try {
|
|
1115
|
+
result.put("type", input.getType());
|
|
1116
|
+
result.put("version", input.getVersion());
|
|
1117
|
+
result.put("issuingCountry", input.getIssuingCountry());
|
|
1118
|
+
result.put("message", input.getMessage());
|
|
1119
|
+
result.put("signatureAlgorithm", input.getSignatureAlg());
|
|
1120
|
+
result.put("signature", generateBytesData(input.getSignature()));
|
|
1121
|
+
result.put("certificate", generateBytesData(input.getCertificate()));
|
|
1122
|
+
result.put("certificateChain", generateList(input.getCertificateChain(), JSONConstructor::generateCertificateChain));
|
|
1123
|
+
result.put("notifications", generateLongArray(input.getNotifications()));
|
|
1124
|
+
} catch (JSONException e) {
|
|
1125
|
+
e.printStackTrace();
|
|
1126
|
+
}
|
|
1127
|
+
return result;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
static JSONObject generateBytesData(BytesData input) {
|
|
1131
|
+
JSONObject result = new JSONObject();
|
|
1132
|
+
if (input == null) return result;
|
|
1133
|
+
try {
|
|
1134
|
+
result.put("data", input.getData());
|
|
1135
|
+
result.put("length", input.getLength());
|
|
1136
|
+
result.put("status", input.getStatus());
|
|
1137
|
+
result.put("type", input.getType());
|
|
1138
|
+
} catch (JSONException e) {
|
|
1139
|
+
e.printStackTrace();
|
|
1140
|
+
}
|
|
1141
|
+
return result;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1042
1144
|
static JSONObject generateDocumentReaderResults(DocumentReaderResults input, Context context) {
|
|
1043
1145
|
JSONObject result = new JSONObject();
|
|
1044
1146
|
if (input == null) return result;
|
|
@@ -1063,6 +1165,8 @@ class JSONConstructor {
|
|
|
1063
1165
|
result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
|
|
1064
1166
|
result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
|
|
1065
1167
|
result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
|
|
1168
|
+
result.put("status", generateDocumentReaderResultsStatus(input.status));
|
|
1169
|
+
result.put("vdsncData", generateVDSNCData(input.vdsncData));
|
|
1066
1170
|
} catch (JSONException e) {
|
|
1067
1171
|
e.printStackTrace();
|
|
1068
1172
|
}
|
|
@@ -1074,10 +1178,6 @@ class JSONConstructor {
|
|
|
1074
1178
|
static DocumentReaderScenario DocumentReaderScenarioFromJSON(JSONObject input) {
|
|
1075
1179
|
try {
|
|
1076
1180
|
DocumentReaderScenario result = new DocumentReaderScenario();
|
|
1077
|
-
if (input.has("uvTorch"))
|
|
1078
|
-
result.uvTorch = input.getBoolean("uvTorch");
|
|
1079
|
-
if (input.has("seriesProcessMode"))
|
|
1080
|
-
result.seriesProcessMode = input.getBoolean("seriesProcessMode");
|
|
1081
1181
|
if (input.has("name"))
|
|
1082
1182
|
result.name = input.getString("name");
|
|
1083
1183
|
if (input.has("caption"))
|
|
@@ -1091,9 +1191,9 @@ class JSONConstructor {
|
|
|
1091
1191
|
return null;
|
|
1092
1192
|
}
|
|
1093
1193
|
|
|
1094
|
-
static
|
|
1194
|
+
static CoreDetailedScenario CoreDetailedScenarioFromJSON(JSONObject input) {
|
|
1095
1195
|
try {
|
|
1096
|
-
|
|
1196
|
+
CoreDetailedScenario result = new CoreDetailedScenario();
|
|
1097
1197
|
if (input.has("uvTorch"))
|
|
1098
1198
|
result.uvTorch = input.getBoolean("uvTorch");
|
|
1099
1199
|
if (input.has("frameOrientation"))
|
|
@@ -209,6 +209,8 @@ class RegulaConfig {
|
|
|
209
209
|
processParams.forceReadMrzBeforeLocate = opts.getBoolean("forceReadMrzBeforeLocate");
|
|
210
210
|
if (opts.has("parseBarcodes"))
|
|
211
211
|
processParams.parseBarcodes = opts.getBoolean("parseBarcodes");
|
|
212
|
+
if (opts.has("shouldReturnPackageForReprocess"))
|
|
213
|
+
processParams.shouldReturnPackageForReprocess = opts.getBoolean("shouldReturnPackageForReprocess");
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
private static void setCustomization(ParamsCustomization customization, JSONObject opts, Context context) throws JSONException {
|
|
@@ -477,6 +479,7 @@ class RegulaConfig {
|
|
|
477
479
|
object.put("mrzFormatsFilter", processParams.mrzFormatsFilter != null ? generateArray(processParams.mrzFormatsFilter) : null);
|
|
478
480
|
object.put("forceReadMrzBeforeLocate", processParams.forceReadMrzBeforeLocate);
|
|
479
481
|
object.put("parseBarcodes", processParams.parseBarcodes);
|
|
482
|
+
object.put("shouldReturnPackageForReprocess", processParams.shouldReturnPackageForReprocess);
|
|
480
483
|
|
|
481
484
|
return object;
|
|
482
485
|
}
|
package/src/android/build.gradle
CHANGED
|
@@ -26,11 +26,11 @@ NSString* taSignatureCompletionEvent = @"taSignatureCompletionEvent";
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
- (void)didChipConnected {
|
|
29
|
-
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent,
|
|
29
|
+
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent, [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletion:1]]] :RGLDocumentReader.command.callbackId]; // int RFID_EVENT_CHIP_DETECTED = 1;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
- (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
|
|
33
|
-
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent,
|
|
33
|
+
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent, [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletionWithError:2:errorCode]]] :RGLDocumentReader.command.callbackId]; // int RFID_EVENT_READING_ERROR = 2;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@end
|
|
@@ -115,11 +115,11 @@ typedef void (^Callback)(NSString* response);
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
- (void)didChipConnected {
|
|
118
|
-
[
|
|
118
|
+
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent, [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletion:1]]] :RGLDocumentReader.command.callbackId]; // int RFID_EVENT_CHIP_DETECTED = 1;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
- (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
|
|
122
|
-
[
|
|
122
|
+
[plugin sendEvent:[NSString stringWithFormat:@"%@%@", rfidNotificationCompletionEvent, [RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateRfidNotificationCompletionWithError:2:errorCode]]] :RGLDocumentReader.command.callbackId]; // int RFID_EVENT_READING_ERROR = 2;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
- (void) exec:(CDVInvokedUrlCommand*)command {
|
|
@@ -325,7 +325,7 @@ typedef void (^Callback)(NSString* response);
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
- (void) initializeReaderWithDatabasePath:(NSString*)licenseString :(NSString*)databasePath :(Callback)successCallback :(Callback)errorCallback{
|
|
328
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true databasePath:databasePath] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
328
|
+
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:[[NSData alloc] initWithBase64EncodedString:licenseString options:0] licenseUpdateCheck:true databasePath:databasePath delayedNNLoadEnabled:false] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
- (void) prepareDatabase:(NSString*)dbID :(Callback)successCallback :(Callback)errorCallback{
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
@interface RGLWJSONConstructor : NSObject
|
|
9
9
|
+(NSString* _Nonnull)dictToString:(NSMutableDictionary* _Nonnull)input;
|
|
10
|
+
+(NSMutableDictionary* _Nonnull)generateRfidNotificationCompletion:(NSInteger)notification;
|
|
11
|
+
+(NSMutableDictionary* _Nonnull)generateRfidNotificationCompletionWithError:(NSInteger)notification : (NSInteger)value;
|
|
10
12
|
+(NSMutableDictionary* _Nonnull)generateNSDictionary:(NSDictionary<NSNumber*, NSNumber*>* _Nullable)input;
|
|
11
13
|
+(RGLPKDCertificate* _Nullable)RGLPKDCertificateFromJson:(NSDictionary* _Nullable) dict;
|
|
12
14
|
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)action;
|
|
@@ -54,6 +56,10 @@
|
|
|
54
56
|
+(NSMutableDictionary* _Nonnull)generateRGLPAResourcesIssuer:(RGLPAResourcesIssuer* _Nullable)input;
|
|
55
57
|
+(NSMutableDictionary* _Nonnull)generateRGLPAAttribute:(RGLPAAttribute* _Nullable)input;
|
|
56
58
|
+(NSMutableDictionary* _Nonnull)generateRGLTAChallenge:(RGLTAChallenge* _Nullable)input;
|
|
59
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus* _Nullable)input;
|
|
60
|
+
+(NSMutableDictionary* _Nonnull)generateRGLOpticalStatus:(RGLOpticalStatus* _Nullable)input;
|
|
61
|
+
+(NSMutableDictionary* _Nonnull)generateRGLVDSNCData:(RGLVDSNCData* _Nullable)input;
|
|
62
|
+
+(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input;
|
|
57
63
|
+(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input;
|
|
58
64
|
|
|
59
65
|
@end
|
|
@@ -62,6 +62,23 @@
|
|
|
62
62
|
return result;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
+(NSMutableDictionary*)generateRfidNotificationCompletion:(NSInteger)notification {
|
|
66
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
67
|
+
|
|
68
|
+
result[@"notification"] = [NSNumber numberWithInteger:notification];
|
|
69
|
+
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
+(NSMutableDictionary*)generateRfidNotificationCompletionWithError:(NSInteger)notification :(NSInteger)value {
|
|
74
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
75
|
+
|
|
76
|
+
result[@"notification"] = [NSNumber numberWithInteger:notification];
|
|
77
|
+
result[@"value"] = [NSNumber numberWithInteger:value];
|
|
78
|
+
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
+(NSInteger)generateDocReaderAction:(RGLDocReaderAction)input {
|
|
66
83
|
NSInteger result = 0;
|
|
67
84
|
switch (input) {
|
|
@@ -235,6 +252,8 @@
|
|
|
235
252
|
result[@"elapsedTime"] = @(input.elapsedTime);
|
|
236
253
|
result[@"elapsedTimeRFID"] = @(input.elapsedTimeRFID);
|
|
237
254
|
result[@"rawResult"] = input.rawResult;
|
|
255
|
+
result[@"status"] = [self generateRGLDocumentReaderResultsStatus:input.status];
|
|
256
|
+
result[@"vdsncData"] = [self generateRGLVDSNCData:input.vdsncData];
|
|
238
257
|
|
|
239
258
|
return result;
|
|
240
259
|
}
|
|
@@ -904,6 +923,79 @@
|
|
|
904
923
|
return result;
|
|
905
924
|
}
|
|
906
925
|
|
|
926
|
+
+(NSMutableDictionary* _Nonnull)generateRGLDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus* _Nullable)input {
|
|
927
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
928
|
+
if(input == nil) return result;
|
|
929
|
+
|
|
930
|
+
result[@"overallStatus"] = @(input.overallStatus);
|
|
931
|
+
result[@"optical"] = @(input.optical);
|
|
932
|
+
result[@"detailsOptical"] = [self generateRGLOpticalStatus:input.detailsOptical];
|
|
933
|
+
result[@"rfid"] = @(input.rfid);
|
|
934
|
+
result[@"detailsRFID"] = [self generateRGLRFIDSessionDataStatus:input.detailsRFID];
|
|
935
|
+
result[@"portrait"] = @(input.portrait);
|
|
936
|
+
result[@"stopList"] = @(input.stopList);
|
|
937
|
+
|
|
938
|
+
return result;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
+(NSMutableDictionary* _Nonnull)generateRGLOpticalStatus:(RGLOpticalStatus* _Nullable)input {
|
|
942
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
943
|
+
if(input == nil) return result;
|
|
944
|
+
|
|
945
|
+
result[@"overallStatus"] = @(input.overallStatus);
|
|
946
|
+
result[@"mrz"] = @(input.mrz);
|
|
947
|
+
result[@"text"] = @(input.text);
|
|
948
|
+
result[@"docType"] = @(input.docType);
|
|
949
|
+
result[@"security"] = @(input.security);
|
|
950
|
+
result[@"imageQA"] = @(input.imageQA);
|
|
951
|
+
result[@"expiry"] = @(input.expiry);
|
|
952
|
+
result[@"vds"] = @(input.vds);
|
|
953
|
+
result[@"pagesCount"] = @(input.pagesCount);
|
|
954
|
+
|
|
955
|
+
return result;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
+(NSMutableDictionary* _Nonnull)generateRGLVDSNCData:(RGLVDSNCData* _Nullable)input {
|
|
959
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
960
|
+
if(input == nil) return result;
|
|
961
|
+
|
|
962
|
+
result[@"type"] = input.type;
|
|
963
|
+
result[@"version"] = @(input.version);
|
|
964
|
+
result[@"issuingCountry"] = input.issuingCountry;
|
|
965
|
+
result[@"message"] = [self generateNSDictionary:input.message];
|
|
966
|
+
result[@"signatureAlgorithm"] = input.signatureAlgorithm;
|
|
967
|
+
result[@"signature"] = [self generateRGLBytesData:input.signature];
|
|
968
|
+
result[@"certificate"] = [self generateRGLBytesData:input.certificate];
|
|
969
|
+
if(input.certificateChain != nil){
|
|
970
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
971
|
+
for(RGLCertificateChain* item in input.certificateChain)
|
|
972
|
+
if(item != nil)
|
|
973
|
+
[array addObject:[self generateRGLCertificateChain:item]];
|
|
974
|
+
result[@"certificateChain"] = array;
|
|
975
|
+
}
|
|
976
|
+
if(input.notifications != nil){
|
|
977
|
+
NSMutableArray *array = [NSMutableArray new];
|
|
978
|
+
for(NSNumber* item in input.notifications)
|
|
979
|
+
if(item != nil)
|
|
980
|
+
[array addObject:item];
|
|
981
|
+
result[@"notifications"] = array;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
return result;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
+(NSMutableDictionary* _Nonnull)generateRGLBytesData:(RGLBytesData* _Nullable)input {
|
|
988
|
+
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
989
|
+
if(input == nil) return result;
|
|
990
|
+
|
|
991
|
+
result[@"data"] = input.data;
|
|
992
|
+
result[@"length"] = @(input.length);
|
|
993
|
+
result[@"status"] = @(input.status);
|
|
994
|
+
result[@"type"] = @(input.type);
|
|
995
|
+
|
|
996
|
+
return result;
|
|
997
|
+
}
|
|
998
|
+
|
|
907
999
|
+(NSMutableDictionary* _Nonnull)generateRGLRFIDNotify:(RGLRFIDNotify* _Nullable)input {
|
|
908
1000
|
NSMutableDictionary *result = [NSMutableDictionary new];
|
|
909
1001
|
if(input == nil) return result;
|
package/src/ios/RegulaConfig.m
CHANGED
|
@@ -696,6 +696,8 @@
|
|
|
696
696
|
processParams.forceReadMrzBeforeLocate = [options valueForKey:@"forceReadMrzBeforeLocate"];
|
|
697
697
|
if([options valueForKey:@"parseBarcodes"] != nil)
|
|
698
698
|
processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
|
|
699
|
+
if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
|
|
700
|
+
processParams.shouldReturnPackageForReprocess = [options valueForKey:@"shouldReturnPackageForReprocess"];
|
|
699
701
|
}
|
|
700
702
|
|
|
701
703
|
+(NSMutableDictionary *)getCustomization:(RGLCustomization*)customization {
|
|
@@ -844,6 +846,7 @@
|
|
|
844
846
|
result[@"mrzFormatsFilter"] = processParams.mrzFormatsFilter;
|
|
845
847
|
result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
|
|
846
848
|
result[@"parseBarcodes"] = processParams.parseBarcodes;
|
|
849
|
+
result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
|
|
847
850
|
|
|
848
851
|
return result;
|
|
849
852
|
}
|