onfido-python 5.0.0__py3-none-any.whl → 5.2.0__py3-none-any.whl

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 (29) hide show
  1. onfido/__init__.py +8 -4
  2. onfido/api/default_api.py +262 -0
  3. onfido/api_client.py +1 -1
  4. onfido/configuration.py +1 -1
  5. onfido/models/__init__.py +7 -3
  6. onfido/models/applicant_consent.py +111 -0
  7. onfido/models/check_builder.py +8 -2
  8. onfido/models/check_request.py +8 -2
  9. onfido/models/device_intelligence_breakdown.py +7 -1
  10. onfido/models/device_intelligence_breakdown_breakdown.py +3 -3
  11. onfido/models/{device_intelligence_breakdown_breakdown_device.py → device_intelligence_breakdown_device.py} +6 -6
  12. onfido/models/{device_intelligence_breakdown_breakdown_device_breakdown.py → device_intelligence_breakdown_device_breakdown.py} +4 -4
  13. onfido/models/device_intelligence_breakdown_properties_device.py +3 -3
  14. onfido/models/device_intelligence_properties.py +116 -0
  15. onfido/models/device_intelligence_report.py +8 -2
  16. onfido/models/document_properties.py +9 -5
  17. onfido/models/{document_properties_driving_licence_information.py → document_properties_driving_licence_information_item.py} +4 -4
  18. onfido/models/document_with_driver_verification_report_all_of_properties.py +9 -5
  19. onfido/models/report_configuration.py +119 -0
  20. onfido/models/report_configuration_facial_similarity.py +110 -0
  21. onfido/models/webhook.py +11 -1
  22. onfido/models/webhook_builder.py +11 -1
  23. onfido/models/webhook_shared.py +12 -2
  24. onfido/models/webhook_updater.py +11 -1
  25. {onfido_python-5.0.0.dist-info → onfido_python-5.2.0.dist-info}/METADATA +3 -2
  26. {onfido_python-5.0.0.dist-info → onfido_python-5.2.0.dist-info}/RECORD +29 -25
  27. {onfido_python-5.0.0.dist-info → onfido_python-5.2.0.dist-info}/WHEEL +1 -1
  28. {onfido_python-5.0.0.dist-info → onfido_python-5.2.0.dist-info/licenses}/LICENSE +0 -0
  29. {onfido_python-5.0.0.dist-info → onfido_python-5.2.0.dist-info}/top_level.txt +0 -0
@@ -19,15 +19,15 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
- from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
22
+ from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
26
- class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel):
26
+ class DeviceIntelligenceBreakdownDevice(BaseModel):
27
27
  """
28
28
  Asserts whether the device used to upload the media is trustworthy, i.e. it is a real, physical device.
29
29
  """ # noqa: E501
30
- breakdown: Optional[DeviceIntelligenceBreakdownBreakdownDeviceBreakdown] = None
30
+ breakdown: Optional[DeviceIntelligenceBreakdownDeviceBreakdown] = None
31
31
  additional_properties: Dict[str, Any] = {}
32
32
  __properties: ClassVar[List[str]] = ["breakdown"]
33
33
 
@@ -49,7 +49,7 @@ class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel):
49
49
 
50
50
  @classmethod
51
51
  def from_json(cls, json_str: str) -> Optional[Self]:
52
- """Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a JSON string"""
52
+ """Create an instance of DeviceIntelligenceBreakdownDevice from a JSON string"""
53
53
  return cls.from_dict(json.loads(json_str))
54
54
 
55
55
  def to_dict(self) -> Dict[str, Any]:
@@ -84,7 +84,7 @@ class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel):
84
84
 
85
85
  @classmethod
86
86
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a dict"""
87
+ """Create an instance of DeviceIntelligenceBreakdownDevice from a dict"""
88
88
  if obj is None:
89
89
  return None
90
90
 
@@ -92,7 +92,7 @@ class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel):
92
92
  return cls.model_validate(obj)
93
93
 
94
94
  _obj = cls.model_validate({
95
- "breakdown": DeviceIntelligenceBreakdownBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
95
+ "breakdown": DeviceIntelligenceBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
96
96
  })
97
97
  # store additional fields in additional_properties
98
98
  for _key in obj.keys():
@@ -23,9 +23,9 @@ from onfido.models.document_breakdown_data_comparison_breakdown_issuing_country
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
26
- class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown(BaseModel):
26
+ class DeviceIntelligenceBreakdownDeviceBreakdown(BaseModel):
27
27
  """
