|
1 | 1 | from yoti_python_sdk.doc_scan.constants import INCLUSION_BLACKLIST |
2 | 2 | from yoti_python_sdk.doc_scan.constants import INCLUSION_WHITELIST |
3 | 3 | from yoti_python_sdk.doc_scan.constants import ORTHOGONAL_RESTRICTIONS |
4 | | -from yoti_python_sdk.utils import YotiSerializable |
| 4 | +from yoti_python_sdk.utils import YotiSerializable, remove_null_values |
5 | 5 | from .document_filter import DocumentFilter |
6 | 6 |
|
7 | 7 |
|
@@ -31,10 +31,9 @@ def country_codes(self): |
31 | 31 | return self.__country_codes |
32 | 32 |
|
33 | 33 | def to_json(self): |
34 | | - return {"inclusion": self.inclusion, "country_codes": self.country_codes} |
35 | | - |
36 | | - def include_null_values(self): |
37 | | - return False |
| 34 | + return remove_null_values( |
| 35 | + {"inclusion": self.inclusion, "country_codes": self.country_codes} |
| 36 | + ) |
38 | 37 |
|
39 | 38 |
|
40 | 39 | class TypeRestriction(YotiSerializable): |
@@ -63,10 +62,9 @@ def document_types(self): |
63 | 62 | return self.__document_types |
64 | 63 |
|
65 | 64 | def to_json(self): |
66 | | - return {"inclusion": self.inclusion, "document_types": self.document_types} |
67 | | - |
68 | | - def include_null_values(self): |
69 | | - return False |
| 65 | + return remove_null_values( |
| 66 | + {"inclusion": self.inclusion, "document_types": self.document_types} |
| 67 | + ) |
70 | 68 |
|
71 | 69 |
|
72 | 70 | class OrthogonalRestrictionsFilter(DocumentFilter): |
@@ -100,10 +98,7 @@ def to_json(self): |
100 | 98 | parent = DocumentFilter.to_json(self) |
101 | 99 | parent["country_restriction"] = self.country_restriction |
102 | 100 | parent["type_restriction"] = self.type_restriction |
103 | | - return parent |
104 | | - |
105 | | - def include_null_values(self): |
106 | | - return False |
| 101 | + return remove_null_values(parent) |
107 | 102 |
|
108 | 103 |
|
109 | 104 | class OrthogonalRestrictionsFilterBuilder(object): |
|
0 commit comments