@regulaforensics/document-reader 8.2.186-beta

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.
Files changed (439) hide show
  1. package/README.md +18 -0
  2. package/RNDocumentReader.podspec +21 -0
  3. package/android/CVDDocumentReader.kt +74 -0
  4. package/android/build.gradle +36 -0
  5. package/android/cordova.gradle +12 -0
  6. package/android/src/main/java/com/regula/plugin/documentreader/BluetoothUtil.kt +160 -0
  7. package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +826 -0
  8. package/android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt +1795 -0
  9. package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +573 -0
  10. package/android/src/main/java/com/regula/plugin/documentreader/RNDocumentReaderModule.kt +100 -0
  11. package/android/src/main/java/com/regula/plugin/documentreader/Utils.kt +181 -0
  12. package/examples/capacitor/README.md +12 -0
  13. package/examples/capacitor/android/app/build.gradle +50 -0
  14. package/examples/capacitor/android/app/capacitor.build.gradle +22 -0
  15. package/examples/capacitor/android/app/proguard-rules.pro +21 -0
  16. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +27 -0
  17. package/examples/capacitor/android/app/src/main/assets/Regula/.gitkeep +0 -0
  18. package/examples/capacitor/android/app/src/main/java/com/regula/dr/fullauthrfid/MainActivity.java +5 -0
  19. package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher.png +0 -0
  20. package/examples/capacitor/android/app/src/main/res/drawable/splash.png +0 -0
  21. package/examples/capacitor/android/app/src/main/res/layout/activity_main.xml +12 -0
  22. package/examples/capacitor/android/app/src/main/res/values/strings.xml +7 -0
  23. package/examples/capacitor/android/app/src/main/res/values/styles.xml +22 -0
  24. package/examples/capacitor/android/build.gradle +30 -0
  25. package/examples/capacitor/android/capacitor.settings.gradle +15 -0
  26. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  27. package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  28. package/examples/capacitor/android/gradle.properties +22 -0
  29. package/examples/capacitor/android/gradlew +252 -0
  30. package/examples/capacitor/android/gradlew.bat +94 -0
  31. package/examples/capacitor/android/settings.gradle +5 -0
  32. package/examples/capacitor/android/variables.gradle +16 -0
  33. package/examples/capacitor/index.html +10 -0
  34. package/examples/capacitor/ionic.config.json +7 -0
  35. package/examples/capacitor/ios/App/App/App.entitlements +5 -0
  36. package/examples/capacitor/ios/App/App/AppDelegate.swift +49 -0
  37. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
  38. package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
  39. package/examples/capacitor/ios/App/App/Assets.xcassets/Contents.json +6 -0
  40. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
  41. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
  42. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
  43. package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
  44. package/examples/capacitor/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
  45. package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +19 -0
  46. package/examples/capacitor/ios/App/App/Info.plist +53 -0
  47. package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +414 -0
  48. package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  49. package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
  50. package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  51. package/examples/capacitor/ios/App/Podfile +26 -0
  52. package/examples/capacitor/ios/App/Podfile.lock +56 -0
  53. package/examples/capacitor/package-lock.json +3467 -0
  54. package/examples/capacitor/package.json +29 -0
  55. package/examples/capacitor/public/assets/.gitkeep +0 -0
  56. package/examples/capacitor/public/images/document.png +0 -0
  57. package/examples/capacitor/public/images/portrait.png +0 -0
  58. package/examples/capacitor/scripts/android.sh +9 -0
  59. package/examples/capacitor/scripts/ios.sh +8 -0
  60. package/examples/capacitor/scripts/setup.sh +6 -0
  61. package/examples/capacitor/src/extra/bt_device.tsx +32 -0
  62. package/examples/capacitor/src/extra/custom_rfid.tsx +74 -0
  63. package/examples/capacitor/src/main.css +131 -0
  64. package/examples/capacitor/src/main.html +41 -0
  65. package/examples/capacitor/src/main.tsx +175 -0
  66. package/examples/capacitor/tsconfig.json +5 -0
  67. package/examples/capacitor/vite.config.ts +17 -0
  68. package/examples/cordova/.vscode/launch.json +28 -0
  69. package/examples/cordova/.vscode/typings/cordova/cordova.d.ts +80 -0
  70. package/examples/cordova/README.md +12 -0
  71. package/examples/cordova/config.xml +29 -0
  72. package/examples/cordova/package-lock.json +1314 -0
  73. package/examples/cordova/package.json +32 -0
  74. package/examples/cordova/scripts/android.sh +8 -0
  75. package/examples/cordova/scripts/ios.sh +8 -0
  76. package/examples/cordova/scripts/setup.sh +8 -0
  77. package/examples/cordova/www/images/document.png +0 -0
  78. package/examples/cordova/www/images/logo.png +0 -0
  79. package/examples/cordova/www/images/portrait.png +0 -0
  80. package/examples/cordova/www/index.html +21 -0
  81. package/examples/cordova/www/src/main.css +130 -0
  82. package/examples/cordova/www/src/main.html +63 -0
  83. package/examples/cordova/www/src/main.js +50 -0
  84. package/examples/ionic/README.md +12 -0
  85. package/examples/ionic/angular.json +39 -0
  86. package/examples/ionic/config.xml +28 -0
  87. package/examples/ionic/index.html +19 -0
  88. package/examples/ionic/index.ts +17 -0
  89. package/examples/ionic/ionic.config.json +7 -0
  90. package/examples/ionic/package-lock.json +16559 -0
  91. package/examples/ionic/package.json +47 -0
  92. package/examples/ionic/scripts/android.sh +8 -0
  93. package/examples/ionic/scripts/ios.sh +8 -0
  94. package/examples/ionic/scripts/setup.sh +8 -0
  95. package/examples/ionic/src/assets/.gitkeep +0 -0
  96. package/examples/ionic/src/images/document.png +0 -0
  97. package/examples/ionic/src/images/icon.png +0 -0
  98. package/examples/ionic/src/images/portrait.png +0 -0
  99. package/examples/ionic/src/main.css +130 -0
  100. package/examples/ionic/src/main.html +63 -0
  101. package/examples/ionic/src/main.ts +66 -0
  102. package/examples/ionic/tsconfig.json +12 -0
  103. package/examples/react_native/README.md +12 -0
  104. package/examples/react_native/app.config.ts +53 -0
  105. package/examples/react_native/assets/.gitkeep +0 -0
  106. package/examples/react_native/images/document.png +0 -0
  107. package/examples/react_native/images/icon/adaptive-icon.png +0 -0
  108. package/examples/react_native/images/icon/icon.png +0 -0
  109. package/examples/react_native/images/portrait.png +0 -0
  110. package/examples/react_native/index.html +11 -0
  111. package/examples/react_native/index.tsx +52 -0
  112. package/examples/react_native/metro.config.js +7 -0
  113. package/examples/react_native/package-lock.json +9254 -0
  114. package/examples/react_native/package.json +27 -0
  115. package/examples/react_native/scripts/android.sh +12 -0
  116. package/examples/react_native/scripts/ios.sh +11 -0
  117. package/examples/react_native/scripts/setup.sh +8 -0
  118. package/examples/react_native/src/main.css +130 -0
  119. package/examples/react_native/src/main.html +63 -0
  120. package/examples/react_native/src/main.tsx +50 -0
  121. package/ios/CVDDocumentReader.h +7 -0
  122. package/ios/CVDDocumentReader.m +39 -0
  123. package/ios/RGLWConfig.h +42 -0
  124. package/ios/RGLWConfig.m +1398 -0
  125. package/ios/RGLWJSONConstructor.h +185 -0
  126. package/ios/RGLWJSONConstructor.m +2379 -0
  127. package/ios/RGLWMain.h +36 -0
  128. package/ios/RGLWMain.m +610 -0
  129. package/ios/RNDocumentReader.h +8 -0
  130. package/ios/RNDocumentReader.m +49 -0
  131. package/package.json +36 -0
  132. package/plugin.xml +51 -0
  133. package/www/capacitor/config/InitConfig.js +25 -0
  134. package/www/capacitor/config/OnlineProcessingConfig.js +41 -0
  135. package/www/capacitor/config/RFIDConfig.js +31 -0
  136. package/www/capacitor/config/RecognizeConfig.js +103 -0
  137. package/www/capacitor/config/ScannerConfig.js +38 -0
  138. package/www/capacitor/index.js +486 -0
  139. package/www/capacitor/info/DocReaderException.js +57 -0
  140. package/www/capacitor/info/DocReaderScenario.js +71 -0
  141. package/www/capacitor/info/DocReaderVersion.js +23 -0
  142. package/www/capacitor/info/DocumentsDatabase.js +27 -0
  143. package/www/capacitor/info/License.js +22 -0
  144. package/www/capacitor/info/PrepareProgress.js +23 -0
  145. package/www/capacitor/info/RFIDException.js +19 -0
  146. package/www/capacitor/internal/bridge.js +98 -0
  147. package/www/capacitor/internal/cordova.js +17 -0
  148. package/www/capacitor/params/Functionality.js +303 -0
  149. package/www/capacitor/params/customization/Customization.js +550 -0
  150. package/www/capacitor/params/customization/CustomizationColors.js +74 -0
  151. package/www/capacitor/params/customization/CustomizationFonts.js +40 -0
  152. package/www/capacitor/params/customization/CustomizationImages.js +25 -0
  153. package/www/capacitor/params/customization/Font.js +28 -0
  154. package/www/capacitor/params/process_params/AuthenticityParams.js +129 -0
  155. package/www/capacitor/params/process_params/BackendProcessingConfig.js +25 -0
  156. package/www/capacitor/params/process_params/FaceApiParams.js +38 -0
  157. package/www/capacitor/params/process_params/FaceApiSearchParams.js +21 -0
  158. package/www/capacitor/params/process_params/GlaresCheckParams.js +18 -0
  159. package/www/capacitor/params/process_params/ImageQA.js +97 -0
  160. package/www/capacitor/params/process_params/LivenessParams.js +67 -0
  161. package/www/capacitor/params/process_params/ProcessParams.js +570 -0
  162. package/www/capacitor/params/process_params/RfidParams.js +15 -0
  163. package/www/capacitor/params/rfid_scenario/DTCDataGroups.js +53 -0
  164. package/www/capacitor/params/rfid_scenario/EDLDataGroups.js +116 -0
  165. package/www/capacitor/params/rfid_scenario/EIDDataGroups.js +165 -0
  166. package/www/capacitor/params/rfid_scenario/EPassportDataGroups.js +130 -0
  167. package/www/capacitor/params/rfid_scenario/RFIDScenario.js +493 -0
  168. package/www/capacitor/results/DocumentType.js +285 -0
  169. package/www/capacitor/results/Position.js +60 -0
  170. package/www/capacitor/results/Results.js +318 -0
  171. package/www/capacitor/results/TransactionInfo.js +16 -0
  172. package/www/capacitor/results/authenticity/Authenticity.js +23 -0
  173. package/www/capacitor/results/authenticity/AuthenticityCheck.js +33 -0
  174. package/www/capacitor/results/authenticity/AuthenticityElement.js +27 -0
  175. package/www/capacitor/results/authenticity/AuthenticityResult.js +26 -0
  176. package/www/capacitor/results/authenticity/CheckDiagnose.js +124 -0
  177. package/www/capacitor/results/authenticity/SecurityFeatureType.js +59 -0
  178. package/www/capacitor/results/barcode/BarcodeField.js +24 -0
  179. package/www/capacitor/results/barcode/BarcodeResult.js +24 -0
  180. package/www/capacitor/results/barcode/BarcodeStatus.js +33 -0
  181. package/www/capacitor/results/barcode/BarcodeType.js +21 -0
  182. package/www/capacitor/results/barcode/PDF417Info.js +16 -0
  183. package/www/capacitor/results/image_quality/ImageQuality.js +31 -0
  184. package/www/capacitor/results/image_quality/ImageQualityCheckType.js +19 -0
  185. package/www/capacitor/results/image_quality/ImageQualityGroup.js +30 -0
  186. package/www/capacitor/results/rfid/AccessControlProcedureType.js +21 -0
  187. package/www/capacitor/results/rfid/Application.js +47 -0
  188. package/www/capacitor/results/rfid/Attribute.js +16 -0
  189. package/www/capacitor/results/rfid/Authority.js +28 -0
  190. package/www/capacitor/results/rfid/CardProperties.js +38 -0
  191. package/www/capacitor/results/rfid/CertificateChain.js +51 -0
  192. package/www/capacitor/results/rfid/CertificateData.js +14 -0
  193. package/www/capacitor/results/rfid/DataField.js +16 -0
  194. package/www/capacitor/results/rfid/Extension.js +14 -0
  195. package/www/capacitor/results/rfid/File.js +39 -0
  196. package/www/capacitor/results/rfid/FileData.js +18 -0
  197. package/www/capacitor/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  198. package/www/capacitor/results/rfid/RFIDCertificateType.js +13 -0
  199. package/www/capacitor/results/rfid/RFIDDataFileType.js +98 -0
  200. package/www/capacitor/results/rfid/RFIDSessionData.js +76 -0
  201. package/www/capacitor/results/rfid/RFIDValidity.js +16 -0
  202. package/www/capacitor/results/rfid/RFIDValue.js +20 -0
  203. package/www/capacitor/results/rfid/SecurityObject.js +31 -0
  204. package/www/capacitor/results/rfid/SecurityObjectCertificates.js +14 -0
  205. package/www/capacitor/results/rfid/SignerInfo.js +57 -0
  206. package/www/capacitor/results/status/CheckResult.js +5 -0
  207. package/www/capacitor/results/status/OpticalStatus.js +30 -0
  208. package/www/capacitor/results/status/RFIDStatus.js +26 -0
  209. package/www/capacitor/results/status/ResultsStatus.js +28 -0
  210. package/www/capacitor/results/visible_digital_seals/BytesData.js +18 -0
  211. package/www/capacitor/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
  212. package/www/capacitor/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
  213. package/www/capacitor/results/visible_digital_seals/VDSNCData.js +40 -0
  214. package/www/capacitor/results/visual_results/Comparison.js +19 -0
  215. package/www/capacitor/results/visual_results/FieldType.js +658 -0
  216. package/www/capacitor/results/visual_results/GraphicField.js +33 -0
  217. package/www/capacitor/results/visual_results/GraphicFieldType.js +25 -0
  218. package/www/capacitor/results/visual_results/GraphicResult.js +22 -0
  219. package/www/capacitor/results/visual_results/LCID.js +174 -0
  220. package/www/capacitor/results/visual_results/Lights.js +11 -0
  221. package/www/capacitor/results/visual_results/RFIDOrigin.js +18 -0
  222. package/www/capacitor/results/visual_results/Rect.js +18 -0
  223. package/www/capacitor/results/visual_results/Symbol.js +18 -0
  224. package/www/capacitor/results/visual_results/TextField.js +68 -0
  225. package/www/capacitor/results/visual_results/TextResult.js +42 -0
  226. package/www/capacitor/results/visual_results/TextSource.js +19 -0
  227. package/www/capacitor/results/visual_results/Validity.js +17 -0
  228. package/www/capacitor/results/visual_results/Value.js +39 -0
  229. package/www/capacitor/rfid/PAAttribute.js +17 -0
  230. package/www/capacitor/rfid/PAResourcesIssuer.js +27 -0
  231. package/www/capacitor/rfid/PKDCertificate.js +54 -0
  232. package/www/capacitor/rfid/RFIDErrorCodes.js +123 -0
  233. package/www/capacitor/rfid/RFIDNotification.js +60 -0
  234. package/www/capacitor/rfid/TAChallenge.js +23 -0
  235. package/www/capacitor/rfid/TccParams.js +24 -0
  236. package/www/cordova.js +9816 -0
  237. package/www/react-native/config/InitConfig.js +25 -0
  238. package/www/react-native/config/OnlineProcessingConfig.js +41 -0
  239. package/www/react-native/config/RFIDConfig.js +31 -0
  240. package/www/react-native/config/RecognizeConfig.js +103 -0
  241. package/www/react-native/config/ScannerConfig.js +38 -0
  242. package/www/react-native/index.js +486 -0
  243. package/www/react-native/info/DocReaderException.js +57 -0
  244. package/www/react-native/info/DocReaderScenario.js +71 -0
  245. package/www/react-native/info/DocReaderVersion.js +23 -0
  246. package/www/react-native/info/DocumentsDatabase.js +27 -0
  247. package/www/react-native/info/License.js +22 -0
  248. package/www/react-native/info/PrepareProgress.js +23 -0
  249. package/www/react-native/info/RFIDException.js +19 -0
  250. package/www/react-native/internal/bridge.js +98 -0
  251. package/www/react-native/params/Functionality.js +303 -0
  252. package/www/react-native/params/customization/Customization.js +550 -0
  253. package/www/react-native/params/customization/CustomizationColors.js +74 -0
  254. package/www/react-native/params/customization/CustomizationFonts.js +40 -0
  255. package/www/react-native/params/customization/CustomizationImages.js +25 -0
  256. package/www/react-native/params/customization/Font.js +28 -0
  257. package/www/react-native/params/process_params/AuthenticityParams.js +129 -0
  258. package/www/react-native/params/process_params/BackendProcessingConfig.js +25 -0
  259. package/www/react-native/params/process_params/FaceApiParams.js +38 -0
  260. package/www/react-native/params/process_params/FaceApiSearchParams.js +21 -0
  261. package/www/react-native/params/process_params/GlaresCheckParams.js +18 -0
  262. package/www/react-native/params/process_params/ImageQA.js +97 -0
  263. package/www/react-native/params/process_params/LivenessParams.js +67 -0
  264. package/www/react-native/params/process_params/ProcessParams.js +570 -0
  265. package/www/react-native/params/process_params/RfidParams.js +15 -0
  266. package/www/react-native/params/rfid_scenario/DTCDataGroups.js +53 -0
  267. package/www/react-native/params/rfid_scenario/EDLDataGroups.js +116 -0
  268. package/www/react-native/params/rfid_scenario/EIDDataGroups.js +165 -0
  269. package/www/react-native/params/rfid_scenario/EPassportDataGroups.js +130 -0
  270. package/www/react-native/params/rfid_scenario/RFIDScenario.js +493 -0
  271. package/www/react-native/results/DocumentType.js +285 -0
  272. package/www/react-native/results/Position.js +60 -0
  273. package/www/react-native/results/Results.js +318 -0
  274. package/www/react-native/results/TransactionInfo.js +16 -0
  275. package/www/react-native/results/authenticity/Authenticity.js +23 -0
  276. package/www/react-native/results/authenticity/AuthenticityCheck.js +33 -0
  277. package/www/react-native/results/authenticity/AuthenticityElement.js +27 -0
  278. package/www/react-native/results/authenticity/AuthenticityResult.js +26 -0
  279. package/www/react-native/results/authenticity/CheckDiagnose.js +124 -0
  280. package/www/react-native/results/authenticity/SecurityFeatureType.js +59 -0
  281. package/www/react-native/results/barcode/BarcodeField.js +24 -0
  282. package/www/react-native/results/barcode/BarcodeResult.js +24 -0
  283. package/www/react-native/results/barcode/BarcodeStatus.js +33 -0
  284. package/www/react-native/results/barcode/BarcodeType.js +21 -0
  285. package/www/react-native/results/barcode/PDF417Info.js +16 -0
  286. package/www/react-native/results/image_quality/ImageQuality.js +31 -0
  287. package/www/react-native/results/image_quality/ImageQualityCheckType.js +19 -0
  288. package/www/react-native/results/image_quality/ImageQualityGroup.js +30 -0
  289. package/www/react-native/results/rfid/AccessControlProcedureType.js +21 -0
  290. package/www/react-native/results/rfid/Application.js +47 -0
  291. package/www/react-native/results/rfid/Attribute.js +16 -0
  292. package/www/react-native/results/rfid/Authority.js +28 -0
  293. package/www/react-native/results/rfid/CardProperties.js +38 -0
  294. package/www/react-native/results/rfid/CertificateChain.js +51 -0
  295. package/www/react-native/results/rfid/CertificateData.js +14 -0
  296. package/www/react-native/results/rfid/DataField.js +16 -0
  297. package/www/react-native/results/rfid/Extension.js +14 -0
  298. package/www/react-native/results/rfid/File.js +39 -0
  299. package/www/react-native/results/rfid/FileData.js +18 -0
  300. package/www/react-native/results/rfid/RFIDAccessControlProcedureType.js +10 -0
  301. package/www/react-native/results/rfid/RFIDCertificateType.js +13 -0
  302. package/www/react-native/results/rfid/RFIDDataFileType.js +98 -0
  303. package/www/react-native/results/rfid/RFIDSessionData.js +76 -0
  304. package/www/react-native/results/rfid/RFIDValidity.js +16 -0
  305. package/www/react-native/results/rfid/RFIDValue.js +20 -0
  306. package/www/react-native/results/rfid/SecurityObject.js +31 -0
  307. package/www/react-native/results/rfid/SecurityObjectCertificates.js +14 -0
  308. package/www/react-native/results/rfid/SignerInfo.js +57 -0
  309. package/www/react-native/results/status/CheckResult.js +5 -0
  310. package/www/react-native/results/status/OpticalStatus.js +30 -0
  311. package/www/react-native/results/status/RFIDStatus.js +26 -0
  312. package/www/react-native/results/status/ResultsStatus.js +28 -0
  313. package/www/react-native/results/visible_digital_seals/BytesData.js +18 -0
  314. package/www/react-native/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
  315. package/www/react-native/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
  316. package/www/react-native/results/visible_digital_seals/VDSNCData.js +40 -0
  317. package/www/react-native/results/visual_results/Comparison.js +19 -0
  318. package/www/react-native/results/visual_results/FieldType.js +658 -0
  319. package/www/react-native/results/visual_results/GraphicField.js +33 -0
  320. package/www/react-native/results/visual_results/GraphicFieldType.js +25 -0
  321. package/www/react-native/results/visual_results/GraphicResult.js +22 -0
  322. package/www/react-native/results/visual_results/LCID.js +174 -0
  323. package/www/react-native/results/visual_results/Lights.js +11 -0
  324. package/www/react-native/results/visual_results/RFIDOrigin.js +18 -0
  325. package/www/react-native/results/visual_results/Rect.js +18 -0
  326. package/www/react-native/results/visual_results/Symbol.js +18 -0
  327. package/www/react-native/results/visual_results/TextField.js +68 -0
  328. package/www/react-native/results/visual_results/TextResult.js +42 -0
  329. package/www/react-native/results/visual_results/TextSource.js +19 -0
  330. package/www/react-native/results/visual_results/Validity.js +17 -0
  331. package/www/react-native/results/visual_results/Value.js +39 -0
  332. package/www/react-native/rfid/PAAttribute.js +17 -0
  333. package/www/react-native/rfid/PAResourcesIssuer.js +27 -0
  334. package/www/react-native/rfid/PKDCertificate.js +54 -0
  335. package/www/react-native/rfid/RFIDErrorCodes.js +123 -0
  336. package/www/react-native/rfid/RFIDNotification.js +60 -0
  337. package/www/react-native/rfid/TAChallenge.js +23 -0
  338. package/www/react-native/rfid/TccParams.js +24 -0
  339. package/www/types/config/InitConfig.d.ts +63 -0
  340. package/www/types/config/OnlineProcessingConfig.d.ts +22 -0
  341. package/www/types/config/RFIDConfig.d.ts +131 -0
  342. package/www/types/config/RecognizeConfig.d.ts +119 -0
  343. package/www/types/config/ScannerConfig.d.ts +54 -0
  344. package/www/types/index.d.ts +421 -0
  345. package/www/types/info/DocReaderException.d.ts +79 -0
  346. package/www/types/info/DocReaderScenario.d.ts +90 -0
  347. package/www/types/info/DocReaderVersion.d.ts +28 -0
  348. package/www/types/info/DocumentsDatabase.d.ts +42 -0
  349. package/www/types/info/License.d.ts +23 -0
  350. package/www/types/info/PrepareProgress.d.ts +15 -0
  351. package/www/types/info/RFIDException.d.ts +8 -0
  352. package/www/types/params/Functionality.d.ts +316 -0
  353. package/www/types/params/customization/Customization.d.ts +558 -0
  354. package/www/types/params/customization/CustomizationColors.d.ts +16 -0
  355. package/www/types/params/customization/CustomizationFonts.d.ts +13 -0
  356. package/www/types/params/customization/CustomizationImages.d.ts +12 -0
  357. package/www/types/params/customization/Font.d.ts +36 -0
  358. package/www/types/params/process_params/AuthenticityParams.d.ts +30 -0
  359. package/www/types/params/process_params/BackendProcessingConfig.d.ts +25 -0
  360. package/www/types/params/process_params/FaceApiParams.d.ts +68 -0
  361. package/www/types/params/process_params/FaceApiSearchParams.d.ts +35 -0
  362. package/www/types/params/process_params/GlaresCheckParams.d.ts +26 -0
  363. package/www/types/params/process_params/ImageQA.d.ts +79 -0
  364. package/www/types/params/process_params/LivenessParams.d.ts +20 -0
  365. package/www/types/params/process_params/ProcessParams.d.ts +465 -0
  366. package/www/types/params/process_params/RfidParams.d.ts +19 -0
  367. package/www/types/params/rfid_scenario/DTCDataGroups.d.ts +13 -0
  368. package/www/types/params/rfid_scenario/EDLDataGroups.d.ts +22 -0
  369. package/www/types/params/rfid_scenario/EIDDataGroups.d.ts +29 -0
  370. package/www/types/params/rfid_scenario/EPassportDataGroups.d.ts +24 -0
  371. package/www/types/params/rfid_scenario/RFIDScenario.d.ts +167 -0
  372. package/www/types/results/DocumentType.d.ts +525 -0
  373. package/www/types/results/Position.d.ts +50 -0
  374. package/www/types/results/Results.d.ts +283 -0
  375. package/www/types/results/TransactionInfo.d.ts +9 -0
  376. package/www/types/results/authenticity/Authenticity.d.ts +67 -0
  377. package/www/types/results/authenticity/AuthenticityCheck.d.ts +23 -0
  378. package/www/types/results/authenticity/AuthenticityElement.d.ts +26 -0
  379. package/www/types/results/authenticity/AuthenticityResult.d.ts +16 -0
  380. package/www/types/results/authenticity/CheckDiagnose.d.ts +229 -0
  381. package/www/types/results/authenticity/SecurityFeatureType.d.ts +100 -0
  382. package/www/types/results/barcode/BarcodeField.d.ts +37 -0
  383. package/www/types/results/barcode/BarcodeResult.d.ts +14 -0
  384. package/www/types/results/barcode/BarcodeStatus.d.ts +66 -0
  385. package/www/types/results/barcode/BarcodeType.d.ts +45 -0
  386. package/www/types/results/barcode/PDF417Info.d.ts +15 -0
  387. package/www/types/results/image_quality/ImageQuality.d.ts +18 -0
  388. package/www/types/results/image_quality/ImageQualityCheckType.d.ts +30 -0
  389. package/www/types/results/image_quality/ImageQualityGroup.d.ts +17 -0
  390. package/www/types/results/rfid/AccessControlProcedureType.d.ts +21 -0
  391. package/www/types/results/rfid/Application.d.ts +44 -0
  392. package/www/types/results/rfid/Attribute.d.ts +9 -0
  393. package/www/types/results/rfid/Authority.d.ts +11 -0
  394. package/www/types/results/rfid/CardProperties.d.ts +48 -0
  395. package/www/types/results/rfid/CertificateChain.d.ts +28 -0
  396. package/www/types/results/rfid/CertificateData.d.ts +7 -0
  397. package/www/types/results/rfid/DataField.d.ts +9 -0
  398. package/www/types/results/rfid/Extension.d.ts +7 -0
  399. package/www/types/results/rfid/File.d.ts +22 -0
  400. package/www/types/results/rfid/FileData.d.ts +9 -0
  401. package/www/types/results/rfid/RFIDAccessControlProcedureType.d.ts +18 -0
  402. package/www/types/results/rfid/RFIDCertificateType.d.ts +13 -0
  403. package/www/types/results/rfid/RFIDDataFileType.d.ts +101 -0
  404. package/www/types/results/rfid/RFIDSessionData.d.ts +48 -0
  405. package/www/types/results/rfid/RFIDValidity.d.ts +9 -0
  406. package/www/types/results/rfid/RFIDValue.d.ts +10 -0
  407. package/www/types/results/rfid/SecurityObject.d.ts +28 -0
  408. package/www/types/results/rfid/SecurityObjectCertificates.d.ts +8 -0
  409. package/www/types/results/rfid/SignerInfo.d.ts +41 -0
  410. package/www/types/results/status/CheckResult.d.ts +8 -0
  411. package/www/types/results/status/OpticalStatus.d.ts +29 -0
  412. package/www/types/results/status/RFIDStatus.d.ts +22 -0
  413. package/www/types/results/status/ResultsStatus.d.ts +24 -0
  414. package/www/types/results/visible_digital_seals/BytesData.d.ts +9 -0
  415. package/www/types/results/visible_digital_seals/LDSParsingErrorCodes.d.ts +132 -0
  416. package/www/types/results/visible_digital_seals/LDSParsingNotificationCodes.d.ts +230 -0
  417. package/www/types/results/visible_digital_seals/VDSNCData.d.ts +35 -0
  418. package/www/types/results/visual_results/Comparison.d.ts +15 -0
  419. package/www/types/results/visual_results/FieldType.d.ts +1310 -0
  420. package/www/types/results/visual_results/GraphicField.d.ts +29 -0
  421. package/www/types/results/visual_results/GraphicFieldType.d.ts +52 -0
  422. package/www/types/results/visual_results/GraphicResult.d.ts +10 -0
  423. package/www/types/results/visual_results/LCID.d.ts +173 -0
  424. package/www/types/results/visual_results/Lights.d.ts +23 -0
  425. package/www/types/results/visual_results/RFIDOrigin.d.ts +10 -0
  426. package/www/types/results/visual_results/Rect.d.ts +9 -0
  427. package/www/types/results/visual_results/Symbol.d.ts +14 -0
  428. package/www/types/results/visual_results/TextField.d.ts +40 -0
  429. package/www/types/results/visual_results/TextResult.d.ts +23 -0
  430. package/www/types/results/visual_results/TextSource.d.ts +15 -0
  431. package/www/types/results/visual_results/Validity.d.ts +13 -0
  432. package/www/types/results/visual_results/Value.d.ts +27 -0
  433. package/www/types/rfid/PAAttribute.d.ts +4 -0
  434. package/www/types/rfid/PAResourcesIssuer.d.ts +7 -0
  435. package/www/types/rfid/PKDCertificate.d.ts +34 -0
  436. package/www/types/rfid/RFIDErrorCodes.d.ts +121 -0
  437. package/www/types/rfid/RFIDNotification.d.ts +153 -0
  438. package/www/types/rfid/TAChallenge.d.ts +7 -0
  439. package/www/types/rfid/TccParams.d.ts +25 -0
