diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..f2a375a --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,3 @@ +{ + "MD024": false +} diff --git a/.release.json b/.release.json index 909c183..646ab9c 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "1f90650", - "long_sha": "1f906509f36a1f5056df0c74b774795f8754e4ca", - "version": "" + "short_sha": "4b15a26", + "long_sha": "4b15a26d432dcb9c3788cece0a46b5157b2e8b99", + "version": "v5.1.0" }, "release": "v5.1.0" } diff --git a/onfido/__init__.py b/onfido/__init__.py index 2a72d2f..4af6236 100644 --- a/onfido/__init__.py +++ b/onfido/__init__.py @@ -59,12 +59,13 @@ from onfido.models.country_codes import CountryCodes from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown -from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice -from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown +from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice +from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp +from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties from onfido.models.device_intelligence_report import DeviceIntelligenceReport from onfido.models.document import Document from onfido.models.document_breakdown import DocumentBreakdown @@ -110,7 +111,7 @@ from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner -from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation +from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData from onfido.models.document_properties_nfc import DocumentPropertiesNfc from onfido.models.document_report import DocumentReport diff --git a/onfido/models/__init__.py b/onfido/models/__init__.py index fd37aee..eaca986 100644 --- a/onfido/models/__init__.py +++ b/onfido/models/__init__.py @@ -42,12 +42,13 @@ from onfido.models.country_codes import CountryCodes from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown -from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice -from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown +from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice +from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp +from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties from onfido.models.device_intelligence_report import DeviceIntelligenceReport from onfido.models.document import Document from onfido.models.document_breakdown import DocumentBreakdown @@ -93,7 +94,7 @@ from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner -from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation +from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData from onfido.models.document_properties_nfc import DocumentPropertiesNfc from onfido.models.document_report import DocumentReport diff --git a/onfido/models/device_intelligence_breakdown.py b/onfido/models/device_intelligence_breakdown.py index d09b4b1..a052d68 100644 --- a/onfido/models/device_intelligence_breakdown.py +++ b/onfido/models/device_intelligence_breakdown.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown +from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice from onfido.models.device_intelligence_breakdown_properties import DeviceIntelligenceBreakdownProperties from typing import Optional, Set from typing_extensions import Self @@ -28,10 +29,11 @@ class DeviceIntelligenceBreakdown(BaseModel): """ DeviceIntelligenceBreakdown """ # noqa: E501 + device: Optional[DeviceIntelligenceBreakdownDevice] = None breakdown: Optional[DeviceIntelligenceBreakdownBreakdown] = None properties: Optional[DeviceIntelligenceBreakdownProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["breakdown", "properties"] + __properties: ClassVar[List[str]] = ["device", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -74,6 +76,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of device + if self.device: + _dict['device'] = self.device.to_dict() # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() @@ -97,6 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None, "breakdown": DeviceIntelligenceBreakdownBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, "properties": DeviceIntelligenceBreakdownProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) diff --git a/onfido/models/device_intelligence_breakdown_breakdown.py b/onfido/models/device_intelligence_breakdown_breakdown.py index df104a7..d45eb0e 100644 --- a/onfido/models/device_intelligence_breakdown_breakdown.py +++ b/onfido/models/device_intelligence_breakdown_breakdown.py @@ -19,7 +19,7 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional -from onfido.models.device_intelligence_breakdown_breakdown_device import DeviceIntelligenceBreakdownBreakdownDevice +from onfido.models.device_intelligence_breakdown_device import DeviceIntelligenceBreakdownDevice from typing import Optional, Set from typing_extensions import Self @@ -27,7 +27,7 @@ class DeviceIntelligenceBreakdownBreakdown(BaseModel): """ DeviceIntelligenceBreakdownBreakdown """ # noqa: E501 - device: Optional[DeviceIntelligenceBreakdownBreakdownDevice] = None + device: Optional[DeviceIntelligenceBreakdownDevice] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["device"] @@ -92,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "device": DeviceIntelligenceBreakdownBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None + "device": DeviceIntelligenceBreakdownDevice.from_dict(obj["device"]) if obj.get("device") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/onfido/models/device_intelligence_breakdown_breakdown_device.py b/onfido/models/device_intelligence_breakdown_device.py similarity index 83% rename from onfido/models/device_intelligence_breakdown_breakdown_device.py rename to onfido/models/device_intelligence_breakdown_device.py index d921251..ec7f47d 100644 --- a/onfido/models/device_intelligence_breakdown_breakdown_device.py +++ b/onfido/models/device_intelligence_breakdown_device.py @@ -19,15 +19,15 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional -from onfido.models.device_intelligence_breakdown_breakdown_device_breakdown import DeviceIntelligenceBreakdownBreakdownDeviceBreakdown +from onfido.models.device_intelligence_breakdown_device_breakdown import DeviceIntelligenceBreakdownDeviceBreakdown from typing import Optional, Set from typing_extensions import Self -class DeviceIntelligenceBreakdownBreakdownDevice(BaseModel): +class DeviceIntelligenceBreakdownDevice(BaseModel): """ Asserts whether the device used to upload the media is trustworthy, i.e. it is a real, physical device. """ # noqa: E501 - breakdown: Optional[DeviceIntelligenceBreakdownBreakdownDeviceBreakdown] = None + breakdown: Optional[DeviceIntelligenceBreakdownDeviceBreakdown] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["breakdown"] @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a JSON string""" + """Create an instance of DeviceIntelligenceBreakdownDevice from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DeviceIntelligenceBreakdownBreakdownDevice from a dict""" + """Create an instance of DeviceIntelligenceBreakdownDevice from a dict""" if obj is None: return None @@ -92,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "breakdown": DeviceIntelligenceBreakdownBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None + "breakdown": DeviceIntelligenceBreakdownDeviceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.py b/onfido/models/device_intelligence_breakdown_device_breakdown.py similarity index 93% rename from onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.py rename to onfido/models/device_intelligence_breakdown_device_breakdown.py index 01b411c..a57b1fc 100644 --- a/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.py +++ b/onfido/models/device_intelligence_breakdown_device_breakdown.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class DeviceIntelligenceBreakdownBreakdownDeviceBreakdown(BaseModel): +class DeviceIntelligenceBreakdownDeviceBreakdown(BaseModel): """ - DeviceIntelligenceBreakdownBreakdownDeviceBreakdown + DeviceIntelligenceBreakdownDeviceBreakdown """ # noqa: E501 application_authenticity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None device_integrity: Optional[DocumentBreakdownDataComparisonBreakdownIssuingCountry] = None @@ -51,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a JSON string""" + """Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -92,7 +92,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DeviceIntelligenceBreakdownBreakdownDeviceBreakdown from a dict""" + """Create an instance of DeviceIntelligenceBreakdownDeviceBreakdown from a dict""" if obj is None: return None diff --git a/onfido/models/device_intelligence_breakdown_properties_device.py b/onfido/models/device_intelligence_breakdown_properties_device.py index 9d167b7..3efe5d2 100644 --- a/onfido/models/device_intelligence_breakdown_properties_device.py +++ b/onfido/models/device_intelligence_breakdown_properties_device.py @@ -17,8 +17,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self @@ -36,7 +36,7 @@ class DeviceIntelligenceBreakdownPropertiesDevice(BaseModel): randomized_device: Optional[StrictBool] = Field(default=None, description="Whether the device is providing false randomized device and network information.") fake_network_request: Optional[StrictBool] = Field(default=None, description="Whether device is using stolen security tokens to send the network information.") 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.") - 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.") + 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.") single_device_used: Optional[StrictBool] = Field(default=None, description="Whether the document or biometric media were uploaded from a single device.") document_capture: Optional[StrictStr] = Field(default=None, description="Whether the document media were live captured from the device camera.") biometric_capture: Optional[StrictStr] = Field(default=None, description="Whether the biometric media were live captured from the device camera.") diff --git a/onfido/models/device_intelligence_properties.py b/onfido/models/device_intelligence_properties.py new file mode 100644 index 0000000..8790c1d --- /dev/null +++ b/onfido/models/device_intelligence_properties.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Onfido API v3.6 + + The Onfido API (v3.6) + + The version of the OpenAPI document: v3.6 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from onfido.models.device_intelligence_breakdown_properties_device import DeviceIntelligenceBreakdownPropertiesDevice +from onfido.models.device_intelligence_breakdown_properties_geolocation import DeviceIntelligenceBreakdownPropertiesGeolocation +from onfido.models.device_intelligence_breakdown_properties_ip import DeviceIntelligenceBreakdownPropertiesIp +from typing import Optional, Set +from typing_extensions import Self + +class DeviceIntelligenceProperties(BaseModel): + """ + DeviceIntelligenceProperties + """ # noqa: E501 + device: Optional[DeviceIntelligenceBreakdownPropertiesDevice] = None + ip: Optional[DeviceIntelligenceBreakdownPropertiesIp] = None + geolocation: Optional[DeviceIntelligenceBreakdownPropertiesGeolocation] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["device", "ip", "geolocation"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeviceIntelligenceProperties from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of device + if self.device: + _dict['device'] = self.device.to_dict() + # override the default output from pydantic by calling `to_dict()` of ip + if self.ip: + _dict['ip'] = self.ip.to_dict() + # override the default output from pydantic by calling `to_dict()` of geolocation + if self.geolocation: + _dict['geolocation'] = self.geolocation.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeviceIntelligenceProperties from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "device": DeviceIntelligenceBreakdownPropertiesDevice.from_dict(obj["device"]) if obj.get("device") is not None else None, + "ip": DeviceIntelligenceBreakdownPropertiesIp.from_dict(obj["ip"]) if obj.get("ip") is not None else None, + "geolocation": DeviceIntelligenceBreakdownPropertiesGeolocation.from_dict(obj["geolocation"]) if obj.get("geolocation") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/onfido/models/device_intelligence_report.py b/onfido/models/device_intelligence_report.py index edbbfcb..ab7da60 100644 --- a/onfido/models/device_intelligence_report.py +++ b/onfido/models/device_intelligence_report.py @@ -21,6 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown +from onfido.models.device_intelligence_properties import DeviceIntelligenceProperties from onfido.models.report_name import ReportName from onfido.models.report_result import ReportResult from onfido.models.report_status import ReportStatus @@ -41,8 +42,9 @@ class DeviceIntelligenceReport(BaseModel): check_id: Optional[StrictStr] = Field(default=None, description="The ID of the check to which the report belongs. Read-only.") name: ReportName breakdown: Optional[DeviceIntelligenceBreakdown] = None + properties: Optional[DeviceIntelligenceProperties] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "name", "breakdown"] + __properties: ClassVar[List[str]] = ["id", "created_at", "href", "status", "result", "sub_result", "check_id", "name", "breakdown", "properties"] model_config = ConfigDict( populate_by_name=True, @@ -88,6 +90,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of breakdown if self.breakdown: _dict['breakdown'] = self.breakdown.to_dict() + # override the default output from pydantic by calling `to_dict()` of properties + if self.properties: + _dict['properties'] = self.properties.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -113,7 +118,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "sub_result": obj.get("sub_result"), "check_id": obj.get("check_id"), "name": obj.get("name"), - "breakdown": DeviceIntelligenceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None + "breakdown": DeviceIntelligenceBreakdown.from_dict(obj["breakdown"]) if obj.get("breakdown") is not None else None, + "properties": DeviceIntelligenceProperties.from_dict(obj["properties"]) if obj.get("properties") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/onfido/models/document_properties.py b/onfido/models/document_properties.py index b3a08a6..b606de7 100644 --- a/onfido/models/document_properties.py +++ b/onfido/models/document_properties.py @@ -24,7 +24,7 @@ from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner -from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation +from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData from onfido.models.document_properties_nfc import DocumentPropertiesNfc from typing import Optional, Set @@ -76,7 +76,7 @@ class DocumentProperties(BaseModel): address_lines: Optional[DocumentPropertiesAddressLines] = None barcode: Optional[List[DocumentPropertiesBarcodeInner]] = None nfc: Optional[DocumentPropertiesNfc] = None - driving_licence_information: Optional[DocumentPropertiesDrivingLicenceInformation] = None + driving_licence_information: Optional[List[DocumentPropertiesDrivingLicenceInformationItem]] = None document_classification: Optional[DocumentPropertiesDocumentClassification] = None extracted_data: Optional[DocumentPropertiesExtractedData] = None additional_properties: Dict[str, Any] = {} @@ -173,9 +173,13 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of nfc if self.nfc: _dict['nfc'] = self.nfc.to_dict() - # override the default output from pydantic by calling `to_dict()` of driving_licence_information + # override the default output from pydantic by calling `to_dict()` of each item in driving_licence_information (list) + _items = [] if self.driving_licence_information: - _dict['driving_licence_information'] = self.driving_licence_information.to_dict() + for _item_driving_licence_information in self.driving_licence_information: + if _item_driving_licence_information: + _items.append(_item_driving_licence_information.to_dict()) + _dict['driving_licence_information'] = _items # override the default output from pydantic by calling `to_dict()` of document_classification if self.document_classification: _dict['document_classification'] = self.document_classification.to_dict() @@ -241,7 +245,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "address_lines": DocumentPropertiesAddressLines.from_dict(obj["address_lines"]) if obj.get("address_lines") is not None else None, "barcode": [DocumentPropertiesBarcodeInner.from_dict(_item) for _item in obj["barcode"]] if obj.get("barcode") is not None else None, "nfc": DocumentPropertiesNfc.from_dict(obj["nfc"]) if obj.get("nfc") is not None else None, - "driving_licence_information": DocumentPropertiesDrivingLicenceInformation.from_dict(obj["driving_licence_information"]) if obj.get("driving_licence_information") is not None else None, + "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, "document_classification": DocumentPropertiesDocumentClassification.from_dict(obj["document_classification"]) if obj.get("document_classification") is not None else None, "extracted_data": DocumentPropertiesExtractedData.from_dict(obj["extracted_data"]) if obj.get("extracted_data") is not None else None }) diff --git a/onfido/models/document_properties_driving_licence_information.py b/onfido/models/document_properties_driving_licence_information_item.py similarity index 94% rename from onfido/models/document_properties_driving_licence_information.py rename to onfido/models/document_properties_driving_licence_information_item.py index 3d7e36c..3a680d8 100644 --- a/onfido/models/document_properties_driving_licence_information.py +++ b/onfido/models/document_properties_driving_licence_information_item.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class DocumentPropertiesDrivingLicenceInformation(BaseModel): +class DocumentPropertiesDrivingLicenceInformationItem(BaseModel): """ - DocumentPropertiesDrivingLicenceInformation + DocumentPropertiesDrivingLicenceInformationItem """ # noqa: E501 category: Optional[StrictStr] = None obtainment_date: Optional[date] = None @@ -52,7 +52,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of DocumentPropertiesDrivingLicenceInformation from a JSON string""" + """Create an instance of DocumentPropertiesDrivingLicenceInformationItem from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of DocumentPropertiesDrivingLicenceInformation from a dict""" + """Create an instance of DocumentPropertiesDrivingLicenceInformationItem from a dict""" if obj is None: return None diff --git a/onfido/models/document_with_driver_verification_report_all_of_properties.py b/onfido/models/document_with_driver_verification_report_all_of_properties.py index be95946..231088b 100644 --- a/onfido/models/document_with_driver_verification_report_all_of_properties.py +++ b/onfido/models/document_with_driver_verification_report_all_of_properties.py @@ -24,7 +24,7 @@ from onfido.models.document_properties_barcode_inner import DocumentPropertiesBarcodeInner from onfido.models.document_properties_document_classification import DocumentPropertiesDocumentClassification from onfido.models.document_properties_document_numbers_inner import DocumentPropertiesDocumentNumbersInner -from onfido.models.document_properties_driving_licence_information import DocumentPropertiesDrivingLicenceInformation +from onfido.models.document_properties_driving_licence_information_item import DocumentPropertiesDrivingLicenceInformationItem from onfido.models.document_properties_extracted_data import DocumentPropertiesExtractedData from onfido.models.document_properties_nfc import DocumentPropertiesNfc from onfido.models.document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle import DocumentWithDriverVerificationReportAllOfPropertiesAllOfPassengerVehicle @@ -78,7 +78,7 @@ class DocumentWithDriverVerificationReportAllOfProperties(BaseModel): address_lines: Optional[DocumentPropertiesAddressLines] = None barcode: Optional[List[DocumentPropertiesBarcodeInner]] = None nfc: Optional[DocumentPropertiesNfc] = None - driving_licence_information: Optional[DocumentPropertiesDrivingLicenceInformation] = None + driving_licence_information: Optional[List[DocumentPropertiesDrivingLicenceInformationItem]] = None document_classification: Optional[DocumentPropertiesDocumentClassification] = None extracted_data: Optional[DocumentPropertiesExtractedData] = None drivers_licence: Optional[StrictBool] = Field(default=None, description="True for **non-restricted** driving licences") @@ -181,9 +181,13 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of nfc if self.nfc: _dict['nfc'] = self.nfc.to_dict() - # override the default output from pydantic by calling `to_dict()` of driving_licence_information + # override the default output from pydantic by calling `to_dict()` of each item in driving_licence_information (list) + _items = [] if self.driving_licence_information: - _dict['driving_licence_information'] = self.driving_licence_information.to_dict() + for _item_driving_licence_information in self.driving_licence_information: + if _item_driving_licence_information: + _items.append(_item_driving_licence_information.to_dict()) + _dict['driving_licence_information'] = _items # override the default output from pydantic by calling `to_dict()` of document_classification if self.document_classification: _dict['document_classification'] = self.document_classification.to_dict() @@ -259,7 +263,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "address_lines": DocumentPropertiesAddressLines.from_dict(obj["address_lines"]) if obj.get("address_lines") is not None else None, "barcode": [DocumentPropertiesBarcodeInner.from_dict(_item) for _item in obj["barcode"]] if obj.get("barcode") is not None else None, "nfc": DocumentPropertiesNfc.from_dict(obj["nfc"]) if obj.get("nfc") is not None else None, - "driving_licence_information": DocumentPropertiesDrivingLicenceInformation.from_dict(obj["driving_licence_information"]) if obj.get("driving_licence_information") is not None else None, + "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, "document_classification": DocumentPropertiesDocumentClassification.from_dict(obj["document_classification"]) if obj.get("document_classification") is not None else None, "extracted_data": DocumentPropertiesExtractedData.from_dict(obj["extracted_data"]) if obj.get("extracted_data") is not None else None, "drivers_licence": obj.get("drivers_licence"), diff --git a/onfido/models/webhook.py b/onfido/models/webhook.py index 718686d..ce5e2d4 100644 --- a/onfido/models/webhook.py +++ b/onfido/models/webhook.py @@ -31,12 +31,17 @@ class Webhook(BaseModel): 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. ") 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. ") payload_version: Optional[StrictInt] = Field(default=None, description="Webhook version used to control the payload object when sending webhooks.") + oauth_enabled: Optional[StrictBool] = Field(default=None, description="Determines if the webhook will fetch OAuth access tokens to send in the Authorization header.") + oauth_server_url: Optional[StrictStr] = Field(default=None, description="The url to fetch the OAuth access token using client credentials grant.") + oauth_server_client_id: Optional[StrictStr] = Field(default=None, description="The client id to authenticate the client credentials grant.") + oauth_server_client_secret: Optional[StrictStr] = Field(default=None, description="The client secret to authenticate the client credentials grant.") + oauth_server_scope: Optional[StrictStr] = Field(default=None, description="The scopes to be sent when requesting the access token.") id: StrictStr = Field(description="The unique identifier of the webhook.") url: Optional[StrictStr] = Field(default=None, description="The url that will listen to notifications (must be https).") token: Optional[StrictStr] = Field(default=None, description="Webhook secret token used to sign the webhook's payload.") href: Optional[StrictStr] = Field(default=None, description="The API endpoint to retrieve the webhook.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version", "id", "url", "token", "href"] + __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"] model_config = ConfigDict( populate_by_name=True, @@ -100,6 +105,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "events": obj.get("events"), "environments": obj.get("environments"), "payload_version": obj.get("payload_version"), + "oauth_enabled": obj.get("oauth_enabled"), + "oauth_server_url": obj.get("oauth_server_url"), + "oauth_server_client_id": obj.get("oauth_server_client_id"), + "oauth_server_client_secret": obj.get("oauth_server_client_secret"), + "oauth_server_scope": obj.get("oauth_server_scope"), "id": obj.get("id"), "url": obj.get("url"), "token": obj.get("token"), diff --git a/onfido/models/webhook_builder.py b/onfido/models/webhook_builder.py index 5892d57..5755afd 100644 --- a/onfido/models/webhook_builder.py +++ b/onfido/models/webhook_builder.py @@ -31,9 +31,14 @@ class WebhookBuilder(BaseModel): 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. ") 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. ") payload_version: Optional[StrictInt] = Field(default=None, description="Webhook version used to control the payload object when sending webhooks.") + oauth_enabled: Optional[StrictBool] = Field(default=None, description="Determines if the webhook will fetch OAuth access tokens to send in the Authorization header.") + oauth_server_url: Optional[StrictStr] = Field(default=None, description="The url to fetch the OAuth access token using client credentials grant.") + oauth_server_client_id: Optional[StrictStr] = Field(default=None, description="The client id to authenticate the client credentials grant.") + oauth_server_client_secret: Optional[StrictStr] = Field(default=None, description="The client secret to authenticate the client credentials grant.") + oauth_server_scope: Optional[StrictStr] = Field(default=None, description="The scopes to be sent when requesting the access token.") url: StrictStr = Field(description="The url that will listen to notifications (must be https).") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version", "url"] + __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", "url"] model_config = ConfigDict( populate_by_name=True, @@ -97,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "events": obj.get("events"), "environments": obj.get("environments"), "payload_version": obj.get("payload_version"), + "oauth_enabled": obj.get("oauth_enabled"), + "oauth_server_url": obj.get("oauth_server_url"), + "oauth_server_client_id": obj.get("oauth_server_client_id"), + "oauth_server_client_secret": obj.get("oauth_server_client_secret"), + "oauth_server_scope": obj.get("oauth_server_scope"), "url": obj.get("url") }) # store additional fields in additional_properties diff --git a/onfido/models/webhook_shared.py b/onfido/models/webhook_shared.py index ac7a7de..c69ed77 100644 --- a/onfido/models/webhook_shared.py +++ b/onfido/models/webhook_shared.py @@ -31,8 +31,13 @@ class WebhookShared(BaseModel): 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. ") 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. ") payload_version: Optional[StrictInt] = Field(default=None, description="Webhook version used to control the payload object when sending webhooks.") + oauth_enabled: Optional[StrictBool] = Field(default=None, description="Determines if the webhook will fetch OAuth access tokens to send in the Authorization header.") + oauth_server_url: Optional[StrictStr] = Field(default=None, description="The url to fetch the OAuth access token using client credentials grant.") + oauth_server_client_id: Optional[StrictStr] = Field(default=None, description="The client id to authenticate the client credentials grant.") + oauth_server_client_secret: Optional[StrictStr] = Field(default=None, description="The client secret to authenticate the client credentials grant.") + oauth_server_scope: Optional[StrictStr] = Field(default=None, description="The scopes to be sent when requesting the access token.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version"] + __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"] model_config = ConfigDict( populate_by_name=True, @@ -95,7 +100,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "enabled": obj.get("enabled"), "events": obj.get("events"), "environments": obj.get("environments"), - "payload_version": obj.get("payload_version") + "payload_version": obj.get("payload_version"), + "oauth_enabled": obj.get("oauth_enabled"), + "oauth_server_url": obj.get("oauth_server_url"), + "oauth_server_client_id": obj.get("oauth_server_client_id"), + "oauth_server_client_secret": obj.get("oauth_server_client_secret"), + "oauth_server_scope": obj.get("oauth_server_scope") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/onfido/models/webhook_updater.py b/onfido/models/webhook_updater.py index d2f8709..5f9dd8b 100644 --- a/onfido/models/webhook_updater.py +++ b/onfido/models/webhook_updater.py @@ -31,9 +31,14 @@ class WebhookUpdater(BaseModel): 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. ") 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. ") payload_version: Optional[StrictInt] = Field(default=None, description="Webhook version used to control the payload object when sending webhooks.") + oauth_enabled: Optional[StrictBool] = Field(default=None, description="Determines if the webhook will fetch OAuth access tokens to send in the Authorization header.") + oauth_server_url: Optional[StrictStr] = Field(default=None, description="The url to fetch the OAuth access token using client credentials grant.") + oauth_server_client_id: Optional[StrictStr] = Field(default=None, description="The client id to authenticate the client credentials grant.") + oauth_server_client_secret: Optional[StrictStr] = Field(default=None, description="The client secret to authenticate the client credentials grant.") + oauth_server_scope: Optional[StrictStr] = Field(default=None, description="The scopes to be sent when requesting the access token.") url: Optional[StrictStr] = Field(default=None, description="The url that will listen to notifications (must be https).") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["enabled", "events", "environments", "payload_version", "url"] + __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", "url"] model_config = ConfigDict( populate_by_name=True, @@ -97,6 +102,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "events": obj.get("events"), "environments": obj.get("environments"), "payload_version": obj.get("payload_version"), + "oauth_enabled": obj.get("oauth_enabled"), + "oauth_server_url": obj.get("oauth_server_url"), + "oauth_server_client_id": obj.get("oauth_server_client_id"), + "oauth_server_client_secret": obj.get("oauth_server_client_secret"), + "oauth_server_scope": obj.get("oauth_server_scope"), "url": obj.get("url") }) # store additional fields in additional_properties diff --git a/poetry.lock b/poetry.lock index c1b8811..732e2bc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -193,13 +193,13 @@ pyflakes = ">=2.5.0,<2.6.0" [[package]] name = "iniconfig" -version = "2.0.0" +version = "2.1.0" description = "brain-dead simple config-ini parsing" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, - {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] [[package]] @@ -274,24 +274,24 @@ reports = ["lxml"] [[package]] name = "mypy-extensions" -version = "1.0.0" +version = "1.1.0" description = "Type system extensions for programs checked with the mypy type checker." optional = false -python-versions = ">=3.5" +python-versions = ">=3.8" files = [ - {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, - {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, ] [[package]] name = "packaging" -version = "24.2" +version = "25.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, - {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, + {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, + {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, ] [[package]] @@ -606,17 +606,17 @@ files = [ [[package]] name = "tox" -version = "4.24.1" +version = "4.25.0" description = "tox is a generic virtualenv management and test command line tool" optional = false python-versions = ">=3.8" files = [ - {file = "tox-4.24.1-py3-none-any.whl", hash = "sha256:57ba7df7d199002c6df8c2db9e6484f3de6ca8f42013c083ea2d4d1e5c6bdc75"}, - {file = "tox-4.24.1.tar.gz", hash = "sha256:083a720adbc6166fff0b7d1df9d154f9d00bfccb9403b8abf6bc0ee435d6a62e"}, + {file = "tox-4.25.0-py3-none-any.whl", hash = "sha256:4dfdc7ba2cc6fdc6688dde1b21e7b46ff6c41795fb54586c91a3533317b5255c"}, + {file = "tox-4.25.0.tar.gz", hash = "sha256:dd67f030317b80722cf52b246ff42aafd3ed27ddf331c415612d084304cf5e52"}, ] [package.dependencies] -cachetools = ">=5.5" +cachetools = ">=5.5.1" chardet = ">=5.2" colorama = ">=0.4.6" filelock = ">=3.16.1" @@ -624,12 +624,12 @@ packaging = ">=24.2" platformdirs = ">=4.3.6" pluggy = ">=1.5" pyproject-api = ">=1.8" -tomli = {version = ">=2.1", markers = "python_version < \"3.11\""} +tomli = {version = ">=2.2.1", markers = "python_version < \"3.11\""} typing-extensions = {version = ">=4.12.2", markers = "python_version < \"3.11\""} -virtualenv = ">=20.27.1" +virtualenv = ">=20.29.1" [package.extras] -test = ["devpi-process (>=1.0.2)", "pytest (>=8.3.3)", "pytest-mock (>=3.14)"] +test = ["devpi-process (>=1.0.2)", "pytest (>=8.3.4)", "pytest-mock (>=3.14)"] [[package]] name = "types-python-dateutil" @@ -644,13 +644,13 @@ files = [ [[package]] name = "typing-extensions" -version = "4.12.2" +version = "4.13.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, - {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, + {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"}, + {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"}, ] [[package]] @@ -672,13 +672,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "virtualenv" -version = "20.29.3" +version = "20.31.2" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.8" files = [ - {file = "virtualenv-20.29.3-py3-none-any.whl", hash = "sha256:3e3d00f5807e83b234dfb6122bf37cfadf4be216c53a49ac059d02414f819170"}, - {file = "virtualenv-20.29.3.tar.gz", hash = "sha256:95e39403fcf3940ac45bc717597dba16110b74506131845d9b687d5e73d947ac"}, + {file = "virtualenv-20.31.2-py3-none-any.whl", hash = "sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11"}, + {file = "virtualenv-20.31.2.tar.gz", hash = "sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af"}, ] [package.dependencies] diff --git a/tests/test_report_schemas.py b/tests/test_report_schemas.py index b2b9a39..fcce68a 100644 --- a/tests/test_report_schemas.py +++ b/tests/test_report_schemas.py @@ -1,15 +1,21 @@ import pytest +import datetime + from onfido import ( ApplicantBuilder, CountryCodes, + DeviceIntelligenceReport, DocumentReport, DocumentWithAddressInformationReport, + DocumentWithDrivingLicenceInformationReport, + DocumentPropertiesDrivingLicenceInformationItem, FacialSimilarityPhotoReport, LocationBuilder, ReportName, ReportStatus, ) + from tests.conftest import ( create_applicant, create_check, @@ -55,7 +61,7 @@ def test_schema_of_document_report_is_valid(onfido_api, applicant_id, document_i assert isinstance(document_report, DocumentReport) -def test_schema_of_facial_similarity_report_id_valid( +def test_schema_of_facial_similarity_report_is_valid( onfido_api, applicant_id, document_id, live_photo_id ): facial_similarity_report_id = create_check( @@ -72,7 +78,7 @@ def test_schema_of_facial_similarity_report_id_valid( assert facial_similarity_report.properties.score is None -def test_schema_of_document_with_address_information_report_id_valid( +def test_schema_of_document_with_address_information_report_is_valid( onfido_api, applicant_id, document_id ): report_id = create_check( @@ -88,3 +94,50 @@ def test_schema_of_document_with_address_information_report_id_valid( assert isinstance(report, DocumentWithAddressInformationReport) assert report.properties.barcode[0].document_type == 'driving_licence' + + +def test_schema_of_document_with_driving_licence_information_report_is_valid( + onfido_api, applicant_id, document_id +): + report_id = create_check( + onfido_api, + applicant_id=applicant_id, + document_ids=[document_id], + report_names=[ReportName.DOCUMENT_WITH_DRIVING_LICENCE_INFORMATION], + ).report_ids[0] + + report = repeat_request_until_status_changes( + onfido_api.find_report, [report_id], ReportStatus.COMPLETE + ) + + assert isinstance(report, DocumentWithDrivingLicenceInformationReport) + + assert DocumentPropertiesDrivingLicenceInformationItem( + category='AM', + obtainment_date=datetime.date(2013, 1, 19), + expiry_date=datetime.date(2050, 1, 1), + codes='01') in report.properties.driving_licence_information + + +def test_schema_of_device_intelligence_report_is_valid( + onfido_api, applicant_id, document_id +): + report_id = create_check( + onfido_api, + applicant_id=applicant_id, + document_ids=[document_id], + report_names=[ReportName.DEVICE_INTELLIGENCE], + ).report_ids[0] + + report = repeat_request_until_status_changes( + onfido_api.find_report, [report_id], ReportStatus.COMPLETE + ) + + assert isinstance(report, DeviceIntelligenceReport) + + assert report.name == ReportName.DEVICE_INTELLIGENCE + assert report.status == ReportStatus.COMPLETE + + assert report.breakdown is not None + assert report.properties.device.ip_reputation == "NOT_ENOUGH_DATA" + assert report.properties.device.raw_model == "SM-G991B"