@regulaforensics/cordova-plugin-document-reader-api 5.6.0 → 6.1.1

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.
@@ -1,17 +1,26 @@
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;
10
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;
16
+ import com.regula.documentreader.api.errors.DocumentReaderException;
17
+ import com.regula.documentreader.api.internal.core.CoreDetailedScenario;
13
18
  import com.regula.documentreader.api.params.FaceMetaData;
19
+ import com.regula.documentreader.api.params.rfid.authorization.PAAttribute;
20
+ import com.regula.documentreader.api.params.rfid.authorization.PAResourcesIssuer;
21
+ import com.regula.documentreader.api.params.rfid.authorization.TAChallenge;
14
22
  import com.regula.documentreader.api.results.Bounds;
23
+ import com.regula.documentreader.api.results.BytesData;
15
24
  import com.regula.documentreader.api.results.Coordinate;
16
25
  import com.regula.documentreader.api.results.DocReaderFieldRect;
17
26
  import com.regula.documentreader.api.results.DocumentReaderBarcodeField;
@@ -21,14 +30,15 @@ import com.regula.documentreader.api.results.DocumentReaderGraphicField;
21
30
  import com.regula.documentreader.api.results.DocumentReaderGraphicResult;
22
31
  import com.regula.documentreader.api.results.DocumentReaderNotification;
23
32
  import com.regula.documentreader.api.results.DocumentReaderResults;
33
+ import com.regula.documentreader.api.results.DocumentReaderResultsStatus;
24
34
  import com.regula.documentreader.api.results.DocumentReaderScenario;
25
- import com.regula.documentreader.api.results.DocumentReaderScenarioFull;
26
35
  import com.regula.documentreader.api.results.DocumentReaderTextField;
27
36
  import com.regula.documentreader.api.results.DocumentReaderTextResult;
28
37
  import com.regula.documentreader.api.results.DocumentReaderValue;
29
38
  import com.regula.documentreader.api.results.ElementPosition;
30
39
  import com.regula.documentreader.api.results.ImageQuality;
31
40
  import com.regula.documentreader.api.results.ImageQualityGroup;
41
+ import com.regula.documentreader.api.results.VDSNCData;
32
42
  import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityCheck;
33
43
  import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityElement;
34
44
  import com.regula.documentreader.api.results.authenticity.DocumentReaderAuthenticityResult;
@@ -264,14 +274,13 @@ class JSONConstructor {
264
274
  return result;
265
275
  }
266
276
 
267
- static JSONObject generateCompletion(int action, DocumentReaderResults results, Throwable error, Context context) {
277
+ static JSONObject generateCompletion(int action, DocumentReaderResults results, DocumentReaderException error, Context context) {
268
278
  JSONObject result = new JSONObject();
269
279
  try {
270
280
  result.put("action", action);
271
281
  switch (action) {
272
282
  case DocReaderAction.PROCESS:
273
283
  case DocReaderAction.PROCESS_WHITE_UV_IMAGES:
274
- result.put("results", "");
275
284
  break;
276
285
  case DocReaderAction.NOTIFICATION:
277
286
  result.put("results", generateDocumentReaderResultsNotification(results));
@@ -283,7 +292,31 @@ class JSONConstructor {
283
292
  result.put("results", generateDocumentReaderResults(results, context));
284
293
  break;
285
294
  }
286
- result.put("error", generateThrowable(error));
295
+ if (error != null)
296
+ result.put("error", generateDocumentReaderException(error));
297
+ } catch (JSONException ignored) {
298
+ }
299
+
300
+ return result;
301
+ }
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
+
315
+ static JSONObject generatePACertificateCompletion(byte[] serialNumber, PAResourcesIssuer issuer) {
316
+ JSONObject result = new JSONObject();
317
+ try {
318
+ result.put("serialNumber", generateByteArray(serialNumber));
319
+ result.put("issuer", generatePAResourcesIssuer(issuer));
287
320
  } catch (JSONException ignored) {
288
321
  }
289
322
 
@@ -320,17 +353,16 @@ class JSONConstructor {
320
353
  JSONObject result = new JSONObject();
321
354
  if (input == null) return result;
322
355
  try {
323
- result.put("uvTorch", input.uvTorch);
324
- result.put("seriesProcessMode", input.seriesProcessMode);
325
356
  result.put("name", input.name);
326
357
  result.put("caption", input.caption);
327
358
  result.put("description", input.description);
328
- } catch (JSONException ignored) {
359
+ } catch (JSONException e) {
360
+ e.printStackTrace();
329
361
  }
330
362
  return result;
331
363
  }
332
364
 
333
- static JSONObject generateDocumentReaderScenarioFull(DocumentReaderScenarioFull input) {
365
+ static JSONObject generateCoreDetailedScenario(CoreDetailedScenario input) {
334
366
  JSONObject result = new JSONObject();
335
367
  if (input == null) return result;
336
368
  try {
@@ -347,7 +379,8 @@ class JSONConstructor {
347
379
  result.put("caption", input.caption);
348
380
  result.put("description", input.description);
349
381
  result.put("manualCrop", input.manualCrop);
350
- } catch (JSONException ignored) {
382
+ } catch (JSONException e) {
383
+ e.printStackTrace();
351
384
  }
352
385
  return result;
353
386
  }
@@ -359,7 +392,8 @@ class JSONConstructor {
359
392
  result.put("ID", input.ID);
360
393
  result.put("rollAngle", input.rollAngle);
361
394
  result.put("bounds", generateBounds(input.bounds));
362
- } catch (JSONException ignored) {
395
+ } catch (JSONException e) {
396
+ e.printStackTrace();
363
397
  }
364
398
  return result;
365
399
  }
@@ -372,7 +406,8 @@ class JSONConstructor {
372
406
  result.put("y", input.y);
373
407
  result.put("width", input.width);
374
408
  result.put("height", input.height);
375
- } catch (JSONException ignored) {
409
+ } catch (JSONException e) {
410
+ e.printStackTrace();
376
411
  }
377
412
  return result;
378
413
  }
@@ -385,7 +420,8 @@ class JSONConstructor {
385
420
  result.put("top", input.top);
386
421
  result.put("left", input.left);
387
422
  result.put("right", input.right);
388
- } catch (JSONException ignored) {
423
+ } catch (JSONException e) {
424
+ e.printStackTrace();
389
425
  }
390
426
  return result;
391
427
  }
@@ -398,7 +434,8 @@ class JSONConstructor {
398
434
  result.put("top", input.top);
399
435
  result.put("left", input.left);
400
436
  result.put("right", input.right);
401
- } catch (JSONException ignored) {
437
+ } catch (JSONException e) {
438
+ e.printStackTrace();
402
439
  }
403
440
  return result;
404
441
  }
@@ -415,7 +452,8 @@ class JSONConstructor {
415
452
  result.put("lightName", eRPRM_Lights.getTranslation(context, input.light));
416
453
  result.put("value", input.imageBase64());
417
454
  result.put("fieldRect", generateDocReaderFieldRect(input.boundRect));
418
- } catch (JSONException ignored) {
455
+ } catch (JSONException e) {
456
+ e.printStackTrace();
419
457
  }
420
458
  return result;
421
459
  }
@@ -425,7 +463,8 @@ class JSONConstructor {
425
463
  if (input == null) return result;
426
464
  try {
427
465
  result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderGraphicField, context));
428
- } catch (JSONException ignored) {
466
+ } catch (JSONException e) {
467
+ e.printStackTrace();
429
468
  }
430
469
  return result;
431
470
  }
@@ -442,7 +481,8 @@ class JSONConstructor {
442
481
  result.put("originalValue", input.originalValue);
443
482
  result.put("boundRect", generateRect(input.boundRect));
444
483
  result.put("comparison", generateMap(input.comparison));
445
- } catch (JSONException ignored) {
484
+ } catch (JSONException e) {
485
+ e.printStackTrace();
446
486
  }
447
487
  return result;
448
488
  }
@@ -458,7 +498,8 @@ class JSONConstructor {
458
498
  result.put("fieldName", input.getFieldName(context));
459
499
  result.put("value", generateDocumentReaderValue(input.value()));
460
500
  result.put("values", generateList(input.values, JSONConstructor::generateDocumentReaderValue));
461
- } catch (JSONException ignored) {
501
+ } catch (JSONException e) {
502
+ e.printStackTrace();
462
503
  }
463
504
  return result;
464
505
  }
@@ -469,7 +510,8 @@ class JSONConstructor {
469
510
  try {
470
511
  result.put("status", input.status);
471
512
  result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderTextField, context));
472
- } catch (JSONException ignored) {
513
+ } catch (JSONException e) {
514
+ e.printStackTrace();
473
515
  }
474
516
  return result;
475
517
  }
@@ -480,7 +522,8 @@ class JSONConstructor {
480
522
  try {
481
523
  result.put("x", input.x);
482
524
  result.put("y", input.y);
483
- } catch (JSONException ignored) {
525
+ } catch (JSONException e) {
526
+ e.printStackTrace();
484
527
  }
485
528
  return result;
486
529
  }
@@ -505,7 +548,8 @@ class JSONConstructor {
505
548
  result.put("leftBottom", generateCoordinate(input.leftBottom));
506
549
  result.put("rightTop", generateCoordinate(input.rightTop));
507
550
  result.put("rightBottom", generateCoordinate(input.rightBottom));
508
- } catch (JSONException ignored) {
551
+ } catch (JSONException e) {
552
+ e.printStackTrace();
509
553
  }
510
554
  return result;
511
555
  }
@@ -517,7 +561,8 @@ class JSONConstructor {
517
561
  result.put("featureType", input.featureType);
518
562
  result.put("result", input.result);
519
563
  result.put("type", input.type);
520
- } catch (JSONException ignored) {
564
+ } catch (JSONException e) {
565
+ e.printStackTrace();
521
566
  }
522
567
  return result;
523
568
  }
@@ -530,7 +575,8 @@ class JSONConstructor {
530
575
  result.put("result", input.result);
531
576
  result.put("imageQualityList", generateList(input.imageQualityList, JSONConstructor::generateImageQuality));
532
577
  result.put("pageIndex", input.pageIndex);
533
- } catch (JSONException ignored) {
578
+ } catch (JSONException e) {
579
+ e.printStackTrace();
534
580
  }
535
581
  return result;
536
582
  }