28
- DeviceIntelligenceBreakdownBreakdownDeviceBreakdown
28
+ DeviceIntelligenceBreakdownDeviceBreakdown
29
29
  """ # noqa: E501
30
30
  application_authenticity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None
31
31
  device_integrity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None
@@ -51,7 +51,7 @@ class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown(BaseModel):
51
51
 
52
52
  @classmethod
53
53
  def from_json(cls, json_str: str) -> Optional[Self]:
54
- """Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a JSON string"""
54
+ """Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a JSON string"""
55
55
  return cls.from_dict(json.loads(json_str))
56
56
 
57
57
  def to_dict(self) -> Dict[str, Any]:
@@ -92,7 +92,7 @@ class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown(BaseModel):
92
92
 
93
93
  @classmethod
94
94
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
- """Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a dict"""
95
+ """Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a dict"""
96
96
  if obj is None:
97
97
  return None
98
98
 
@@ -17,8 +17,8 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
@@ -36,7 +36,7 @@ class DeviceIntelligenceBreakdownPropertiesDevice(BaseModel):
36
36
  randomized_device: Optional[StrictBool] = Field(default=None, description="Whether the device is providing false randomized device and network information.")
37
37
  fake_network_request: Optional[StrictBool] = Field(default=None, description="Whether device is using stolen security tokens to send the network information.")
38
38
  ip_reputation: Optional[StrictStr] = Field(default=None, description="Whether there is highly suspicious traffic related to the IP address. The risk depends on the overall ratio of clear checks on a given IP.")
39
- device_fingerprint_reuse: Optional[StrictInt] = Field(default=None, description="The number of times the device was used to create a report for a new applicant. A value greater than 1 indicates potential device reuse.")
39
+ device_fingerprint_reuse: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The number of times the device was used to create a report for a new applicant. A value greater than 1 indicates potential device reuse.")
40
40
  single_device_used: Optional[StrictBool] = Field(default=None, description="Whether the document or biometric media were uploaded from a single device.")
41
41
  document_capture: Optional[StrictStr] = Field(default=None, description="Whether the document media were live captured from the device camera.")
42
42
  biometric_capture: Optional[StrictStr] = Field(default=None, description="Whether the biometric media were live captured from the device camera.")
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido API v3.6
5
+
6
+ The Onfido API (v3.6)
7
+
8
+ The version of the OpenAPI document: v3.6
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice
23
+ from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation
24
+ from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class DeviceIntelligenceProperties(BaseModel):
29
+ """
30
+ DeviceIntelligenceProperties
31
+ """ # noqa: E501
32
+ device: Optional[DeviceIntelligenceBreakdownPropertiesDevice] = None
33
+ ip: Optional[DeviceIntelligenceBreakdownPropertiesIp] = None
34
+ geolocation: Optional[DeviceIntelligenceBreakdownPropertiesGeolocation] = None
35
+ additional_properties: Dict[str, Any] = {}
36
+ __properties: ClassVar[List[str]] = ["device", "ip", "geolocation"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of DeviceIntelligenceProperties from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ * Fields in `self.additional_properties` are added to the output dict.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ "additional_properties",
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of device
80
+ if self.device:
81
+ _dict['device'] = self.device.to_dict()
82
+ # override the default output from pydantic by calling `to_dict()` of ip
83
+ if self.ip:
84
+ _dict['ip'] = self.ip.to_dict()
85
+ # override the default output from pydantic by calling `to_dict()` of geolocation
86
+ if self.geolocation:
87
+ _dict['geolocation'] = self.geolocation.to_dict()
88
+ # puts key-value pairs in additional_properties in the top level
89
+ if self.additional_properties is not None:
90
+ for _key, _value in self.additional_properties.items():
91
+ _dict[_key] = _value
92
+
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of DeviceIntelligenceProperties from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({
105
+ "device": DeviceIntelligenceBreakdownPropertiesDevice.from_dict(obj["device"]) if obj.get("device") is not None else None,
106
+ "ip": DeviceIntelligenceBreakdownPropertiesIp.from_dict(obj["ip"]) if obj.get("ip") is not None else None,
107
+ "geolocation": DeviceIntelligenceBreakdownPropertiesGeolocation.from_dict(obj["geolocation"]) if obj.get("geolocation") is not None else None
108
+ })
109
+ # store additional fields in additional_properties
110
+ for _key in obj.keys():
111
+ if _key not in cls.__properties:
112
+ _obj.additional_properties[_key] = obj.get(_key)
113
+
114
+ return _obj
115
+
116
+
@@ -21,6 +21,7 @@ from datetime import datetime
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
24
+ from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties
24
25
  from onfido.models.report_name import ReportName
25
26
  from onfido.models.report_result import ReportResult
26
27
  from onfido.models.report_status import ReportStatus
@@ -41,8 +42,9 @@ class DeviceIntelligenceReport(BaseModel):
41
42
  check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.")
42
43
  name: ReportName
43
44
  breakdown: Optional[DeviceIntelligenceBreakdown] = None
45
+ properties: Optional[DeviceIntelligenceProperties] = None
44
46
  additional_properties: Dict[str, Any] = {}
45
- __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "name", "breakdown"]
47
+ __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "name", "breakdown", "properties"]
46
48
 
47
49
  model_config = ConfigDict(
48
50
  populate_by_name=True,
@@ -88,6 +90,9 @@ class DeviceIntelligenceReport(BaseModel):
88
90
  # override the default output from pydantic by calling `to_dict()` of breakdown
89
91
  if self.breakdown:
90
92
  _dict['breakdown'] = self.breakdown.to_dict()
93
+ # override the default output from pydantic by calling `to_dict()` of properties
94
+ if self.properties:
95
+ _dict['properties'] = self.properties.to_dict()
91
96
  # puts key-value pairs in additional_properties in the top level
92
97
  if self.additional_properties is not None:
93
98
  for _key, _value in self.additional_properties.items():
@@ -113,7 +118,8 @@ class DeviceIntelligenceReport(BaseModel):
113
118
  "sub_result": obj.get("sub_result"),
114
119
  "check_id": obj.get("check_id"),
115
120
  "name": obj.get("name"),
116
- "breakdown": DeviceIntelligenceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None
121
+ "breakdown": DeviceIntelligenceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None,
122
+ "properties": DeviceIntelligenceProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None
117
123
  })
118
124
  # store additional fields in additional_properties
119
125
  for _key in obj.keys():
@@ -24,7 +24,7 @@ from onfido.models.document_properties_address_lines import DocumentPropertiesAd
24
24
  from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner
25
25
  from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification
26
26
  from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner
27
- from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation
27
+ from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem
28
28
  from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
29
29
  from onfido.models.document_properties_nfc import DocumentPropertiesNfc
30
30
  from typing import Optional, Set
@@ -76,7 +76,7 @@ class DocumentProperties(BaseModel):
76
76
  address_lines: Optional[DocumentPropertiesAddressLines] = None
77
77
  barcode: Optional[List[DocumentPropertiesBarcodeInner]] = None
78
78
  nfc: Optional[DocumentPropertiesNfc] = None
79
- driving_licence_information: Optional[DocumentPropertiesDrivingLicenceInformation] = None
79
+ driving_licence_information: Optional[List[DocumentPropertiesDrivingLicenceInformationItem]] = None
80
80
  document_classification: Optional[DocumentPropertiesDocumentClassification] = None
81
81
  extracted_data: Optional[DocumentPropertiesExtractedData] = None
82
82
  additional_properties: Dict[str, Any] = {}
@@ -173,9 +173,13 @@ class DocumentProperties(BaseModel):
173
173
  # override the default output from pydantic by calling `to_dict()` of nfc
174
174
  if self.nfc:
175
175
  _dict['nfc'] = self.nfc.to_dict()
176
- # override the default output from pydantic by calling `to_dict()` of driving_licence_information
176
+ # override the default output from pydantic by calling `to_dict()` of each item in driving_licence_information (list)
177
+ _items = []
177
178
  if self.driving_licence_information:
178
- _dict['driving_licence_information'] = self.driving_licence_information.to_dict()
179
+ for _item_driving_licence_information in self.driving_licence_information:
180
+ if _item_driving_licence_information:
181
+ _items.append(_item_driving_licence_information.to_dict())
182
+ _dict['driving_licence_information'] = _items
179
183
  # override the default output from pydantic by calling `to_dict()` of document_classification
180
184
  if self.document_classification:
181
185
  _dict['document_classification'] = self.document_classification.to_dict()
@@ -241,7 +245,7 @@ class DocumentProperties(BaseModel):
241
245
  "address_lines": DocumentPropertiesAddressLines.from_dict(obj["address_lines"]) if obj.get("address_lines") is not None else None,
242
246
  "barcode": [DocumentPropertiesBarcodeInner.from_dict(_item) for _item in obj["barcode"]] if obj.get("barcode") is not None else None,
243
247
  "nfc": DocumentPropertiesNfc.from_dict(obj["nfc"]) if obj.get("nfc") is not None else None,
244
- "driving_licence_information": DocumentPropertiesDrivingLicenceInformation.from_dict(obj["driving_licence_information"]) if obj.get("driving_licence_information") is not None else None,
248
+ "driving_licence_information": [DocumentPropertiesDrivingLicenceInformationItem.from_dict(_item) for _item in obj["driving_licence_information"]] if obj.get("driving_licence_information") is not None else None,
245
249
  "document_classification": DocumentPropertiesDocumentClassification.from_dict(obj["document_classification"]) if obj.get("document_classification") is not None else None,
246
250
  "extracted_data": DocumentPropertiesExtractedData.from_dict(obj["extracted_data"]) if obj.get("extracted_data") is not None else None
247
251
  })
@@ -23,9 +23,9 @@ from typing import Any, ClassVar, Dict, List, Optional
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
26
- class DocumentPropertiesDrivingLicenceInformation(BaseModel):
26
+ class DocumentPropertiesDrivingLicenceInformationItem(BaseModel):
27
27
  """
