@regulaforensics/cordova-plugin-document-reader-api 5.5.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.
@@ -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
  }
@@ -529,7 +574,9 @@ class JSONConstructor {
529
574
  result.put("count", input.count);
530
575
  result.put("result", input.result);
531
576
  result.put("imageQualityList", generateList(input.imageQualityList, JSONConstructor::generateImageQuality));
532
- } catch (JSONException ignored) {
577
+ result.put("pageIndex", input.pageIndex);
578
+ } catch (JSONException e) {
579
+ e.printStackTrace();
533
580
  }
534
581
  return result;
535
582
  }
@@ -549,7 +596,8 @@ class JSONConstructor {
549
596
  result.put("dYear", input.dYear);
550
597
  result.put("dCountryName", input.dCountryName);
551
598
  result.put("FDSID", generateIntArray(input.FDSID));
552
- } catch (JSONException ignored) {
599
+ } catch (JSONException e) {
600
+ e.printStackTrace();
553
601
  }
554
602
  return result;
555
603
  }
@@ -561,7 +609,8 @@ class JSONConstructor {
561
609
  result.put("code", input.code & 0xFFFF0000);
562
610
  result.put("number", input.code & 0x0000FFFF);
563
611
  result.put("value", input.value);
564
- } catch (JSONException ignored) {
612
+ } catch (JSONException e) {
613
+ e.printStackTrace();
565
614
  }
566
615
  return result;
567
616
  }
@@ -574,7 +623,8 @@ class JSONConstructor {
574
623
  result.put("type", input.type);
575
624
  result.put("status", input.status);
576
625
  result.put("notifications", generateList(input.notifications));
577
- } catch (JSONException ignored) {
626
+ } catch (JSONException e) {
627
+ e.printStackTrace();
578
628
  }
579
629
  return result;
580
630
  }
@@ -587,7 +637,8 @@ class JSONConstructor {
587
637
  result.put("type", input.type);
588
638
  result.put("status", input.status);
589
639
  result.put("data", input.data);
590
- } catch (JSONException ignored) {
640
+ } catch (JSONException e) {
641
+ e.printStackTrace();
591
642
  }
592
643
  return result;
593
644
  }
@@ -598,7 +649,8 @@ class JSONConstructor {
598
649
  try {
599
650
  result.put("length", input.length);
600
651
  result.put("data", input.data);
601
- } catch (JSONException ignored) {
652
+ } catch (JSONException e) {
653
+ e.printStackTrace();
602
654
  }
603
655
  return result;
604
656
  }
@@ -608,7 +660,8 @@ class JSONConstructor {
608
660
  if (input == null) return result;
609
661
  try {
610
662
  result.put("securityObject", generateCertificateData(input.securityObject));
611
- } catch (JSONException ignored) {
663
+ } catch (JSONException e) {
664
+ e.printStackTrace();
612
665
  }
613
666
  return result;
614
667
  }
@@ -628,7 +681,8 @@ class JSONConstructor {
628
681
  result.put("docFieldsGraphics", generateList(input.docFieldsGraphics));
629
682
  result.put("docFieldsOriginals", generateList(input.docFieldsOriginals));
630
683
  result.put("notifications", generateList(input.notifications));
631
- } catch (JSONException ignored) {
684
+ } catch (JSONException e) {
685
+ e.printStackTrace();
632
686
  }
633
687
  return result;
634
688
  }
@@ -644,7 +698,8 @@ class JSONConstructor {
644
698
  result.put("unicodeVersion", input.unicodeVersion);
645
699
  result.put("version", input.version);
646
700
  result.put("files", generateList(input.files, JSONConstructor::generateFile));
647
- } catch (JSONException ignored) {
701
+ } catch (JSONException e) {
702
+ e.printStackTrace();
648
703
  }
649
704
  return result;
650
705
  }
@@ -658,7 +713,8 @@ class JSONConstructor {
658
713
  result.put("status", input.status);
659
714
  result.put("data", input.data);
660
715
  result.put("format", input.format);
661
- } catch (JSONException ignored) {
716
+ } catch (JSONException e) {
717
+ e.printStackTrace();
662
718
  }
663
719
  return result;
664
720
  }
@@ -669,7 +725,8 @@ class JSONConstructor {
669
725
  try {
670
726
  result.put("type", input.type);
671
727
  result.put("value", generateValue(input.value));
672
- } catch (JSONException ignored) {
728
+ } catch (JSONException e) {
729
+ e.printStackTrace();
673
730
  }
674
731
  return result;
675
732
  }
@@ -681,7 +738,8 @@ class JSONConstructor {
681
738
  result.put("data", input.data);
682
739
  result.put("friendlyName", generateValue(input.friendlyName));
683
740
  result.put("attributes", generateList(input.attributes, JSONConstructor::generateAttribute));
684
- } catch (JSONException ignored) {
741
+ } catch (JSONException e) {
742
+ e.printStackTrace();
685
743
  }
686
744
  return result;
687
745
  }
@@ -692,7 +750,8 @@ class JSONConstructor {
692
750
  try {
693
751
  result.put("data", input.data);
694
752
  result.put("type", input.type);
695
- } catch (JSONException ignored) {
753
+ } catch (JSONException e) {
754
+ e.printStackTrace();
696
755
  }
697
756
  return result;
698
757
  }
@@ -703,7 +762,8 @@ class JSONConstructor {
703
762
  try {
704
763
  result.put("notAfter", generateValue(input.notAfter));
705
764
  result.put("notBefore", generateValue(input.notBefore));
706
- } catch (JSONException ignored) {
765
+ } catch (JSONException e) {
766
+ e.printStackTrace();
707
767
  }
708
768
  return result;
709
769
  }
@@ -725,7 +785,8 @@ class JSONConstructor {
725
785
  result.put("subject", generateAuthority(input.subject));
726
786
  result.put("notifications", generateList(input.notifications));
727
787
  result.put("extensions", generateList(input.extensions, JSONConstructor::generateExtension));
728
- } catch (JSONException ignored) {
788
+ } catch (JSONException e) {
789
+ e.printStackTrace();
729
790
  }
730
791
  return result;
731
792
  }
@@ -746,7 +807,8 @@ class JSONConstructor {
746
807
  result.put("notifications", generateList(input.notifications));
747
808
  result.put("signedAttributes", generateList(input.signedAttributes, JSONConstructor::generateExtension));
748
809
  result.put("certificateChain", generateList(input.certificateChain, JSONConstructor::generateCertificateChain));
749
- } catch (JSONException ignored) {
810
+ } catch (JSONException e) {
811
+ e.printStackTrace();
750
812
  }
751
813
  return result;
752
814
  }
@@ -760,7 +822,8 @@ class JSONConstructor {
760
822
  result.put("objectType", input.objectType);
761
823
  result.put("notifications", generateList(input.notifications));
762
824
  result.put("signerInfos", generateList(input.signerInfos, JSONConstructor::generateSignerInfo));
763
- } catch (JSONException ignored) {
825
+ } catch (JSONException e) {
826
+ e.printStackTrace();
764
827
  }
765
828
  return result;
766
829
  }
