onfido-python 3.5.0__py3-none-any.whl → 4.0.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.
- onfido/__init__.py +10 -5
- onfido/api/default_api.py +611 -416
- onfido/api_client.py +38 -11
- onfido/configuration.py +14 -3
- onfido/models/__init__.py +9 -4
- onfido/models/addresses_list.py +3 -3
- onfido/models/applicant.py +3 -3
- onfido/models/applicant_builder.py +12 -8
- onfido/models/{consents_builder.py → applicant_consent_builder.py} +11 -6
- onfido/models/applicant_consent_name.py +38 -0
- onfido/models/applicant_request.py +10 -6
- onfido/models/applicant_shared.py +3 -3
- onfido/models/applicant_updater.py +12 -8
- onfido/models/applicants_list.py +3 -3
- onfido/models/check.py +10 -13
- onfido/models/check_builder.py +3 -1
- onfido/models/check_response.py +7 -13
- onfido/models/check_shared.py +4 -2
- onfido/models/check_status.py +41 -0
- onfido/models/checks_list.py +3 -3
- onfido/models/device_intelligence_breakdown_properties_device.py +1 -9
- onfido/models/device_intelligence_breakdown_properties_ip.py +2 -8
- onfido/models/device_intelligence_report.py +3 -3
- onfido/models/document.py +2 -1
- onfido/models/document_properties.py +6 -6
- onfido/models/document_report.py +3 -3
- onfido/models/document_shared.py +2 -1
- onfido/models/document_types.py +5 -0
- onfido/models/document_video_report.py +3 -3
- onfido/models/document_video_with_address_information_report.py +3 -3
- onfido/models/document_with_address_information_report.py +3 -3
- onfido/models/document_with_driver_verification_report.py +3 -3
- onfido/models/document_with_driver_verification_report_all_of_properties.py +9 -9
- onfido/models/document_with_driving_licence_information_report.py +3 -3
- onfido/models/documents_list.py +3 -3
- onfido/models/facial_similarity_motion_report.py +3 -3
- onfido/models/facial_similarity_photo_fully_auto_report.py +3 -3
- onfido/models/facial_similarity_photo_report.py +3 -3
- onfido/models/facial_similarity_video_report.py +3 -3
- onfido/models/id_photos_list.py +3 -3
- onfido/models/identity_enhanced_properties.py +3 -3
- onfido/models/identity_enhanced_report.py +3 -3
- onfido/models/india_pan_report.py +3 -3
- onfido/models/known_faces_properties.py +3 -3
- onfido/models/known_faces_report.py +3 -3
- onfido/models/live_photos_list.py +3 -3
- onfido/models/live_videos_list.py +3 -3
- onfido/models/motion_captures_list.py +3 -3
- onfido/models/proof_of_address_report.py +3 -3
- onfido/models/repeat_attempts_list.py +3 -3
- onfido/models/report_shared.py +3 -3
- onfido/models/reports_list.py +3 -3
- onfido/models/task_item.py +11 -2
- onfido/models/us_driving_licence_report.py +3 -3
- onfido/models/watchlist_aml_report.py +3 -3
- onfido/models/watchlist_enhanced_properties.py +3 -3
- onfido/models/watchlist_enhanced_properties_records_inner.py +18 -18
- onfido/models/watchlist_enhanced_report.py +3 -3
- onfido/models/watchlist_monitor_matches_list.py +3 -3
- onfido/models/watchlist_monitors_list.py +3 -3
- onfido/models/watchlist_peps_only_report.py +3 -3
- onfido/models/watchlist_sanctions_only_report.py +3 -3
- onfido/models/watchlist_standard_report.py +3 -3
- onfido/models/webhook_event_object_status.py +54 -0
- onfido/models/webhook_event_payload.py +9 -4
- onfido/models/webhook_event_payload_object.py +2 -1
- onfido/models/webhook_event_payload_resource.py +158 -0
- onfido/models/webhook_event_resource_type.py +41 -0
- onfido/models/webhook_resend.py +3 -3
- onfido/models/webhooks_list.py +3 -3
- onfido/models/workflow_run.py +9 -18
- onfido/models/workflow_run_builder.py +3 -3
- onfido/models/{workflow_run_response_error.py → workflow_run_error.py} +4 -4
- onfido/models/{workflow_run_shared_link.py → workflow_run_link.py} +24 -4
- onfido/models/workflow_run_response.py +6 -15
- onfido/models/workflow_run_shared.py +3 -3
- onfido/models/workflow_run_status.py +43 -0
- onfido/rest.py +1 -1
- {onfido_python-3.5.0.dist-info → onfido_python-4.0.0.dist-info}/METADATA +3 -3
- {onfido_python-3.5.0.dist-info → onfido_python-4.0.0.dist-info}/RECORD +83 -78
- {onfido_python-3.5.0.dist-info → onfido_python-4.0.0.dist-info}/WHEEL +1 -1
- onfido/models/consent_item.py +0 -109
- {onfido_python-3.5.0.dist-info → onfido_python-4.0.0.dist-info}/LICENSE +0 -0
- {onfido_python-3.5.0.dist-info → onfido_python-4.0.0.dist-info}/top_level.txt +0 -0
onfido/api_client.py
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import datetime
|
|
16
16
|
from dateutil.parser import parse
|
|
17
17
|
from enum import Enum
|
|
18
|
+
import decimal
|
|
18
19
|
import json
|
|
19
20
|
import mimetypes
|
|
20
21
|
import os
|
|
@@ -66,6 +67,7 @@ class ApiClient:
|
|
|
66
67
|
'bool': bool,
|
|
67
68
|
'date': datetime.date,
|
|
68
69
|
'datetime': datetime.datetime,
|
|
70
|
+
'decimal': decimal.Decimal,
|
|
69
71
|
'object': object,
|
|
70
72
|
}
|
|
71
73
|
_pool = None
|
|
@@ -88,7 +90,7 @@ class ApiClient:
|
|
|
88
90
|
self.default_headers[header_name] = header_value
|
|
89
91
|
self.cookie = cookie
|
|
90
92
|
# Set default User-Agent.
|
|
91
|
-
self.user_agent = 'onfido-python/
|
|
93
|
+
self.user_agent = 'onfido-python/4.0.0'
|
|
92
94
|
self.client_side_validation = configuration.client_side_validation
|
|
93
95
|
|
|
94
96
|
def __enter__(self):
|
|
@@ -227,7 +229,7 @@ class ApiClient:
|
|
|
227
229
|
body = self.sanitize_for_serialization(body)
|
|
228
230
|
|
|
229
231
|
# request url
|
|
230
|
-
if _host is None:
|
|
232
|
+
if _host is None or self.configuration.ignore_operation_servers:
|
|
231
233
|
url = self.configuration.host + resource_path
|
|
232
234
|
else:
|
|
233
235
|
# use server/host defined in path or operation instead
|
|
@@ -314,10 +316,7 @@ class ApiClient:
|
|
|
314
316
|
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
|
|
315
317
|
encoding = match.group(1) if match else "utf-8"
|
|
316
318
|
response_text = response_data.data.decode(encoding)
|
|
317
|
-
|
|
318
|
-
return_data = self.__deserialize_primitive(response_text, response_type)
|
|
319
|
-
else:
|
|
320
|
-
return_data = self.deserialize(response_text, response_type)
|
|
319
|
+
return_data = self.deserialize(response_text, response_type, content_type)
|
|
321
320
|
finally:
|
|
322
321
|
if not 200 <= response_data.status <= 299:
|
|
323
322
|
raise ApiException.from_response(
|
|
@@ -341,6 +340,7 @@ class ApiClient:
|
|
|
341
340
|
If obj is str, int, long, float, bool, return directly.
|
|
342
341
|
If obj is datetime.datetime, datetime.date
|
|
343
342
|
convert to string in iso8601 format.
|
|
343
|
+
If obj is decimal.Decimal return string representation.
|
|
344
344
|
If obj is list, sanitize each element in the list.
|
|
345
345
|
If obj is dict, return the dict.
|
|
346
346
|
If obj is OpenAPI model, return the properties dict.
|
|
@@ -366,6 +366,8 @@ class ApiClient:
|
|
|
366
366
|
)
|
|
367
367
|
elif isinstance(obj, (datetime.datetime, datetime.date)):
|
|
368
368
|
return obj.isoformat()
|
|
369
|
+
elif isinstance(obj, decimal.Decimal):
|
|
370
|
+
return str(obj)
|
|
369
371
|
|
|
370
372
|
elif isinstance(obj, dict):
|
|
371
373
|
obj_dict = obj
|
|
@@ -385,21 +387,35 @@ class ApiClient:
|
|
|
385
387
|
for key, val in obj_dict.items()
|
|
386
388
|
}
|
|
387
389
|
|
|
388
|
-
def deserialize(self, response_text, response_type):
|
|
390
|
+
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
|
|
389
391
|
"""Deserializes response into an object.
|
|
390
392
|
|
|
391
393
|
:param response: RESTResponse object to be deserialized.
|
|
392
394
|
:param response_type: class literal for
|
|
393
395
|
deserialized object, or string of class name.
|
|
396
|
+
:param content_type: content type of response.
|
|
394
397
|
|
|
395
398
|
:return: deserialized object.
|
|
396
399
|
"""
|
|
397
400
|
|
|
398
401
|
# fetch data from response object
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
+
if content_type is None:
|
|
403
|
+
try:
|
|
404
|
+
data = json.loads(response_text)
|
|
405
|
+
except ValueError:
|
|
406
|
+
data = response_text
|
|
407
|
+
elif re.match(r'^application/(json|[\w!#$&.+-^]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
|
|
408
|
+
if response_text == "":
|
|
409
|
+
data = ""
|
|
410
|
+
else:
|
|
411
|
+
data = json.loads(response_text)
|
|
412
|
+
elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
|
|
402
413
|
data = response_text
|
|
414
|
+
else:
|
|
415
|
+
raise ApiException(
|
|
416
|
+
status=0,
|
|
417
|
+
reason="Unsupported content type: {0}".format(content_type)
|
|
418
|
+
)
|
|
403
419
|
|
|
404
420
|
return self.__deserialize(data, response_type)
|
|
405
421
|
|
|
@@ -443,6 +459,8 @@ class ApiClient:
|
|
|
443
459
|
return self.__deserialize_date(data)
|
|
444
460
|
elif klass == datetime.datetime:
|
|
445
461
|
return self.__deserialize_datetime(data)
|
|
462
|
+
elif klass == decimal.Decimal:
|
|
463
|
+
return decimal.Decimal(data)
|
|
446
464
|
elif issubclass(klass, Enum):
|
|
447
465
|
return self.__deserialize_enum(data, klass)
|
|
448
466
|
else:
|
|
@@ -517,7 +535,10 @@ class ApiClient:
|
|
|
517
535
|
|
|
518
536
|
return "&".join(["=".join(map(str, item)) for item in new_params])
|
|
519
537
|
|
|
520
|
-
def files_parameters(
|
|
538
|
+
def files_parameters(
|
|
539
|
+
self,
|
|
540
|
+
files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
|
|
541
|
+
):
|
|
521
542
|
"""Builds form parameters.
|
|
522
543
|
|
|
523
544
|
:param files: File parameters.
|
|
@@ -532,6 +553,12 @@ class ApiClient:
|
|
|
532
553
|
elif isinstance(v, bytes):
|
|
533
554
|
filename = k
|
|
534
555
|
filedata = v
|
|
556
|
+
elif isinstance(v, tuple):
|
|
557
|
+
filename, filedata = v
|
|
558
|
+
elif isinstance(v, list):
|
|
559
|
+
for file_param in v:
|
|
560
|
+
params.extend(self.files_parameters({k: file_param}))
|
|
561
|
+
continue
|
|
535
562
|
else:
|
|
536
563
|
raise ValueError("Unsupported file value")
|
|
537
564
|
mimetype = (
|
onfido/configuration.py
CHANGED
|
@@ -52,6 +52,7 @@ class Configuration:
|
|
|
52
52
|
values before.
|
|
53
53
|
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
|
54
54
|
in PEM format.
|
|
55
|
+
:param retries: Number of retries for API requests.
|
|
55
56
|
|
|
56
57
|
:Example:
|
|
57
58
|
|
|
@@ -83,7 +84,11 @@ conf = onfido.Configuration(
|
|
|
83
84
|
timeout=None,
|
|
84
85
|
server_index=None,
|
|
85
86
|
server_operation_index=None, server_operation_variables=None,
|
|
87
|
+
ignore_operation_servers=False,
|
|
86
88
|
ssl_ca_cert=None,
|
|
89
|
+
retries=None,
|
|
90
|
+
*,
|
|
91
|
+
debug: Optional[bool] = None
|
|
87
92
|
) -> None:
|
|
88
93
|
"""Constructor
|
|
89
94
|
"""
|
|
@@ -99,6 +104,9 @@ conf = onfido.Configuration(
|
|
|
99
104
|
self.server_operation_variables = server_operation_variables or {}
|
|
100
105
|
"""Default server variables
|
|
101
106
|
"""
|
|
107
|
+
self.ignore_operation_servers = ignore_operation_servers
|
|
108
|
+
"""Ignore operation servers
|
|
109
|
+
"""
|
|
102
110
|
self.temp_folder_path = None
|
|
103
111
|
"""Temp file folder for downloading files
|
|
104
112
|
"""
|
|
@@ -127,7 +135,10 @@ conf = onfido.Configuration(
|
|
|
127
135
|
self.logger_file = None
|
|
128
136
|
"""Debug file location
|
|
129
137
|
"""
|
|
130
|
-
|
|
138
|
+
if debug is not None:
|
|
139
|
+
self.debug = debug
|
|
140
|
+
else:
|
|
141
|
+
self.__debug = False
|
|
131
142
|
"""Debug switch
|
|
132
143
|
"""
|
|
133
144
|
|
|
@@ -170,7 +181,7 @@ conf = onfido.Configuration(
|
|
|
170
181
|
self.safe_chars_for_path_param = ''
|
|
171
182
|
"""Safe chars for path_param
|
|
172
183
|
"""
|
|
173
|
-
self.retries =
|
|
184
|
+
self.retries = retries
|
|
174
185
|
"""Adding retries to override urllib3 default value 3
|
|
175
186
|
"""
|
|
176
187
|
# Enable client side validation
|
|
@@ -383,7 +394,7 @@ conf = onfido.Configuration(
|
|
|
383
394
|
"OS: {env}\n"\
|
|
384
395
|
"Python Version: {pyversion}\n"\
|
|
385
396
|
"Version of the API: v3.6\n"\
|
|
386
|
-
"SDK Package Version:
|
|
397
|
+
"SDK Package Version: 4.0.0".\
|
|
387
398
|
format(env=sys.platform, pyversion=sys.version)
|
|
388
399
|
|
|
389
400
|
def get_host_settings(self):
|
onfido/models/__init__.py
CHANGED
|
@@ -20,6 +20,8 @@ from onfido.models.address_shared import AddressShared
|
|
|
20
20
|
from onfido.models.addresses_list import AddressesList
|
|
21
21
|
from onfido.models.applicant import Applicant
|
|
22
22
|
from onfido.models.applicant_builder import ApplicantBuilder
|
|
23
|
+
from onfido.models.applicant_consent_builder import ApplicantConsentBuilder
|
|
24
|
+
from onfido.models.applicant_consent_name import ApplicantConsentName
|
|
23
25
|
from onfido.models.applicant_create import ApplicantCreate
|
|
24
26
|
from onfido.models.applicant_request import ApplicantRequest
|
|
25
27
|
from onfido.models.applicant_response import ApplicantResponse
|
|
@@ -32,11 +34,10 @@ from onfido.models.check_builder import CheckBuilder
|
|
|
32
34
|
from onfido.models.check_request import CheckRequest
|
|
33
35
|
from onfido.models.check_response import CheckResponse
|
|
34
36
|
from onfido.models.check_shared import CheckShared
|
|
37
|
+
from onfido.models.check_status import CheckStatus
|
|
35
38
|
from onfido.models.checks_list import ChecksList
|
|
36
39
|
from onfido.models.complete_task_builder import CompleteTaskBuilder
|
|
37
40
|
from onfido.models.complete_task_data_builder import CompleteTaskDataBuilder
|
|
38
|
-
from onfido.models.consent_item import ConsentItem
|
|
39
|
-
from onfido.models.consents_builder import ConsentsBuilder
|
|
40
41
|
from onfido.models.country_codes import CountryCodes
|
|
41
42
|
from onfido.models.device_intelligence_breakdown import DeviceIntelligenceBreakdown
|
|
42
43
|
from onfido.models.device_intelligence_breakdown_breakdown import DeviceIntelligenceBreakdownBreakdown
|
|
@@ -280,8 +281,11 @@ from onfido.models.webhook import Webhook
|
|
|
280
281
|
from onfido.models.webhook_builder import WebhookBuilder
|
|
281
282
|
from onfido.models.webhook_create import WebhookCreate
|
|
282
283
|
from onfido.models.webhook_event import WebhookEvent
|
|
284
|
+
from onfido.models.webhook_event_object_status import WebhookEventObjectStatus
|
|
283
285
|
from onfido.models.webhook_event_payload import WebhookEventPayload
|
|
284
286
|
from onfido.models.webhook_event_payload_object import WebhookEventPayloadObject
|
|
287
|
+
from onfido.models.webhook_event_payload_resource import WebhookEventPayloadResource
|
|
288
|
+
from onfido.models.webhook_event_resource_type import WebhookEventResourceType
|
|
285
289
|
from onfido.models.webhook_event_type import WebhookEventType
|
|
286
290
|
from onfido.models.webhook_resend import WebhookResend
|
|
287
291
|
from onfido.models.webhook_response import WebhookResponse
|
|
@@ -292,8 +296,9 @@ from onfido.models.webhooks_list import WebhooksList
|
|
|
292
296
|
from onfido.models.webhooks_resend_item import WebhooksResendItem
|
|
293
297
|
from onfido.models.workflow_run import WorkflowRun
|
|
294
298
|
from onfido.models.workflow_run_builder import WorkflowRunBuilder
|
|
299
|
+
from onfido.models.workflow_run_error import WorkflowRunError
|
|
300
|
+
from onfido.models.workflow_run_link import WorkflowRunLink
|
|
295
301
|
from onfido.models.workflow_run_request import WorkflowRunRequest
|
|
296
302
|
from onfido.models.workflow_run_response import WorkflowRunResponse
|
|
297
|
-
from onfido.models.workflow_run_response_error import WorkflowRunResponseError
|
|
298
303
|
from onfido.models.workflow_run_shared import WorkflowRunShared
|
|
299
|
-
from onfido.models.
|
|
304
|
+
from onfido.models.workflow_run_status import WorkflowRunStatus
|
onfido/models/addresses_list.py
CHANGED
|
@@ -75,9 +75,9 @@ class AddressesList(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in addresses (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.addresses:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_addresses in self.addresses:
|
|
79
|
+
if _item_addresses:
|
|
80
|
+
_items.append(_item_addresses.to_dict())
|
|
81
81
|
_dict['addresses'] = _items
|
|
82
82
|
# puts key-value pairs in additional_properties in the top level
|
|
83
83
|
if self.additional_properties is not None:
|
onfido/models/applicant.py
CHANGED
|
@@ -111,9 +111,9 @@ class Applicant(BaseModel):
|
|
|
111
111
|
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
112
112
|
_items = []
|
|
113
113
|
if self.id_numbers:
|
|
114
|
-
for
|
|
115
|
-
if
|
|
116
|
-
_items.append(
|
|
114
|
+
for _item_id_numbers in self.id_numbers:
|
|
115
|
+
if _item_id_numbers:
|
|
116
|
+
_items.append(_item_id_numbers.to_dict())
|
|
117
117
|
_dict['id_numbers'] = _items
|
|
118
118
|
# override the default output from pydantic by calling `to_dict()` of address
|
|
119
119
|
if self.address:
|
|
@@ -22,7 +22,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing_extensions import Annotated
|
|
24
24
|
from onfido.models.address_builder import AddressBuilder
|
|
25
|
-
from onfido.models.
|
|
25
|
+
from onfido.models.applicant_consent_builder import ApplicantConsentBuilder
|
|
26
26
|
from onfido.models.id_number import IdNumber
|
|
27
27
|
from onfido.models.location_builder import LocationBuilder
|
|
28
28
|
from typing import Optional, Set
|
|
@@ -36,7 +36,7 @@ class ApplicantBuilder(BaseModel):
|
|
|
36
36
|
dob: Optional[date] = Field(default=None, description="The applicant's date of birth")
|
|
37
37
|
id_numbers: Optional[List[IdNumber]] = None
|
|
38
38
|
phone_number: Optional[StrictStr] = Field(default=None, description="The applicant's phone number")
|
|
39
|
-
consents: Optional[
|
|
39
|
+
consents: Optional[List[ApplicantConsentBuilder]] = Field(default=None, description="The applicant's consents")
|
|
40
40
|
address: Optional[AddressBuilder] = None
|
|
41
41
|
location: Optional[LocationBuilder] = None
|
|
42
42
|
first_name: Annotated[str, Field(strict=True)] = Field(description="The applicant's first name")
|
|
@@ -102,13 +102,17 @@ class ApplicantBuilder(BaseModel):
|
|
|
102
102
|
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
103
103
|
_items = []
|
|
104
104
|
if self.id_numbers:
|
|
105
|
-
for
|
|
106
|
-
if
|
|
107
|
-
_items.append(
|
|
105
|
+
for _item_id_numbers in self.id_numbers:
|
|
106
|
+
if _item_id_numbers:
|
|
107
|
+
_items.append(_item_id_numbers.to_dict())
|
|
108
108
|
_dict['id_numbers'] = _items
|
|
109
|
-
# override the default output from pydantic by calling `to_dict()` of consents
|
|
109
|
+
# override the default output from pydantic by calling `to_dict()` of each item in consents (list)
|
|
110
|
+
_items = []
|
|
110
111
|
if self.consents:
|
|
111
|
-
|
|
112
|
+
for _item_consents in self.consents:
|
|
113
|
+
if _item_consents:
|
|
114
|
+
_items.append(_item_consents.to_dict())
|
|
115
|
+
_dict['consents'] = _items
|
|
112
116
|
# override the default output from pydantic by calling `to_dict()` of address
|
|
113
117
|
if self.address:
|
|
114
118
|
_dict['address'] = self.address.to_dict()
|
|
@@ -136,7 +140,7 @@ class ApplicantBuilder(BaseModel):
|
|
|
136
140
|
"dob": obj.get("dob"),
|
|
137
141
|
"id_numbers": [IdNumber.from_dict(_item) for _item in obj["id_numbers"]] if obj.get("id_numbers") is not None else None,
|
|
138
142
|
"phone_number": obj.get("phone_number"),
|
|
139
|
-
"consents":
|
|
143
|
+
"consents": [ApplicantConsentBuilder.from_dict(_item) for _item in obj["consents"]] if obj.get("consents") is not None else None,
|
|
140
144
|
"address": AddressBuilder.from_dict(obj["address"]) if obj.get("address") is not None else None,
|
|
141
145
|
"location": LocationBuilder.from_dict(obj["location"]) if obj.get("location") is not None else None,
|
|
142
146
|
"first_name": obj.get("first_name"),
|
|
@@ -17,17 +17,20 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictBool
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from onfido.models.applicant_consent_name import ApplicantConsentName
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
25
|
-
class
|
|
26
|
+
class ApplicantConsentBuilder(BaseModel):
|
|
26
27
|
"""
|
|
27
|
-
|
|
28
|
+
ApplicantConsentBuilder
|
|
28
29
|
""" # noqa: E501
|
|
30
|
+
name: ApplicantConsentName
|
|
31
|
+
granted: StrictBool
|
|
29
32
|
additional_properties: Dict[str, Any] = {}
|
|
30
|
-
__properties: ClassVar[List[str]] = []
|
|
33
|
+
__properties: ClassVar[List[str]] = ["name", "granted"]
|
|
31
34
|
|
|
32
35
|
model_config = ConfigDict(
|
|
33
36
|
populate_by_name=True,
|
|
@@ -47,7 +50,7 @@ class ConsentsBuilder(BaseModel):
|
|
|
47
50
|
|
|
48
51
|
@classmethod
|
|
49
52
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
-
"""Create an instance of
|
|
53
|
+
"""Create an instance of ApplicantConsentBuilder from a JSON string"""
|
|
51
54
|
return cls.from_dict(json.loads(json_str))
|
|
52
55
|
|
|
53
56
|
def to_dict(self) -> Dict[str, Any]:
|
|
@@ -79,7 +82,7 @@ class ConsentsBuilder(BaseModel):
|
|
|
79
82
|
|
|
80
83
|
@classmethod
|
|
81
84
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
-
"""Create an instance of
|
|
85
|
+
"""Create an instance of ApplicantConsentBuilder from a dict"""
|
|
83
86
|
if obj is None:
|
|
84
87
|
return None
|
|
85
88
|
|
|
@@ -87,6 +90,8 @@ class ConsentsBuilder(BaseModel):
|
|
|
87
90
|
return cls.model_validate(obj)
|
|
88
91
|
|
|
89
92
|
_obj = cls.model_validate({
|
|
93
|
+
"name": obj.get("name"),
|
|
94
|
+
"granted": obj.get("granted")
|
|
90
95
|
})
|
|
91
96
|
# store additional fields in additional_properties
|
|
92
97
|
for _key in obj.keys():
|
|
@@ -0,0 +1,38 @@
|
|
|
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 json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
from typing_extensions import Self
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ApplicantConsentName(str, Enum):
|
|
22
|
+
"""
|
|
23
|
+
ApplicantConsentName
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
allowed enum values
|
|
28
|
+
"""
|
|
29
|
+
PRIVACY_NOTICES_READ = 'privacy_notices_read'
|
|
30
|
+
SSN_VERIFICATION = 'ssn_verification'
|
|
31
|
+
PHONE_NUMBER_VERIFICATION = 'phone_number_verification'
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json_str: str) -> Self:
|
|
35
|
+
"""Create an instance of ApplicantConsentName from a JSON string"""
|
|
36
|
+
return cls(json.loads(json_str))
|
|
37
|
+
|
|
38
|
+
|
|
@@ -17,10 +17,10 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from onfido.models.address_builder import AddressBuilder
|
|
23
|
-
from onfido.models.
|
|
23
|
+
from onfido.models.applicant_consent_builder import ApplicantConsentBuilder
|
|
24
24
|
from onfido.models.location_builder import LocationBuilder
|
|
25
25
|
from typing import Optional, Set
|
|
26
26
|
from typing_extensions import Self
|
|
@@ -29,7 +29,7 @@ class ApplicantRequest(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
ApplicantRequest
|
|
31
31
|
""" # noqa: E501
|
|
32
|
-
consents: Optional[
|
|
32
|
+
consents: Optional[List[ApplicantConsentBuilder]] = Field(default=None, description="The applicant's consents")
|
|
33
33
|
address: Optional[AddressBuilder] = None
|
|
34
34
|
location: Optional[LocationBuilder] = None
|
|
35
35
|
additional_properties: Dict[str, Any] = {}
|
|
@@ -76,9 +76,13 @@ class ApplicantRequest(BaseModel):
|
|
|
76
76
|
exclude=excluded_fields,
|
|
77
77
|
exclude_none=True,
|
|
78
78
|
)
|
|
79
|
-
# override the default output from pydantic by calling `to_dict()` of consents
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of each item in consents (list)
|
|
80
|
+
_items = []
|
|
80
81
|
if self.consents:
|
|
81
|
-
|
|
82
|
+
for _item_consents in self.consents:
|
|
83
|
+
if _item_consents:
|
|
84
|
+
_items.append(_item_consents.to_dict())
|
|
85
|
+
_dict['consents'] = _items
|
|
82
86
|
# override the default output from pydantic by calling `to_dict()` of address
|
|
83
87
|
if self.address:
|
|
84
88
|
_dict['address'] = self.address.to_dict()
|
|
@@ -102,7 +106,7 @@ class ApplicantRequest(BaseModel):
|
|
|
102
106
|
return cls.model_validate(obj)
|
|
103
107
|
|
|
104
108
|
_obj = cls.model_validate({
|
|
105
|
-
"consents":
|
|
109
|
+
"consents": [ApplicantConsentBuilder.from_dict(_item) for _item in obj["consents"]] if obj.get("consents") is not None else None,
|
|
106
110
|
"address": AddressBuilder.from_dict(obj["address"]) if obj.get("address") is not None else None,
|
|
107
111
|
"location": LocationBuilder.from_dict(obj["location"]) if obj.get("location") is not None else None
|
|
108
112
|
})
|
|
@@ -79,9 +79,9 @@ class ApplicantShared(BaseModel):
|
|
|
79
79
|
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
80
80
|
_items = []
|
|
81
81
|
if self.id_numbers:
|
|
82
|
-
for
|
|
83
|
-
if
|
|
84
|
-
_items.append(
|
|
82
|
+
for _item_id_numbers in self.id_numbers:
|
|
83
|
+
if _item_id_numbers:
|
|
84
|
+
_items.append(_item_id_numbers.to_dict())
|
|
85
85
|
_dict['id_numbers'] = _items
|
|
86
86
|
# puts key-value pairs in additional_properties in the top level
|
|
87
87
|
if self.additional_properties is not None:
|
|
@@ -22,7 +22,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
23
|
from typing_extensions import Annotated
|
|
24
24
|
from onfido.models.address_builder import AddressBuilder
|
|
25
|
-
from onfido.models.
|
|
25
|
+
from onfido.models.applicant_consent_builder import ApplicantConsentBuilder
|
|
26
26
|
from onfido.models.id_number import IdNumber
|
|
27
27
|
from onfido.models.location_builder import LocationBuilder
|
|
28
28
|
from typing import Optional, Set
|
|
@@ -36,7 +36,7 @@ class ApplicantUpdater(BaseModel):
|
|
|
36
36
|
dob: Optional[date] = Field(default=None, description="The applicant's date of birth")
|
|
37
37
|
id_numbers: Optional[List[IdNumber]] = None
|
|
38
38
|
phone_number: Optional[StrictStr] = Field(default=None, description="The applicant's phone number")
|
|
39
|
-
consents: Optional[
|
|
39
|
+
consents: Optional[List[ApplicantConsentBuilder]] = Field(default=None, description="The applicant's consents")
|
|
40
40
|
address: Optional[AddressBuilder] = None
|
|
41
41
|
location: Optional[LocationBuilder] = None
|
|
42
42
|
first_name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The applicant's first name")
|
|
@@ -108,13 +108,17 @@ class ApplicantUpdater(BaseModel):
|
|
|
108
108
|
# override the default output from pydantic by calling `to_dict()` of each item in id_numbers (list)
|
|
109
109
|
_items = []
|
|
110
110
|
if self.id_numbers:
|
|
111
|
-
for
|
|
112
|
-
if
|
|
113
|
-
_items.append(
|
|
111
|
+
for _item_id_numbers in self.id_numbers:
|
|
112
|
+
if _item_id_numbers:
|
|
113
|
+
_items.append(_item_id_numbers.to_dict())
|
|
114
114
|
_dict['id_numbers'] = _items
|
|
115
|
-
# override the default output from pydantic by calling `to_dict()` of consents
|
|
115
|
+
# override the default output from pydantic by calling `to_dict()` of each item in consents (list)
|
|
116
|
+
_items = []
|
|
116
117
|
if self.consents:
|
|
117
|
-
|
|
118
|
+
for _item_consents in self.consents:
|
|
119
|
+
if _item_consents:
|
|
120
|
+
_items.append(_item_consents.to_dict())
|
|
121
|
+
_dict['consents'] = _items
|
|
118
122
|
# override the default output from pydantic by calling `to_dict()` of address
|
|
119
123
|
if self.address:
|
|
120
124
|
_dict['address'] = self.address.to_dict()
|
|
@@ -142,7 +146,7 @@ class ApplicantUpdater(BaseModel):
|
|
|
142
146
|
"dob": obj.get("dob"),
|
|
143
147
|
"id_numbers": [IdNumber.from_dict(_item) for _item in obj["id_numbers"]] if obj.get("id_numbers") is not None else None,
|
|
144
148
|
"phone_number": obj.get("phone_number"),
|
|
145
|
-
"consents":
|
|
149
|
+
"consents": [ApplicantConsentBuilder.from_dict(_item) for _item in obj["consents"]] if obj.get("consents") is not None else None,
|
|
146
150
|
"address": AddressBuilder.from_dict(obj["address"]) if obj.get("address") is not None else None,
|
|
147
151
|
"location": LocationBuilder.from_dict(obj["location"]) if obj.get("location") is not None else None,
|
|
148
152
|
"first_name": obj.get("first_name"),
|
onfido/models/applicants_list.py
CHANGED
|
@@ -75,9 +75,9 @@ class ApplicantsList(BaseModel):
|
|
|
75
75
|
# override the default output from pydantic by calling `to_dict()` of each item in applicants (list)
|
|
76
76
|
_items = []
|
|
77
77
|
if self.applicants:
|
|
78
|
-
for
|
|
79
|
-
if
|
|
80
|
-
_items.append(
|
|
78
|
+
for _item_applicants in self.applicants:
|
|
79
|
+
if _item_applicants:
|
|
80
|
+
_items.append(_item_applicants.to_dict())
|
|
81
81
|
_dict['applicants'] = _items
|
|
82
82
|
# puts key-value pairs in additional_properties in the top level
|
|
83
83
|
if self.additional_properties is not None:
|
onfido/models/check.py
CHANGED
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from onfido.models.check_status import CheckStatus
|
|
23
24
|
from typing import Optional, Set
|
|
24
25
|
from typing_extensions import Self
|
|
25
26
|
|
|
@@ -32,27 +33,20 @@ class Check(BaseModel):
|
|
|
32
33
|
applicant_provides_data: Optional[StrictBool] = Field(default=None, description="Send an applicant form to applicant to complete to proceed with check. Defaults to false. ")
|
|
33
34
|
tags: Optional[List[StrictStr]] = Field(default=None, description="Array of tags being assigned to this check.")
|
|
34
35
|
redirect_uri: Optional[StrictStr] = Field(default=None, description="For checks where `applicant_provides_data` is `true`, redirect to this URI when the applicant has submitted their data.")
|
|
36
|
+
privacy_notices_read_consent_given: Optional[StrictBool] = None
|
|
35
37
|
id: StrictStr = Field(description="The unique identifier for the check.")
|
|
36
38
|
created_at: Optional[datetime] = Field(default=None, description="The date and time when this check was created.")
|
|
37
39
|
href: Optional[StrictStr] = Field(default=None, description="The uri of this resource.")
|
|
38
|
-
status: Optional[StrictStr] =
|
|
40
|
+
status: Optional[StrictStr] = None
|
|
39
41
|
result: Optional[StrictStr] = Field(default=None, description="The overall result of the check, based on the results of the constituent reports.")
|
|
40
42
|
form_uri: Optional[StrictStr] = Field(default=None, description="A link to the applicant form, if `applicant_provides_data` is `true`.")
|
|
41
43
|
results_uri: Optional[StrictStr] = Field(default=None, description="A link to the corresponding results page on the Onfido dashboard.")
|
|
42
44
|
report_ids: Optional[List[StrictStr]] = Field(default=None, description="An array of report ids.")
|
|
43
45
|
sandbox: Optional[StrictBool] = Field(default=None, description="Indicates whether the object was created in the sandbox or not.")
|
|
46
|
+
paused: Optional[StrictBool] = None
|
|
47
|
+
version: Optional[StrictStr] = None
|
|
44
48
|
additional_properties: Dict[str, Any] = {}
|
|
45
|
-
__properties: ClassVar[List[str]] = ["webhook_ids", "applicant_id", "applicant_provides_data", "tags", "redirect_uri", "id", "created_at", "href", "status", "result", "form_uri", "results_uri", "report_ids", "sandbox"]
|
|
46
|
-
|
|
47
|
-
@field_validator('status')
|
|
48
|
-
def status_validate_enum(cls, value):
|
|
49
|
-
"""Validates the enum"""
|
|
50
|
-
if value is None:
|
|
51
|
-
return value
|
|
52
|
-
|
|
53
|
-
if value not in set(['in_progress', 'awaiting_applicant', 'complete', 'withdrawn', 'paused', 'reopened']):
|
|
54
|
-
raise ValueError("must be one of enum values ('in_progress', 'awaiting_applicant', 'complete', 'withdrawn', 'paused', 'reopened')")
|
|
55
|
-
return value
|
|
49
|
+
__properties: ClassVar[List[str]] = ["webhook_ids", "applicant_id", "applicant_provides_data", "tags", "redirect_uri", "privacy_notices_read_consent_given", "id", "created_at", "href", "status", "result", "form_uri", "results_uri", "report_ids", "sandbox", "paused", "version"]
|
|
56
50
|
|
|
57
51
|
@field_validator('result')
|
|
58
52
|
def result_validate_enum(cls, value):
|
|
@@ -127,6 +121,7 @@ class Check(BaseModel):
|
|
|
127
121
|
"applicant_provides_data": obj.get("applicant_provides_data"),
|
|
128
122
|
"tags": obj.get("tags"),
|
|
129
123
|
"redirect_uri": obj.get("redirect_uri"),
|
|
124
|
+
"privacy_notices_read_consent_given": obj.get("privacy_notices_read_consent_given"),
|
|
130
125
|
"id": obj.get("id"),
|
|
131
126
|
"created_at": obj.get("created_at"),
|
|
132
127
|
"href": obj.get("href"),
|
|
@@ -135,7 +130,9 @@ class Check(BaseModel):
|
|
|
135
130
|
"form_uri": obj.get("form_uri"),
|
|
136
131
|
"results_uri": obj.get("results_uri"),
|
|
137
132
|
"report_ids": obj.get("report_ids"),
|
|
138
|
-
"sandbox": obj.get("sandbox")
|
|
133
|
+
"sandbox": obj.get("sandbox"),
|
|
134
|
+
"paused": obj.get("paused"),
|
|
135
|
+
"version": obj.get("version")
|
|
139
136
|
})
|
|
140
137
|
# store additional fields in additional_properties
|
|
141
138
|
for _key in obj.keys():
|
onfido/models/check_builder.py
CHANGED
|
@@ -33,6 +33,7 @@ class CheckBuilder(BaseModel):
|
|
|
33
33
|
applicant_provides_data: Optional[StrictBool] = Field(default=False, description="Send an applicant form to applicant to complete to proceed with check. Defaults to false.")
|
|
34
34
|
tags: Optional[List[StrictStr]] = Field(default=None, description="Array of tags being assigned to this check.")
|
|
35
35
|
redirect_uri: Optional[StrictStr] = Field(default=None, description="For checks where `applicant_provides_data` is `true`, redirect to this URI when the applicant has submitted their data.")
|
|
36
|
+
privacy_notices_read_consent_given: Optional[StrictBool] = None
|
|
36
37
|
report_names: List[ReportName] = Field(description="An array of report names (strings).")
|
|
37
38
|
document_ids: Optional[List[StrictStr]] = Field(default=None, description="Optional. An array of document ids, for use with Document reports only. If omitted, the Document report will use the most recently uploaded document by default.")
|
|
38
39
|
asynchronous: Optional[StrictBool] = Field(default=True, description="Defaults to `true`. If set to `false`, you will only receive a response when all reports in your check have completed. ")
|
|
@@ -41,7 +42,7 @@ class CheckBuilder(BaseModel):
|
|
|
41
42
|
consider: Optional[List[ReportName]] = Field(default=None, description="Array of names of particular reports to return consider as their results. This is a feature available in sandbox testing")
|
|
42
43
|
us_driving_licence: Optional[UsDrivingLicenceBuilder] = None
|
|
43
44
|
additional_properties: Dict[str, Any] = {}
|
|
44
|
-
__properties: ClassVar[List[str]] = ["webhook_ids", "applicant_id", "applicant_provides_data", "tags", "redirect_uri", "report_names", "document_ids", "asynchronous", "suppress_form_emails", "sub_result", "consider", "us_driving_licence"]
|
|
45
|
+
__properties: ClassVar[List[str]] = ["webhook_ids", "applicant_id", "applicant_provides_data", "tags", "redirect_uri", "privacy_notices_read_consent_given", "report_names", "document_ids", "asynchronous", "suppress_form_emails", "sub_result", "consider", "us_driving_licence"]
|
|
45
46
|
|
|
46
47
|
model_config = ConfigDict(
|
|
47
48
|
populate_by_name=True,
|
|
@@ -109,6 +110,7 @@ class CheckBuilder(BaseModel):
|
|
|
109
110
|
"applicant_provides_data": obj.get("applicant_provides_data") if obj.get("applicant_provides_data") is not None else False,
|
|
110
111
|
"tags": obj.get("tags"),
|
|
111
112
|
"redirect_uri": obj.get("redirect_uri"),
|
|
113
|
+
"privacy_notices_read_consent_given": obj.get("privacy_notices_read_consent_given"),
|
|
112
114
|
"report_names": obj.get("report_names"),
|
|
113
115
|
"document_ids": obj.get("document_ids"),
|
|
114
116
|
"asynchronous": obj.get("asynchronous") if obj.get("asynchronous") is not None else True,
|