|
1 | 1 | from typing import Optional |
2 | 2 |
|
3 | | -from regula.documentreader.webclient import gen, AuthenticityResultType |
| 3 | +from regula.documentreader.webclient.gen.models import AuthenticityCheckList as GenAuthenticityCheckList |
| 4 | +from regula.documentreader.webclient.gen.models import AuthenticityResultType, AuthenticityCheckResult |
4 | 5 | from regula.documentreader.webclient.ext.models.authenticity.fiber import FiberChecks |
5 | 6 | from regula.documentreader.webclient.ext.models.authenticity.ident import IdentChecks |
6 | 7 | from regula.documentreader.webclient.ext.models.authenticity.image_ident import ImageIdentChecks |
7 | 8 | from regula.documentreader.webclient.ext.models.authenticity.ocr_security_text import OCRSecurityTextChecks |
8 | 9 | from regula.documentreader.webclient.ext.models.authenticity.security_feature import SecurityFeatureChecks |
9 | 10 |
|
10 | 11 |
|
11 | | -class AuthenticityCheckList(gen.AuthenticityCheckList): |
| 12 | +class AuthenticityCheckList(GenAuthenticityCheckList): |
12 | 13 |
|
13 | 14 | @property |
14 | 15 | def uv_luminescence_checks(self) -> Optional[SecurityFeatureChecks]: |
15 | | - return self.__result_by_type(AuthenticityResultType.UV_LUMINESCENCE, SecurityFeatureChecks) |
| 16 | + result = self.__result_by_type(AuthenticityResultType.UV_LUMINESCENCE) |
| 17 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
16 | 18 |
|
17 | 19 | @property |
18 | 20 | def ir_b900_checks(self) -> Optional[SecurityFeatureChecks]: |
19 | | - return self.__result_by_type(AuthenticityResultType.IR_B900, SecurityFeatureChecks) |
| 21 | + result = self.__result_by_type(AuthenticityResultType.IR_B900) |
| 22 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
20 | 23 |
|
21 | 24 | @property |
22 | 25 | def image_pattern_checks(self) -> Optional[IdentChecks]: |
23 | | - return self.__result_by_type(AuthenticityResultType.IMAGE_PATTERN, IdentChecks) |
| 26 | + result = self.__result_by_type(AuthenticityResultType.IMAGE_PATTERN) |
| 27 | + return IdentChecks.from_dict(result.to_dict()) |
24 | 28 |
|
25 | 29 | @property |
26 | 30 | def axial_protection_checks(self) -> Optional[SecurityFeatureChecks]: |
27 | | - return self.__result_by_type(AuthenticityResultType.AXIAL_PROTECTION, SecurityFeatureChecks) |
| 31 | + result = self.__result_by_type(AuthenticityResultType.AXIAL_PROTECTION) |
| 32 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
28 | 33 |
|
29 | 34 | @property |
30 | 35 | def uv_fiber_checks(self) -> Optional[FiberChecks]: |
31 | | - return self.__result_by_type(AuthenticityResultType.UV_FIBERS, FiberChecks) |
| 36 | + result = self.__result_by_type(AuthenticityResultType.UV_FIBERS) |
| 37 | + return FiberChecks.from_dict(result.to_dict()) |
32 | 38 |
|
33 | 39 | @property |
34 | 40 | def ir_visibility_checks(self) -> Optional[IdentChecks]: |
35 | | - return self.__result_by_type(AuthenticityResultType.IR_VISIBILITY, IdentChecks) |
| 41 | + result = self.__result_by_type(AuthenticityResultType.IR_VISIBILITY) |
| 42 | + return IdentChecks.from_dict(result.to_dict()) |
36 | 43 |
|
37 | 44 | @property |
38 | 45 | def ocr_security_text_checks(self) -> Optional[OCRSecurityTextChecks]: |
39 | | - return self.__result_by_type(AuthenticityResultType.OCR_SECURITY_TEXT, OCRSecurityTextChecks) |
| 46 | + result = self.__result_by_type(AuthenticityResultType.OCR_SECURITY_TEXT) |
| 47 | + return OCRSecurityTextChecks.from_dict(result.to_dict()) |
40 | 48 |
|
41 | 49 | @property |
42 | 50 | def ipi_checks(self) -> Optional[ImageIdentChecks]: |
43 | | - return self.__result_by_type(AuthenticityResultType.IPI, ImageIdentChecks) |
| 51 | + result = self.__result_by_type(AuthenticityResultType.IPI) |
| 52 | + return ImageIdentChecks.from_dict(result.to_dict()) |
44 | 53 |
|
45 | 54 | @property |
46 | 55 | def embed_image_checks(self) -> Optional[SecurityFeatureChecks]: |
47 | | - return self.__result_by_type(AuthenticityResultType.PHOTO_EMBED_TYPE, SecurityFeatureChecks) |
| 56 | + result = self.__result_by_type(AuthenticityResultType.PHOTO_EMBED_TYPE) |
| 57 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
48 | 58 |
|
49 | 59 | @property |
50 | 60 | def holograms_checks(self) -> Optional[SecurityFeatureChecks]: |
51 | | - return self.__result_by_type(AuthenticityResultType.HOLOGRAMS, SecurityFeatureChecks) |
| 61 | + result = self.__result_by_type(AuthenticityResultType.HOLOGRAMS) |
| 62 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
52 | 63 |
|
53 | 64 | @property |
54 | 65 | def photo_area_checks(self) -> Optional[SecurityFeatureChecks]: |
55 | | - return self.__result_by_type(AuthenticityResultType.PHOTO_AREA, SecurityFeatureChecks) |
| 66 | + result = self.__result_by_type(AuthenticityResultType.PHOTO_AREA) |
| 67 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
56 | 68 |
|
57 | 69 | @property |
58 | 70 | def portrait_comparison_checks(self) -> Optional[IdentChecks]: |
59 | | - return self.__result_by_type(AuthenticityResultType.PORTRAIT_COMPARISON, IdentChecks) |
| 71 | + result = self.__result_by_type(AuthenticityResultType.PORTRAIT_COMPARISON) |
| 72 | + return IdentChecks.from_dict(result.to_dict()) |
60 | 73 |
|
61 | 74 | @property |
62 | 75 | def barcode_format_checks(self) -> Optional[SecurityFeatureChecks]: |
63 | | - return self.__result_by_type(AuthenticityResultType.BARCODE_FORMAT_CHECK, SecurityFeatureChecks) |
| 76 | + result = self.__result_by_type(AuthenticityResultType.BARCODE_FORMAT_CHECK) |
| 77 | + return SecurityFeatureChecks.from_dict(result.to_dict()) |
64 | 78 |
|
65 | 79 | @property |
66 | 80 | def kinegram_checks(self) -> Optional[IdentChecks]: |
67 | | - return self.__result_by_type(AuthenticityResultType.KINEGRAM, IdentChecks) |
| 81 | + result = self.__result_by_type(AuthenticityResultType.KINEGRAM) |
| 82 | + return IdentChecks.from_dict(result.to_dict()) |
68 | 83 |
|
69 | 84 | @property |
70 | 85 | def letter_screen_checks(self) -> Optional[IdentChecks]: |
71 | | - return self.__result_by_type(AuthenticityResultType.LETTER_SCREEN, IdentChecks) |
| 86 | + result = self.__result_by_type(AuthenticityResultType.LETTER_SCREEN) |
| 87 | + return IdentChecks.from_dict(result.to_dict()) |
72 | 88 |
|
73 | | - def __result_by_type(self, authenticity_type: int, parent_class: type) -> Optional[gen.AuthenticityCheckResult]: |
| 89 | + def __result_by_type(self, authenticity_type: int) -> Optional[AuthenticityCheckResult]: |
74 | 90 | for result in self.list: |
75 | 91 | if result.type == authenticity_type: |
76 | | - result.__class__ = parent_class |
77 | 92 | return result |
78 | 93 | return None |
0 commit comments