@@ -783,7 +846,8 @@ class JSONConstructor {
783
846
  result.put("baudrate1", input.baudrate1);
784
847
  result.put("baudrate2", input.baudrate2);
785
848
  result.put("uID", input.uID);
786
- } catch (JSONException ignored) {
849
+ } catch (JSONException e) {
850
+ e.printStackTrace();
787
851
  }
788
852
  return result;
789
853
  }
@@ -802,7 +866,8 @@ class JSONConstructor {
802
866
  result.put("accessControls", generateList(input.accessControls, JSONConstructor::generateAccessControlProcedureType));
803
867
  result.put("applications", generateList(input.applications, JSONConstructor::generateApplication));
804
868
  result.put("securityObjects", generateList(input.securityObjects, JSONConstructor::generateSecurityObject));
805
- } catch (JSONException ignored) {
869
+ } catch (JSONException e) {
870
+ e.printStackTrace();
806
871
  }
807
872
  return result;
808
873
  }
@@ -816,7 +881,8 @@ class JSONConstructor {
816
881
  result.put("typeName", input.getTypeName(context));
817
882
  result.put("pageIndex", input.pageIndex);
818
883
  result.put("elements", generateList(input.elements, JSONConstructor::generateDocumentReaderAuthenticityElement, context));
819
- } catch (JSONException ignored) {
884
+ } catch (JSONException e) {
885
+ e.printStackTrace();
820
886
  }
821
887
  return result;
822
888
  }
@@ -828,7 +894,8 @@ class JSONConstructor {
828
894
  result.put("errorLevel", input.errorLevel);
829
895
  result.put("columns", input.columns);
830
896
  result.put("rows", input.rows);
831
- } catch (JSONException ignored) {
897
+ } catch (JSONException e) {
898
+ e.printStackTrace();
832
899
  }
833
900
  return result;
834
901
  }
@@ -844,7 +911,8 @@ class JSONConstructor {
844
911
  result.put("PACE", input.PACE);
845
912
  result.put("TA", input.TA);
846
913
  result.put("overallStatus", input.overallStatus);
847
- } catch (JSONException ignored) {
914
+ } catch (JSONException e) {
915
+ e.printStackTrace();
848
916
  }
849
917
  return result;
850
918
  }
@@ -854,7 +922,8 @@ class JSONConstructor {
854
922
  if (input == null) return result;
855
923
  try {
856
924
  result.put("fields", generateList(input.fields, JSONConstructor::generateDocumentReaderBarcodeField));
857
- } catch (JSONException ignored) {
925
+ } catch (JSONException e) {
926
+ e.printStackTrace();
858
927
  }
859
928
  return result;
860
929
  }
@@ -868,7 +937,8 @@ class JSONConstructor {
868
937
  result.put("pageIndex", input.pageIndex);
869
938
  result.put("pdf417Info", generatePDF417Info(input.pdf417Info));
870
939
  result.put("data", generateByteArray(input.data));
871
- } catch (JSONException ignored) {
940
+ } catch (JSONException e) {
941
+ e.printStackTrace();
872
942
  }
873
943
  return result;
874
944
  }
@@ -879,7 +949,8 @@ class JSONConstructor {
879
949
  try {
880
950
  result.put("status", input.getStatus());
881
951
  result.put("checks", generateList(input.checks, JSONConstructor::generateDocumentReaderAuthenticityCheck, context));
882
- } catch (JSONException ignored) {
952
+ } catch (JSONException e) {
953
+ e.printStackTrace();
883
954
  }
884
955
  return result;
885
956
  }
@@ -893,7 +964,23 @@ class JSONConstructor {
893
964
  result.put("elementDiagnose", input.elementDiagnose);
894
965
  result.put("elementTypeName", input.getElementTypeName(context));
895
966
  result.put("elementDiagnoseName", input.getElementDiagnoseName(context));
896
- } 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();
897
984
  }
898
985
  return result;
899
986
  }
@@ -906,7 +993,8 @@ class JSONConstructor {
906
993
  result.put("message", input.getMessage());
907
994
  result.put("string", input.toString());
908
995
  result.put("stackTrace", generateArray(input.getStackTrace(), JSONConstructor::generateStackTraceElement));
909
- } catch (JSONException ignored) {
996
+ } catch (JSONException e) {
997
+ e.printStackTrace();
910
998
  }
911
999
  return result;
912
1000
  }
@@ -921,7 +1009,134 @@ class JSONConstructor {
921
1009
  result.put("fileName", input.getFileName());
922
1010
  result.put("methodName", input.getMethodName());
923
1011
  result.put("string", input.toString());
924
- } 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();
925
1140
  }
926
1141
  return result;
927
1142
  }
@@ -950,7 +1165,10 @@ class JSONConstructor {
950
1165
  result.put("authenticityResult", generateDocumentReaderAuthenticityResult(input.authenticityResult, context));
951
1166
  result.put("barcodeResult", generateDocumentReaderBarcodeResult(input.barcodeResult));
952
1167
  result.put("documentType", generateList(input.documentType, JSONConstructor::generateDocumentReaderDocumentType));
953
- } catch (JSONException ignored) {
1168
+ result.put("status", generateDocumentReaderResultsStatus(input.status));
1169
+ result.put("vdsncData", generateVDSNCData(input.vdsncData));
1170
+ } catch (JSONException e) {
1171
+ e.printStackTrace();
954
1172
  }
955
1173
  return result;
956
1174
  }