@@ -550,7 +596,8 @@ class JSONConstructor {
550
596
  result.put("dYear", input.dYear);
551
597
  result.put("dCountryName", input.dCountryName);
552
598
  result.put("FDSID", generateIntArray(input.FDSID));
553
- } catch (JSONException ignored) {
599
+ } catch (JSONException e) {
600
+ e.printStackTrace();
554
601
  }
555
602
  return result;
556
603
  }
@@ -562,7 +609,8 @@ class JSONConstructor {
562
609
  result.put("code", input.code & 0xFFFF0000);
563
610
  result.put("number", input.code & 0x0000FFFF);
564
611
  result.put("value", input.value);
565
- } catch (JSONException ignored) {
612
+ } catch (JSONException e) {
613
+ e.printStackTrace();
566
614
  }
567
615
  return result;
568
616
  }
@@ -575,7 +623,8 @@ class JSONConstructor {
575
623
  result.put("type", input.type);
576
624
  result.put("status", input.status);
577
625
  result.put("notifications", generateList(input.notifications));
578
- } catch (JSONException ignored) {
626
+ } catch (JSONException e) {
627
+ e.printStackTrace();
579
628
  }
580
629
  return result;
581
630
  }
@@ -588,7 +637,8 @@ class JSONConstructor {
588
637
  result.put("type", input.type);
589
638
  result.put("status", input.status);
590
639
  result.put("data", input.data);
591
- } catch (JSONException ignored) {
640
+ } catch (JSONException e) {
641
+ e.printStackTrace();
592
642
  }
593
643
  return result;
594
644
  }
@@ -599,7 +649,8 @@ class JSONConstructor {
599
649
  try {
600
650
  result.put("length", input.length);
601
651
  result.put("data", input.data);
602
- } catch (JSONException ignored) {
652
+ } catch (JSONException e) {
653
+ e.printStackTrace();
603
654
  }
604
655
  return result;
605
656
  }
@@ -609,7 +660,8 @@ class JSONConstructor {
609
660
  if (input == null) return result;
610
661
  try {
611
662
  result.put("securityObject", generateCertificateData(input.securityObject));
612
- } catch (JSONException ignored) {
663
+ } catch (JSONException e) {
664
+ e.printStackTrace();
613
665
  }
614
666
  return result;
615
667
  }
@@ -629,7 +681,8 @@ class JSONConstructor {
629
681
  result.put("docFieldsGraphics", generateList(input.docFieldsGraphics));
630
682
  result.put("docFieldsOriginals", generateList(input.docFieldsOriginals));
631
683
  result.put("notifications", generateList(input.notifications));
632
- } catch (JSONException ignored) {
684
+ } catch (JSONException e) {
685
+ e.printStackTrace();
633
686
  }
634
687
  return result;
635
688
  }
@@ -645,7 +698,8 @@ class JSONConstructor {
645
698
  result.put("unicodeVersion", input.unicodeVersion);
646
699
  result.put("version", input.version);
647
700
  result.put("files", generateList(input.files, JSONConstructor::generateFile));
648
- } catch (JSONException ignored) {
701
+ } catch (JSONException e) {
702
+ e.printStackTrace();
649
703
  }
650
704
  return result;
651
705
  }
@@ -659,7 +713,8 @@ class JSONConstructor {
659
713
  result.put("status", input.status);
660
714
  result.put("data", input.data);
661
715
  result.put("format", input.format);
662
- } catch (JSONException ignored) {
716
+ } catch (JSONException e) {
717
+ e.printStackTrace();
663
718
  }
664
719
  return result;
665
720
  }
@@ -670,7 +725,8 @@ class JSONConstructor {
670
725
  try {
671
726
  result.put("type", input.type);
672
727
  result.put("value", generateValue(input.value));
673
- } catch (JSONException ignored) {
728
+ } catch (JSONException e) {
729
+ e.printStackTrace();
674
730
  }
675
731
  return result;
676
732
  }
@@ -682,7 +738,8 @@ class JSONConstructor {
682
738
  result.put("data", input.data);
683
739
  result.put("friendlyName", generateValue(input.friendlyName));
684
740
  result.put("attributes", generateList(input.attributes, JSONConstructor::generateAttribute));
685
- } catch (JSONException ignored) {
741
+ } catch (JSONException e) {
742
+ e.printStackTrace();
686
743
  }
687
744
  return result;
688
745
  }
@@ -693,7 +750,8 @@ class JSONConstructor {
693
750
  try {
694
751
  result.put("data", input.data);
695
752
  result.put("type", input.type);
696
- } catch (JSONException ignored) {
753
+ } catch (JSONException e) {
754
+ e.printStackTrace();
697
755
  }
698
756
  return result;
699
757
  }
@@ -704,7 +762,8 @@ class JSONConstructor {
704
762
  try {
705
763
  result.put("notAfter", generateValue(input.notAfter));
706
764
  result.put("notBefore", generateValue(input.notBefore));
707
- } catch (JSONException ignored) {
765
+ } catch (JSONException e) {
766
+ e.printStackTrace();
708
767
  }
709
768
  return result;
710
769
  }
@@ -726,7 +785,8 @@ class JSONConstructor {
726
785
  result.put("subject", generateAuthority(input.subject));
727
786
  result.put("notifications", generateList(input.notifications));
728
787
  result.put("extensions", generateList(input.extensions, JSONConstructor::generateExtension));
729
- } catch (JSONException ignored) {
788
+ } catch (JSONException e) {
789
+ e.printStackTrace();
730
790
  }
731
791
  return result;
732
792
  }
@@ -747,7 +807,8 @@ class JSONConstructor {
747
807
  result.put("notifications", generateList(input.notifications));
748
808
  result.put("signedAttributes", generateList(input.signedAttributes, JSONConstructor::generateExtension));
749
809
  result.put("certificateChain", generateList(input.certificateChain, JSONConstructor::generateCertificateChain));
750
- } catch (JSONException ignored) {
810
+ } catch (JSONException e) {
811
+ e.printStackTrace();
751
812
  }
752
813
  return result;
753
814
  }
@@ -761,7 +822,8 @@ class JSONConstructor {
761
822
  result.put("objectType", input.objectType);
762
823
  result.put("notifications", generateList(input.notifications));
763
824
  result.put("signerInfos", generateList(input.signerInfos, JSONConstructor::generateSignerInfo));
764
- } catch (JSONException ignored) {
825
+ } catch (JSONException e) {
826
+ e.printStackTrace();
765
827
  }
766
828
  return result;
767
829
  }
@@ -784,7 +846,8 @@ class JSONConstructor {
784
846
  result.put("baudrate1", input.baudrate1);
785
847
  result.put("baudrate2", input.baudrate2);
786
848
  result.put("uID", input.uID);
787
- } catch (JSONException ignored) {
849
+ } catch (JSONException e) {
850
+ e.printStackTrace();
788
851
  }
789
852
  return result;
790
853
  }
@@ -803,7 +866,8 @@ class JSONConstructor {
803
866
  result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
804
867
  result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
805
868
  result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
806
- } catch (JSONException ignored) {
869
+ } catch (JSONException e) {
870
+ e.printStackTrace();
807
871
  }
808
872
  return result;
809
873
  }
@@ -817,7 +881,8 @@ class JSONConstructor {
817
881
  result.put("typeName", input.getTypeName(context));
818
882
  result.put("pageIndex", input.pageIndex);
819
883
  result.put("elements", generateList(input.elements, JSONConstructor::generateDocumentReaderAuthenticityElement, context));
820
- } catch (JSONException ignored) {
884
+ } catch (JSONException e) {
885
+ e.printStackTrace();
821
886
  }
822
887
  return result;
823
888
  }
@@ -829,7 +894,8 @@ class JSONConstructor {
829
894
  result.put("errorLevel", input.errorLevel);
830
895
  result.put("columns", input.columns);
831
896
  result.put("rows", input.rows);
832
- } catch (JSONException ignored) {
897
+ } catch (JSONException e) {
898
+ e.printStackTrace();
833
899
  }
834
900
  return result;
835
901
  }
@@ -845,7 +911,8 @@ class JSONConstructor {
845
911
  result.put("PACE", input.PACE);
846
912
  result.put("TA", input.TA);
847
913
  result.put("overallStatus", input.overallStatus);
848
- } catch (JSONException ignored) {
914
+ } catch (JSONException e) {
915
+ e.printStackTrace();
849
916
  }
850
917
  return result;
851
918
  }
@@ -855,7 +922,8 @@ class JSONConstructor {
855
922
  if (input == null) return result;
856
923
  try {
857
924
  result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderBarcodeField));
858
- } catch (JSONException ignored) {
925
+ } catch (JSONException e) {
926
+ e.printStackTrace();
859
927
  }
860
928
  return result;
861
929
  }
@@ -869,7 +937,8 @@ class JSONConstructor {
869
937
  result.put("pageIndex", input.pageIndex);
870
938
  result.put("pdf417Info", generatePDF417Info(input.pdf417Info));
871
939
  result.put("data", generateByteArray(input.data));
872
- } catch (JSONException ignored) {
940
+ } catch (JSONException e) {
941
+ e.printStackTrace();
873
942
  }
874
943
  return result;
875
944
  }
@@ -880,7 +949,8 @@ class JSONConstructor {
880
949
  try {
881
950
  result.put("status", input.getStatus());
882
951
  result.put("checks", generateList(input.checks, JSONConstructor::generateDocumentReaderAuthenticityCheck, context));
883
- } catch (JSONException ignored) {
952
+ } catch (JSONException e) {
953
+ e.printStackTrace();
884
954
  }
885
955
  return result;
886
956
  }
@@ -894,7 +964,23 @@ class JSONConstructor {
894
964
  result.put("elementDiagnose", input.elementDiagnose);
895
965
  result.put("elementTypeName", input.getElementTypeName(context));
896
966
  result.put("elementDiagnoseName", input.getElementDiagnoseName(context));
897
- } catch (JSONException ignored) {
967
+ } catch (JSONException e) {
968
+ e.printStackTrace();
969
+ }
970
+ return result;
971
+ }
972
+
973
+ static JSONObject generateDocumentReaderException(DocumentReaderException input) {
974
+ JSONObject result = new JSONObject();
975
+ if (input == null) return result;
976
+ try {
977
+ result.put("errorCode", input.getErrorCode());
978
+ result.put("localizedMessage", input.getLocalizedMessage());
979
+ result.put("message", input.getMessage());
980
+ result.put("string", input.toString());
981
+ result.put("stackTrace", generateArray(input.getStackTrace(), JSONConstructor::generateStackTraceElement));
982
+ } catch (JSONException e) {
983
+ e.printStackTrace();
898
984
  }
899
985
  return result;
900
986
  }