@@ -0,0 +1,826 @@
1
+ @file:Suppress("EnumValuesSoftDeprecate", "DEPRECATION")
2
+
3
+ package com.regula.plugin.documentreader
4
+
5
+ import android.graphics.Paint
6
+ import android.graphics.Typeface
7
+ import android.graphics.drawable.Drawable
8
+ import android.text.SpannableString
9
+ import android.widget.ImageView
10
+ import androidx.core.content.ContextCompat
11
+ import com.regula.documentreader.api.enums.CustomizationColor
12
+ import com.regula.documentreader.api.enums.CustomizationFont
13
+ import com.regula.documentreader.api.enums.CustomizationImage
14
+ import com.regula.documentreader.api.enums.LogLevel
15
+ import com.regula.documentreader.api.params.AuthenticityParams
16
+ import com.regula.documentreader.api.params.Functionality
17
+ import com.regula.documentreader.api.params.ImageQA
18
+ import com.regula.documentreader.api.params.LivenessParams
19
+ import com.regula.documentreader.api.params.ParamsCustomization
20
+ import com.regula.documentreader.api.params.ProcessParam
21
+ import com.regula.documentreader.api.params.RfidScenario
22
+ import com.regula.documentreader.api.params.rfid.dg.DTCDataGroup
23
+ import com.regula.documentreader.api.params.rfid.dg.DataGroups
24
+ import com.regula.documentreader.api.params.rfid.dg.EIDDataGroups
25
+ import com.regula.documentreader.api.params.rfid.dg.EPassportDataGroups
26
+ import com.regula.plugin.documentreader.Convert.toBase64
27
+ import com.regula.plugin.documentreader.Convert.toDrawable
28
+ import org.json.JSONArray
29
+ import org.json.JSONObject
30
+
31
+ fun setFunctionality(config: Functionality, input: JSONObject) = input.forEach { k, v ->
32
+ val editor = config.edit()
33
+ when (k) {
34
+ "pictureOnBoundsReady" -> editor.setPictureOnBoundsReady(v as Boolean)
35
+ "showTorchButton" -> editor.setShowTorchButton(v as Boolean)
36
+ "showCloseButton" -> editor.setShowCloseButton(v as Boolean)
37
+ "videoCaptureMotionControl" -> editor.setVideoCaptureMotionControl(v as Boolean)
38
+ "showCaptureButton" -> editor.setShowCaptureButton(v as Boolean)
39
+ "showChangeFrameButton" -> editor.setShowChangeFrameButton(v as Boolean)
40
+ "showSkipNextPageButton" -> editor.setShowSkipNextPageButton(v as Boolean)
41
+ "useAuthenticator" -> editor.setUseAuthenticator(v as Boolean)
42
+ "skipFocusingFrames" -> editor.setSkipFocusingFrames(v as Boolean)
43
+ "showCameraSwitchButton" -> editor.setShowCameraSwitchButton(v as Boolean)
44
+ "displayMetadata" -> editor.setDisplayMetadata(v as Boolean)
45
+ "isZoomEnabled" -> editor.setZoomEnabled(v as Boolean)
46
+ "isCameraTorchCheckDisabled" -> editor.setIsCameraTorchCheckDisabled(v as Boolean)
47
+ "recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
48
+ "manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
49
+ "torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
50
+ "showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
51
+ "showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
52
+ "orientation" -> editor.setOrientation(v.toInt())
53
+ "captureMode" -> editor.setCaptureMode(v.toInt())
54
+ "cameraMode" -> editor.setCameraMode(v.toInt())
55
+ "rfidTimeout" -> editor.setRfidTimeout(v.toInt())
56
+ "forcePagesCount" -> editor.setForcePagesCount(v.toInt())
57
+ "cameraFrame" -> editor.setCameraFrame(v as String)
58
+ "btDeviceName" -> editor.setBtDeviceName(v as String)
59
+ "zoomFactor" -> editor.setZoomFactor(v.toFloat())
60
+ "exposure" -> editor.setExposure(v.toFloat())
61
+ "excludedCamera2Models" -> editor.setExcludedCamera2Models((v as JSONArray).toList())
62
+ "cameraSize" -> editor.setCameraSize(cameraSizeFromJSON(v as JSONObject).first, cameraSizeFromJSON(v).second)
63
+ }
64
+ editor.apply()
65
+ }
66
+
67
+ fun getFunctionality(input: Functionality) = mapOf(
68
+ "pictureOnBoundsReady" to input.isPictureOnBoundsReady,
69
+ "showTorchButton" to input.isShowTorchButton,
70
+ "showCloseButton" to input.isShowCloseButton,
71
+ "videoCaptureMotionControl" to input.isVideoCaptureMotionControl,
72
+ "showCaptureButton" to input.isShowCaptureButton,
73
+ "showChangeFrameButton" to input.isShowChangeFrameButton,
74
+ "showSkipNextPageButton" to input.isShowSkipNextPageButton,
75
+ "useAuthenticator" to input.isUseAuthenticator,
76
+ "skipFocusingFrames" to input.isSkipFocusingFrames,
77
+ "showCameraSwitchButton" to input.isShowCameraSwitchButton,
78
+ "displayMetadata" to input.isDisplayMetaData,
79
+ "isZoomEnabled" to input.isZoomEnabled,
80
+ "isCameraTorchCheckDisabled" to input.isCameraTorchCheckDisabled,
81
+ "recordScanningProcess" to input.doRecordProcessingVideo(),
82
+ "manualMultipageMode" to input.isManualMultipageMode,
83
+ "torchTurnedOn" to input.isTorchTurnedOn,
84
+ "showCaptureButtonDelayFromDetect" to input.showCaptureButtonDelayFromDetect,
85
+ "showCaptureButtonDelayFromStart" to input.showCaptureButtonDelayFromStart,
86
+ "orientation" to input.orientation,
87
+ "captureMode" to input.captureMode,
88
+ "cameraMode" to input.cameraMode,
89
+ "rfidTimeout" to input.rfidTimeout,
90
+ "forcePagesCount" to input.forcePagesCount,
91
+ "cameraFrame" to input.cameraFrame,
92
+ "btDeviceName" to input.btDeviceName,
93
+ "zoomFactor" to input.zoomFactor,
94
+ "exposure" to input.exposure,
95
+ "excludedCamera2Models" to input.excludedCamera2Models.toJson(),
96
+ "cameraSize" to generateCameraSize(input.cameraWidth, input.cameraHeight)
97
+ ).toJson()
98
+
99
+ @Suppress("DEPRECATION")
100
+ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEach { k, v ->
101
+ when (k) {
102
+ "multipageProcessing" -> processParams.multipageProcessing = v as Boolean
103
+ "logs" -> processParams.setLogs(v as Boolean)
104
+ "debugSaveImages" -> processParams.debugSaveImages = v as Boolean
105
+ "debugSaveLogs" -> processParams.debugSaveLogs = v as Boolean
106
+ "returnUncroppedImage" -> processParams.returnUncroppedImage = v as Boolean
107
+ "uvTorchEnabled" -> processParams.uvTorchEnabled = v as Boolean
108
+ "debugSaveCroppedImages" -> processParams.debugSaveCroppedImages = v as Boolean
109
+ "disableFocusingCheck" -> processParams.disableFocusingCheck = v as Boolean
110
+ "debugSaveRFIDSession" -> processParams.debugSaveRFIDSession = v as Boolean
111
+ "doublePageSpread" -> processParams.doublePageSpread = v as Boolean
112
+ "manualCrop" -> processParams.manualCrop = v as Boolean
113
+ "integralImage" -> processParams.integralImage = v as Boolean
114
+ "returnCroppedBarcode" -> processParams.returnCroppedBarcode = v as Boolean
115
+ "checkRequiredTextFields" -> processParams.checkRequiredTextFields = v as Boolean
116
+ "depersonalizeLog" -> processParams.depersonalizeLog = v as Boolean
117
+ "generateDoublePageSpreadImage" -> processParams.generateDoublePageSpreadImage = v as Boolean
118
+ "alreadyCropped" -> processParams.alreadyCropped = v as Boolean
119
+ "matchTextFieldMask" -> processParams.matchTextFieldMask = v as Boolean
120
+ "updateOCRValidityByGlare" -> processParams.updateOCRValidityByGlare = v as Boolean
121
+ "noGraphics" -> processParams.noGraphics = v as Boolean
122
+ "multiDocOnImage" -> processParams.multiDocOnImage = v as Boolean
123
+ "forceReadMrzBeforeLocate" -> processParams.forceReadMrzBeforeLocate = v as Boolean
124
+ "parseBarcodes" -> processParams.parseBarcodes = v as Boolean
125
+ "shouldReturnPackageForReprocess" -> processParams.shouldReturnPackageForReprocess = v as Boolean
126
+ "disablePerforationOCR" -> processParams.disablePerforationOCR = v as Boolean
127
+ "respectImageQuality" -> processParams.respectImageQuality = v as Boolean
128
+ "strictImageQuality" -> processParams.strictImageQuality = v as Boolean
129
+ "splitNames" -> processParams.splitNames = v as Boolean
130
+ "doDetectCan" -> processParams.doDetectCan = v as Boolean
131
+ "useFaceApi" -> processParams.useFaceApi = v as Boolean
132
+ "useAuthenticityCheck" -> processParams.useAuthenticityCheck = v as Boolean
133
+ "checkHologram" -> processParams.checkHologram = v as Boolean
134
+ "generateNumericCodes" -> processParams.generateNumericCodes = v as Boolean
135
+ "strictBarcodeDigitalSignatureCheck" -> processParams.strictBarcodeDigitalSignatureCheck = v as Boolean
136
+ "selectLongestNames" -> processParams.selectLongestNames = v as Boolean
137
+ "generateDTCVC" -> processParams.generateDTCVC = v as Boolean
138
+ "strictDLCategoryExpiry" -> processParams.strictDLCategoryExpiry = v as Boolean
139
+ "generateAlpha2Codes" -> processParams.generateAlpha2Codes = v as Boolean
140
+ "measureSystem" -> processParams.measureSystem = v.toInt()
141
+ "barcodeParserType" -> processParams.barcodeParserType = v.toInt()
142
+ "perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
143
+ "minDPI" -> processParams.minDPI = v.toInt()
144
+ "imageDpiOutMax" -> processParams.imageDpiOutMax = v.toInt()
145
+ "forceDocID" -> processParams.forceDocID = v.toInt()
146
+ "forceDocFormat" -> processParams.forceDocFormat = v.toInt()
147
+ "shiftExpiryDate" -> processParams.shiftExpiryDate = v.toInt()
148
+ "minimalHolderAge" -> processParams.minimalHolderAge = v.toInt()
149
+ "imageOutputMaxHeight" -> processParams.imageOutputMaxHeight = v.toInt()
150
+ "imageOutputMaxWidth" -> processParams.imageOutputMaxWidth = v.toInt()
151
+ "processAuth" -> processParams.processAuth = v.toInt()
152
+ "convertCase" -> processParams.convertCase = v.toInt()
153
+ "logLevel" -> processParams.logLevel = LogLevel.valueOf(v.toString())
154
+ "mrzDetectMode" -> processParams.mrzDetectMode = v.toInt()
155
+ "pdfPagesLimit" -> processParams.pdfPagesLimit = v.toInt()
156
+ "dateFormat" -> processParams.dateFormat = v as String
157
+ "scenario" -> processParams.scenario = v as String
158
+ "captureButtonScenario" -> processParams.captureButtonScenario = v as String
159
+ "timeout" -> processParams.timeout = v.toDouble()
160
+ "timeoutFromFirstDetect" -> processParams.timeoutFromFirstDetect = v.toDouble()
161
+ "timeoutFromFirstDocType" -> processParams.timeoutFromFirstDocType = v.toDouble()
162
+ "documentAreaMin" -> processParams.documentAreaMin = v.toDouble()
163
+ "timeoutLiveness" -> processParams.timeoutLiveness = v.toDouble()
164
+ "documentIDList" -> processParams.documentIDList = v.toIntArray()
165
+ "fieldTypesFilter" -> processParams.fieldTypesFilter = v.toIntArray()
166
+ "resultTypeOutput" -> processParams.resultTypeOutput = v.toIntArray()
167
+ "documentGroupFilter" -> processParams.documentGroupFilter = v.toIntArray()
168
+ "lcidIgnoreFilter" -> processParams.lcidIgnoreFilter = v.toIntArray()
169
+ "lcidFilter" -> processParams.lcidFilter = v.toIntArray()
170
+ "barcodeTypes" -> processParams.doBarcodes = barcodeTypeArrayFromJson(v as JSONArray)
171
+ "mrzFormatsFilter" -> processParams.mrzFormatsFilter = (v as JSONArray).toArray()
172
+ "customParams" -> processParams.customParams = v as JSONObject
173
+ "imageQA" -> setImageQA(processParams.imageQA, v as JSONObject)
174
+ "rfidParams" -> processParams.rfidParams = rfidParamsFromJSON(v as JSONObject)
175
+ "faceApiParams" -> processParams.faceApiParams = faceApiParamsFromJSON(v as JSONObject)
176
+ "backendProcessingConfig" -> processParams.backendProcessingConfig = backendProcessingConfigFromJSON(v as JSONObject)
177
+ "authenticityParams" -> {
178
+ if (processParams.authenticityParams == null) processParams.authenticityParams = AuthenticityParams.defaultParams()
179
+ setAuthenticityParams(processParams.authenticityParams!!, v as JSONObject)
180
+ }
181
+ }
182
+ }
183
+
184
+ @Suppress("DEPRECATION")
185
+ fun getProcessParams(processParams: ProcessParam) = mapOf(
186
+ "multipageProcessing" to processParams.multipageProcessing,
187
+ "logs" to processParams.isLogEnable,
188
+ "debugSaveImages" to processParams.debugSaveImages,
189
+ "debugSaveLogs" to processParams.debugSaveLogs,
190
+ "returnUncroppedImage" to processParams.returnUncroppedImage,
191
+ "uvTorchEnabled" to processParams.uvTorchEnabled,
192
+ "debugSaveCroppedImages" to processParams.debugSaveCroppedImages,
193
+ "disableFocusingCheck" to processParams.disableFocusingCheck,
194
+ "debugSaveRFIDSession" to processParams.debugSaveRFIDSession,
195
+ "doublePageSpread" to processParams.doublePageSpread,
196
+ "manualCrop" to processParams.manualCrop,
197
+ "integralImage" to processParams.integralImage,
198
+ "returnCroppedBarcode" to processParams.returnCroppedBarcode,
199
+ "checkRequiredTextFields" to processParams.checkRequiredTextFields,
200
+ "depersonalizeLog" to processParams.depersonalizeLog,
201
+ "generateDoublePageSpreadImage" to processParams.generateDoublePageSpreadImage,
202
+ "alreadyCropped" to processParams.alreadyCropped,
203
+ "matchTextFieldMask" to processParams.matchTextFieldMask,
204
+ "updateOCRValidityByGlare" to processParams.updateOCRValidityByGlare,
205
+ "noGraphics" to processParams.noGraphics,
206
+ "multiDocOnImage" to processParams.multiDocOnImage,
207
+ "forceReadMrzBeforeLocate" to processParams.forceReadMrzBeforeLocate,
208
+ "parseBarcodes" to processParams.parseBarcodes,
209
+ "shouldReturnPackageForReprocess" to processParams.shouldReturnPackageForReprocess,
210
+ "disablePerforationOCR" to processParams.disablePerforationOCR,
211
+ "respectImageQuality" to processParams.respectImageQuality,
212
+ "strictImageQuality" to processParams.strictImageQuality,
213
+ "splitNames" to processParams.splitNames,
214
+ "doDetectCan" to processParams.doDetectCan,
215
+ "useFaceApi" to processParams.useFaceApi,
216
+ "useAuthenticityCheck" to processParams.useAuthenticityCheck,
217
+ "checkHologram" to processParams.checkHologram,
218
+ "generateNumericCodes" to processParams.generateNumericCodes,
219
+ "strictBarcodeDigitalSignatureCheck" to processParams.strictBarcodeDigitalSignatureCheck,
220
+ "selectLongestNames" to processParams.selectLongestNames,
221
+ "generateDTCVC" to processParams.generateDTCVC,
222
+ "strictDLCategoryExpiry" to processParams.strictDLCategoryExpiry,
223
+ "generateAlpha2Codes" to processParams.generateAlpha2Codes,
224
+ "measureSystem" to processParams.measureSystem,
225
+ "barcodeParserType" to processParams.barcodeParserType,
226
+ "perspectiveAngle" to processParams.perspectiveAngle,
227
+ "minDPI" to processParams.minDPI,
228
+ "imageDpiOutMax" to processParams.imageDpiOutMax,
229
+ "forceDocID" to processParams.forceDocID,
230
+ "forceDocFormat" to processParams.forceDocFormat,
231
+ "shiftExpiryDate" to processParams.shiftExpiryDate,
232
+ "minimalHolderAge" to processParams.minimalHolderAge,
233
+ "imageOutputMaxHeight" to processParams.imageOutputMaxHeight,
234
+ "imageOutputMaxWidth" to processParams.imageOutputMaxWidth,
235
+ "processAuth" to processParams.processAuth,
236
+ "convertCase" to processParams.convertCase,
237
+ "logLevel" to processParams.logLevel?.toString(),
238
+ "mrzDetectMode" to processParams.mrzDetectMode,
239
+ "pdfPagesLimit" to processParams.pdfPagesLimit,
240
+ "dateFormat" to processParams.dateFormat,
241
+ "scenario" to processParams.scenario,
242
+ "captureButtonScenario" to processParams.captureButtonScenario,
243
+ "timeout" to processParams.timeout,
244
+ "timeoutFromFirstDetect" to processParams.timeoutFromFirstDetect,
245
+ "timeoutFromFirstDocType" to processParams.timeoutFromFirstDocType,
246
+ "documentAreaMin" to processParams.documentAreaMin,
247
+ "timeoutLiveness" to processParams.timeoutLiveness,
248
+ "documentIDList" to processParams.documentIDList.toJson(),
249
+ "fieldTypesFilter" to processParams.fieldTypesFilter.toJson(),
250
+ "documentGroupFilter" to processParams.documentGroupFilter.toJson(),
251
+ "lcidIgnoreFilter" to processParams.lcidIgnoreFilter.toJson(),
252
+ "lcidFilter" to processParams.lcidFilter.toJson(),
253
+ "resultTypeOutput" to processParams.resultTypeOutput.toJson(),
254
+ "mrzFormatsFilter" to processParams.mrzFormatsFilter.toJson(),
255
+ "barcodeTypes" to generateBarcodeTypeArray(processParams.doBarcodes),
256
+ "imageQA" to getImageQA(processParams.imageQA),
257
+ "rfidParams" to generateRFIDParams(processParams.rfidParams),
258
+ "faceApiParams" to generateFaceApiParams(processParams.faceApiParams),
259
+ "backendProcessingConfig" to generateBackendProcessingConfig(processParams.backendProcessingConfig),
260
+ "authenticityParams" to getAuthenticityParams(processParams.authenticityParams),
261
+ "customParams" to processParams.customParams,
262
+ ).toJson()
263
+
264
+ fun setCustomization(customization: ParamsCustomization, opts: JSONObject) = opts.forEach { k, v ->
265
+ val editor = customization.edit()
266
+ when (k) {
267
+ "showStatusMessages" -> editor.setShowStatusMessages(v as Boolean)
268
+ "showResultStatusMessages" -> editor.setShowResultStatusMessages(v as Boolean)
269
+ "showHelpAnimation" -> editor.setShowHelpAnimation(v as Boolean)
270
+ "showNextPageAnimation" -> editor.setShowNextPageAnimation(v as Boolean)
271
+ "showBackgroundMask" -> editor.setShowBackgroundMask(v as Boolean)
272
+ "cameraFrameBorderWidth" -> editor.setCameraFrameBorderWidth(v.toInt())
273
+ "cameraFrameLineLength" -> editor.setCameraFrameLineLength(v.toInt())
274
+ "cameraFrameShapeType" -> editor.setCameraFrameShapeType(v.toInt())
275
+ "cameraFrameOffsetWidth" -> editor.setCameraFrameOffsetWidth(v.toInt())
276
+ "activityIndicatorSize" -> editor.setActivityIndicatorSize(v.toInt())
277
+ "status" -> editor.setStatus(v as String)
278
+ "resultStatus" -> editor.setResultStatus(v as String)
279
+ "multipageButtonText" -> editor.setMultipageButtonText(v as String)
280
+ "cameraFrameDefaultColor" -> editor.setCameraFrameDefaultColor(v.toColor())
281
+ "cameraFrameActiveColor" -> editor.setCameraFrameActiveColor(v.toColor())
282
+ "statusTextColor" -> editor.setStatusTextColor(v.toColor())
283
+ "resultStatusTextColor" -> editor.setResultStatusTextColor(v.toColor())
284
+ "resultStatusBackgroundColor" -> editor.setResultStatusBackgroundColor(v.toColor())
285
+ "multipageButtonBackgroundColor" -> editor.setMultipageButtonBackgroundColor(v.toColor())
286
+ "tintColor" -> editor.setTintColor(v.toColor())
287
+ "activityIndicatorColor" -> editor.setActivityIndicatorColor(v.toColor())
288
+ "statusBackgroundColor" -> editor.setStatusBackgroundColor(v.toColor())
289
+ "cameraPreviewBackgroundColor" -> editor.setCameraPreviewBackgroundColor(v.toColor())
290
+ "backgroundMaskColor" -> editor.setBackgroundMaskColor(v.toColor())
291
+ "multipageButtonTextColor" -> editor.setMultipageButtonTextColor(v.toColor())
292
+ "statusPositionMultiplier" -> editor.setStatusPositionMultiplier(v.toFloat())
293
+ "resultStatusPositionMultiplier" -> editor.setResultStatusPositionMultiplier(v.toFloat())
294
+ "toolbarSize" -> editor.setToolbarSize(v.toFloat())
295
+ "backgroundMaskAlpha" -> editor.setBackgroundMaskAlpha(v.toFloat())
296
+ "customStatusPositionMultiplier" -> editor.setCustomStatusPositionMultiplier(v.toFloat())
297
+ "cameraFrameVerticalPositionMultiplier" -> editor.setCameraFrameVerticalPositionMultiplier(v.toFloat())
298
+ "cameraFrameLandscapeAspectRatio" -> editor.setCameraFrameLandscapeAspectRatio(v.toFloat())
299
+ "cameraFramePortraitAspectRatio" -> editor.setCameraFramePortraitAspectRatio(v.toFloat())
300
+ "cameraFrameCornerRadius" -> editor.setCameraFrameCornerRadius(v.toFloat())
301
+ "livenessAnimationPositionMultiplier" -> editor.setLivenessAnimationPositionMultiplier(v.toFloat())
302
+ "nextPageAnimationStartDelay" -> editor.setNextPageAnimationStartDelay(v.toFloat())
303
+ "nextPageAnimationEndDelay" -> editor.setNextPageAnimationEndDelay(v.toFloat())
304
+ "activityIndicatorPortraitPositionMultiplier" -> editor.setActivityIndicatorPortraitPositionMultiplier(v.toFloat())
305
+ "activityIndicatorLandscapePositionMultiplier" -> editor.setActivityIndicatorLandscapePositionMultiplier(v.toFloat())
306
+ "cameraPreviewVerticalPositionMultiplier" -> editor.setCameraPreviewVerticalPositionMultiplier(v.toFloat())
307
+ "multipageAnimationFrontImage" -> editor.setMultipageAnimationFrontImage(v.toDrawable())
308
+ "multipageAnimationBackImage" -> editor.setMultipageAnimationBackImage(v.toDrawable())
309
+ "borderBackgroundImage" -> editor.setBorderBackgroundImage(v.toDrawable())
310
+ "helpAnimationImage" -> editor.setHelpAnimationImage(v.toDrawable())
311
+ "closeButtonImage" -> editor.setCloseButtonImage(v.toDrawable())
312
+ "captureButtonImage" -> editor.setCaptureButtonImage(v.toDrawable())
313
+ "changeFrameButtonCollapseImage" -> editor.setChangeFrameCollapseButtonImage(v.toDrawable())
314
+ "changeFrameButtonExpandImage" -> editor.setChangeFrameExpandButtonImage(v.toDrawable())
315
+ "cameraSwitchButtonImage" -> editor.setCameraSwitchButtonImage(v.toDrawable())
316
+ "torchButtonOnImage" -> editor.setTorchImageOn(v.toDrawable())
317
+ "torchButtonOffImage" -> editor.setTorchImageOff(v.toDrawable())
318
+ "livenessAnimationImage" -> editor.setLivenessAnimationImage(v.toDrawable())
319
+ "helpAnimationImageMatrix" -> editor.setHelpAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setHelpAnimationImageScaleType(ImageView.ScaleType.MATRIX)
320
+ "multipageAnimationFrontImageMatrix" -> editor.setMultipageAnimationFrontImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationFrontImageScaleType(ImageView.ScaleType.MATRIX)
321
+ "multipageAnimationBackImageMatrix" -> editor.setMultipageAnimationBackImageMatrix(matrixFromJSON(v as JSONArray?)).setMultipageAnimationBackImageScaleType(ImageView.ScaleType.MATRIX)
322
+ "livenessAnimationImageMatrix" -> editor.setLivenessAnimationImageMatrix(matrixFromJSON(v as JSONArray?)).setLivenessAnimationImageScaleType(ImageView.ScaleType.MATRIX)
323
+ "borderBackgroundImageMatrix" -> editor.setBorderBackgroundImageMatrix(matrixFromJSON(v as JSONArray?)).setBorderBackgroundImageScaleType(ImageView.ScaleType.MATRIX)
324
+ "customLabelStatus" -> editor.setCustomLabelStatus(SpannableString(v as String))
325
+ "cameraFrameLineCap" -> editor.setCameraFrameLineCap(Paint.Cap.values()[v.toInt()])
326
+ "uiCustomizationLayer" -> editor.setUiCustomizationLayer(JSONObject(v.toString()))
327
+ "colors" -> setColors(editor, v as JSONObject)
328
+ "fonts" -> setFonts(editor, v as JSONObject)
329
+ "images" -> setImages(editor, v as JSONObject)
330
+ "statusTextFont" -> {
331
+ val font = typefaceFromJSON(v as JSONObject)
332
+ editor.setStatusTextFont(font.first)
333
+ font.second?.let { editor.setStatusTextSize(it) }
334
+ }
335
+
336
+ "resultStatusTextFont" -> {
337
+ val font = typefaceFromJSON(v as JSONObject)
338
+ editor.setResultStatusTextFont(font.first)
339
+ font.second?.let { editor.setResultStatusTextSize(it) }
340
+ }
341
+
342
+ "multipageButtonTextFont" -> {
343
+ val font = typefaceFromJSON(v as JSONObject)
344
+ editor.setMultipageButtonTextFont(font.first)
345
+ font.second?.let { editor.setMultipageButtonTextSize(it) }
346
+ }
347
+ }
348
+ editor.applyImmediately(context)
349
+ }
350
+
351
+ fun getCustomization(customization: ParamsCustomization) = mapOf(
352
+ "showStatusMessages" to customization.isShowStatusMessages,
353
+ "showResultStatusMessages" to customization.isShowResultStatusMessages,
354
+ "showHelpAnimation" to customization.isShowHelpAnimation,
355
+ "showNextPageAnimation" to customization.isShowNextPageAnimation,
356
+ "showBackgroundMask" to customization.isShowBackgroundMask,
357
+ "cameraFrameBorderWidth" to customization.cameraFrameBorderWidth,
358
+ "cameraFrameLineLength" to customization.cameraFrameLineLength,
359
+ "cameraFrameShapeType" to customization.cameraFrameShapeType,
360
+ "cameraFrameOffsetWidth" to customization.cameraFrameOffsetWidth,
361
+ "activityIndicatorSize" to customization.activityIndicatorSize,
362
+ "status" to customization.status,
363
+ "resultStatus" to customization.resultStatus,
364
+ "multipageButtonText" to customization.multipageButtonText,
365
+ "cameraFrameDefaultColor" to customization.cameraFrameDefaultColor.colorToLong(),
366
+ "cameraFrameActiveColor" to customization.cameraFrameActiveColor.colorToLong(),
367
+ "statusTextColor" to customization.statusTextColor.colorToLong(),
368
+ "resultStatusTextColor" to customization.resultStatusTextColor.colorToLong(),
369
+ "resultStatusBackgroundColor" to customization.resultStatusBackgroundColor.colorToLong(),
370
+ "multipageButtonBackgroundColor" to customization.multipageButtonBackgroundColor.colorToLong(),
371
+ "tintColor" to customization.tintColor.colorToLong(),
372
+ "activityIndicatorColor" to customization.activityIndicatorColor.colorToLong(),
373
+ "statusBackgroundColor" to customization.statusBackgroundColor.colorToLong(),
374
+ "cameraPreviewBackgroundColor" to customization.cameraPreviewBackgroundColor.colorToLong(),
375
+ "backgroundMaskColor" to customization.backgroundMaskColor.colorToLong(),
376
+ "multipageButtonTextColor" to customization.multipageButtonTextColor.colorToLong(),
377
+ "statusPositionMultiplier" to customization.statusPositionMultiplier,
378
+ "resultStatusPositionMultiplier" to customization.resultStatusPositionMultiplier,
379
+ "backgroundMaskAlpha" to customization.backgroundMaskAlpha,
380
+ "toolbarSize" to customization.toolbarSize,
381
+ "customStatusPositionMultiplier" to customization.customStatusPositionMultiplier,
382
+ "cameraFrameVerticalPositionMultiplier" to customization.cameraFrameVerticalPositionMultiplier,
383
+ "cameraFrameLandscapeAspectRatio" to customization.cameraFrameLandscapeAspectRatio,
384
+ "cameraFramePortraitAspectRatio" to customization.cameraFramePortraitAspectRatio,
385
+ "cameraFrameCornerRadius" to customization.cameraFrameCornerRadius,
386
+ "livenessAnimationPositionMultiplier" to customization.livenessAnimationPositionMultiplier,
387
+ "nextPageAnimationStartDelay" to customization.nextPageAnimationStartDelay,
388
+ "nextPageAnimationEndDelay" to customization.nextPageAnimationEndDelay,
389
+ "activityIndicatorPortraitPositionMultiplier" to customization.activityIndicatorPortraitPositionMultiplier,
390
+ "activityIndicatorLandscapePositionMultiplier" to customization.activityIndicatorLandscapePositionMultiplier,
391
+ "cameraPreviewVerticalPositionMultiplier" to customization.cameraPreviewVerticalPositionMultiplier,
392
+ "multipageAnimationFrontImage" to customization.multipageAnimationFrontImage.toBase64(),
393
+ "multipageAnimationBackImage" to customization.multipageAnimationBackImage.toBase64(),
394
+ "borderBackgroundImage" to customization.borderBackgroundImage.toBase64(),
395
+ "helpAnimationImage" to customization.helpAnimationImageDrawable.toBase64(),
396
+ "closeButtonImage" to customization.closeButtonDrawable.toBase64(),
397
+ "captureButtonImage" to customization.captureButtonDrawable.toBase64(),
398
+ "changeFrameButtonCollapseImage" to customization.changeFrameCollapseButtonDrawable.toBase64(),
399
+ "changeFrameButtonExpandImage" to customization.changeFrameExpandButtonDrawable.toBase64(),
400
+ "cameraSwitchButtonImage" to customization.cameraSwitchButtonDrawable.toBase64(),
401
+ "torchButtonOnImage" to customization.torchImageOnDrawable.toBase64(),
402
+ "torchButtonOffImage" to customization.torchImageOffDrawable.toBase64(),
403
+ "livenessAnimationImage" to customization.livenessAnimationImage.toBase64(),
404
+ "helpAnimationImageMatrix" to generateMatrix(customization.helpAnimationImageMatrix),
405
+ "multipageAnimationFrontImageMatrix" to generateMatrix(customization.multipageAnimationFrontImageMatrix),
406
+ "multipageAnimationBackImageMatrix" to generateMatrix(customization.multipageAnimationBackImageMatrix),
407
+ "livenessAnimationImageMatrix" to generateMatrix(customization.livenessAnimationImageMatrix),
408
+ "borderBackgroundImageMatrix" to generateMatrix(customization.borderBackgroundImageMatrix),
409
+ "statusTextFont" to generateTypeface(customization.statusTextFont, customization.statusTextSize),
410
+ "resultStatusTextFont" to generateTypeface(customization.resultStatusTextFont, customization.resultStatusTextSize),
411
+ "multipageButtonTextFont" to generateTypeface(customization.multipageButtonTextFont, customization.multipageButtonTextSize),
412
+ "customLabelStatus" to customization.customLabelStatus?.toString(),
413
+ "cameraFrameLineCap" to customization.cameraFrameLineCap.ordinal,
414
+ "uiCustomizationLayer" to customization.uiCustomizationLayer,
415
+ "colors" to getColors(customization.colors),
416
+ "fonts" to getFonts(customization.typeFaces, customization.fontSizes),
417
+ "images" to getImages(customization.images)
418
+ ).toJson()
419
+
420
+ fun setRfidScenario(rfidScenario: RfidScenario, opts: JSONObject) = opts.forEach { k, v ->
421
+ when (k) {
422
+ "paceStaticBinding" -> rfidScenario.isPaceStaticBinding = v as Boolean
423
+ "onlineTA" -> rfidScenario.isOnlineTA = v as Boolean
424
+ "writeEid" -> rfidScenario.isWriteEid = v as Boolean
425
+ "universalAccessRights" -> rfidScenario.isUniversalAccessRights = v as Boolean
426
+ "authorizedRestrictedIdentification" -> rfidScenario.isAuthorizedRestrictedIdentification = v as Boolean
427
+ "auxVerificationCommunityID" -> rfidScenario.isAuxVerificationCommunityID = v as Boolean
428
+ "auxVerificationDateOfBirth" -> rfidScenario.isAuxVerificationDateOfBirth = v as Boolean
429
+ "skipAA" -> rfidScenario.isSkipAA = v as Boolean
430
+ "strictProcessing" -> rfidScenario.isStrictProcessing = v as Boolean
431
+ "pkdDSCertPriority" -> rfidScenario.isPkdDSCertPriority = v as Boolean
432
+ "pkdUseExternalCSCA" -> rfidScenario.isPkdUseExternalCSCA = v as Boolean
433
+ "trustedPKD" -> rfidScenario.isTrustedPKD = v as Boolean
434
+ "passiveAuth" -> rfidScenario.isPassiveAuth = v as Boolean
435
+ "useSFI" -> rfidScenario.isUseSFI = v as Boolean
436
+ "readEPassport" -> rfidScenario.isReadEPassport = v as Boolean
437
+ "readEID" -> rfidScenario.isReadEID = v as Boolean
438
+ "readEDL" -> rfidScenario.isReadEDL = v as Boolean
439
+ "authorizedSTSignature" -> rfidScenario.isAuthorizedSTSignature = v as Boolean
440
+ "authorizedSTQSignature" -> rfidScenario.isAuthorizedSTQSignature = v as Boolean
441
+ "authorizedWriteDG17" -> rfidScenario.isAuthorizedWriteDG17 = v as Boolean
442
+ "authorizedWriteDG18" -> rfidScenario.isAuthorizedWriteDG18 = v as Boolean
443
+ "authorizedWriteDG19" -> rfidScenario.isAuthorizedWriteDG19 = v as Boolean
444
+ "authorizedWriteDG20" -> rfidScenario.isAuthorizedWriteDG20 = v as Boolean
445
+ "authorizedWriteDG21" -> rfidScenario.isAuthorizedWriteDG21 = v as Boolean
446
+ "authorizedVerifyAge" -> rfidScenario.isAuthorizedVerifyAge = v as Boolean
447
+ "authorizedVerifyCommunityID" -> rfidScenario.isAuthorizedVerifyCommunityID = v as Boolean
448
+ "authorizedPrivilegedTerminal" -> rfidScenario.isAuthorizedPrivilegedTerminal = v as Boolean
449
+ "authorizedCANAllowed" -> rfidScenario.isAuthorizedCANAllowed = v as Boolean
450
+ "authorizedPINManagement" -> rfidScenario.isAuthorizedPINManagment = v as Boolean
451
+ "authorizedInstallCert" -> rfidScenario.isAuthorizedInstallCert = v as Boolean
452
+ "authorizedInstallQCert" -> rfidScenario.isAuthorizedInstallQCert = v as Boolean
453
+ "applyAmendments" -> rfidScenario.isApplyAmendments = v as Boolean
454
+ "autoSettings" -> rfidScenario.isAutoSettings = v as Boolean
455
+ "proceedReadingAlways" -> rfidScenario.proceedReadingAlways = v as Boolean
456
+ "readDTC" -> rfidScenario.isReadDTC = v as Boolean
457
+ "mrzStrictCheck" -> rfidScenario.isMrzStrictCheck = v as Boolean
458
+ "loadCRLFromRemote" -> rfidScenario.isLoadCRLFromRemote = v as Boolean
459
+ "independentSODStatus" -> rfidScenario.isIndependentSODStatus = v as Boolean
460
+ "signManagementAction" -> rfidScenario.signManagementAction = v.toInt()
461
+ "readingBuffer" -> rfidScenario.readingBuffer = v.toInt()
462
+ "onlineTAToSignDataType" -> rfidScenario.onlineTAToSignDataType = v.toInt()
463
+ "profilerType" -> rfidScenario.profilerType = v.toInt()
464
+ "authProcType" -> rfidScenario.authProcType = v.toInt()
465
+ "baseSMProcedure" -> rfidScenario.baseSMProcedure = v.toInt()
466
+ "pacePasswordType" -> rfidScenario.pacePasswordType = v.toInt()
467
+ "terminalType" -> rfidScenario.terminalType = v.toInt()
468
+ "defaultReadingBufferSize" -> rfidScenario.defaultReadingBufferSize = v.toInt()
469
+ "password" -> rfidScenario.password = v as String
470
+ "pkdPA" -> rfidScenario.pkdPA = v as String
471
+ "pkdEAC" -> rfidScenario.pkdEAC = v as String
472
+ "mrz" -> rfidScenario.mrz = v as String
473
+ "eSignPINDefault" -> rfidScenario.seteSignPINDefault(v as String)
474
+ "eSignPINNewValue" -> rfidScenario.seteSignPINNewValue(v as String)
475
+ "cardAccess" -> rfidScenario.cardAccess = v as String
476
+ "mrzHash" -> rfidScenario.mrzHash = v as String
477
+ "documentNumber" -> rfidScenario.documentNumber = v as String
478
+ "dateOfBirth" -> rfidScenario.dateOfBirth = v as String
479
+ "dateOfExpiry" -> rfidScenario.dateOfExpiry = v as String
480
+ "ePassportDataGroups" -> setDataGroups(rfidScenario.ePassportDataGroups(), v as JSONObject)
481
+ "eIDDataGroups" -> setDataGroups(rfidScenario.eIDDataGroups(), v as JSONObject)
482
+ "eDLDataGroups" -> setDataGroups(rfidScenario.eDLDataGroups(), v as JSONObject)
483
+ "dtcDataGroups" -> setDTCDataGroup(rfidScenario.DTCDataGroup(), v as JSONObject)
484
+ }
485
+ }
486
+
487
+ fun getRfidScenario(rfidScenario: RfidScenario) = mapOf(
488
+ "paceStaticBinding" to rfidScenario.isPaceStaticBinding,
489
+ "onlineTA" to rfidScenario.isOnlineTA,
490
+ "writeEid" to rfidScenario.isWriteEid,
491
+ "universalAccessRights" to rfidScenario.isUniversalAccessRights,
492
+ "authorizedRestrictedIdentification" to rfidScenario.isAuthorizedRestrictedIdentification,
493
+ "auxVerificationCommunityID" to rfidScenario.isAuxVerificationCommunityID,
494
+ "auxVerificationDateOfBirth" to rfidScenario.isAuxVerificationDateOfBirth,
495
+ "skipAA" to rfidScenario.isSkipAA,
496
+ "strictProcessing" to rfidScenario.isStrictProcessing,
497
+ "pkdDSCertPriority" to rfidScenario.isPkdDSCertPriority,
498
+ "pkdUseExternalCSCA" to rfidScenario.isPkdUseExternalCSCA,
499
+ "trustedPKD" to rfidScenario.isTrustedPKD,
500
+ "passiveAuth" to rfidScenario.isPassiveAuth,
501
+ "useSFI" to rfidScenario.isUseSFI,
502
+ "readEPassport" to rfidScenario.isReadEPassport,
503
+ "readEID" to rfidScenario.isReadEID,
504
+ "readEDL" to rfidScenario.isReadEDL,
505
+ "authorizedSTSignature" to rfidScenario.isAuthorizedSTSignature,
506
+ "authorizedSTQSignature" to rfidScenario.isAuthorizedSTQSignature,
507
+ "authorizedWriteDG17" to rfidScenario.isAuthorizedWriteDG17,
508
+ "authorizedWriteDG18" to rfidScenario.isAuthorizedWriteDG18,
509
+ "authorizedWriteDG19" to rfidScenario.isAuthorizedWriteDG19,
510
+ "authorizedWriteDG20" to rfidScenario.isAuthorizedWriteDG20,
511
+ "authorizedWriteDG21" to rfidScenario.isAuthorizedWriteDG21,
512
+ "authorizedVerifyAge" to rfidScenario.isAuthorizedVerifyAge,
513
+ "authorizedVerifyCommunityID" to rfidScenario.isAuthorizedVerifyCommunityID,
514
+ "authorizedPrivilegedTerminal" to rfidScenario.isAuthorizedPrivilegedTerminal,
515
+ "authorizedCANAllowed" to rfidScenario.isAuthorizedCANAllowed,
516
+ "authorizedPINManagement" to rfidScenario.isAuthorizedPINManagment,
517
+ "authorizedInstallCert" to rfidScenario.isAuthorizedInstallCert,
518
+ "authorizedInstallQCert" to rfidScenario.isAuthorizedInstallQCert,
519
+ "applyAmendments" to rfidScenario.isApplyAmendments,
520
+ "autoSettings" to rfidScenario.isAutoSettings,
521
+ "proceedReadingAlways" to rfidScenario.proceedReadingAlways,
522
+ "readDTC" to rfidScenario.isReadDTC,
523
+ "mrzStrictCheck" to rfidScenario.isMrzStrictCheck,
524
+ "loadCRLFromRemote" to rfidScenario.isLoadCRLFromRemote,
525
+ "independentSODStatus" to rfidScenario.isIndependentSODStatus,
526
+ "signManagementAction" to rfidScenario.signManagementAction,
527
+ "readingBuffer" to rfidScenario.readingBuffer,
528
+ "onlineTAToSignDataType" to rfidScenario.onlineTAToSignDataType,
529
+ "profilerType" to rfidScenario.profilerType,
530
+ "authProcType" to rfidScenario.authProcType,
531
+ "baseSMProcedure" to rfidScenario.baseSMProcedure,
532
+ "pacePasswordType" to rfidScenario.pacePasswordType,
533
+ "terminalType" to rfidScenario.terminalType,
534
+ "defaultReadingBufferSize" to rfidScenario.defaultReadingBufferSize,
535
+ "password" to rfidScenario.password,
536
+ "pkdPA" to rfidScenario.pkdPA,
537
+ "pkdEAC" to rfidScenario.pkdEAC,
538
+ "mrz" to rfidScenario.mrz,
539
+ "eSignPINDefault" to rfidScenario.geteSignPINDefault(),
540
+ "eSignPINNewValue" to rfidScenario.geteSignPINNewValue(),
541
+ "cardAccess" to rfidScenario.cardAccess,
542
+ "mrzHash" to rfidScenario.mrzHash,
543
+ "documentNumber" to rfidScenario.documentNumber,
544
+ "dateOfBirth" to rfidScenario.dateOfBirth,
545
+ "dateOfExpiry" to rfidScenario.dateOfExpiry,
546
+ "ePassportDataGroups" to getDataGroups(rfidScenario.ePassportDataGroups()),
547
+ "eIDDataGroups" to getDataGroups(rfidScenario.eIDDataGroups()),
548
+ "eDLDataGroups" to getDataGroups(rfidScenario.eDLDataGroups()),
549
+ "dtcDataGroups" to getDTCDataGroup(rfidScenario.DTCDataGroup())
550
+ ).toJson()
551
+
552
+ fun setDataGroups(dataGroup: DataGroups, opts: JSONObject) = opts.forEach { k, v ->
553
+ val value = v as Boolean
554
+ when (k) {
555
+ "DG1" -> dataGroup.isDG1 = value
556
+ "DG2" -> dataGroup.isDG2 = value
557
+ "DG3" -> dataGroup.isDG3 = value
558
+ "DG4" -> dataGroup.isDG4 = value
559
+ "DG5" -> dataGroup.isDG5 = value
560
+ "DG6" -> dataGroup.isDG6 = value
561
+ "DG7" -> dataGroup.isDG7 = value
562
+ "DG8" -> dataGroup.isDG8 = value
563
+ "DG9" -> dataGroup.isDG9 = value
564
+ "DG10" -> dataGroup.isDG10 = value
565
+ "DG11" -> dataGroup.isDG11 = value
566
+ "DG12" -> dataGroup.isDG12 = value
567
+ "DG13" -> dataGroup.isDG13 = value
568
+ "DG14" -> dataGroup.isDG14 = value
569
+ }
570
+ if (dataGroup is EPassportDataGroups) when (k) {
571
+ "DG15" -> dataGroup.isDG15 = value
572
+ "DG16" -> dataGroup.isDG16 = value
573
+ }
574
+ if (dataGroup is EIDDataGroups) when (k) {
575
+ "DG15" -> dataGroup.isDG15 = value
576
+ "DG16" -> dataGroup.isDG16 = value
577
+ "DG17" -> dataGroup.isDG17 = value
578
+ "DG18" -> dataGroup.isDG18 = value
579
+ "DG19" -> dataGroup.isDG19 = value
580
+ "DG20" -> dataGroup.isDG20 = value
581
+ "DG21" -> dataGroup.isDG21 = value
582
+ }
583
+ }
584
+
585
+ fun getDataGroups(dataGroup: DataGroups): JSONObject {
586
+ val result = mutableMapOf(
587
+ "DG1" to dataGroup.isDG1,
588
+ "DG2" to dataGroup.isDG2,
589
+ "DG3" to dataGroup.isDG3,
590
+ "DG4" to dataGroup.isDG4,
591
+ "DG5" to dataGroup.isDG5,
592
+ "DG6" to dataGroup.isDG6,
593
+ "DG7" to dataGroup.isDG7,
594
+ "DG8" to dataGroup.isDG8,
595
+ "DG9" to dataGroup.isDG9,
596
+ "DG10" to dataGroup.isDG10,
597
+ "DG11" to dataGroup.isDG11,
598
+ "DG12" to dataGroup.isDG12,
599
+ "DG13" to dataGroup.isDG13,
600
+ "DG14" to dataGroup.isDG14
601
+ )
602
+ if (dataGroup is EPassportDataGroups) {
603
+ result["DG15"] = dataGroup.isDG15
604
+ result["DG16"] = dataGroup.isDG16
605
+ }
606
+ if (dataGroup is EIDDataGroups) {
607
+ result["DG15"] = dataGroup.isDG15
608
+ result["DG16"] = dataGroup.isDG16
609
+ result["DG17"] = dataGroup.isDG17
610
+ result["DG18"] = dataGroup.isDG18
611
+ result["DG19"] = dataGroup.isDG19
612
+ result["DG20"] = dataGroup.isDG20
613
+ result["DG21"] = dataGroup.isDG21
614
+ }
615
+ return result.toJson()
616
+ }
617
+
618
+ fun setDTCDataGroup(dataGroup: DTCDataGroup, opts: JSONObject) = opts.forEach { k, v ->
619
+ val value = v as Boolean
620
+ when (k) {
621
+ "DG17" -> dataGroup.isDG17 = value
622
+ "DG18" -> dataGroup.isDG18 = value
623
+ "DG22" -> dataGroup.isDG22 = value
624
+ "DG23" -> dataGroup.isDG23 = value
625
+ "DG24" -> dataGroup.isDG24 = value
626
+ }
627
+ }
628
+
629
+ fun getDTCDataGroup(dataGroup: DTCDataGroup) = mapOf(
630
+ "DG17" to dataGroup.isDG17,
631
+ "DG18" to dataGroup.isDG18,
632
+ "DG22" to dataGroup.isDG22,
633
+ "DG23" to dataGroup.isDG23,
634
+ "DG24" to dataGroup.isDG24,
635
+ ).toJson()
636
+
637
+ fun setImageQA(input: ImageQA, opts: JSONObject) = opts.forEach { k, v ->
638
+ when (k) {
639
+ "focusCheck" -> input.focusCheck = v as Boolean
640
+ "glaresCheck" -> input.glaresCheck = v as Boolean
641
+ "colornessCheck" -> input.colornessCheck = v as Boolean
642
+ "screenCapture" -> input.screenCapture = v as Boolean
643
+ "dpiThreshold" -> input.dpiThreshold = v.toInt()
644
+ "angleThreshold" -> input.angleThreshold = v.toInt()
645
+ "documentPositionIndent" -> input.documentPositionIndent = v.toInt()
646
+ "brightnessThreshold" -> input.brightnessThreshold = v.toDouble()
647
+ "expectedPass" -> input.expectedPass = v.toIntArray()
648
+ "glaresCheckParams" -> input.glaresCheckParams = glaresCheckParamsFromJSON(v as JSONObject)
649
+ "occlusionCheck" -> input.occlusionCheck = v as Boolean
650
+ }
651
+ }
652
+
653
+ fun getImageQA(input: ImageQA) = mapOf(
654
+ "focusCheck" to input.focusCheck,
655
+ "glaresCheck" to input.glaresCheck,
656
+ "colornessCheck" to input.colornessCheck,
657
+ "screenCapture" to input.screenCapture,
658
+ "dpiThreshold" to input.dpiThreshold,
659
+ "angleThreshold" to input.angleThreshold,
660
+ "documentPositionIndent" to input.documentPositionIndent,
661
+ "brightnessThreshold" to input.brightnessThreshold,
662
+ "expectedPass" to input.expectedPass.toJson(),
663
+ "glaresCheckParams" to generateGlaresCheckParams(input.glaresCheckParams),
664
+ "occlusionCheck" to input.occlusionCheck,
665
+ ).toJson()
666
+
667
+ fun setAuthenticityParams(input: AuthenticityParams, opts: JSONObject) = opts.forEach { k, v ->
668
+ when (k) {
669
+ "useLivenessCheck" -> input.useLivenessCheck = v as Boolean
670
+ "checkUVLuminiscence" -> input.checkUVLuminiscence = v as Boolean
671
+ "checkIRB900" -> input.checkIRB900 = v as Boolean
672
+ "checkImagePatterns" -> input.checkImagePatterns = v as Boolean
673
+ "checkFibers" -> input.checkFibers = v as Boolean
674
+ "checkExtMRZ" -> input.checkExtMRZ = v as Boolean
675
+ "checkExtOCR" -> input.checkExtOCR = v as Boolean
676
+ "checkAxial" -> input.checkAxial = v as Boolean
677
+ "checkBarcodeFormat" -> input.checkBarcodeFormat = v as Boolean
678
+ "checkIRVisibility" -> input.checkIRVisibility = v as Boolean
679
+ "checkIPI" -> input.checkIPI = v as Boolean
680
+ "checkPhotoEmbedding" -> input.checkPhotoEmbedding = v as Boolean
681
+ "checkPhotoComparison" -> input.checkPhotoComparison = v as Boolean
682
+ "checkLetterScreen" -> input.checkLetterScreen = v as Boolean
683
+ "checkSecurityText" -> input.checkSecurityText = v as Boolean
684
+ "livenessParams" -> {
685
+ if (input.livenessParams == null) input.livenessParams = LivenessParams.defaultParams()
686
+ setLivenessParams(input.livenessParams!!, v as JSONObject)
687
+ }
688
+ }
689
+ }
690
+
691
+ fun getAuthenticityParams(input: AuthenticityParams?) = input?.let {
692
+ mapOf(
693
+ "useLivenessCheck" to it.useLivenessCheck,
694
+ "checkUVLuminiscence" to it.checkUVLuminiscence,
695
+ "checkIRB900" to input.checkIRB900,
696
+ "checkImagePatterns" to it.checkImagePatterns,
697
+ "checkFibers" to it.checkFibers,
698
+ "checkExtMRZ" to it.checkExtMRZ,
699
+ "checkExtOCR" to it.checkExtOCR,
700
+ "checkAxial" to it.checkAxial,
701
+ "checkBarcodeFormat" to it.checkBarcodeFormat,
702
+ "checkIRVisibility" to it.checkIRVisibility,
703
+ "checkIPI" to it.checkIPI,
704
+ "checkPhotoEmbedding" to it.checkPhotoEmbedding,
705
+ "checkPhotoComparison" to it.checkPhotoComparison,
706
+ "checkLetterScreen" to it.checkLetterScreen,
707
+ "checkSecurityText" to it.checkSecurityText,
708
+ "livenessParams" to getLivenessParams(it.livenessParams)
709
+ ).toJson()
710
+ }
711
+
712
+ fun setLivenessParams(input: LivenessParams, opts: JSONObject) = opts.forEach { k, v ->
713
+ when (k) {
714
+ "checkOVI" -> input.checkOVI = v as Boolean
715
+ "checkMLI" -> input.checkMLI = v as Boolean
716
+ "checkHolo" -> input.checkHolo = v as Boolean
717
+ "checkED" -> input.checkED = v as Boolean
718
+ "checkBlackAndWhiteCopy" -> input.checkBlackAndWhiteCopy = v as Boolean
719
+ "checkDynaprint" -> input.checkDynaprint = v as Boolean
720
+ "checkGeometry" -> input.checkGeometry = v as Boolean
721
+ }
722
+ }
723
+
724
+ fun getLivenessParams(input: LivenessParams?) = input?.let {
725
+ mapOf(
726
+ "checkOVI" to input.checkOVI,
727
+ "checkMLI" to input.checkMLI,
728
+ "checkHolo" to input.checkHolo,
729
+ "checkED" to input.checkED,
730
+ "checkBlackAndWhiteCopy" to input.checkBlackAndWhiteCopy,
731
+ "checkDynaprint" to input.checkDynaprint,
732
+ "checkGeometry" to input.checkGeometry,
733
+ ).toJson()
734
+ }
735
+
736
+ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
737
+ val value = v.toLong()
738
+ when (key) {
739
+ "rfidProcessingScreenBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND, value)
740
+ "rfidProcessingScreenHintLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT, value)
741
+ "rfidProcessingScreenHintLabelBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND, value)
742
+ "rfidProcessingScreenProgressLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT, value)
743
+ "rfidProcessingScreenProgressBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR, value)
744
+ "rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
745
+ "rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
746
+ "rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
747
+ }
748
+ }
749
+
750
+ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
751
+ "rfidProcessingScreenBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_BACKGROUND],
752
+ "rfidProcessingScreenHintLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_TEXT],
753
+ "rfidProcessingScreenHintLabelBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_HINT_LABEL_BACKGROUND],
754
+ "rfidProcessingScreenProgressLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_LABEL_TEXT],
755
+ "rfidProcessingScreenProgressBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR],
756
+ "rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
757
+ "rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
758
+ "rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
759
+ ).toJson()
760
+
761
+ fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
762
+ when (key) {
763
+ "rfidProcessingScreenHintLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.setFont(input, value)
764
+ "rfidProcessingScreenProgressLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.setFont(input, value)
765
+ "rfidProcessingScreenResultLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.setFont(input, value)
766
+ }
767
+ }
768
+
769
+ fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) = mapOf(
770
+ "rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.getFont(fonts, sizes),
771
+ "rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.getFont(fonts, sizes),
772
+ "rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.getFont(fonts, sizes),
773
+ ).toJson()
774
+
775
+ fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
776
+ when (key) {
777
+ "rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable())
778
+ }
779
+ }
780
+
781
+ fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
782
+ "rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toBase64(),
783
+ ).toJson()
784
+
785
+ fun CustomizationFont.getFont(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) =
786
+ generateTypeface(fonts[this], sizes[this])
787
+
788
+ fun CustomizationFont.setFont(editor: ParamsCustomization.CustomizationEditor, value: Any?) {
789
+ val font = typefaceFromJSON(value as JSONObject)
790
+ editor.setFont(this, font.first)
791
+ font.second?.let { editor.setFontSize(this, it) }
792
+ }
793
+
794
+ fun Any.toInt() = when (this) {
795
+ is Double -> toInt()
796
+ is Long -> toInt()
797
+ is String -> Integer.parseInt(this)
798
+ else -> this as Int
799
+ }
800
+
801
+ fun Any.toLong() = when (this) {
802
+ is Double -> toLong()
803
+ is Int -> toLong()
804
+ else -> this as Long
805
+ }
806
+
807
+ fun Any.toFloat() = when (this) {
808
+ is Int -> toFloat()
809
+ is Double -> toFloat()
810
+ else -> this as Float
811
+ }
812
+
813
+ fun Any.toDouble() = when (this) {
814
+ is Int -> toDouble()
815
+ is Long -> toDouble()
816
+ else -> this as Double
817
+ }
818
+
819
+ fun Any?.toColor() = this?.let {
820
+ "#" + toLong().toString(16)
821
+ }
822
+
823
+ fun String?.colorToLong() = this?.let {
824
+ if (this[0] == '#') this.substring(1).toLong(16)
825
+ else this.toLong(16)
826
+ }