| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._list_object import ListObject |
| 4 |
from stripe._listable_api_resource import ListableAPIResource |
| 5 |
from stripe._stripe_object import StripeObject |
| 6 |
from typing import ClassVar, List, Optional |
| 7 |
from typing_extensions import Literal, Unpack, TYPE_CHECKING |
| 8 |
|
| 9 |
if TYPE_CHECKING: |
| 10 |
from stripe.params.identity._verification_report_list_params import ( |
| 11 |
VerificationReportListParams, |
| 12 |
) |
| 13 |
from stripe.params.identity._verification_report_retrieve_params import ( |
| 14 |
VerificationReportRetrieveParams, |
| 15 |
) |
| 16 |
|
| 17 |
|
| 18 |
class VerificationReport(ListableAPIResource["VerificationReport"]): |
| 19 |
""" |
| 20 |
A VerificationReport is the result of an attempt to collect and verify data from a user. |
| 21 |
The collection of verification checks performed is determined from the `type` and `options` |
| 22 |
parameters used. You can find the result of each verification check performed in the |
| 23 |
appropriate sub-resource: `document`, `id_number`, `selfie`. |
| 24 |
|
| 25 |
Each VerificationReport contains a copy of any data collected by the user as well as |
| 26 |
reference IDs which can be used to access collected images through the [FileUpload](https://docs.stripe.com/api/files) |
| 27 |
API. To configure and create VerificationReports, use the |
| 28 |
[VerificationSession](https://docs.stripe.com/api/identity/verification_sessions) API. |
| 29 |
|
| 30 |
Related guide: [Accessing verification results](https://docs.stripe.com/identity/verification-sessions#results). |
| 31 |
""" |
| 32 |
|
| 33 |
OBJECT_NAME: ClassVar[Literal["identity.verification_report"]] = ( |
| 34 |
"identity.verification_report" |
| 35 |
) |
| 36 |
|
| 37 |
class Document(StripeObject): |
| 38 |
class Address(StripeObject): |
| 39 |
city: Optional[str] |
| 40 |
""" |
| 41 |
City, district, suburb, town, or village. |
| 42 |
""" |
| 43 |
country: Optional[str] |
| 44 |
""" |
| 45 |
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). |
| 46 |
""" |
| 47 |
line1: Optional[str] |
| 48 |
""" |
| 49 |
Address line 1, such as the street, PO Box, or company name. |
| 50 |
""" |
| 51 |
line2: Optional[str] |
| 52 |
""" |
| 53 |
Address line 2, such as the apartment, suite, unit, or building. |
| 54 |
""" |
| 55 |
postal_code: Optional[str] |
| 56 |
""" |
| 57 |
ZIP or postal code. |
| 58 |
""" |
| 59 |
state: Optional[str] |
| 60 |
""" |
| 61 |
State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). |
| 62 |
""" |
| 63 |
|
| 64 |
class Dob(StripeObject): |
| 65 |
day: Optional[int] |
| 66 |
""" |
| 67 |
Numerical day between 1 and 31. |
| 68 |
""" |
| 69 |
month: Optional[int] |
| 70 |
""" |
| 71 |
Numerical month between 1 and 12. |
| 72 |
""" |
| 73 |
year: Optional[int] |
| 74 |
""" |
| 75 |
The four-digit year. |
| 76 |
""" |
| 77 |
|
| 78 |
class Error(StripeObject): |
| 79 |
code: Optional[ |
| 80 |
Literal[ |
| 81 |
"document_expired", |
| 82 |
"document_type_not_supported", |
| 83 |
"document_unverified_other", |
| 84 |
] |
| 85 |
] |
| 86 |
""" |
| 87 |
A short machine-readable string giving the reason for the verification failure. |
| 88 |
""" |
| 89 |
reason: Optional[str] |
| 90 |
""" |
| 91 |
A human-readable message giving the reason for the failure. These messages can be shown to your users. |
| 92 |
""" |
| 93 |
|
| 94 |
class ExpirationDate(StripeObject): |
| 95 |
day: Optional[int] |
| 96 |
""" |
| 97 |
Numerical day between 1 and 31. |
| 98 |
""" |
| 99 |
month: Optional[int] |
| 100 |
""" |
| 101 |
Numerical month between 1 and 12. |
| 102 |
""" |
| 103 |
year: Optional[int] |
| 104 |
""" |
| 105 |
The four-digit year. |
| 106 |
""" |
| 107 |
|
| 108 |
class IssuedDate(StripeObject): |
| 109 |
day: Optional[int] |
| 110 |
""" |
| 111 |
Numerical day between 1 and 31. |
| 112 |
""" |
| 113 |
month: Optional[int] |
| 114 |
""" |
| 115 |
Numerical month between 1 and 12. |
| 116 |
""" |
| 117 |
year: Optional[int] |
| 118 |
""" |
| 119 |
The four-digit year. |
| 120 |
""" |
| 121 |
|
| 122 |
address: Optional[Address] |
| 123 |
""" |
| 124 |
Address as it appears in the document. |
| 125 |
""" |
| 126 |
dob: Optional[Dob] |
| 127 |
""" |
| 128 |
Date of birth as it appears in the document. |
| 129 |
""" |
| 130 |
error: Optional[Error] |
| 131 |
""" |
| 132 |
Details on the verification error. Present when status is `unverified`. |
| 133 |
""" |
| 134 |
expiration_date: Optional[ExpirationDate] |
| 135 |
""" |
| 136 |
Expiration date of the document. |
| 137 |
""" |
| 138 |
files: Optional[List[str]] |
| 139 |
""" |
| 140 |
Array of [File](https://docs.stripe.com/api/files) ids containing images for this document. |
| 141 |
""" |
| 142 |
first_name: Optional[str] |
| 143 |
""" |
| 144 |
First name as it appears in the document. |
| 145 |
""" |
| 146 |
issued_date: Optional[IssuedDate] |
| 147 |
""" |
| 148 |
Issued date of the document. |
| 149 |
""" |
| 150 |
issuing_country: Optional[str] |
| 151 |
""" |
| 152 |
Issuing country of the document. |
| 153 |
""" |
| 154 |
last_name: Optional[str] |
| 155 |
""" |
| 156 |
Last name as it appears in the document. |
| 157 |
""" |
| 158 |
number: Optional[str] |
| 159 |
""" |
| 160 |
Document ID number. |
| 161 |
""" |
| 162 |
sex: Optional[Literal["[redacted]", "female", "male", "unknown"]] |
| 163 |
""" |
| 164 |
Sex of the person in the document. |
| 165 |
""" |
| 166 |
status: Literal["unverified", "verified"] |
| 167 |
""" |
| 168 |
Status of this `document` check. |
| 169 |
""" |
| 170 |
type: Optional[Literal["driving_license", "id_card", "passport"]] |
| 171 |
""" |
| 172 |
Type of the document. |
| 173 |
""" |
| 174 |
unparsed_place_of_birth: Optional[str] |
| 175 |
""" |
| 176 |
Place of birth as it appears in the document. |
| 177 |
""" |
| 178 |
unparsed_sex: Optional[str] |
| 179 |
""" |
| 180 |
Sex as it appears in the document. |
| 181 |
""" |
| 182 |
_inner_class_types = { |
| 183 |
"address": Address, |
| 184 |
"dob": Dob, |
| 185 |
"error": Error, |
| 186 |
"expiration_date": ExpirationDate, |
| 187 |
"issued_date": IssuedDate, |
| 188 |
} |
| 189 |
|
| 190 |
class Email(StripeObject): |
| 191 |
class Error(StripeObject): |
| 192 |
code: Optional[ |
| 193 |
Literal[ |
| 194 |
"email_unverified_other", "email_verification_declined" |
| 195 |
] |
| 196 |
] |
| 197 |
""" |
| 198 |
A short machine-readable string giving the reason for the verification failure. |
| 199 |
""" |
| 200 |
reason: Optional[str] |
| 201 |
""" |
| 202 |
A human-readable message giving the reason for the failure. These messages can be shown to your users. |
| 203 |
""" |
| 204 |
|
| 205 |
email: Optional[str] |
| 206 |
""" |
| 207 |
Email to be verified. |
| 208 |
""" |
| 209 |
error: Optional[Error] |
| 210 |
""" |
| 211 |
Details on the verification error. Present when status is `unverified`. |
| 212 |
""" |
| 213 |
status: Literal["unverified", "verified"] |
| 214 |
""" |
| 215 |
Status of this `email` check. |
| 216 |
""" |
| 217 |
_inner_class_types = {"error": Error} |
| 218 |
|
| 219 |
class IdNumber(StripeObject): |
| 220 |
class Dob(StripeObject): |
| 221 |
day: Optional[int] |
| 222 |
""" |
| 223 |
Numerical day between 1 and 31. |
| 224 |
""" |
| 225 |
month: Optional[int] |
| 226 |
""" |
| 227 |
Numerical month between 1 and 12. |
| 228 |
""" |
| 229 |
year: Optional[int] |
| 230 |
""" |
| 231 |
The four-digit year. |
| 232 |
""" |
| 233 |
|
| 234 |
class Error(StripeObject): |
| 235 |
code: Optional[ |
| 236 |
Literal[ |
| 237 |
"id_number_insufficient_document_data", |
| 238 |
"id_number_mismatch", |
| 239 |
"id_number_unverified_other", |
| 240 |
] |
| 241 |
] |
| 242 |
""" |
| 243 |
A short machine-readable string giving the reason for the verification failure. |
| 244 |
""" |
| 245 |
reason: Optional[str] |
| 246 |
""" |
| 247 |
A human-readable message giving the reason for the failure. These messages can be shown to your users. |
| 248 |
""" |
| 249 |
|
| 250 |
dob: Optional[Dob] |
| 251 |
""" |
| 252 |
Date of birth. |
| 253 |
""" |
| 254 |
error: Optional[Error] |
| 255 |
""" |
| 256 |
Details on the verification error. Present when status is `unverified`. |
| 257 |
""" |
| 258 |
first_name: Optional[str] |
| 259 |
""" |
| 260 |
First name. |
| 261 |
""" |
| 262 |
id_number: Optional[str] |
| 263 |
""" |
| 264 |
ID number. When `id_number_type` is `us_ssn`, only the last 4 digits are present. |
| 265 |
""" |
| 266 |
id_number_type: Optional[Literal["br_cpf", "sg_nric", "us_ssn"]] |
| 267 |
""" |
| 268 |
Type of ID number. |
| 269 |
""" |
| 270 |
last_name: Optional[str] |
| 271 |
""" |
| 272 |
Last name. |
| 273 |
""" |
| 274 |
status: Literal["unverified", "verified"] |
| 275 |
""" |
| 276 |
Status of this `id_number` check. |
| 277 |
""" |
| 278 |
_inner_class_types = {"dob": Dob, "error": Error} |
| 279 |
|
| 280 |
class Options(StripeObject): |
| 281 |
class Document(StripeObject): |
| 282 |
allowed_types: Optional[ |
| 283 |
List[Literal["driving_license", "id_card", "passport"]] |
| 284 |
] |
| 285 |
""" |
| 286 |
Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code. |
| 287 |
""" |
| 288 |
require_id_number: Optional[bool] |
| 289 |
""" |
| 290 |
Collect an ID number and perform an [ID number check](https://docs.stripe.com/identity/verification-checks?type=id-number) with the document's extracted name and date of birth. |
| 291 |
""" |
| 292 |
require_live_capture: Optional[bool] |
| 293 |
""" |
| 294 |
Disable image uploads, identity document images have to be captured using the device's camera. |
| 295 |
""" |
| 296 |
require_matching_selfie: Optional[bool] |
| 297 |
""" |
| 298 |
Capture a face image and perform a [selfie check](https://docs.stripe.com/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://docs.stripe.com/identity/selfie). |
| 299 |
""" |
| 300 |
|
| 301 |
class IdNumber(StripeObject): |
| 302 |
pass |
| 303 |
|
| 304 |
document: Optional[Document] |
| 305 |
id_number: Optional[IdNumber] |
| 306 |
_inner_class_types = {"document": Document, "id_number": IdNumber} |
| 307 |
|
| 308 |
class Phone(StripeObject): |
| 309 |
class Error(StripeObject): |
| 310 |
code: Optional[ |
| 311 |
Literal[ |
| 312 |
"phone_unverified_other", "phone_verification_declined" |
| 313 |
] |
| 314 |
] |
| 315 |
""" |
| 316 |
A short machine-readable string giving the reason for the verification failure. |
| 317 |
""" |
| 318 |
reason: Optional[str] |
| 319 |
""" |
| 320 |
A human-readable message giving the reason for the failure. These messages can be shown to your users. |
| 321 |
""" |
| 322 |
|
| 323 |
error: Optional[Error] |
| 324 |
""" |
| 325 |
Details on the verification error. Present when status is `unverified`. |
| 326 |
""" |
| 327 |
phone: Optional[str] |
| 328 |
""" |
| 329 |
Phone to be verified. |
| 330 |
""" |
| 331 |
status: Literal["unverified", "verified"] |
| 332 |
""" |
| 333 |
Status of this `phone` check. |
| 334 |
""" |
| 335 |
_inner_class_types = {"error": Error} |
| 336 |
|
| 337 |
class Selfie(StripeObject): |
| 338 |
class Error(StripeObject): |
| 339 |
code: Optional[ |
| 340 |
Literal[ |
| 341 |
"selfie_document_missing_photo", |
| 342 |
"selfie_face_mismatch", |
| 343 |
"selfie_manipulated", |
| 344 |
"selfie_unverified_other", |
| 345 |
] |
| 346 |
] |
| 347 |
""" |
| 348 |
A short machine-readable string giving the reason for the verification failure. |
| 349 |
""" |
| 350 |
reason: Optional[str] |
| 351 |
""" |
| 352 |
A human-readable message giving the reason for the failure. These messages can be shown to your users. |
| 353 |
""" |
| 354 |
|
| 355 |
document: Optional[str] |
| 356 |
""" |
| 357 |
ID of the [File](https://docs.stripe.com/api/files) holding the image of the identity document used in this check. |
| 358 |
""" |
| 359 |
error: Optional[Error] |
| 360 |
""" |
| 361 |
Details on the verification error. Present when status is `unverified`. |
| 362 |
""" |
| 363 |
selfie: Optional[str] |
| 364 |
""" |
| 365 |
ID of the [File](https://docs.stripe.com/api/files) holding the image of the selfie used in this check. |
| 366 |
""" |
| 367 |
status: Literal["unverified", "verified"] |
| 368 |
""" |
| 369 |
Status of this `selfie` check. |
| 370 |
""" |
| 371 |
_inner_class_types = {"error": Error} |
| 372 |
|
| 373 |
client_reference_id: Optional[str] |
| 374 |
""" |
| 375 |
A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. |
| 376 |
""" |
| 377 |
created: int |
| 378 |
""" |
| 379 |
Time at which the object was created. Measured in seconds since the Unix epoch. |
| 380 |
""" |
| 381 |
document: Optional[Document] |
| 382 |
""" |
| 383 |
Result from a document check |
| 384 |
""" |
| 385 |
email: Optional[Email] |
| 386 |
""" |
| 387 |
Result from a email check |
| 388 |
""" |
| 389 |
id: str |
| 390 |
""" |
| 391 |
Unique identifier for the object. |
| 392 |
""" |
| 393 |
id_number: Optional[IdNumber] |
| 394 |
""" |
| 395 |
Result from an id_number check |
| 396 |
""" |
| 397 |
livemode: bool |
| 398 |
""" |
| 399 |
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. |
| 400 |
""" |
| 401 |
object: Literal["identity.verification_report"] |
| 402 |
""" |
| 403 |
String representing the object's type. Objects of the same type share the same value. |
| 404 |
""" |
| 405 |
options: Optional[Options] |
| 406 |
phone: Optional[Phone] |
| 407 |
""" |
| 408 |
Result from a phone check |
| 409 |
""" |
| 410 |
selfie: Optional[Selfie] |
| 411 |
""" |
| 412 |
Result from a selfie check |
| 413 |
""" |
| 414 |
type: Literal["document", "id_number", "verification_flow"] |
| 415 |
""" |
| 416 |
Type of report. |
| 417 |
""" |
| 418 |
verification_flow: Optional[str] |
| 419 |
""" |
| 420 |
The configuration token of a verification flow from the dashboard. |
| 421 |
""" |
| 422 |
verification_session: Optional[str] |
| 423 |
""" |
| 424 |
ID of the VerificationSession that created this report. |
| 425 |
""" |
| 426 |
|
| 427 |
@classmethod |
| 428 |
def list( |
| 429 |
cls, **params: Unpack["VerificationReportListParams"] |
| 430 |
) -> ListObject["VerificationReport"]: |
| 431 |
""" |
| 432 |
List all verification reports. |
| 433 |
""" |
| 434 |
result = cls._static_request( |
| 435 |
"get", |
| 436 |
cls.class_url(), |
| 437 |
params=params, |
| 438 |
) |
| 439 |
if not isinstance(result, ListObject): |
| 440 |
raise TypeError( |
| 441 |
"Expected list object from API, got %s" |
| 442 |
% (type(result).__name__) |
| 443 |
) |
| 444 |
|
| 445 |
return result |
| 446 |
|
| 447 |
@classmethod |
| 448 |
async def list_async( |
| 449 |
cls, **params: Unpack["VerificationReportListParams"] |
| 450 |
) -> ListObject["VerificationReport"]: |
| 451 |
""" |
| 452 |
List all verification reports. |
| 453 |
""" |
| 454 |
result = await cls._static_request_async( |
| 455 |
"get", |
| 456 |
cls.class_url(), |
| 457 |
params=params, |
| 458 |
) |
| 459 |
if not isinstance(result, ListObject): |
| 460 |
raise TypeError( |
| 461 |
"Expected list object from API, got %s" |
| 462 |
% (type(result).__name__) |
| 463 |
) |
| 464 |
|
| 465 |
return result |
| 466 |
|
| 467 |
@classmethod |
| 468 |
def retrieve( |
| 469 |
cls, id: str, **params: Unpack["VerificationReportRetrieveParams"] |
| 470 |
) -> "VerificationReport": |
| 471 |
""" |
| 472 |
Retrieves an existing VerificationReport |
| 473 |
""" |
| 474 |
instance = cls(id, **params) |
| 475 |
instance.refresh() |
| 476 |
return instance |
| 477 |
|
| 478 |
@classmethod |
| 479 |
async def retrieve_async( |
| 480 |
cls, id: str, **params: Unpack["VerificationReportRetrieveParams"] |
| 481 |
) -> "VerificationReport": |
| 482 |
""" |
| 483 |
Retrieves an existing VerificationReport |
| 484 |
""" |
| 485 |
instance = cls(id, **params) |
| 486 |
await instance.refresh_async() |
| 487 |
return instance |
| 488 |
|
| 489 |
_inner_class_types = { |
| 490 |
"document": Document, |
| 491 |
"email": Email, |
| 492 |
"id_number": IdNumber, |
| 493 |
"options": Options, |
| 494 |
"phone": Phone, |
| 495 |
"selfie": Selfie, |
| 496 |
} |