@@ -907,7 +993,8 @@ class JSONConstructor {
907
993
  result.put("message", input.getMessage());
908
994
  result.put("string", input.toString());
909
995
  result.put("stackTrace", generateArray(input.getStackTrace(), JSONConstructor::generateStackTraceElement));
910
- } catch (JSONException ignored) {
996
+ } catch (JSONException e) {
997
+ e.printStackTrace();
911
998
  }
912
999
  return result;
913
1000
  }
@@ -922,7 +1009,134 @@ class JSONConstructor {
922
1009
  result.put("fileName", input.getFileName());
923
1010
  result.put("methodName", input.getMethodName());
924
1011
  result.put("string", input.toString());
925
- } catch (JSONException ignored) {
1012
+ } catch (JSONException e) {
1013
+ e.printStackTrace();
1014
+ }
1015
+ return result;
1016
+ }
1017
+
1018
+ static JSONObject generatePAResourcesIssuer(PAResourcesIssuer input) {
1019
+ JSONObject result = new JSONObject();
1020
+ if (input == null) return result;
1021
+ try {
1022
+ result.put("data", generateByteArray(input.data));
1023
+ result.put("friendlyName", input.friendlyName);
1024
+ result.put("attributes", generateArray(input.attributes, JSONConstructor::generatePAAttribute));
1025
+ } catch (JSONException e) {
1026
+ e.printStackTrace();
1027
+ }
1028
+ return result;
1029
+ }
1030
+
1031
+ static JSONObject generatePAAttribute(PAAttribute input) {
1032
+ JSONObject result = new JSONObject();
1033
+ if (input == null) return result;
1034
+ try {
1035
+ result.put("type", input.type);
1036
+ result.put("value", input.value);
1037
+ } catch (JSONException e) {
1038
+ e.printStackTrace();
1039
+ }
1040
+ return result;
1041
+ }
1042
+
1043
+ static JSONObject generateTAChallenge(TAChallenge input) {
1044
+ JSONObject result = new JSONObject();
1045
+ if (input == null) return result;
1046
+ try {
1047
+ result.put("data", generateByteArray(input.data));
1048
+ result.put("auxPCD", input.auxPCD);
1049
+ result.put("challengePICC", input.challengePICC);
1050
+ result.put("hashPK", input.hashPK);
1051
+ result.put("idPICC", input.idPICC);
1052
+ } catch (JSONException e) {
1053
+ e.printStackTrace();
1054
+ }
1055
+ return result;
1056
+ }
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();
926
1140
  }
927
1141
  return result;
928
1142
  }
@@ -951,7 +1165,10 @@ class JSONConstructor {
951
1165
  result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
952
1166
  result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
953
1167
  result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
954
- } catch (JSONException ignored) {
1168
+ result.put("status", generateDocumentReaderResultsStatus(input.status));
1169
+ result.put("vdsncData", generateVDSNCData(input.vdsncData));
1170
+ } catch (JSONException e) {
1171
+ e.printStackTrace();
955
1172
  }
956
1173
  return result;
957
1174
  }