28
- DocumentPropertiesDrivingLicenceInformation
28
+ DocumentPropertiesDrivingLicenceInformationItem
29
29
  """ # noqa: E501
30
30
  category: Optional[StrictStr] = None
31
31
  obtainment_date: Optional[date] = None
@@ -52,7 +52,7 @@ class DocumentPropertiesDrivingLicenceInformation(BaseModel):
52
52
 
53
53
  @classmethod
54
54
  def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of DocumentPropertiesDrivingLicenceInformation from a JSON string"""
55
+ """Create an instance of DocumentPropertiesDrivingLicenceInformationItem from a JSON string"""
56
56
  return cls.from_dict(json.loads(json_str))
57
57
 
58
58
  def to_dict(self) -> Dict[str, Any]:
@@ -84,7 +84,7 @@ class DocumentPropertiesDrivingLicenceInformation(BaseModel):
84
84
 
85
85
  @classmethod
86
86
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of DocumentPropertiesDrivingLicenceInformation from a dict"""
87
+ """Create an instance of DocumentPropertiesDrivingLicenceInformationItem from a dict"""
88
88
  if obj is None:
89
89
  return None
90
90
 
@@ -24,7 +24,7 @@ from onfido.models.document_properties_address_lines import DocumentPropertiesAd
24
24
  from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner
25
25
  from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification
26
26
  from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner
27
- from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation
27
+ from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem
28
28
  from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData
29
29
  from onfido.models.document_properties_nfc import DocumentPropertiesNfc
30
30
  from onfido.models.document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle import DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle
@@ -78,7 +78,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
78
78
  address_lines: Optional[DocumentPropertiesAddressLines] = None
79
79
  barcode: Optional[List[DocumentPropertiesBarcodeInner]] = None
80
80
  nfc: Optional[DocumentPropertiesNfc] = None
81
- driving_licence_information: Optional[DocumentPropertiesDrivingLicenceInformation] = None
81
+ driving_licence_information: Optional[List[DocumentPropertiesDrivingLicenceInformationItem]] = None
82
82
  document_classification: Optional[DocumentPropertiesDocumentClassification] = None
83
83
  extracted_data: Optional[DocumentPropertiesExtractedData] = None
84
84
  drivers_licence: Optional[StrictBool] = Field(default=None, description="True for **non-restricted** driving licences")
@@ -181,9 +181,13 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
181
181
  # override the default output from pydantic by calling `to_dict()` of nfc
182
182
  if self.nfc:
183
183
  _dict['nfc'] = self.nfc.to_dict()
184
- # override the default output from pydantic by calling `to_dict()` of driving_licence_information
184
+ # override the default output from pydantic by calling `to_dict()` of each item in driving_licence_information (list)
185
+ _items = []
185
186
  if self.driving_licence_information:
186
- _dict['driving_licence_information'] = self.driving_licence_information.to_dict()
187
+ for _item_driving_licence_information in self.driving_licence_information:
188
+ if _item_driving_licence_information:
189
+ _items.append(_item_driving_licence_information.to_dict())
190
+ _dict['driving_licence_information'] = _items
187
191
  # override the default output from pydantic by calling `to_dict()` of document_classification
188
192
  if self.document_classification:
189
193
  _dict['document_classification'] = self.document_classification.to_dict()
@@ -259,7 +263,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel):
259
263
  "address_lines": DocumentPropertiesAddressLines.from_dict(obj["address_lines"]) if obj.get("address_lines") is not None else None,
260
264
  "barcode": [DocumentPropertiesBarcodeInner.from_dict(_item) for _item in obj["barcode"]] if obj.get("barcode") is not None else None,
261
265
  "nfc": DocumentPropertiesNfc.from_dict(obj["nfc"]) if obj.get("nfc") is not None else None,
262
- "driving_licence_information": DocumentPropertiesDrivingLicenceInformation.from_dict(obj["driving_licence_information"]) if obj.get("driving_licence_information") is not None else None,
266
+ "driving_licence_information": [DocumentPropertiesDrivingLicenceInformationItem.from_dict(_item) for _item in obj["driving_licence_information"]] if obj.get("driving_licence_information") is not None else None,
263
267
  "document_classification": DocumentPropertiesDocumentClassification.from_dict(obj["document_classification"]) if obj.get("document_classification") is not None else None,
264
268
  "extracted_data": DocumentPropertiesExtractedData.from_dict(obj["extracted_data"]) if obj.get("extracted_data") is not None else None,
265
269
  "drivers_licence": obj.get("drivers_licence"),
@@ -0,0 +1,119 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido API v3.6
5
+
6
+ The Onfido API (v3.6)
7
+
8
+ The version of the OpenAPI document: v3.6
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from onfido.models.report_configuration_facial_similarity import ReportConfigurationFacialSimilarity
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ReportConfiguration(BaseModel):
27
+ """
28
+ Defines configuration options for facial similarity checks used to distinguish between onboarding and reverification scenarios.
29
+ """ # noqa: E501
30
+ facial_similarity_photo: Optional[ReportConfigurationFacialSimilarity] = None
31
+ facial_similarity_photo_fully_auto: Optional[ReportConfigurationFacialSimilarity] = None
32
+ facial_similarity_video: Optional[ReportConfigurationFacialSimilarity] = None
33
+ facial_similarity_motion: Optional[ReportConfigurationFacialSimilarity] = None
34
+ additional_properties: Dict[str, Any] = {}
35
+ __properties: ClassVar[List[str]] = ["facial_similarity_photo", "facial_similarity_photo_fully_auto", "facial_similarity_video", "facial_similarity_motion"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of ReportConfiguration from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * Fields in `self.additional_properties` are added to the output dict.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "additional_properties",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of facial_similarity_photo
79
+ if self.facial_similarity_photo:
80
+ _dict['facial_similarity_photo'] = self.facial_similarity_photo.to_dict()
81
+ # override the default output from pydantic by calling `to_dict()` of facial_similarity_photo_fully_auto
82
+ if self.facial_similarity_photo_fully_auto:
83
+ _dict['facial_similarity_photo_fully_auto'] = self.facial_similarity_photo_fully_auto.to_dict()
84
+ # override the default output from pydantic by calling `to_dict()` of facial_similarity_video
85
+ if self.facial_similarity_video:
86
+ _dict['facial_similarity_video'] = self.facial_similarity_video.to_dict()
87
+ # override the default output from pydantic by calling `to_dict()` of facial_similarity_motion
88
+ if self.facial_similarity_motion:
89
+ _dict['facial_similarity_motion'] = self.facial_similarity_motion.to_dict()
90
+ # puts key-value pairs in additional_properties in the top level
91
+ if self.additional_properties is not None:
92
+ for _key, _value in self.additional_properties.items():
93
+ _dict[_key] = _value
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of ReportConfiguration from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "facial_similarity_photo": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_photo"]) if obj.get("facial_similarity_photo") is not None else None,
108
+ "facial_similarity_photo_fully_auto": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_photo_fully_auto"]) if obj.get("facial_similarity_photo_fully_auto") is not None else None,
109
+ "facial_similarity_video": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_video"]) if obj.get("facial_similarity_video") is not None else None,
110
+ "facial_similarity_motion": ReportConfigurationFacialSimilarity.from_dict(obj["facial_similarity_motion"]) if obj.get("facial_similarity_motion") is not None else None
111
+ })
112
+ # store additional fields in additional_properties
113
+ for _key in obj.keys():
114
+ if _key not in cls.__properties:
115
+ _obj.additional_properties[_key] = obj.get(_key)
116
+
117
+ return _obj
118
+
119
+
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Onfido API v3.6
5
+
6
+ The Onfido API (v3.6)
7
+
8
+ The version of the OpenAPI document: v3.6
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ReportConfigurationFacialSimilarity(BaseModel):
26
+ """
27
+ ReportConfigurationFacialSimilarity
28
+ """ # noqa: E501
29
+ use_case: Optional[StrictStr] = Field(default=None, description="You should set it to \"reverification\" on a post-onboarding scenario (e.g. ongoing authentication). ")
30
+ additional_properties: Dict[str, Any] = {}
31
+ __properties: ClassVar[List[str]] = ["use_case"]
32
+
33
+ @field_validator('use_case')
34
+ def use_case_validate_enum(cls, value):
35
+ """Validates the enum"""
36
+ if value is None:
37
+ return value
38
+
39
+ if value not in set(['onboarding', 'reverification', 'unknown_default_open_api']):
40
+ raise ValueError("must be one of enum values ('onboarding', 'reverification', 'unknown_default_open_api')")
41
+ return value
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of ReportConfigurationFacialSimilarity from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ * Fields in `self.additional_properties` are added to the output dict.
74
+ """
75
+ excluded_fields: Set[str] = set([
76
+ "additional_properties",
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ # puts key-value pairs in additional_properties in the top level
85
+ if self.additional_properties is not None:
86
+ for _key, _value in self.additional_properties.items():
87
+ _dict[_key] = _value
88
+
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of ReportConfigurationFacialSimilarity from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate({
101
+ "use_case": obj.get("use_case")
102
+ })
103
+ # store additional fields in additional_properties
104
+ for _key in obj.keys():
105
+ if _key not in cls.__properties:
106
+ _obj.additional_properties[_key] = obj.get(_key)
107
+
108
+ return _obj
109
+
110
+
onfido/models/webhook.py CHANGED
@@ -31,12 +31,17 @@ class Webhook(BaseModel):
31
31
  events: Optional[List[WebhookEventType]] = Field(default=None, description="The events that will be published to the webhook. If the events parameter is omitted all the events will be subscribed. ")
32
32
  environments: Optional[List[StrictStr]] = Field(default=None, description="The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments. ")
33
33
  payload_version: Optional[StrictInt] = Field(default=None, description="Webhook version used to control the payload object when sending webhooks.")
34
+ oauth_enabled: Optional[StrictBool] = Field(default=None, description="Determines if the webhook will fetch OAuth access tokens to send in the Authorization header.")
35
+ oauth_server_url: Optional[StrictStr] = Field(default=None, description="The url to fetch the OAuth access token using client credentials grant.")
36
+ oauth_server_client_id: Optional[StrictStr] = Field(default=None, description="The client id to authenticate the client credentials grant.")
37
+ oauth_server_client_secret: Optional[StrictStr] = Field(default=None, description="The client secret to authenticate the client credentials grant.")
38
+ oauth_server_scope: Optional[StrictStr] = Field(default=None, description="The scopes to be sent when requesting the access token.")
34
39
  id: StrictStr = Field(description="The unique identifier of the webhook.")
35
40
  url: Optional[StrictStr] = Field(default=None, description="The url that will listen to notifications (must be https).")
36
41
  token: Optional[StrictStr] = Field(default=None, description="Webhook secret token used to sign the webhook's payload.")
37
42
  href: Optional[StrictStr] = Field(default=None, description="The API endpoint to retrieve the webhook.")
38
43
  additional_properties: Dict[str, Any] = {}
39
- __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version", "id", "url", "token", "href"]
44
+ __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version", "oauth_enabled", "oauth_server_url", "oauth_server_client_id", "oauth_server_client_secret", "oauth_server_scope", "id", "url", "token", "href"]
40
45
 
41
46
  model_config = ConfigDict(
42
47
  populate_by_name=True,
@@ -100,6 +105,11 @@ class Webhook(BaseModel):
100
105
  "events": obj.get("events"),
101
106
  "environments": obj.get("environments"),
102
107
  "payload_version": obj.get("payload_version"),
108
+ "oauth_enabled": obj.get("oauth_enabled"),
109
+ "oauth_server_url": obj.get("oauth_server_url"),
110
+ "oauth_server_client_id": obj.get("oauth_server_client_id"),
111
+ "oauth_server_client_secret": obj.get("oauth_server_client_secret"),
112
+ "oauth_server_scope": obj.get("oauth_server_scope"),
103
113
  "id": obj.get("id"),
104
114
  "url": obj.get("url"),
105
115
  "token": obj.get("token"),