@@ -958,26 +1176,24 @@ class JSONConstructor {
958
1176
  // From JSON
959
1177
 
960
1178
  static DocumentReaderScenario DocumentReaderScenarioFromJSON(JSONObject input) {
961
- DocumentReaderScenario result = new DocumentReaderScenario();
962
1179
  try {
963
- if (input.has("uvTorch"))
964
- result.uvTorch = input.getBoolean("uvTorch");
965
- if (input.has("seriesProcessMode"))
966
- result.seriesProcessMode = input.getBoolean("seriesProcessMode");
1180
+ DocumentReaderScenario result = new DocumentReaderScenario();
967
1181
  if (input.has("name"))
968
1182
  result.name = input.getString("name");
969
1183
  if (input.has("caption"))
970
1184
  result.caption = input.getString("caption");
971
1185
  if (input.has("description"))
972
1186
  result.description = input.getString("description");
973
- } catch (JSONException ignored) {
1187
+ return result;
1188
+ } catch (JSONException e) {
1189
+ e.printStackTrace();
974
1190
  }
975
- return result;
1191
+ return null;
976
1192
  }
977
1193
 
978
- static DocumentReaderScenarioFull DocumentReaderScenarioFullFromJSON(JSONObject input) {
979
- DocumentReaderScenarioFull result = new DocumentReaderScenarioFull();
1194
+ static CoreDetailedScenario CoreDetailedScenarioFromJSON(JSONObject input) {
980
1195
  try {
1196
+ CoreDetailedScenario result = new CoreDetailedScenario();
981
1197
  if (input.has("uvTorch"))
982
1198
  result.uvTorch = input.getBoolean("uvTorch");
983
1199
  if (input.has("frameOrientation"))
@@ -1004,28 +1220,32 @@ class JSONConstructor {
1004
1220
  result.description = input.getString("description");
1005
1221
  if (input.has("manualCrop"))
1006
1222
  result.manualCrop = input.getBoolean("manualCrop");
1007
- } catch (JSONException ignored) {
1223
+ return result;
1224
+ } catch (JSONException e) {
1225
+ e.printStackTrace();
1008
1226
  }
1009
- return result;
1227
+ return null;
1010
1228
  }
1011
1229
 
1012
1230
  static FaceMetaData FaceMetaDataFromJSON(JSONObject input) {
1013
- FaceMetaData result = new FaceMetaData();
1014
1231
  try {
1232
+ FaceMetaData result = new FaceMetaData();
1015
1233
  if (input.has("ID"))
1016
1234
  result.ID = input.getInt("ID");
1017
1235
  if (input.has("rollAngle"))
1018
1236
  result.rollAngle = input.getInt("rollAngle");
1019
1237
  if (input.has("bounds"))
1020
1238
  result.bounds = BoundsFromJSON(input.getJSONObject("bounds"));
1021
- } catch (JSONException ignored) {
1239
+ return result;
1240
+ } catch (JSONException e) {
1241
+ e.printStackTrace();
1022
1242
  }
1023
- return result;
1243
+ return null;
1024
1244
  }
1025
1245
 
1026
1246
  static Bounds BoundsFromJSON(JSONObject input) {
1027
- Bounds result = new Bounds();
1028
1247
  try {
1248
+ Bounds result = new Bounds();
1029
1249
  if (input.has("x"))
1030
1250
  result.x = input.getInt("x");
1031
1251
  if (input.has("y"))
@@ -1034,14 +1254,16 @@ class JSONConstructor {
1034
1254
  result.width = input.getInt("width");
1035
1255
  if (input.has("height"))
1036
1256
  result.height = input.getInt("height");
1037
- } catch (JSONException ignored) {
1257
+ return result;
1258
+ } catch (JSONException e) {
1259
+ e.printStackTrace();
1038
1260
  }
1039
- return result;
1261
+ return null;
1040
1262
  }
1041
1263
 
1042
1264
  static Rect RectFromJSON(JSONObject input) {
1043
- Rect result = new Rect();
1044
1265
  try {
1266
+ Rect result = new Rect();
1045
1267
  if (input.has("bottom"))
1046
1268
  result.bottom = input.getInt("bottom");
1047
1269
  if (input.has("top"))
@@ -1050,14 +1272,16 @@ class JSONConstructor {
1050
1272
  result.left = input.getInt("left");
1051
1273
  if (input.has("right"))
1052
1274
  result.right = input.getInt("right");
1053
- } catch (JSONException ignored) {
1275
+ return result;
1276
+ } catch (JSONException e) {
1277
+ e.printStackTrace();
1054
1278
  }
1055
- return result;
1279
+ return null;
1056
1280
  }
1057
1281
 
1058
1282
  static DocReaderFieldRect DocReaderFieldRectFromJSON(JSONObject input) {
1059
- DocReaderFieldRect result = new DocReaderFieldRect();
1060
1283
  try {
1284
+ DocReaderFieldRect result = new DocReaderFieldRect();
1061
1285
  if (input.has("bottom"))
1062
1286
  result.bottom = input.getInt("bottom");
1063
1287
  if (input.has("top"))
@@ -1066,14 +1290,16 @@ class JSONConstructor {
1066
1290
  result.left = input.getInt("left");
1067
1291
  if (input.has("right"))
1068
1292
  result.right = input.getInt("right");
1069
- } catch (JSONException ignored) {
1293
+ return result;
1294
+ } catch (JSONException e) {
1295
+ e.printStackTrace();
1070
1296
  }
1071
- return result;
1297
+ return null;
1072
1298
  }
1073
1299
 
1074
1300
  static DocumentReaderGraphicField DocumentReaderGraphicFieldFromJSON(JSONObject input) {
1075
- DocumentReaderGraphicField result = new DocumentReaderGraphicField();
1076
1301
  try {
1302
+ DocumentReaderGraphicField result = new DocumentReaderGraphicField();
1077
1303
  if (input.has("sourceType"))
1078
1304
  result.sourceType = input.getInt("sourceType");
1079
1305
  if (input.has("fieldType"))
@@ -1084,29 +1310,33 @@ class JSONConstructor {
1084
1310
  result.pageIndex = input.getInt("pageIndex");
1085
1311
  if (input.has("fieldRect"))
1086
1312
  result.boundRect = DocReaderFieldRectFromJSON(input.getJSONObject("fieldRect"));
1087
- } catch (JSONException ignored) {
1313
+ return result;
1314
+ } catch (JSONException e) {
1315
+ e.printStackTrace();
1088
1316
  }
1089
- return result;
1317
+ return null;
1090
1318
  }
1091
1319
 
1092
1320
  static DocumentReaderGraphicResult DocumentReaderGraphicResultFromJSON(JSONObject input) {
1093
- DocumentReaderGraphicResult result = new DocumentReaderGraphicResult();
1094
1321
  try {
1322
+ DocumentReaderGraphicResult result = new DocumentReaderGraphicResult();
1095
1323
  if (input.has("fields")){
1096
- JSONArray jsonArray = input.getJSONArray("fields");
1097
- List<DocumentReaderGraphicField> array = new ArrayList<>();
1098
- for (int i = 0; i < jsonArray.length(); i++)
1099
- array.add(DocumentReaderGraphicFieldFromJSON(jsonArray.getJSONObject(i)));
1100
- 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;
1101
1329
  }
1102
- } catch (JSONException ignored) {
1330
+ return result;
1331
+ } catch (JSONException e) {
1332
+ e.printStackTrace();
1103
1333
  }
1104
- return result;
1334
+ return null;
1105
1335
  }
1106
1336
 
1107
1337
  static DocumentReaderValue DocumentReaderValueFromJSON(JSONObject input) {
1108
- DocumentReaderValue result = new DocumentReaderValue();
1109
1338
  try {
1339
+ DocumentReaderValue result = new DocumentReaderValue();
1110
1340
  if (input.has("pageIndex"))
1111
1341
  result.pageIndex = input.getInt("pageIndex");
1112
1342
  if (input.has("sourceType"))
@@ -1121,14 +1351,16 @@ class JSONConstructor {
1121
1351
  result.originalValue = input.getString("originalValue");
1122
1352
  if (input.has("boundRect"))
1123
1353
  result.boundRect = RectFromJSON(input.getJSONObject("boundRect"));
1124
- } catch (JSONException ignored) {
1354
+ return result;
1355
+ } catch (JSONException e) {
1356
+ e.printStackTrace();
1125
1357
  }
1126
- return result;
1358
+ return null;
1127
1359
  }
1128
1360
 
1129
1361
  static DocumentReaderTextField DocumentReaderTextFieldFromJSON(JSONObject input) {
1130
- DocumentReaderTextField result = new DocumentReaderTextField();
1131
1362
  try {
1363
+ DocumentReaderTextField result = new DocumentReaderTextField();
1132
1364
  if (input.has("fieldType"))
1133
1365
  result.fieldType = input.getInt("fieldType");
1134
1366
  if (input.has("lcid"))
@@ -1136,49 +1368,55 @@ class JSONConstructor {
1136
1368
  if (input.has("status"))
1137
1369
  result.status = input.getInt("status");
1138
1370
  if (input.has("values")){
1139
- JSONArray jsonArray = input.getJSONArray("values");
1140
- List<DocumentReaderValue> array = new ArrayList<>();
1141
- for (int i = 0; i < jsonArray.length(); i++)
1142
- array.add(DocumentReaderValueFromJSON(jsonArray.getJSONObject(i)));
1143
- 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;
1144
1376
  }
1145
- } catch (JSONException ignored) {
1377
+ return result;
1378
+ } catch (JSONException e) {
1379
+ e.printStackTrace();
1146
1380
  }
1147
- return result;
1381
+ return null;
1148
1382
  }
1149
1383
 
1150
1384
  static DocumentReaderTextResult DocumentReaderTextResultFromJSON(JSONObject input) {
1151
- DocumentReaderTextResult result = new DocumentReaderTextResult();
1152
1385
  try {
1386
+ DocumentReaderTextResult result = new DocumentReaderTextResult();
1153
1387
  if (input.has("status"))
1154
1388
  result.status = input.getInt("status");
1155
1389
  if (input.has("fields")){
1156
- JSONArray jsonArray = input.getJSONArray("fields");
1157
- List<DocumentReaderTextField> array = new ArrayList<>();
1158
- for (int i = 0; i < jsonArray.length(); i++)
1159
- array.add(DocumentReaderTextFieldFromJSON(jsonArray.getJSONObject(i)));
1160
- 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;
1161
1395
  }
1162
- } catch (JSONException ignored) {
1396
+ return result;
1397
+ } catch (JSONException e) {
1398
+ e.printStackTrace();
1163
1399
  }
1164
- return result;
1400
+ return null;
1165
1401
  }
1166
1402
 
1167
1403
  static Coordinate CoordinateFromJSON(JSONObject input) {
1168
- Coordinate result = new Coordinate();
1169
1404
  try {
1405
+ Coordinate result = new Coordinate();
1170
1406
  if (input.has("x"))
1171
1407
  result.x = input.getInt("x");
1172
1408
  if (input.has("y"))
1173
1409
  result.y = input.getInt("y");
1174
- } catch (JSONException ignored) {
1410
+ return result;
1411
+ } catch (JSONException e) {
1412
+ e.printStackTrace();
1175
1413
  }
1176
- return result;
1414
+ return null;
1177
1415
  }
1178
1416
 
1179
1417
  static ElementPosition ElementPositionFromJSON(JSONObject input) {
1180
- ElementPosition result = new ElementPosition();
1181
1418
  try {
1419
+ ElementPosition result = new ElementPosition();
1182
1420
  if (input.has("docFormat"))
1183
1421
  result.docFormat = input.getInt("docFormat");
1184
1422
  if (input.has("width"))
@@ -1211,47 +1449,55 @@ class JSONConstructor {
1211
1449
  result.rightTop = CoordinateFromJSON(input.getJSONObject("rightTop"));
1212
1450
  if (input.has("rightBottom"))
1213
1451
  result.rightBottom = CoordinateFromJSON(input.getJSONObject("rightBottom"));
1214
- } catch (JSONException ignored) {
1452
+ return result;
1453
+ } catch (JSONException e) {
1454
+ e.printStackTrace();
1215
1455
  }
1216
- return result;
1456
+ return null;
1217
1457
  }
1218
1458
 
1219
1459
  static ImageQuality ImageQualityFromJSON(JSONObject input) {
1220
- ImageQuality result = new ImageQuality();
1221
1460
  try {
1461
+ ImageQuality result = new ImageQuality();
1222
1462
  if (input.has("featureType"))
1223
1463
  result.featureType = input.getInt("featureType");
1224
1464
  if (input.has("result"))
1225
1465
  result.result = input.getInt("result");
1226
1466
  if (input.has("type"))
1227
1467
  result.type = input.getInt("type");
1228
- } catch (JSONException ignored) {
1468
+ return result;
1469
+ } catch (JSONException e) {
1470
+ e.printStackTrace();
1229
1471
  }
1230
- return result;
1472
+ return null;
1231
1473
  }
1232
1474
 
1233
1475
  static ImageQualityGroup ImageQualityGroupFromJSON(JSONObject input) {
1234
- ImageQualityGroup result = new ImageQualityGroup();
1235
1476
  try {
1477
+ ImageQualityGroup result = new ImageQualityGroup();
1236
1478
  if (input.has("count"))
1237
1479
  result.count = input.getInt("count");
1238
1480
  if (input.has("result"))
1239
1481
  result.result = input.getInt("result");
1240
1482
  if (input.has("imageQualityList")){
1241
- JSONArray jsonArray = input.getJSONArray("imageQualityList");
1242
- List<ImageQuality> array = new ArrayList<>();
1243
- for (int i = 0; i < jsonArray.length(); i++)
1244
- array.add(ImageQualityFromJSON(jsonArray.getJSONObject(i)));
1245
- 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;
1246
1488
  }
1247
- } catch (JSONException ignored) {
1489
+ if (input.has("pageIndex"))
1490
+ result.pageIndex = input.getInt("pageIndex");
1491
+ return result;
1492
+ } catch (JSONException e) {
1493
+ e.printStackTrace();
1248
1494
  }
1249
- return result;
1495
+ return null;
1250
1496
  }
1251
1497
 
1252
1498
  static DocumentReaderDocumentType DocumentReaderDocumentTypeFromJSON(JSONObject input) {
1253
- DocumentReaderDocumentType result = new DocumentReaderDocumentType();
1254
1499
  try {
1500
+ DocumentReaderDocumentType result = new DocumentReaderDocumentType();
1255
1501
  if (input.has("pageIndex"))
1256
1502
  result.pageIndex = input.getInt("pageIndex");
1257
1503
  if (input.has("documentID"))
@@ -1273,20 +1519,22 @@ class JSONConstructor {
1273
1519
  if (input.has("dCountryName"))
1274
1520
  result.dCountryName = input.getString("dCountryName");
1275
1521
  if (input.has("FDSID")){
1276
- JSONArray jsonArray = input.getJSONArray("FDSID");
1277
- int[] array = new int[jsonArray.length()];
1278
- for (int i = 0; i < jsonArray.length(); i++)
1279
- array[i] = jsonArray.getInt(i);
1280
- 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;
1281
1527
  }
1282
- } catch (JSONException ignored) {
1528
+ return result;
1529
+ } catch (JSONException e) {
1530
+ e.printStackTrace();
1283
1531
  }
1284
- return result;
1532
+ return null;
1285
1533
  }
1286
1534
 
1287
1535
  static AccessControlProcedureType AccessControlProcedureTypeFromJSON(JSONObject input) {
1288
- AccessControlProcedureType result = new AccessControlProcedureType();
1289
1536
  try {
1537
+ AccessControlProcedureType result = new AccessControlProcedureType();
1290
1538
  if (input.has("activeOptionIdx"))
1291
1539
  result.activeOptionIdx = input.getInt("activeOptionIdx");
1292
1540
  if (input.has("type"))
@@ -1294,20 +1542,22 @@ class JSONConstructor {
1294
1542
  if (input.has("status"))
1295
1543
  result.status = input.getInt("status");
1296
1544
  if (input.has("notifications")){
1297
- JSONArray jsonArray = input.getJSONArray("notifications");
1298
- List<Long> array = new ArrayList<>();
1299
- for (int i = 0; i < jsonArray.length(); i++)
1300
- array.add(jsonArray.getLong(i));
1301
- 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;
1302
1550
  }
1303
- } catch (JSONException ignored) {
1551
+ return result;
1552
+ } catch (JSONException e) {
1553
+ e.printStackTrace();
1304
1554
  }
1305
- return result;
1555
+ return null;
1306
1556
  }
1307
1557
 
1308
1558
  static FileData FileDataFromJSON(JSONObject input) {
1309
- FileData result = new FileData();
1310
1559
  try {
1560
+ FileData result = new FileData();
1311
1561
  if (input.has("length"))
1312
1562
  result.length = input.getInt("length");
1313
1563
  if (input.has("type"))
@@ -1316,36 +1566,42 @@ class JSONConstructor {
1316
1566
  result.status = input.getInt("status");
1317
1567
  if (input.has("data"))
1318
1568
  result.data = input.getString("data");
1319
- } catch (JSONException ignored) {
1569
+ return result;
1570
+ } catch (JSONException e) {
1571
+ e.printStackTrace();
1320
1572
  }
1321
- return result;
1573
+ return null;
1322
1574
  }
1323
1575
 
1324
1576
  static CertificateData CertificateDataFromJSON(JSONObject input) {
1325
- CertificateData result = new CertificateData();
1326
1577
  try {
1578
+ CertificateData result = new CertificateData();
1327
1579
  if (input.has("length"))
1328
1580
  result.length = input.getInt("length");
1329
1581
  if (input.has("data"))
1330
1582
  result.data = input.getString("data");
1331
- } catch (JSONException ignored) {
1583
+ return result;
1584
+ } catch (JSONException e) {
1585
+ e.printStackTrace();
1332
1586
  }
1333
- return result;
1587
+ return null;
1334
1588
  }
1335
1589
 
1336
1590
  static SecurityObjectCertificates SecurityObjectCertificatesFromJSON(JSONObject input) {
1337
- SecurityObjectCertificates result = new SecurityObjectCertificates();
1338
1591
  try {
1592
+ SecurityObjectCertificates result = new SecurityObjectCertificates();
1339
1593
  if (input.has("securityObject"))
1340
1594
  result.securityObject = CertificateDataFromJSON(input.getJSONObject("securityObject"));
1341
- } catch (JSONException ignored) {
1595
+ return result;
1596
+ } catch (JSONException e) {
1597
+ e.printStackTrace();
1342
1598
  }
1343
- return result;
1599
+ return null;
1344
1600
  }
1345
1601
 
1346
1602
  static File FileFromJSON(JSONObject input) {
1347
- File result = new File();
1348
1603
  try {
1604
+ File result = new File();
1349
1605
  if (input.has("readingTime"))
1350
1606
  result.readingTime = input.getInt("readingTime");
1351
1607
  if (input.has("type"))
@@ -1361,41 +1617,43 @@ class JSONConstructor {
1361
1617
  if (input.has("certificates"))
1362
1618
  result.certificates = SecurityObjectCertificatesFromJSON(input.getJSONObject("certificates"));
1363
1619
  if (input.has("docFieldsText")){
1364
- JSONArray jsonArray = input.getJSONArray("docFieldsText");
1365
- List<Integer> array = new ArrayList<>();
1366
- for (int i = 0; i < jsonArray.length(); i++)
1367
- array.add(jsonArray.getInt(i));
1368
- 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;
1369
1625
  }
1370
1626
  if (input.has("docFieldsGraphics")){
1371
- JSONArray jsonArray = input.getJSONArray("docFieldsGraphics");
1372
- List<Integer> array = new ArrayList<>();
1373
- for (int i = 0; i < jsonArray.length(); i++)
1374
- array.add(jsonArray.getInt(i));
1375
- 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;
1376
1632
  }
1377
1633
  if (input.has("docFieldsOriginals")){
1378
- JSONArray jsonArray = input.getJSONArray("docFieldsOriginals");
1379
- List<Integer> array = new ArrayList<>();
1380
- for (int i = 0; i < jsonArray.length(); i++)
1381
- array.add(jsonArray.getInt(i));
1382
- 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;
1383
1639
  }
1384
1640
  if (input.has("notifications")){
1385
- JSONArray jsonArray = input.getJSONArray("notifications");
1386
- List<Long> array = new ArrayList<>();
1387
- for (int i = 0; i < jsonArray.length(); i++)
1388
- array.add(jsonArray.getLong(i));
1389
- 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;
1390
1646
  }
1391
- } catch (JSONException ignored) {
1647
+ return result;
1648
+ } catch (JSONException e) {
1649
+ e.printStackTrace();
1392
1650
  }
1393
- return result;
1651
+ return null;
1394
1652
  }
1395
1653
 
1396
1654
  static Application ApplicationFromJSON(JSONObject input) {
1397
- Application result = new Application();
1398
1655
  try {
1656
+ Application result = new Application();
1399
1657
  if (input.has("type"))
1400
1658
  result.type = input.getInt("type");
1401
1659
  if (input.has("status"))
@@ -1409,20 +1667,22 @@ class JSONConstructor {
1409
1667
  if (input.has("version"))
1410
1668
  result.version = input.getString("version");
1411
1669
  if (input.has("files")){
1412
- JSONArray jsonArray = input.getJSONArray("files");
1413
- List<File> array = new ArrayList<>();
1414
- for (int i = 0; i < jsonArray.length(); i++)
1415
- array.add(FileFromJSON(jsonArray.getJSONObject(i)));
1416
- 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;
1417
1675
  }
1418
- } catch (JSONException ignored) {
1676
+ return result;
1677
+ } catch (JSONException e) {
1678
+ e.printStackTrace();
1419
1679
  }
1420
- return result;
1680
+ return null;
1421
1681
  }
1422
1682
 
1423
1683
  static Value ValueFromJSON(JSONObject input) {
1424
- Value result = new Value();
1425
1684
  try {
1685
+ Value result = new Value();
1426
1686
  if (input.has("length"))
1427
1687
  result.length = input.getInt("length");
1428
1688
  if (input.has("type"))
@@ -1433,69 +1693,79 @@ class JSONConstructor {
1433
1693
  result.data = input.getString("data");
1434
1694
  if (input.has("format"))
1435
1695
  result.format = input.getString("format");
1436
- } catch (JSONException ignored) {
1696
+ return result;
1697
+ } catch (JSONException e) {
1698
+ e.printStackTrace();
1437
1699
  }
1438
- return result;
1700
+ return null;
1439
1701
  }
1440
1702
 
1441
1703
  static Attribute AttributeFromJSON(JSONObject input) {
1442
- Attribute result = new Attribute();
1443
1704
  try {
1705
+ Attribute result = new Attribute();
1444
1706
  if (input.has("type"))
1445
1707
  result.type = input.getString("type");
1446
1708
  if (input.has("value"))
1447
1709
  result.value = ValueFromJSON(input.getJSONObject("value"));
1448
- } catch (JSONException ignored) {
1710
+ return result;
1711
+ } catch (JSONException e) {
1712
+ e.printStackTrace();
1449
1713
  }
1450
- return result;
1714
+ return null;
1451
1715
  }
1452
1716
 
1453
1717
  static Authority AuthorityFromJSON(JSONObject input) {
1454
- Authority result = new Authority();
1455
1718
  try {
1719
+ Authority result = new Authority();
1456
1720
  if (input.has("data"))
1457
1721
  result.data = input.getString("data");
1458
1722
  if (input.has("friendlyName"))
1459
1723
  result.friendlyName = ValueFromJSON(input.getJSONObject("friendlyName"));
1460
1724
  if (input.has("attributes")){
1461
- JSONArray jsonArray = input.getJSONArray("attributes");
1462
- List<Attribute> array = new ArrayList<>();
1463
- for (int i = 0; i < jsonArray.length(); i++)
1464
- array.add(AttributeFromJSON(jsonArray.getJSONObject(i)));
1465
- 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;
1466
1730
  }
1467
- } catch (JSONException ignored) {
1731
+ return result;
1732
+ } catch (JSONException e) {
1733
+ e.printStackTrace();
1468
1734
  }
1469
- return result;
1735
+ return null;
1470
1736
  }
1471
1737
 
1472
1738
  static Extension ExtensionFromJSON(JSONObject input) {
1473
- Extension result = new Extension();
1474
1739
  try {
1740
+ Extension result = new Extension();
1475
1741
  if (input.has("data"))
1476
1742
  result.data = input.getString("data");
1477
1743
  if (input.has("type"))
1478
1744
  result.type = input.getString("type");
1479
- } catch (JSONException ignored) {
1745
+ return result;
1746
+ } catch (JSONException e) {
1747
+ e.printStackTrace();
1480
1748
  }
1481
- return result;
1749
+ return null;
1482
1750
  }
1483
1751
 
1484
1752
  static Validity ValidityFromJSON(JSONObject input) {
1485
- Validity result = new Validity();
1486
1753
  try {
1754
+ Validity result = new Validity();
1487
1755
  if (input.has("notAfter"))
1488
1756
  result.notAfter = ValueFromJSON(input.getJSONObject("notAfter"));
1489
1757
  if (input.has("notBefore"))
1490
1758
  result.notBefore = ValueFromJSON(input.getJSONObject("notBefore"));
1491
- } catch (JSONException ignored) {
1759
+ return result;
1760
+ } catch (JSONException e) {
1761
+ e.printStackTrace();
1492
1762
  }
1493
- return result;
1763
+ return null;
1494
1764
  }
1495
1765
 
1496
1766
  static CertificateChain CertificateChainFromJSON(JSONObject input) {
1497
- CertificateChain result = new CertificateChain();
1498
1767
  try {
1768
+ CertificateChain result = new CertificateChain();
1499
1769
  if (input.has("origin"))
1500
1770
  result.origin = input.getInt("origin");
1501
1771
  if (input.has("type"))
@@ -1519,27 +1789,29 @@ class JSONConstructor {
1519
1789
  if (input.has("subject"))
1520
1790
  result.subject = AuthorityFromJSON(input.getJSONObject("subject"));
1521
1791
  if (input.has("notifications")){
1522
- JSONArray jsonArray = input.getJSONArray("notifications");
1523
- List<Long> array = new ArrayList<>();
1524
- for (int i = 0; i < jsonArray.length(); i++)
1525
- array.add(jsonArray.getLong(i));
1526
- 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;
1527
1797
  }
1528
1798
  if (input.has("extensions")){
1529
- JSONArray jsonArray = input.getJSONArray("extensions");
1530
- List<Extension> array = new ArrayList<>();
1531
- for (int i = 0; i < jsonArray.length(); i++)
1532
- array.add(ExtensionFromJSON(jsonArray.getJSONObject(i)));
1533
- 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;
1534
1804
  }
1535
- } catch (JSONException ignored) {
1805
+ return result;
1806
+ } catch (JSONException e) {
1807
+ e.printStackTrace();
1536
1808
  }
1537
- return result;
1809
+ return null;
1538
1810
  }
1539
1811
 
1540
1812
  static SignerInfo SignerInfoFromJSON(JSONObject input) {
1541
- SignerInfo result = new SignerInfo();
1542
1813
  try {
1814
+ SignerInfo result = new SignerInfo();
1543
1815
  if (input.has("version"))
1544
1816
  result.version = input.getInt("version");
1545
1817
  if (input.has("paStatus"))
@@ -1559,34 +1831,36 @@ class JSONConstructor {
1559
1831
  if (input.has("issuer"))
1560
1832
  result.issuer = AuthorityFromJSON(input.getJSONObject("issuer"));
1561
1833
  if (input.has("notifications")){
1562
- JSONArray jsonArray = input.getJSONArray("notifications");
1563
- List<Long> array = new ArrayList<>();
1564
- for (int i = 0; i < jsonArray.length(); i++)
1565
- array.add(jsonArray.getLong(i));
1566
- 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;
1567
1839
  }
1568
1840
  if (input.has("signedAttributes")){
1569
- JSONArray jsonArray = input.getJSONArray("signedAttributes");
1570
- List<Extension> array = new ArrayList<>();
1571
- for (int i = 0; i < jsonArray.length(); i++)
1572
- array.add(ExtensionFromJSON(jsonArray.getJSONObject(i)));
1573
- 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;
1574
1846
  }
1575
1847
  if (input.has("certificateChain")){
1576
- JSONArray jsonArray = input.getJSONArray("certificateChain");
1577
- List<CertificateChain> array = new ArrayList<>();
1578
- for (int i = 0; i < jsonArray.length(); i++)
1579
- array.add(CertificateChainFromJSON(jsonArray.getJSONObject(i)));
1580
- 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;
1581
1853
  }
1582
- } catch (JSONException ignored) {
1854
+ return result;
1855
+ } catch (JSONException e) {
1856
+ e.printStackTrace();
1583
1857
  }
1584
- return result;
1858
+ return null;
1585
1859
  }
1586
1860
 
1587
1861
  static SecurityObject SecurityObjectFromJSON(JSONObject input) {
1588
- SecurityObject result = new SecurityObject();
1589
1862
  try {
1863
+ SecurityObject result = new SecurityObject();
1590
1864
  if (input.has("fileReference"))
1591
1865
  result.fileReference = input.getInt("fileReference");
1592
1866
  if (input.has("version"))
@@ -1594,27 +1868,29 @@ class JSONConstructor {
1594
1868
  if (input.has("objectType"))
1595
1869
  result.objectType = input.getString("objectType");
1596
1870
  if (input.has("notifications")){
1597
- JSONArray jsonArray = input.getJSONArray("notifications");
1598
- List<Long> array = new ArrayList<>();
1599
- for (int i = 0; i < jsonArray.length(); i++)
1600
- array.add(jsonArray.getLong(i));
1601
- 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;
1602
1876
  }
1603
1877
  if (input.has("signerInfos")){
1604
- JSONArray jsonArray = input.getJSONArray("signerInfos");
1605
- List<SignerInfo> array = new ArrayList<>();
1606
- for (int i = 0; i < jsonArray.length(); i++)
1607
- array.add(SignerInfoFromJSON(jsonArray.getJSONObject(i)));
1608
- 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;
1609
1883
  }
1610
- } catch (JSONException ignored) {
1884
+ return result;
1885
+ } catch (JSONException e) {
1886
+ e.printStackTrace();
1611
1887
  }
1612
- return result;
1888
+ return null;
1613
1889
  }
1614
1890
 
1615
1891
  static CardProperties CardPropertiesFromJSON(JSONObject input) {
1616
- CardProperties result = new CardProperties();
1617
1892
  try {
1893
+ CardProperties result = new CardProperties();
1618
1894
  if (input.has("aTQA"))
1619
1895
  result.aTQA = input.getInt("aTQA");
1620
1896
  if (input.has("bitRateR"))
@@ -1643,14 +1919,16 @@ class JSONConstructor {
1643
1919
  result.baudrate2 = input.getString("baudrate2");
1644
1920
  if (input.has("uID"))
1645
1921
  result.uID = input.getString("uID");
1646
- } catch (JSONException ignored) {
1922
+ return result;
1923
+ } catch (JSONException e) {
1924
+ e.printStackTrace();
1647
1925
  }
1648
- return result;
1926
+ return null;
1649
1927
  }
1650
1928
 
1651
1929
  static RFIDSessionData RFIDSessionDataFromJSON(JSONObject input) {
1652
- RFIDSessionData result = new RFIDSessionData();
1653
1930
  try {
1931
+ RFIDSessionData result = new RFIDSessionData();
1654
1932
  if (input.has("totalBytesReceived"))
1655
1933
  result.totalBytesReceived = input.getInt("totalBytesReceived");
1656
1934
  if (input.has("totalBytesSent"))
@@ -1666,67 +1944,73 @@ class JSONConstructor {
1666
1944
  if (input.has("sessionDataStatus"))
1667
1945
  result.sessionDataStatus = RFIDSessionDataStatusFromJSON(input.getJSONObject("sessionDataStatus"));
1668
1946
  if (input.has("accessControls")){
1669
- JSONArray jsonArray = input.getJSONArray("accessControls");
1670
- List<AccessControlProcedureType> array = new ArrayList<>();
1671
- for (int i = 0; i < jsonArray.length(); i++)
1672
- array.add(AccessControlProcedureTypeFromJSON(jsonArray.getJSONObject(i)));
1673
- 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;
1674
1952
  }
1675
1953
  if (input.has("applications")){
1676
- JSONArray jsonArray = input.getJSONArray("applications");
1677
- List<Application> array = new ArrayList<>();
1678
- for (int i = 0; i < jsonArray.length(); i++)
1679
- array.add(ApplicationFromJSON(jsonArray.getJSONObject(i)));
1680
- 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;
1681
1959
  }
1682
1960
  if (input.has("securityObjects")){
1683
- JSONArray jsonArray = input.getJSONArray("securityObjects");
1684
- List<SecurityObject> array = new ArrayList<>();
1685
- for (int i = 0; i < jsonArray.length(); i++)
1686
- array.add(SecurityObjectFromJSON(jsonArray.getJSONObject(i)));
1687
- 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;
1688
1966
  }
1689
- } catch (JSONException ignored) {
1967
+ return result;
1968
+ } catch (JSONException e) {
1969
+ e.printStackTrace();
1690
1970
  }
1691
- return result;
1971
+ return null;
1692
1972
  }
1693
1973
 
1694
1974
  static DocumentReaderAuthenticityCheck DocumentReaderAuthenticityCheckFromJSON(JSONObject input) {
1695
- DocumentReaderAuthenticityCheck result = new DocumentReaderAuthenticityCheck();
1696
1975
  try {
1976
+ DocumentReaderAuthenticityCheck result = new DocumentReaderAuthenticityCheck();
1697
1977
  if (input.has("type"))
1698
1978
  result.type = input.getInt("type");
1699
1979
  if (input.has("pageIndex"))
1700
1980
  result.pageIndex = input.getInt("pageIndex");
1701
1981
  if (input.has("elements")){
1702
- JSONArray jsonArray = input.getJSONArray("elements");
1703
- List<DocumentReaderAuthenticityElement> array = new ArrayList<>();
1704
- for (int i = 0; i < jsonArray.length(); i++)
1705
- array.add(DocumentReaderAuthenticityElementFromJSON(jsonArray.getJSONObject(i)));
1706
- 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;
1707
1987
  }
1708
- } catch (JSONException ignored) {
1988
+ return result;
1989
+ } catch (JSONException e) {
1990
+ e.printStackTrace();
1709
1991
  }
1710
- return result;
1992
+ return null;
1711
1993
  }
1712
1994
 
1713
1995
  static PDF417Info PDF417InfoFromJSON(JSONObject input) {
1714
- PDF417Info result = new PDF417Info();
1715
1996
  try {
1997
+ PDF417Info result = new PDF417Info();
1716
1998
  if (input.has("errorLevel"))
1717
1999
  result.errorLevel = input.getInt("errorLevel");
1718
2000
  if (input.has("columns"))
1719
2001
  result.columns = input.getInt("columns");
1720
2002
  if (input.has("rows"))
1721
2003
  result.rows = input.getInt("rows");
1722
- } catch (JSONException ignored) {
2004
+ return result;
2005
+ } catch (JSONException e) {
2006
+ e.printStackTrace();
1723
2007
  }
1724
- return result;
2008
+ return null;
1725
2009
  }
1726
2010
 
1727
2011
  static RFIDSessionDataStatus RFIDSessionDataStatusFromJSON(JSONObject input) {
1728
- RFIDSessionDataStatus result = new RFIDSessionDataStatus();
1729
2012
  try {
2013
+ RFIDSessionDataStatus result = new RFIDSessionDataStatus();
1730
2014
  if (input.has("AA"))
1731
2015
  result.AA = input.getInt("AA");
1732
2016
  if (input.has("BAC"))
@@ -1741,29 +2025,33 @@ class JSONConstructor {
1741
2025
  result.TA = input.getInt("TA");
1742
2026
  if (input.has("overallStatus"))
1743
2027
  result.overallStatus = input.getInt("overallStatus");
1744
- } catch (JSONException ignored) {
2028
+ return result;
2029
+ } catch (JSONException e) {
2030
+ e.printStackTrace();
1745
2031
  }
1746
- return result;
2032
+ return null;
1747
2033
  }
1748
2034
 
1749
2035
  static DocumentReaderBarcodeResult DocumentReaderBarcodeResultFromJSON(JSONObject input) {
1750
- DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
1751
2036
  try {
2037
+ DocumentReaderBarcodeResult result = new DocumentReaderBarcodeResult();
1752
2038
  if (input.has("fields")){
1753
- JSONArray jsonArray = input.getJSONArray("fields");
1754
- List<DocumentReaderBarcodeField> array = new ArrayList<>();
1755
- for (int i = 0; i < jsonArray.length(); i++)
1756
- array.add(DocumentReaderBarcodeFieldFromJSON(jsonArray.getJSONObject(i)));
1757
- 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;
1758
2044
  }
1759
- } catch (JSONException ignored) {
2045
+ return result;
2046
+ } catch (JSONException e) {
2047
+ e.printStackTrace();
1760
2048
  }
1761
- return result;
2049
+ return null;
1762
2050
  }
1763
2051
 
1764
2052
  static DocumentReaderBarcodeField DocumentReaderBarcodeFieldFromJSON(JSONObject input) {
1765
- DocumentReaderBarcodeField result = new DocumentReaderBarcodeField();
1766
2053
  try {
2054
+ DocumentReaderBarcodeField result = new DocumentReaderBarcodeField();
1767
2055
  if (input.has("barcodeType"))
1768
2056
  result.barcodeType = input.getInt("barcodeType");
1769
2057
  if (input.has("status"))
@@ -1773,49 +2061,120 @@ class JSONConstructor {
1773
2061
  if (input.has("pdf417Info"))
1774
2062
  result.pdf417Info = PDF417InfoFromJSON(input.getJSONObject("pdf417Info"));
1775
2063
  if (input.has("data")){
1776
- JSONArray jsonArray = input.getJSONArray("data");
1777
- byte[] array = new byte[jsonArray.length()];
1778
- for (int i = 0; i < jsonArray.length(); i++)
1779
- array[i] = (byte) jsonArray.get(i);
1780
- 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;
1781
2069
  }
1782
- } catch (JSONException ignored) {
2070
+ return result;
2071
+ } catch (JSONException e) {
2072
+ e.printStackTrace();
1783
2073
  }
1784
- return result;
2074
+ return null;
1785
2075
  }
1786
2076
 
1787
2077
  static DocumentReaderAuthenticityResult DocumentReaderAuthenticityResultFromJSON(JSONObject input) {
1788
- DocumentReaderAuthenticityResult result = new DocumentReaderAuthenticityResult();
1789
2078
  try {
2079
+ DocumentReaderAuthenticityResult result = new DocumentReaderAuthenticityResult();
1790
2080
  if (input.has("checks")){
1791
- JSONArray jsonArray = input.getJSONArray("checks");
1792
- List<DocumentReaderAuthenticityCheck> array = new ArrayList<>();
1793
- for (int i = 0; i < jsonArray.length(); i++)
1794
- array.add(DocumentReaderAuthenticityCheckFromJSON(jsonArray.getJSONObject(i)));
1795
- 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;
1796
2086
  }
1797
- } catch (JSONException ignored) {
2087
+ return result;
2088
+ } catch (JSONException e) {
2089
+ e.printStackTrace();
1798
2090
  }
1799
- return result;
2091
+ return null;
1800
2092
  }
1801
2093
 
1802
2094
  static DocumentReaderAuthenticityElement DocumentReaderAuthenticityElementFromJSON(JSONObject input) {
1803
- DocumentReaderAuthenticityElement result = new DocumentReaderAuthenticityElement();
1804
2095
  try {
2096
+ DocumentReaderAuthenticityElement result = new DocumentReaderAuthenticityElement();
1805
2097
  if (input.has("status"))
1806
2098
  result.status = input.getInt("status");
1807
2099
  if (input.has("elementType"))
1808
2100
  result.elementType = input.getInt("elementType");
1809
2101
  if (input.has("elementDiagnose"))
1810
2102
  result.elementDiagnose = input.getInt("elementDiagnose");
1811
- } catch (JSONException ignored) {
2103
+ return result;
2104
+ } catch (JSONException e) {
2105
+ e.printStackTrace();
1812
2106
  }
1813
- 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;
1814
2173
  }
1815
2174
 
1816
2175
  static DocumentReaderResults DocumentReaderResultsFromJSON(JSONObject input) {
1817
- DocumentReaderResults result = new DocumentReaderResults();
1818
2176
  try {
2177
+ DocumentReaderResults result = new DocumentReaderResults();
1819
2178
  if (input.has("chipPage"))
1820
2179
  result.chipPage = input.getInt("chipPage");
1821
2180
  if (input.has("processingFinishedStatus"))
@@ -1835,32 +2194,32 @@ class JSONConstructor {
1835
2194
  if (input.has("textResult"))
1836
2195
  result.textResult = DocumentReaderTextResultFromJSON(input.getJSONObject("textResult"));
1837
2196
  if (input.has("documentPosition")){
1838
- JSONArray jsonArray = input.getJSONArray("documentPosition");
1839
- List<ElementPosition> array = new ArrayList<>();
1840
- for (int i = 0; i < jsonArray.length(); i++)
1841
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1842
- 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;
1843
2202
  }
1844
2203
  if (input.has("barcodePosition")){
1845
- JSONArray jsonArray = input.getJSONArray("barcodePosition");
1846
- List<ElementPosition> array = new ArrayList<>();
1847
- for (int i = 0; i < jsonArray.length(); i++)
1848
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1849
- 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;
1850
2209
  }
1851
2210
  if (input.has("mrzPosition")){
1852
- JSONArray jsonArray = input.getJSONArray("mrzPosition");
1853
- List<ElementPosition> array = new ArrayList<>();
1854
- for (int i = 0; i < jsonArray.length(); i++)
1855
- array.add(ElementPositionFromJSON(jsonArray.getJSONObject(i)));
1856
- 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;
1857
2216
  }
1858
2217
  if (input.has("imageQuality")){
1859
- JSONArray jsonArray = input.getJSONArray("imageQuality");
1860
- List<ImageQualityGroup> array = new ArrayList<>();
1861
- for (int i = 0; i < jsonArray.length(); i++)
1862
- array.add(ImageQualityGroupFromJSON(jsonArray.getJSONObject(i)));
1863
- 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;
1864
2223
  }
1865
2224
  if (input.has("rawResult"))
1866
2225
  result.rawResult = input.getString("rawResult");
@@ -1873,14 +2232,16 @@ class JSONConstructor {
1873
2232
  if (input.has("barcodeResult"))
1874
2233
  result.barcodeResult = DocumentReaderBarcodeResultFromJSON(input.getJSONObject("barcodeResult"));
1875
2234
  if (input.has("documentType")){
1876
- JSONArray jsonArray = input.getJSONArray("documentType");
1877
- List<DocumentReaderDocumentType> array = new ArrayList<>();
1878
- for (int i = 0; i < jsonArray.length(); i++)
1879
- array.add(DocumentReaderDocumentTypeFromJSON(jsonArray.getJSONObject(i)));
1880
- 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;
1881
2240
  }
1882
- } catch (JSONException ignored) {
2241
+ return result;
2242
+ } catch (JSONException e) {
2243
+ e.printStackTrace();
1883
2244
  }
1884
- return result;
2245
+ return null;
1885
2246
  }
1886
2247
  }