@@ -959,26 +1176,24 @@ class JSONConstructor {
959
1176
  // From JSON
960
1177
 
961
1178
  static DocumentReaderScenario DocumentReaderScenarioFromJSON(JSONObject input) {
962
- DocumentReaderScenario result = new DocumentReaderScenario();
963
1179
  try {
964
- if (input.has("uvTorch"))
965
- result.uvTorch = input.getBoolean("uvTorch");
966
- if (input.has("seriesProcessMode"))
967
- result.seriesProcessMode = input.getBoolean("seriesProcessMode");
1180
+ DocumentReaderScenario result = new DocumentReaderScenario();
968
1181
  if (input.has("name"))
969
1182
  result.name = input.getString("name");
970
1183
  if (input.has("caption"))
971
1184
  result.caption = input.getString("caption");
972
1185
  if (input.has("description"))
973
1186
  result.description = input.getString("description");
974
- } catch (JSONException ignored) {
1187
+ return result;
1188
+ } catch (JSONException e) {
1189
+ e.printStackTrace();
975
1190
  }
976
- return result;
1191
+ return null;
977
1192
  }
978
1193
 
979
- static DocumentReaderScenarioFull DocumentReaderScenarioFullFromJSON(JSONObject input) {
980
- DocumentReaderScenarioFull result = new DocumentReaderScenarioFull();
1194
+ static CoreDetailedScenario CoreDetailedScenarioFromJSON(JSONObject input) {
981
1195
  try {
1196
+ CoreDetailedScenario result = new CoreDetailedScenario();
982
1197
  if (input.has("uvTorch"))
983
1198
  result.uvTorch = input.getBoolean("uvTorch");
984
1199
  if (input.has("frameOrientation"))
@@ -1005,28 +1220,32 @@ class JSONConstructor {
1005
1220
  result.description = input.getString("description");
1006
1221
  if (input.has("manualCrop"))
1007
1222
  result.manualCrop = input.getBoolean("manualCrop");
1008
- } catch (JSONException ignored) {
1223
+ return result;
1224
+ } catch (JSONException e) {
1225
+ e.printStackTrace();
1009
1226
  }
1010
- return result;
1227
+ return null;
1011
1228
  }
1012
1229
 
1013
1230
  static FaceMetaData FaceMetaDataFromJSON(JSONObject input) {
1014
- FaceMetaData result = new FaceMetaData();
1015
1231
  try {
1232
+ FaceMetaData result = new FaceMetaData();
1016
1233
  if (input.has("ID"))
1017
1234
  result.ID = input.getInt("ID");
1018
1235
  if (input.has("rollAngle"))
1019
1236
  result.rollAngle = input.getInt("rollAngle");
1020
1237
  if (input.has("bounds"))
1021
1238
  result.bounds = BoundsFromJSON(input.getJSONObject("bounds"));
1022
- } catch (JSONException ignored) {
1239
+ return result;
1240
+ } catch (JSONException e) {
1241
+ e.printStackTrace();
1023
1242
  }
1024
- return result;
1243
+ return null;
1025
1244
  }
1026
1245
 
1027
1246
  static Bounds BoundsFromJSON(JSONObject input) {
1028
- Bounds result = new Bounds();
1029
1247
  try {
1248
+ Bounds result = new Bounds();
1030
1249
  if (input.has("x"))
1031
1250
  result.x = input.getInt("x");
1032
1251
  if (input.has("y"))
@@ -1035,14 +1254,16 @@ class JSONConstructor {
1035
1254
  result.width = input.getInt("width");
1036
1255
  if (input.has("height"))
1037
1256
  result.height = input.getInt("height");
1038
- } catch (JSONException ignored) {
1257
+ return result;
1258
+ } catch (JSONException e) {
1259
+ e.printStackTrace();
1039
1260
  }
1040
- return result;
1261
+ return null;
1041
1262
  }
1042
1263
 
1043
1264
  static Rect RectFromJSON(JSONObject input) {
1044
- Rect result = new Rect();
1045
1265
  try {
1266
+ Rect result = new Rect();
1046
1267
  if (input.has("bottom"))
1047
1268
  result.bottom = input.getInt("bottom");
1048
1269
  if (input.has("top"))
@@ -1051,14 +1272,16 @@ class JSONConstructor {
1051
1272
  result.left = input.getInt("left");
1052
1273
  if (input.has("right"))
1053
1274
  result.right = input.getInt("right");
1054
- } catch (JSONException ignored) {
1275
+ return result;
1276
+ } catch (JSONException e) {
1277
+ e.printStackTrace();
1055
1278
  }
1056
- return result;
1279
+ return null;
1057
1280
  }
1058
1281
 
1059
1282
  static DocReaderFieldRect DocReaderFieldRectFromJSON(JSONObject input) {
1060
- DocReaderFieldRect result = new DocReaderFieldRect();
1061
1283
  try {
1284
+ DocReaderFieldRect result = new DocReaderFieldRect();
1062
1285
  if (input.has("bottom"))
1063
1286
  result.bottom = input.getInt("bottom");
1064
1287
  if (input.has("top"))
@@ -1067,14 +1290,16 @@ class JSONConstructor {
1067
1290
  result.left = input.getInt("left");
1068
1291
  if (input.has("right"))
1069
1292
  result.right = input.getInt("right");
1070
- } catch (JSONException ignored) {
1293
+ return result;
1294
+ } catch (JSONException e) {
1295
+ e.printStackTrace();
1071
1296
  }
1072
- return result;
1297
+ return null;
1073
1298
  }
1074
1299
 
1075
1300
  static DocumentReaderGraphicField DocumentReaderGraphicFieldFromJSON(JSONObject input) {
1076
- DocumentReaderGraphicField result = new DocumentReaderGraphicField();
1077
1301
  try {
1302
+ DocumentReaderGraphicField result = new DocumentReaderGraphicField();
1078
1303
  if (input.has("sourceType"))
1079
1304
  result.sourceType = input.getInt("sourceType");
1080
1305
  if (input.has("fieldType"))
@@ -1085,29 +1310,33 @@ class JSONConstructor {
1085
1310
  result.pageIndex = input.getInt("pageIndex");
1086
1311
  if (input.has("fieldRect"))
1087
1312
  result.boundRect = DocReaderFieldRectFromJSON(input.getJSONObject("fieldRect"));
1088
- } catch (JSONException ignored) {
1313
+ return result;
1314
+ } catch (JSONException e) {
1315
+ e.printStackTrace();
1089
1316
  }
1090
- return result;
1317
+ return null;
1091
1318
  }
1092
1319
 
1093
1320
  static DocumentReaderGraphicResult DocumentReaderGraphicResultFromJSON(JSONObject input) {
1094
- DocumentReaderGraphicResult result = new DocumentReaderGraphicResult();
1095
1321
  try {
1322
+ DocumentReaderGraphicResult result = new DocumentReaderGraphicResult();
1096
1323
  if (input.has("fields")){
1097
- JSONArray jsonArray = input.getJSONArray("fields");
1098
- List<DocumentReaderGraphicField> array = new ArrayList<>();
1099
- for (int i = 0; i < jsonArray.length(); i++)
1100
- array.add(DocumentReaderGraphicFieldFromJSON(jsonArray.getJSONObject(i)));
1101
- result.fields = array;
1324
+ JSONArray jsonArray_fields = input.getJSONArray("fields");
1325
+ List<DocumentReaderGraphicField> fields = new ArrayList<>();
1326
+ for (int i = 0; i < jsonArray_fields.length(); i++)
1327
+ fields.add(DocumentReaderGraphicFieldFromJSON(jsonArray_fields.getJSONObject(i)));
1328
+ result.fields = fields;
1102
1329
  }
1103
- } catch (JSONException ignored) {
1330
+ return result;
1331
+ } catch (JSONException e) {
1332
+ e.printStackTrace();
1104
1333
  }
1105
- return result;
1334
+ return null;
1106
1335
  }
1107
1336
 
1108
1337
  static DocumentReaderValue DocumentReaderValueFromJSON(JSONObject input) {
1109
- DocumentReaderValue result = new DocumentReaderValue();
1110
1338
  try {
1339
+ DocumentReaderValue result = new DocumentReaderValue();
1111
1340
  if (input.has("pageIndex"))
1112
1341
  result.pageIndex = input.getInt("pageIndex");
1113
1342
  if (input.has("sourceType"))
@@ -1122,14 +1351,16 @@ class JSONConstructor {
1122
1351
  result.originalValue = input.getString("originalValue");
1123
1352
  if (input.has("boundRect"))
1124
1353
  result.boundRect = RectFromJSON(input.getJSONObject("boundRect"));
1125
- } catch (JSONException ignored) {
1354
+ return result;
1355
+ } catch (JSONException e) {
1356
+ e.printStackTrace();
1126
1357
  }
1127
- return result;
1358
+ return null;
1128
1359
  }
1129
1360
 
1130
1361
  static DocumentReaderTextField DocumentReaderTextFieldFromJSON(JSONObject input) {
1131
- DocumentReaderTextField result = new DocumentReaderTextField();
1132
1362
  try {
1363
+ DocumentReaderTextField result = new DocumentReaderTextField();
1133
1364
  if (input.has("fieldType"))
1134
1365
  result.fieldType = input.getInt("fieldType");
1135
1366
  if (input.has("lcid"))
@@ -1137,49 +1368,55 @@ class JSONConstructor {
1137
1368
  if (input.has("status"))
1138
1369
  result.status = input.getInt("status");
1139
1370
  if (input.has("values")){
1140
- JSONArray jsonArray = input.getJSONArray("values");
1141
- List<DocumentReaderValue> array = new ArrayList<>();
1142
- for (int i = 0; i < jsonArray.length(); i++)
1143
- array.add(DocumentReaderValueFromJSON(jsonArray.getJSONObject(i)));
1144
- result.values = array;
1371
+ JSONArray jsonArray_values = input.getJSONArray("values");
1372
+ List<DocumentReaderValue> values = new ArrayList<>();
1373
+ for (int i = 0; i < jsonArray_values.length(); i++)
1374
+ values.add(DocumentReaderValueFromJSON(jsonArray_values.getJSONObject(i)));
1375
+ result.values = values;
1145
1376
  }
1146
- } catch (JSONException ignored) {
1377
+ return result;
1378
+ } catch (JSONException e) {
1379
+ e.printStackTrace();
1147
1380
  }
1148
- return result;
1381
+ return null;
1149
1382
  }
1150
1383
 
1151
1384
  static DocumentReaderTextResult DocumentReaderTextResultFromJSON(JSONObject input) {
1152
- DocumentReaderTextResult result = new DocumentReaderTextResult();
1153
1385
  try {
1386
+ DocumentReaderTextResult result = new DocumentReaderTextResult();
1154
1387
  if (input.has("status"))
1155
1388
  result.status = input.getInt("status");
1156
1389
  if (input.has("fields")){
1157
- JSONArray jsonArray = input.getJSONArray("fields");
1158
- List<DocumentReaderTextField> array = new ArrayList<>();
1159
- for (int i = 0; i < jsonArray.length(); i++)
1160
- array.add(DocumentReaderTextFieldFromJSON(jsonArray.getJSONObject(i)));
1161
- result.fields = array;
1390
+ JSONArray jsonArray_fields = input.getJSONArray("fields");
1391
+ List<DocumentReaderTextField> fields = new ArrayList<>();
1392
+ for (int i = 0; i < jsonArray_fields.length(); i++)
1393
+ fields.add(DocumentReaderTextFieldFromJSON(jsonArray_fields.getJSONObject(i)));
1394
+ result.fields = fields;
1162
1395
  }
1163
- } catch (JSONException ignored) {
1396
+ return result;
1397
+ } catch (JSONException e) {
1398
+ e.printStackTrace();
1164
1399
  }
1165
- return result;
1400
+ return null;
1166
1401
  }
1167
1402
 
1168
1403
  static Coordinate CoordinateFromJSON(JSONObject input) {
1169
- Coordinate result = new Coordinate();
1170
1404
  try {
1405
+ Coordinate result = new Coordinate();
1171
1406
  if (input.has("x"))
1172
1407
  result.x = input.getInt("x");
1173
1408
  if (input.has("y"))
1174
1409
  result.y = input.getInt("y");
1175
- } catch (JSONException ignored) {
1410
+ return result;
1411
+ } catch (JSONException e) {
1412
+ e.printStackTrace();
1176
1413
  }
1177
- return result;
1414
+ return null;
1178
1415
  }
1179
1416
 
1180
1417
  static ElementPosition ElementPositionFromJSON(JSONObject input) {
1181
- ElementPosition result = new ElementPosition();
1182
1418
  try {
1419
+ ElementPosition result = new ElementPosition();
1183
1420
  if (input.has("docFormat"))
1184
1421
  result.docFormat = input.getInt("docFormat");
1185
1422
  if (input.has("width"))
@@ -1212,49 +1449,55 @@ class JSONConstructor {
1212
1449
  result.rightTop = CoordinateFromJSON(input.getJSONObject("rightTop"));
1213
1450
  if (input.has("rightBottom"))
1214
1451
  result.rightBottom = CoordinateFromJSON(input.getJSONObject("rightBottom"));
1215
- } catch (JSONException ignored) {
1452
+ return result;
1453
+ } catch (JSONException e) {
1454
+ e.printStackTrace();
1216
1455
  }
1217
- return result;
1456
+ return null;
1218
1457
  }
1219
1458
 
1220
1459
  static ImageQuality ImageQualityFromJSON(JSONObject input) {
1221
- ImageQuality result = new ImageQuality();
1222
1460
  try {
1461
+ ImageQuality result = new ImageQuality();
1223
1462
  if (input.has("featureType"))
1224
1463
  result.featureType = input.getInt("featureType");
1225
1464
  if (input.has("result"))
1226
1465
  result.result = input.getInt("result");
1227
1466
  if (input.has("type"))
1228
1467
  result.type = input.getInt("type");
1229
- } catch (JSONException ignored) {
1468
+ return result;
1469
+ } catch (JSONException e) {
1470
+ e.printStackTrace();
1230
1471
  }
1231
- return result;
1472
+ return null;
1232
1473
  }
1233
1474
 
1234
1475
  static ImageQualityGroup ImageQualityGroupFromJSON(JSONObject input) {
1235
- ImageQualityGroup result = new ImageQualityGroup();
1236
1476
  try {
1477
+ ImageQualityGroup result = new ImageQualityGroup();
1237
1478
  if (input.has("count"))
1238
1479
  result.count = input.getInt("count");
1239
1480
  if (input.has("result"))
1240
1481
  result.result = input.getInt("result");
1241
1482
  if (input.has("imageQualityList")){
1242
- JSONArray jsonArray = input.getJSONArray("imageQualityList");
1243
- List<ImageQuality> array = new ArrayList<>();
1244
- for (int i = 0; i < jsonArray.length(); i++)
1245
- array.add(ImageQualityFromJSON(jsonArray.getJSONObject(i)));
1246
- result.imageQualityList = array;
1483
+ JSONArray jsonArray_imageQualityList = input.getJSONArray("imageQualityList");
1484
+ List<ImageQuality> imageQualityList = new ArrayList<>();
1485
+ for (int i = 0; i < jsonArray_imageQualityList.length(); i++)
1486
+ imageQualityList.add(ImageQualityFromJSON(jsonArray_imageQualityList.getJSONObject(i)));
1487
+ result.imageQualityList = imageQualityList;
1247
1488
  }
1248
1489
  if (input.has("pageIndex"))
1249
1490
  result.pageIndex = input.getInt("pageIndex");
1250
- } catch (JSONException ignored) {
1491
+ return result;
1492
+ } catch (JSONException e) {
1493
+ e.printStackTrace();
1251
1494
  }
1252
- return result;
1495
+ return null;
1253
1496
  }
1254
1497
 
1255
1498
  static DocumentReaderDocumentType DocumentReaderDocumentTypeFromJSON(JSONObject input) {
1256
- DocumentReaderDocumentType result = new DocumentReaderDocumentType();
1257
1499
  try {
1500
+ DocumentReaderDocumentType result = new DocumentReaderDocumentType();
1258
1501
  if (input.has("pageIndex"))
1259
1502
  result.pageIndex = input.getInt("pageIndex");
1260
1503
  if (input.has("documentID"))
@@ -1276,20 +1519,22 @@ class JSONConstructor {
1276
1519
  if (input.has("dCountryName"))
1277
1520
  result.dCountryName = input.getString("dCountryName");
1278
1521
  if (input.has("FDSID")){
1279
- JSONArray jsonArray = input.getJSONArray("FDSID");
1280
- int[] array = new int[jsonArray.length()];
1281
- for (int i = 0; i < jsonArray.length(); i++)
1282
- array[i] = jsonArray.getInt(i);
1283
- result.FDSID = array;
1522
+ JSONArray jsonArray_FDSID = input.getJSONArray("FDSID");
1523
+ int[] FDSID = new int[jsonArray_FDSID.length()];
1524
+ for (int i = 0; i < jsonArray_FDSID.length(); i++)
1525
+ FDSID[i] = jsonArray_FDSID.getInt(i);
1526
+ result.FDSID = FDSID;
1284
1527
  }
1285
- } catch (JSONException ignored) {
1528
+ return result;
1529
+ } catch (JSONException e) {
1530
+ e.printStackTrace();
1286
1531
  }
1287
- return result;
1532
+ return null;
1288
1533
  }
1289
1534
 
1290
1535
  static AccessControlProcedureType AccessControlProcedureTypeFromJSON(JSONObject input) {
1291
- AccessControlProcedureType result = new AccessControlProcedureType();
1292
1536
  try {
1537
+ AccessControlProcedureType result = new AccessControlProcedureType();
1293
1538
  if (input.has("activeOptionIdx"))
1294
1539
  result.activeOptionIdx = input.getInt("activeOptionIdx");
1295
1540
  if (input.has("type"))
@@ -1297,20 +1542,22 @@ class JSONConstructor {
1297
1542
  if (input.has("status"))
1298
1543
  result.status = input.getInt("status");
1299
1544
  if (input.has("notifications")){
1300
- JSONArray jsonArray = input.getJSONArray("notifications");
1301
- List<Long> array = new ArrayList<>();
1302
- for (int i = 0; i < jsonArray.length(); i++)
1303
- array.add(jsonArray.getLong(i));
1304
- result.notifications = array;
1545
+ JSONArray jsonArray_notifications = input.getJSONArray("notifications");
1546
+ List<Long> notifications = new ArrayList<>();
1547
+ for (int i = 0; i < jsonArray_notifications.length(); i++)
1548
+ notifications.add(jsonArray_notifications.getLong(i));
1549
+ result.notifications = notifications;
1305
1550
  }
1306
- } catch (JSONException ignored) {
1551
+ return result;
1552
+ } catch (JSONException e) {
1553
+ e.printStackTrace();
1307
1554
  }
1308
- return result;
1555
+ return null;
1309
1556
  }
1310
1557
 
1311
1558
  static FileData FileDataFromJSON(JSONObject input) {
1312
- FileData result = new FileData();
1313
1559
  try {
1560
+ FileData result = new FileData();
1314
1561
  if (input.has("length"))
1315
1562
  result.length = input.getInt("length");
1316
1563
  if (input.has("type"))
@@ -1319,36 +1566,42 @@ class JSONConstructor {
1319
1566
  result.status = input.getInt("status");
1320
1567
  if (input.has("data"))
1321
1568
  result.data = input.getString("data");
1322
- } catch (JSONException ignored) {
1569
+ return result;
1570
+ } catch (JSONException e) {
1571
+ e.printStackTrace();
1323
1572
  }
1324
- return result;
1573
+ return null;
1325
1574
  }
1326
1575
 
1327
1576
  static CertificateData CertificateDataFromJSON(JSONObject input) {
1328
- CertificateData result = new CertificateData();
1329
1577
  try {
1578
+ CertificateData result = new CertificateData();
1330
1579
  if (input.has("length"))
1331
1580
  result.length = input.getInt("length");
1332
1581
  if (input.has("data"))
1333
1582
  result.data = input.getString("data");
1334
- } catch (JSONException ignored) {
1583
+ return result;
1584
+ } catch (JSONException e) {
1585
+ e.printStackTrace();
1335
1586
  }
1336
- return result;
1587
+ return null;
1337
1588
  }
1338
1589
 
1339
1590
  static SecurityObjectCertificates SecurityObjectCertificatesFromJSON(JSONObject input) {
1340
- SecurityObjectCertificates result = new SecurityObjectCertificates();
1341
1591
  try {
1592
+ SecurityObjectCertificates result = new SecurityObjectCertificates();
1342
1593
  if (input.has("securityObject"))
1343
1594
  result.securityObject = CertificateDataFromJSON(input.getJSONObject("securityObject"));
1344
- } catch (JSONException ignored) {
1595
+ return result;
1596
+ } catch (JSONException e) {
1597
+ e.printStackTrace();
1345
1598
  }
1346
- return result;
1599
+ return null;
1347
1600
  }
1348
1601
 
1349
1602
  static File FileFromJSON(JSONObject input) {
1350
- File result = new File();
1351
1603
  try {
1604
+ File result = new File();
1352
1605
  if (input.has("readingTime"))
1353
1606
  result.readingTime = input.getInt("readingTime");
1354
1607
  if (input.has("type"))
@@ -1364,41 +1617,43 @@ class JSONConstructor {
1364
1617
  if (input.has("certificates"))
1365
1618
  result.certificates = SecurityObjectCertificatesFromJSON(input.getJSONObject("certificates"));
1366
1619
  if (input.has("docFieldsText")){
1367
- JSONArray jsonArray = input.getJSONArray("docFieldsText");
1368
- List<Integer> array = new ArrayList<>();
1369
- for (int i = 0; i < jsonArray.length(); i++)
1370
- array.add(jsonArray.getInt(i));
1371
- result.docFieldsText = array;
1620
+ JSONArray jsonArray_docFieldsText = input.getJSONArray("docFieldsText");
1621
+ List<Integer> docFieldsText = new ArrayList<>();
1622
+ for (int i = 0; i < jsonArray_docFieldsText.length(); i++)
1623
+ docFieldsText.add(jsonArray_docFieldsText.getInt(i));
1624
+ result.docFieldsText = docFieldsText;
1372
1625
  }
1373
1626
  if (input.has("docFieldsGraphics")){
1374
- JSONArray jsonArray = input.getJSONArray("docFieldsGraphics");
1375
- List<Integer> array = new ArrayList<>();
1376
- for (int i = 0; i < jsonArray.length(); i++)
1377
- array.add(jsonArray.getInt(i));
1378
- result.docFieldsGraphics = array;
1627
+ JSONArray jsonArray_docFieldsGraphics = input.getJSONArray("docFieldsGraphics");
1628
+ List<Integer> docFieldsGraphics = new ArrayList<>();
1629
+ for (int i = 0; i < jsonArray_docFieldsGraphics.length(); i++)
1630
+ docFieldsGraphics.add(jsonArray_docFieldsGraphics.getInt(i));
1631
+ result.docFieldsGraphics = docFieldsGraphics;
1379
1632
  }
1380
1633
  if (input.has("docFieldsOriginals")){
1381
- JSONArray jsonArray = input.getJSONArray("docFieldsOriginals");
1382
- List<Integer> array = new ArrayList<>();
1383
- for (int i = 0; i < jsonArray.length(); i++)
1384
- array.add(jsonArray.getInt(i));
1385
- result.docFieldsOriginals = array;
1634
+ JSONArray jsonArray_docFieldsOriginals = input.getJSONArray("docFieldsOriginals");
1635
+ List<Integer> docFieldsOriginals = new ArrayList<>();
1636
+ for (int i = 0; i < jsonArray_docFieldsOriginals.length(); i++)
1637
+ docFieldsOriginals.add(jsonArray_docFieldsOriginals.getInt(i));
1638
+ result.docFieldsOriginals = docFieldsOriginals;
1386
1639
  }
1387
1640
  if (input.has("notifications")){
1388
- JSONArray jsonArray = input.getJSONArray("notifications");
1389
- List<Long> array = new ArrayList<>();
1390
- for (int i = 0; i < jsonArray.length(); i++)
1391
- array.add(jsonArray.getLong(i));
1392
- result.notifications = array;
1641
+ JSONArray jsonArray_notifications = input.getJSONArray("notifications");
1642
+ List<Long> notifications = new ArrayList<>();
1643
+ for (int i = 0; i < jsonArray_notifications.length(); i++)
1644
+ notifications.add(jsonArray_notifications.getLong(i));
1645
+ result.notifications = notifications;
1393
1646
  }
1394
- } catch (JSONException ignored) {
1647
+ return result;
1648
+ } catch (JSONException e) {
1649
+ e.printStackTrace();
1395
1650
  }
1396
- return result;
1651
+ return null;
1397
1652
  }
1398
1653
 
1399
1654
  static Application ApplicationFromJSON(JSONObject input) {
1400
- Application result = new Application();
1401
1655
  try {
1656
+ Application result = new Application();
1402
1657
  if (input.has("type"))
1403
1658
  result.type = input.getInt("type");
1404
1659
  if (input.has("status"))
@@ -1412,20 +1667,22 @@ class JSONConstructor {
1412
1667
  if (input.has("version"))
1413
1668
  result.version = input.getString("version");
1414
1669
  if (input.has("files")){
1415
- JSONArray jsonArray = input.getJSONArray("files");
1416
- List<File> array = new ArrayList<>();
1417
- for (int i = 0; i < jsonArray.length(); i++)
1418
- array.add(FileFromJSON(jsonArray.getJSONObject(i)));
1419
- result.files = array;
1670
+ JSONArray jsonArray_files = input.getJSONArray("files");
1671
+ List<File> files = new ArrayList<>();
1672
+ for (int i = 0; i < jsonArray_files.length(); i++)
1673
+ files.add(FileFromJSON(jsonArray_files.getJSONObject(i)));
1674
+ result.files = files;
1420
1675
  }
1421
- } catch (JSONException ignored) {
1676
+ return result;
1677
+ } catch (JSONException e) {
1678
+ e.printStackTrace();
1422
1679
  }
1423
- return result;
1680
+ return null;
1424
1681
  }
1425
1682
 
1426
1683
  static Value ValueFromJSON(JSONObject input) {
1427
- Value result = new Value();
1428
1684
  try {
1685
+ Value result = new Value();
1429
1686
  if (input.has("length"))
1430
1687
  result.length = input.getInt("length");
1431
1688
  if (input.has("type"))
@@ -1436,69 +1693,79 @@ class JSONConstructor {
1436
1693
  result.data = input.getString("data");
1437
1694
  if (input.has("format"))
1438
1695
  result.format = input.getString("format");
1439
- } catch (JSONException ignored) {
1696
+ return result;
1697
+ } catch (JSONException e) {
1698
+ e.printStackTrace();
1440
1699
  }
1441
- return result;
1700
+ return null;
1442
1701
  }
1443
1702
 
1444
1703
  static Attribute AttributeFromJSON(JSONObject input) {
1445
- Attribute result = new Attribute();
1446
1704
  try {
1705
+ Attribute result = new Attribute();
1447
1706
  if (input.has("type"))
1448
1707
  result.type = input.getString("type");
1449
1708
  if (input.has("value"))
1450
1709
  result.value = ValueFromJSON(input.getJSONObject("value"));
1451
- } catch (JSONException ignored) {
1710
+ return result;
1711
+ } catch (JSONException e) {
1712
+ e.printStackTrace();
1452
1713
  }
1453
- return result;
1714
+ return null;
1454
1715
  }
1455
1716
 
1456
1717
  static Authority AuthorityFromJSON(JSONObject input) {
1457
- Authority result = new Authority();
1458
1718
  try {
1719
+ Authority result = new Authority();
1459
1720
  if (input.has("data"))
1460
1721
  result.data = input.getString("data");
1461
1722
  if (input.has("friendlyName"))
1462
1723
  result.friendlyName = ValueFromJSON(input.getJSONObject("friendlyName"));
1463
1724
  if (input.has("attributes")){
1464
- JSONArray jsonArray = input.getJSONArray("attributes");
1465
- List<Attribute> array = new ArrayList<>();
1466
- for (int i = 0; i < jsonArray.length(); i++)
1467
- array.add(AttributeFromJSON(jsonArray.getJSONObject(i)));
1468
- result.attributes = array;
1725
+ JSONArray jsonArray_attributes = input.getJSONArray("attributes");
1726
+ List<Attribute> attributes = new ArrayList<>();
1727
+ for (int i = 0; i < jsonArray_attributes.length(); i++)
1728
+ attributes.add(AttributeFromJSON(jsonArray_attributes.getJSONObject(i)));
1729
+ result.attributes = attributes;
1469
1730
  }
1470
- } catch (JSONException ignored) {
1731
+ return result;
1732
+ } catch (JSONException e) {
1733
+ e.printStackTrace();
1471
1734
  }
1472
- return result;
1735
+ return null;
1473
1736
  }
1474
1737
 
1475
1738
  static Extension ExtensionFromJSON(JSONObject input) {
1476
- Extension result = new Extension();
1477
1739
  try {
1740
+ Extension result = new Extension();
1478
1741
  if (input.has("data"))
1479
1742
  result.data = input.getString("data");
1480
1743
  if (input.has("type"))
1481
1744
  result.type = input.getString("type");
1482
- } catch (JSONException ignored) {
1745
+ return result;
1746
+ } catch (JSONException e) {
1747
+ e.printStackTrace();
1483
1748
  }
1484
- return result;
1749
+ return null;
1485
1750
  }
1486
1751
 
1487
1752
  static Validity ValidityFromJSON(JSONObject input) {
1488
- Validity result = new Validity();
1489
1753
  try {
1754
+ Validity result = new Validity();
1490
1755
  if (input.has("notAfter"))
1491
1756
  result.notAfter = ValueFromJSON(input.getJSONObject("notAfter"));
1492
1757
  if (input.has("notBefore"))
1493
1758
  result.notBefore = ValueFromJSON(input.getJSONObject("notBefore"));
1494
- } catch (JSONException ignored) {
1759
+ return result;
1760
+ } catch (JSONException e) {
1761
+ e.printStackTrace();
1495
1762
  }
1496
- return result;
1763
+ return null;
1497
1764
  }
1498
1765
 
1499
1766
  static CertificateChain CertificateChainFromJSON(JSONObject input) {
1500
- CertificateChain result = new CertificateChain();
1501
1767
  try {
1768
+ CertificateChain result = new CertificateChain();
1502
1769
  if (input.has("origin"))
1503
1770
  result.origin = input.getInt("origin");
1504
1771
  if (input.has("type"))
@@ -1522,27 +1789,29 @@ class JSONConstructor {
1522
1789
  if (input.has("subject"))
1523
1790
  result.subject = AuthorityFromJSON(input.getJSONObject("subject"));
1524
1791
  if (input.has("notifications")){
1525
- JSONArray jsonArray = input.getJSONArray("notifications");
1526
- List<Long> array = new ArrayList<>();
1527
- for (int i = 0; i < jsonArray.length(); i++)
1528
- array.add(jsonArray.getLong(i));
1529
- result.notifications = array;
1792
+ JSONArray jsonArray_notifications = input.getJSONArray("notifications");
1793
+ List<Long> notifications = new ArrayList<>();
1794
+ for (int i = 0; i < jsonArray_notifications.length(); i++)
1795
+ notifications.add(jsonArray_notifications.getLong(i));
1796
+ result.notifications = notifications;
1530
1797
  }
1531
1798
  if (input.has("extensions")){
1532
- JSONArray jsonArray = input.getJSONArray("extensions");
1533
- List<Extension> array = new ArrayList<>();
1534
- for (int i = 0; i < jsonArray.length(); i++)
1535
- array.add(ExtensionFromJSON(jsonArray.getJSONObject(i)));
1536
- result.extensions = array;
1799
+ JSONArray jsonArray_extensions = input.getJSONArray("extensions");
1800
+ List<Extension> extensions = new ArrayList<>();
1801
+ for (int i = 0; i < jsonArray_extensions.length(); i++)
1802
+ extensions.add(ExtensionFromJSON(jsonArray_extensions.getJSONObject(i)));
1803
+ result.extensions = extensions;
1537
1804
  }
1538
- } catch (JSONException ignored) {
1805
+ return result;
1806
+ } catch (JSONException e) {
1807
+ e.printStackTrace();
1539
1808
  }
1540
- return result;
1809
+ return null;
1541
1810
  }
1542
1811
 
1543
1812
  static SignerInfo SignerInfoFromJSON(JSONObject input) {
1544
- SignerInfo result = new SignerInfo();
1545
1813
  try {
1814
+ SignerInfo result = new SignerInfo();
1546
1815
  if (input.has("version"))
1547
1816
  result.version = input.getInt("version");
1548
1817
  if (input.has("paStatus"))
@@ -1562,34 +1831,36 @@ class JSONConstructor {
1562
1831
  if (input.has("issuer"))
1563
1832
  result.issuer = AuthorityFromJSON(input.getJSONObject("issuer"));
1564
1833
  if (input.has("notifications")){
1565
- JSONArray jsonArray = input.getJSONArray("notifications");
1566
- List<Long> array = new ArrayList<>();
1567
- for (int i = 0; i < jsonArray.length(); i++)
1568
- array.add(jsonArray.getLong(i));
1569
- result.notifications = array;
1834
+ JSONArray jsonArray_notifications = input.getJSONArray("notifications");
1835
+ List<Long> notifications = new ArrayList<>();
1836
+ for (int i = 0; i < jsonArray_notifications.length(); i++)
1837
+ notifications.add(jsonArray_notifications.getLong(i));
1838
+ result.notifications = notifications;
1570
1839
  }
1571
1840
  if (input.has("signedAttributes")){
1572
- JSONArray jsonArray = input.getJSONArray("signedAttributes");
1573
- List<Extension> array = new ArrayList<>();
1574
- for (int i = 0; i < jsonArray.length(); i++)
1575
- array.add(ExtensionFromJSON(jsonArray.getJSONObject(i)));
1576
- result.signedAttributes = array;
1841
+ JSONArray jsonArray_signedAttributes = input.getJSONArray("signedAttributes");
1842
+ List<Extension> signedAttributes = new ArrayList<>();
1843
+ for (int i = 0; i < jsonArray_signedAttributes.length(); i++)
1844
+ signedAttributes.add(ExtensionFromJSON(jsonArray_signedAttributes.getJSONObject(i)));
1845
+ result.signedAttributes = signedAttributes;
1577
1846
  }
1578
1847
  if (input.has("certificateChain")){
1579
- JSONArray jsonArray = input.getJSONArray("certificateChain");
1580
- List<CertificateChain> array = new ArrayList<>();
1581
- for (int i = 0; i < jsonArray.length(); i++)
1582
- array.add(CertificateChainFromJSON(jsonArray.getJSONObject(i)));
1583
- result.certificateChain = array;
1848
+ JSONArray jsonArray_certificateChain = input.getJSONArray("certificateChain");
1849
+ List<CertificateChain> certificateChain = new ArrayList<>();
1850
+ for (int i = 0; i < jsonArray_certificateChain.length(); i++)
1851
+ certificateChain.add(CertificateChainFromJSON(jsonArray_certificateChain.getJSONObject(i)));
1852
+ result.certificateChain = certificateChain;
1584
1853
  }
1585
- } catch (JSONException ignored) {
1854
+ return result;
1855
+ } catch (JSONException e) {
1856
+ e.printStackTrace();
1586
1857
  }
1587
- return result;
1858
+ return null;
1588
1859
  }
1589
1860
 
1590
1861
  static SecurityObject SecurityObjectFromJSON(JSONObject input) {
1591
- SecurityObject result = new SecurityObject();
1592
1862
  try {
1863
+ SecurityObject result = new SecurityObject();
1593
1864
  if (input.has("fileReference"))
1594
1865
  result.fileReference = input.getInt("fileReference");
1595
1866
  if (input.has("version"))
@@ -1597,27 +1868,29 @@ class JSONConstructor {
1597
1868
  if (input.has("objectType"))
1598
1869
  result.objectType = input.getString("objectType");
1599
1870
  if (input.has("notifications")){
1600
- JSONArray jsonArray = input.getJSONArray("notifications");
1601
- List<Long> array = new ArrayList<>();
1602
- for (int i = 0; i < jsonArray.length(); i++)
1603
- array.add(jsonArray.getLong(i));
1604
- result.notifications = array;
1871
+ JSONArray jsonArray_notifications = input.getJSONArray("notifications");
1872
+ List<Long> notifications = new ArrayList<>();
1873
+ for (int i = 0; i < jsonArray_notifications.length(); i++)
1874
+ notifications.add(jsonArray_notifications.getLong(i));
1875
+ result.notifications = notifications;
1605
1876
  }
1606
1877
  if (input.has("signerInfos")){
1607
- JSONArray jsonArray = input.getJSONArray("signerInfos");
1608
- List<SignerInfo> array = new ArrayList<>();
1609
- for (int i = 0; i < jsonArray.length(); i++)
1610
- array.add(SignerInfoFromJSON(jsonArray.getJSONObject(i)));
1611
- result.signerInfos = array;
1878
+ JSONArray jsonArray_signerInfos = input.getJSONArray("signerInfos");
1879
+ List<SignerInfo> signerInfos = new ArrayList<>();
1880
+ for (int i = 0; i < jsonArray_signerInfos.length(); i++)
1881
+ signerInfos.add(SignerInfoFromJSON(jsonArray_signerInfos.getJSONObject(i)));
1882
+ result.signerInfos = signerInfos;
1612
1883
  }
1613
- } catch (JSONException ignored) {
1884
+ return result;
1885
+ } catch (JSONException e) {
1886
+ e.printStackTrace();
1614
1887
  }
1615
- return result;
1888
+ return null;
1616
1889
  }
1617
1890
 
1618
1891
  static CardProperties CardPropertiesFromJSON(JSONObject input) {
1619
- CardProperties result = new CardProperties();
1620
1892
  try {
1893
+ CardProperties result = new CardProperties();
1621
1894
  if (input.has("aTQA"))
1622
1895
  result.aTQA = input.getInt("aTQA");
1623
1896
  if (input.has("bitRateR"))
@@ -1646,14 +1919,16 @@ class JSONConstructor {
1646
1919
  result.baudrate2 = input.getString("baudrate2");
1647
1920
  if (input.has("uID"))
1648
1921
  result.uID = input.getString("uID");
1649
- } catch (JSONException ignored) {
1922
+ return result;
1923
+ } catch (JSONException e) {
1924
+ e.printStackTrace();
1650
1925
  }
1651
- return result;
1926
+ return null;
1652
1927
  }
1653
1928
 
1654
1929
  static RFIDSessionData RFIDSessionDataFromJSON(JSONObject input) {
1655
- RFIDSessionData result = new RFIDSessionData();
1656
1930
  try {
1931
+ RFIDSessionData result = new RFIDSessionData();
1657
1932
  if (input.has("totalBytesReceived"))
1658
1933
  result.totalBytesReceived = input.getInt("totalBytesReceived");
1659
1934
  if (input.has("totalBytesSent"))
@@ -1669,67 +1944,73 @@ class JSONConstructor {
1669
1944
  if (input.has("sessionDataStatus"))
1670
1945
  result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
1671
1946
  if (input.has("accessControls")){
1672
- JSONArray jsonArray = input.getJSONArray("accessControls");
1673
- List<AccessControlProcedureType> array = new ArrayList<>();
1674
- for (int i = 0; i < jsonArray.length(); i++)
1675
- array.add(AccessControlProcedureTypeFromJSON(jsonArray.getJSONObject(i)));
1676
- result.accessControls = array;
1947
+ JSONArray jsonArray_accessControls = input.getJSONArray("accessControls");
1948
+ List<AccessControlProcedureType> accessControls = new ArrayList<>();
1949
+ for (int i = 0; i < jsonArray_accessControls.length(); i++)
1950
+ accessControls.add(AccessControlProcedureTypeFromJSON(jsonArray_accessControls.getJSONObject(i)));
1951
+ result.accessControls = accessControls;
1677
1952
  }
1678
1953
  if (input.has("applications")){
1679
- JSONArray jsonArray = input.getJSONArray("applications");
1680
- List<Application> array = new ArrayList<>();
1681
- for (int i = 0; i < jsonArray.length(); i++)
1682
- array.add(ApplicationFromJSON(jsonArray.getJSONObject(i)));
1683
- result.applications = array;
1954
+ JSONArray jsonArray_applications = input.getJSONArray("applications");
1955
+ List<Application> applications = new ArrayList<>();
1956
+ for (int i = 0; i < jsonArray_applications.length(); i++)
1957
+ applications.add(ApplicationFromJSON(jsonArray_applications.getJSONObject(i)));
1958
+ result.applications = applications;
1684
1959
  }
1685
1960
  if (input.has("securityObjects")){
1686
- JSONArray jsonArray = input.getJSONArray("securityObjects");
1687
- List<SecurityObject> array = new ArrayList<>();
1688
- for (int i = 0; i < jsonArray.length(); i++)
1689
- array.add(SecurityObjectFromJSON(jsonArray.getJSONObject(i)));
1690
- result.securityObjects = array;
1961
+ JSONArray jsonArray_securityObjects = input.getJSONArray("securityObjects");
1962
+ List<SecurityObject> securityObjects = new ArrayList<>();
1963
+ for (int i = 0; i < jsonArray_securityObjects.length(); i++)
1964
+ securityObjects.add(SecurityObjectFromJSON(jsonArray_securityObjects.getJSONObject(i)));
1965
+ result.securityObjects = securityObjects;
1691
1966
  }
1692
- } catch (JSONException ignored) {
1967
+ return result;
1968
+ } catch (JSONException e) {
1969
+ e.printStackTrace();
1693
1970
  }
1694
- return result;
1971
+ return null;
1695
1972
  }
1696
1973
 
1697
1974
  static DocumentReaderAuthenticityCheck DocumentReaderAuthenticityCheckFromJSON(JSONObject input) {
1698
- DocumentReaderAuthenticityCheck result = new DocumentReaderAuthenticityCheck();
1699
1975
  try {
1976
+ DocumentReaderAuthenticityCheck result = new DocumentReaderAuthenticityCheck();
1700
1977
  if (input.has("type"))
1701
1978
  result.type = input.getInt("type");
1702
1979
  if (input.has("pageIndex"))
1703
1980
  result.pageIndex = input.getInt("pageIndex");
1704
1981
  if (input.has("elements")){
1705
- JSONArray jsonArray = input.getJSONArray("elements");
1706
- List<DocumentReaderAuthenticityElement> array = new ArrayList<>();
1707
- for (int i = 0; i < jsonArray.length(); i++)
1708
- array.add(DocumentReaderAuthenticityElementFromJSON(jsonArray.getJSONObject(i)));
1709
- result.elements = array;
1982
+ JSONArray jsonArray_elements = input.getJSONArray("elements");
1983
+ List<DocumentReaderAuthenticityElement> elements = new ArrayList<>();
1984
+ for (int i = 0; i < jsonArray_elements.length(); i++)
1985
+ elements.add(DocumentReaderAuthenticityElementFromJSON(jsonArray_elements.getJSONObject(i)));
1986
+ result.elements = elements;
1710
1987
  }
1711
- } catch (JSONException ignored) {
1988
+ return result;
1989
+ } catch (JSONException e) {
1990
+ e.printStackTrace();
1712
1991
  }
1713
- return result;
1992
+ return null;
1714
1993
  }
1715
1994
 
1716
1995
  static PDF417Info PDF417InfoFromJSON(JSONObject input) {
1717
- PDF417Info result = new PDF417Info();
1718
1996
  try {
1997
+ PDF417Info result = new PDF417Info();
1719
1998
  if (input.has("errorLevel"))
1720
1999
  result.errorLevel = input.getInt("errorLevel");
1721
2000
  if (input.has("columns"))
1722
2001
  result.columns = input.getInt("columns");
1723
2002
  if (input.has("rows"))
1724
2003
  result.rows = input.getInt("rows");
1725
- } catch (JSONException ignored) {
2004
+ return result;
2005
+ } catch (JSONException e) {
2006
+ e.printStackTrace();
1726
2007
  }
1727
- return result;
2008
+ return null;
1728
2009
  }
1729
2010
 
1730
2011
  static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
1731
- RFIDSessionDataStatus result = new RFIDSessionDataStatus();
1732
2012
  try {
2013
+ RFIDSessionDataStatus result = new RFIDSessionDataStatus();
1733
2014
  if (input.has("AA"))
1734
2015
  result.AA = input.getInt("AA");
1735
2016
  if (input.has("BAC"))
@@ -1744,29 +2025,33 @@ class JSONConstructor {
1744
2025
  result.TA = input.getInt("TA");
1745
2026
  if (input.has("overallStatus"))
1746
2027
  result.overallStatus = input.getInt("overallStatus");
1747
- } catch (JSONException ignored) {
2028
+ return result;
2029
+ } catch (JSONException e) {
2030
+ e.printStackTrace();
1748
2031
  }
1749
- return result;
2032
+ return null;
1750
2033
  }
1751
2034
 
1752
2035
  static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
1753
- DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
1754
2036
  try {
2037
+ DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
1755
2038
  if (input.has("fields")){
1756
- JSONArray jsonArray = input.getJSONArray("fields");
1757
- List<DocumentReaderBarcodeField> array = new ArrayList<>();
1758
- for (int i = 0; i < jsonArray.length(); i++)
1759
- array.add(DocumentReaderBarcodeFieldFromJSON(jsonArray.getJSONObject(i)));
1760
- result.fields = array;
2039
+ JSONArray jsonArray_fields = input.getJSONArray("fields");
2040
+ List<DocumentReaderBarcodeField> fields = new ArrayList<>();
2041
+ for (int i = 0; i < jsonArray_fields.length(); i++)
2042
+ fields.add(DocumentReaderBarcodeFieldFromJSON(jsonArray_fields.getJSONObject(i)));
2043
+ result.fields = fields;
1761
2044
  }
1762
- } catch (JSONException ignored) {
2045
+ return result;
2046
+ } catch (JSONException e) {
2047
+ e.printStackTrace();
1763
2048
  }
1764
- return result;
2049
+ return null;
1765
2050
  }
1766
2051
 
1767
2052
  static DocumentReaderBarcodeField DocumentReaderBarcodeFieldFromJSON(JSONObject input) {
1768
- DocumentReaderBarcodeField result = new DocumentReaderBarcodeField();
1769
2053
  try {
2054
+ DocumentReaderBarcodeField result = new DocumentReaderBarcodeField();
1770
2055
  if (input.has("barcodeType"))
1771
2056
  result.barcodeType = input.getInt("barcodeType");
1772
2057
  if (input.has("status"))
@@ -1776,49 +2061,120 @@ class JSONConstructor {
1776
2061
  if (input.has("pdf417Info"))
1777
2062
  result.pdf417Info = PDF417InfoFromJSON(input.getJSONObject("pdf417Info"));
1778
2063
  if (input.has("data")){
1779
- JSONArray jsonArray = input.getJSONArray("data");
1780
- byte[] array = new byte[jsonArray.length()];
1781
- for (int i = 0; i < jsonArray.length(); i++)
1782
- array[i] = (byte) jsonArray.get(i);
1783
- result.data = array;
2064
+ JSONArray jsonArray_data = input.getJSONArray("data");
2065
+ byte[] data = new byte[jsonArray_data.length()];
2066
+ for (int i = 0; i < jsonArray_data.length(); i++)
2067
+ data[i] = (byte) jsonArray_data.get(i);
2068
+ result.data = data;
1784
2069
  }
1785
- } catch (JSONException ignored) {
2070
+ return result;
2071
+ } catch (JSONException e) {
2072
+ e.printStackTrace();
1786
2073
  }
1787
- return result;
2074
+ return null;
1788
2075
  }
1789
2076
 
1790
2077
  static DocumentReaderAuthenticityResult DocumentReaderAuthenticityResultFromJSON(JSONObject input) {
1791
- DocumentReaderAuthenticityResult result = new DocumentReaderAuthenticityResult();
1792
2078
  try {
2079
+ DocumentReaderAuthenticityResult result = new DocumentReaderAuthenticityResult();
1793
2080
  if (input.has("checks")){
1794
- JSONArray jsonArray = input.getJSONArray("checks");
1795
- List<DocumentReaderAuthenticityCheck> array = new ArrayList<>();
1796
- for (int i = 0; i < jsonArray.length(); i++)
1797
- array.add(DocumentReaderAuthenticityCheckFromJSON(jsonArray.getJSONObject(i)));
1798
- result.checks = array;
2081
+ JSONArray jsonArray_checks = input.getJSONArray("checks");
2082
+ List<DocumentReaderAuthenticityCheck> checks = new ArrayList<>();
2083
+ for (int i = 0; i < jsonArray_checks.length(); i++)
2084
+ checks.add(DocumentReaderAuthenticityCheckFromJSON(jsonArray_checks.getJSONObject(i)));
2085
+ result.checks = checks;
1799
2086
  }
1800
- } catch (JSONException ignored) {
2087
+ return result;
2088
+ } catch (JSONException e) {
2089
+ e.printStackTrace();
1801
2090
  }
1802
- return result;
2091
+ return null;
1803
2092
  }
1804
2093
 
1805
2094
  static DocumentReaderAuthenticityElement DocumentReaderAuthenticityElementFromJSON(JSONObject input) {
1806
- DocumentReaderAuthenticityElement result = new DocumentReaderAuthenticityElement();
1807
2095
  try {
2096
+ DocumentReaderAuthenticityElement result = new DocumentReaderAuthenticityElement();
1808
2097
  if (input.has("status"))
1809
2098
  result.status = input.getInt("status");
1810
2099
  if (input.has("elementType"))
1811
2100
  result.elementType = input.getInt("elementType");
1812
2101
  if (input.has("elementDiagnose"))
1813
2102
  result.elementDiagnose = input.getInt("elementDiagnose");
1814
- } catch (JSONException ignored) {
2103
+ return result;
2104
+ } catch (JSONException e) {
2105
+ e.printStackTrace();
1815
2106
  }
1816
- return result;
2107
+ return null;
2108
+ }
2109
+
2110
+ static PAResourcesIssuer PAResourcesIssuerFromJSON(JSONObject input) {
2111
+ try {
2112
+ PAResourcesIssuer result = new PAResourcesIssuer();
2113
+ if (input.has("data")){
2114
+ JSONArray jsonArray_data = input.getJSONArray("data");
2115
+ byte[] data = new byte[jsonArray_data.length()];
2116
+ for (int i = 0; i < jsonArray_data.length(); i++)
2117
+ data[i] = (byte) jsonArray_data.get(i);
2118
+ result.data = data;
2119
+ }
2120
+ if (input.has("friendlyName"))
2121
+ result.friendlyName = input.getString("friendlyName");
2122
+ if (input.has("attributes")){
2123
+ JSONArray jsonArray_attributes = input.getJSONArray("attributes");
2124
+ PAAttribute[] attributes = new PAAttribute[jsonArray_attributes.length()];
2125
+ for (int i = 0; i < jsonArray_attributes.length(); i++)
2126
+ attributes[i] = PAAttributeFromJSON(jsonArray_attributes.getJSONObject(i));
2127
+ result.attributes = attributes;
2128
+ }
2129
+ return result;
2130
+ } catch (JSONException e) {
2131
+ e.printStackTrace();
2132
+ }
2133
+ return null;
2134
+ }
2135
+
2136
+ static PAAttribute PAAttributeFromJSON(JSONObject input) {
2137
+ try {
2138
+ PAAttribute result = new PAAttribute();
2139
+ if (input.has("type"))
2140
+ result.type = input.getString("type");
2141
+ if (input.has("value"))
2142
+ result.value = input.getString("value");
2143
+ return result;
2144
+ } catch (JSONException e) {
2145
+ e.printStackTrace();
2146
+ }
2147
+ return null;
2148
+ }
2149
+
2150
+ static TAChallenge TAChallengeFromJSON(JSONObject input) {
2151
+ try {
2152
+ TAChallenge result = new TAChallenge();
2153
+ if (input.has("data")){
2154
+ JSONArray jsonArray_data = input.getJSONArray("data");
2155
+ byte[] data = new byte[jsonArray_data.length()];
2156
+ for (int i = 0; i < jsonArray_data.length(); i++)
2157
+ data[i] = (byte) jsonArray_data.get(i);
2158
+ result.data = data;
2159
+ }
2160
+ if (input.has("auxPCD"))
2161
+ result.auxPCD = input.getString("auxPCD");
2162
+ if (input.has("challengePICC"))
2163
+ result.challengePICC = input.getString("challengePICC");
2164
+ if (input.has("hashPK"))
2165
+ result.hashPK = input.getString("hashPK");
2166
+ if (input.has("idPICC"))
2167
+ result.idPICC = input.getString("idPICC");
2168
+ return result;
2169
+ } catch (JSONException e) {
2170
+ e.printStackTrace();
2171
+ }
2172
+ return null;
1817
2173
  }
1818
2174
 
1819
2175
  static DocumentReaderResults DocumentReaderResultsFromJSON(JSONObject input) {
1820
- DocumentReaderResults result = new DocumentReaderResults();
1821
2176
  try {
2177
+ DocumentReaderResults result = new DocumentReaderResults();
1822
2178
  if (input.has("chipPage"))
1823
2179
  result.chipPage = input.getInt("chipPage");
1824
2180
  if (input.has("processingFinishedStatus"))
@@ -1838,32 +2194,32 @@ class JSONConstructor {
1838
2194
  if (input.has("textResult"))
1839
2195
  result.textResult = DocumentReaderTextResultFromJSON(input.getJSONObject("textResult"));
1840
2196
  if (input.has("documentPosition")){
1841
- JSONArray jsonArray = input.getJSONArray("documentPosition");
1842
- List<ElementPosition> array = new ArrayList<>();
1843
- for (int i = 0; i < jsonArray.length(); i++)
1844
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1845
- result.documentPosition = array;
2197
+ JSONArray jsonArray_documentPosition = input.getJSONArray("documentPosition");
2198
+ List<ElementPosition> documentPosition = new ArrayList<>();
2199
+ for (int i = 0; i < jsonArray_documentPosition.length(); i++)
2200
+ documentPosition.add(ElementPositionFromJSON(jsonArray_documentPosition.getJSONObject(i)));
2201
+ result.documentPosition = documentPosition;
1846
2202
  }
1847
2203
  if (input.has("barcodePosition")){
1848
- JSONArray jsonArray = input.getJSONArray("barcodePosition");
1849
- List<ElementPosition> array = new ArrayList<>();
1850
- for (int i = 0; i < jsonArray.length(); i++)
1851
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1852
- result.barcodePosition = array;
2204
+ JSONArray jsonArray_barcodePosition = input.getJSONArray("barcodePosition");
2205
+ List<ElementPosition> barcodePosition = new ArrayList<>();
2206
+ for (int i = 0; i < jsonArray_barcodePosition.length(); i++)
2207
+ barcodePosition.add(ElementPositionFromJSON(jsonArray_barcodePosition.getJSONObject(i)));
2208
+ result.barcodePosition = barcodePosition;
1853
2209
  }
1854
2210
  if (input.has("mrzPosition")){
1855
- JSONArray jsonArray = input.getJSONArray("mrzPosition");
1856
- List<ElementPosition> array = new ArrayList<>();
1857
- for (int i = 0; i < jsonArray.length(); i++)
1858
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1859
- result.mrzPosition = array;
2211
+ JSONArray jsonArray_mrzPosition = input.getJSONArray("mrzPosition");
2212
+ List<ElementPosition> mrzPosition = new ArrayList<>();
2213
+ for (int i = 0; i < jsonArray_mrzPosition.length(); i++)
2214
+ mrzPosition.add(ElementPositionFromJSON(jsonArray_mrzPosition.getJSONObject(i)));
2215
+ result.mrzPosition = mrzPosition;
1860
2216
  }
1861
2217
  if (input.has("imageQuality")){
1862
- JSONArray jsonArray = input.getJSONArray("imageQuality");
1863
- List<ImageQualityGroup> array = new ArrayList<>();
1864
- for (int i = 0; i < jsonArray.length(); i++)
1865
- array.add(ImageQualityGroupFromJSON(jsonArray.getJSONObject(i)));
1866
- result.imageQuality = array;
2218
+ JSONArray jsonArray_imageQuality = input.getJSONArray("imageQuality");
2219
+ List<ImageQualityGroup> imageQuality = new ArrayList<>();
2220
+ for (int i = 0; i < jsonArray_imageQuality.length(); i++)
2221
+ imageQuality.add(ImageQualityGroupFromJSON(jsonArray_imageQuality.getJSONObject(i)));
2222
+ result.imageQuality = imageQuality;
1867
2223
  }
1868
2224
  if (input.has("rawResult"))
1869
2225
  result.rawResult = input.getString("rawResult");
@@ -1876,14 +2232,16 @@ class JSONConstructor {
1876
2232
  if (input.has("barcodeResult"))
1877
2233
  result.barcodeResult = DocumentReaderBarcodeResultFromJSON(input.getJSONObject("barcodeResult"));
1878
2234
  if (input.has("documentType")){
1879
- JSONArray jsonArray = input.getJSONArray("documentType");
1880
- List<DocumentReaderDocumentType> array = new ArrayList<>();
1881
- for (int i = 0; i < jsonArray.length(); i++)
1882
- array.add(DocumentReaderDocumentTypeFromJSON(jsonArray.getJSONObject(i)));
1883
- result.documentType = array;
2235
+ JSONArray jsonArray_documentType = input.getJSONArray("documentType");
2236
+ List<DocumentReaderDocumentType> documentType = new ArrayList<>();
2237
+ for (int i = 0; i < jsonArray_documentType.length(); i++)
2238
+ documentType.add(DocumentReaderDocumentTypeFromJSON(jsonArray_documentType.getJSONObject(i)));
2239
+ result.documentType = documentType;
1884
2240
  }
1885
- } catch (JSONException ignored) {
2241
+ return result;
2242
+ } catch (JSONException e) {
2243
+ e.printStackTrace();
1886
2244
  }
1887
- return result;
2245
+ return null;
1888
2246
  }
1889
2247
  }