From 8f3d64ae18834e0ad77263a147d9045316d3e548 Mon Sep 17 00:00:00 2001 From: dvacca-onfido <134616519+dvacca-onfido@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:27:24 +0000 Subject: [PATCH 1/2] Upgrade after onfido-openapi-spec change 10f8380 --- .release.json | 6 +- lib/Api/DefaultApi.php | 10 +- lib/Model/ApplicantBuilder.php | 6 +- ...ntItem.php => ApplicantConsentBuilder.php} | 53 +- lib/Model/ApplicantConsentName.php | 68 ++ lib/Model/ApplicantRequest.php | 6 +- lib/Model/ApplicantUpdater.php | 6 +- lib/Model/Check.php | 164 +++- lib/Model/CheckBuilder.php | 34 + lib/Model/CheckResponse.php | 130 ++- lib/Model/CheckShared.php | 46 +- lib/Model/CheckStatus.php | 78 ++ lib/Model/ConsentsBuilder.php | 382 -------- ...eIntelligenceBreakdownPropertiesDevice.php | 144 --- ...eviceIntelligenceBreakdownPropertiesIp.php | 120 +-- lib/Model/Document.php | 6 +- lib/Model/DocumentShared.php | 6 +- lib/Model/DocumentTypes.php | 15 + lib/Model/TaskItem.php | 75 ++ lib/Model/WatchlistAmlProperties.php | 2 + lib/Model/WatchlistStandardProperties.php | 2 + lib/Model/WebhookEventObjectStatus.php | 117 +++ lib/Model/WebhookEventPayload.php | 12 +- lib/Model/WebhookEventPayloadObject.php | 6 +- lib/Model/WebhookEventPayloadResource.php | 910 ++++++++++++++++++ lib/Model/WebhookEventResourceType.php | 77 ++ lib/Model/WorkflowRun.php | 64 +- lib/Model/WorkflowRunBuilder.php | 6 +- ...ResponseError.php => WorkflowRunError.php} | 9 +- ...wRunSharedLink.php => WorkflowRunLink.php} | 55 +- lib/Model/WorkflowRunResponse.php | 58 +- lib/Model/WorkflowRunShared.php | 6 +- lib/Model/WorkflowRunStatus.php | 83 ++ 33 files changed, 1800 insertions(+), 962 deletions(-) rename lib/Model/{ConsentItem.php => ApplicantConsentBuilder.php} (85%) create mode 100644 lib/Model/ApplicantConsentName.php create mode 100644 lib/Model/CheckStatus.php delete mode 100644 lib/Model/ConsentsBuilder.php create mode 100644 lib/Model/WebhookEventObjectStatus.php create mode 100644 lib/Model/WebhookEventPayloadResource.php create mode 100644 lib/Model/WebhookEventResourceType.php rename lib/Model/{WorkflowRunResponseError.php => WorkflowRunError.php} (96%) rename lib/Model/{WorkflowRunSharedLink.php => WorkflowRunLink.php} (87%) create mode 100644 lib/Model/WorkflowRunStatus.php diff --git a/.release.json b/.release.json index 9bf5532..64db771 100644 --- a/.release.json +++ b/.release.json @@ -1,9 +1,9 @@ { "source": { "repo_url": "https://github.com/onfido/onfido-openapi-spec", - "short_sha": "08508b9", - "long_sha": "08508b9517238b3becb4265130633a418a8ee319", - "version": "v3.5.0" + "short_sha": "10f8380", + "long_sha": "10f83806efa080edbf022ac48d5eeac90fbceb0c", + "version": "" }, "release": "v7.5.0" } diff --git a/lib/Api/DefaultApi.php b/lib/Api/DefaultApi.php index f5102db..ae07e8c 100644 --- a/lib/Api/DefaultApi.php +++ b/lib/Api/DefaultApi.php @@ -20961,7 +20961,7 @@ public function updateWebhookRequest($webhook_id, $webhook_updater, string $cont * * Upload a document * - * @param string $type The type of document (required) + * @param \Onfido\Model\DocumentTypes $type The type of document (required) * @param string $applicant_id The ID of the applicant whose document is being uploaded. (required) * @param \SplFileObject $file The file to be uploaded. (required) * @param string $file_type The file type of the uploaded file (optional) @@ -20986,7 +20986,7 @@ public function uploadDocument($type, $applicant_id, $file, $file_type = null, $ * * Upload a document * - * @param string $type The type of document (required) + * @param \Onfido\Model\DocumentTypes $type The type of document (required) * @param string $applicant_id The ID of the applicant whose document is being uploaded. (required) * @param \SplFileObject $file The file to be uploaded. (required) * @param string $file_type The file type of the uploaded file (optional) @@ -21152,7 +21152,7 @@ public function uploadDocumentWithHttpInfo($type, $applicant_id, $file, $file_ty * * Upload a document * - * @param string $type The type of document (required) + * @param \Onfido\Model\DocumentTypes $type The type of document (required) * @param string $applicant_id The ID of the applicant whose document is being uploaded. (required) * @param \SplFileObject $file The file to be uploaded. (required) * @param string $file_type The file type of the uploaded file (optional) @@ -21180,7 +21180,7 @@ function ($response) { * * Upload a document * - * @param string $type The type of document (required) + * @param \Onfido\Model\DocumentTypes $type The type of document (required) * @param string $applicant_id The ID of the applicant whose document is being uploaded. (required) * @param \SplFileObject $file The file to be uploaded. (required) * @param string $file_type The file type of the uploaded file (optional) @@ -21237,7 +21237,7 @@ function ($exception) { /** * Create request for operation 'uploadDocument' * - * @param string $type The type of document (required) + * @param \Onfido\Model\DocumentTypes $type The type of document (required) * @param string $applicant_id The ID of the applicant whose document is being uploaded. (required) * @param \SplFileObject $file The file to be uploaded. (required) * @param string $file_type The file type of the uploaded file (optional) diff --git a/lib/Model/ApplicantBuilder.php b/lib/Model/ApplicantBuilder.php index b29e9b0..234ae61 100644 --- a/lib/Model/ApplicantBuilder.php +++ b/lib/Model/ApplicantBuilder.php @@ -61,7 +61,7 @@ class ApplicantBuilder implements ModelInterface, ArrayAccess, \JsonSerializable 'dob' => '\DateTime', 'id_numbers' => '\Onfido\Model\IdNumber[]', 'phone_number' => 'string', - 'consents' => '\Onfido\Model\ConsentsBuilder', + 'consents' => '\Onfido\Model\ApplicantConsentBuilder[]', 'address' => '\Onfido\Model\AddressBuilder', 'location' => '\Onfido\Model\LocationBuilder', 'first_name' => 'string', @@ -470,7 +470,7 @@ public function setPhoneNumber($phone_number) /** * Gets consents * - * @return \Onfido\Model\ConsentsBuilder|null + * @return \Onfido\Model\ApplicantConsentBuilder[]|null */ public function getConsents() { @@ -480,7 +480,7 @@ public function getConsents() /** * Sets consents * - * @param \Onfido\Model\ConsentsBuilder|null $consents consents + * @param \Onfido\Model\ApplicantConsentBuilder[]|null $consents The applicant's consents * * @return self */ diff --git a/lib/Model/ConsentItem.php b/lib/Model/ApplicantConsentBuilder.php similarity index 85% rename from lib/Model/ConsentItem.php rename to lib/Model/ApplicantConsentBuilder.php index b9476b1..092aeaa 100644 --- a/lib/Model/ConsentItem.php +++ b/lib/Model/ApplicantConsentBuilder.php @@ -1,6 +1,6 @@ */ -class ConsentItem implements ModelInterface, ArrayAccess, \JsonSerializable +class ApplicantConsentBuilder implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -50,7 +49,7 @@ class ConsentItem implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'Consent_item'; + protected static $openAPIModelName = 'applicant_consent_builder'; /** * Array of property to type mappings. Used for (de)serialization @@ -58,7 +57,7 @@ class ConsentItem implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'name' => 'string', + 'name' => '\Onfido\Model\ApplicantConsentName', 'granted' => 'bool' ]; @@ -235,25 +234,6 @@ public function getModelName() return self::$openAPIModelName; } - public const NAME_PRIVACY_NOTICES_READ = 'privacy_notices_read'; - public const NAME_SSN_VERIFICATION = 'ssn_verification'; - public const NAME_PHONE_NUMBER_VERIFICATION = 'phone_number_verification'; - public const NAME_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getNameAllowableValues() - { - return [ - self::NAME_PRIVACY_NOTICES_READ, - self::NAME_SSN_VERIFICATION, - self::NAME_PHONE_NUMBER_VERIFICATION, - self::NAME_UNKNOWN_DEFAULT_OPEN_API, - ]; - } /** * Associative array for storing property values @@ -304,15 +284,6 @@ public function listInvalidProperties() if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - $allowedValues = $this->getNameAllowableValues(); - if (!is_null($this->container['name']) && !in_array($this->container['name'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'name', must be one of '%s'", - $this->container['name'], - implode("', '", $allowedValues) - ); - } - if ($this->container['granted'] === null) { $invalidProperties[] = "'granted' can't be null"; } @@ -334,7 +305,7 @@ public function valid() /** * Gets name * - * @return string + * @return \Onfido\Model\ApplicantConsentName */ public function getName() { @@ -344,7 +315,7 @@ public function getName() /** * Sets name * - * @param string $name name + * @param \Onfido\Model\ApplicantConsentName $name name * * @return self */ @@ -353,16 +324,6 @@ public function setName($name) if (is_null($name)) { throw new \InvalidArgumentException('non-nullable name cannot be null'); } - $allowedValues = $this->getNameAllowableValues(); - if (!in_array($name, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'name', must be one of '%s'", - $name, - implode("', '", $allowedValues) - ) - ); - } $this->container['name'] = $name; return $this; diff --git a/lib/Model/ApplicantConsentName.php b/lib/Model/ApplicantConsentName.php new file mode 100644 index 0000000..7fbac9b --- /dev/null +++ b/lib/Model/ApplicantConsentName.php @@ -0,0 +1,68 @@ + '\Onfido\Model\ConsentsBuilder', + 'consents' => '\Onfido\Model\ApplicantConsentBuilder[]', 'address' => '\Onfido\Model\AddressBuilder', 'location' => '\Onfido\Model\LocationBuilder' ]; @@ -306,7 +306,7 @@ public function valid() /** * Gets consents * - * @return \Onfido\Model\ConsentsBuilder|null + * @return \Onfido\Model\ApplicantConsentBuilder[]|null */ public function getConsents() { @@ -316,7 +316,7 @@ public function getConsents() /** * Sets consents * - * @param \Onfido\Model\ConsentsBuilder|null $consents consents + * @param \Onfido\Model\ApplicantConsentBuilder[]|null $consents The applicant's consents * * @return self */ diff --git a/lib/Model/ApplicantUpdater.php b/lib/Model/ApplicantUpdater.php index c009f37..98969bd 100644 --- a/lib/Model/ApplicantUpdater.php +++ b/lib/Model/ApplicantUpdater.php @@ -61,7 +61,7 @@ class ApplicantUpdater implements ModelInterface, ArrayAccess, \JsonSerializable 'dob' => '\DateTime', 'id_numbers' => '\Onfido\Model\IdNumber[]', 'phone_number' => 'string', - 'consents' => '\Onfido\Model\ConsentsBuilder', + 'consents' => '\Onfido\Model\ApplicantConsentBuilder[]', 'address' => '\Onfido\Model\AddressBuilder', 'location' => '\Onfido\Model\LocationBuilder', 'first_name' => 'string', @@ -464,7 +464,7 @@ public function setPhoneNumber($phone_number) /** * Gets consents * - * @return \Onfido\Model\ConsentsBuilder|null + * @return \Onfido\Model\ApplicantConsentBuilder[]|null */ public function getConsents() { @@ -474,7 +474,7 @@ public function getConsents() /** * Sets consents * - * @param \Onfido\Model\ConsentsBuilder|null $consents consents + * @param \Onfido\Model\ApplicantConsentBuilder[]|null $consents The applicant's consents * * @return self */ diff --git a/lib/Model/Check.php b/lib/Model/Check.php index 2fa15ba..2de649a 100644 --- a/lib/Model/Check.php +++ b/lib/Model/Check.php @@ -62,15 +62,18 @@ class Check implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => 'bool', 'tags' => 'string[]', 'redirect_uri' => 'string', + 'privacy_notices_read_consent_given' => 'bool', 'id' => 'string', 'created_at' => '\DateTime', 'href' => 'string', - 'status' => 'string', + 'status' => '\Onfido\Model\CheckStatus', 'result' => 'string', 'form_uri' => 'string', 'results_uri' => 'string', 'report_ids' => 'string[]', - 'sandbox' => 'bool' + 'sandbox' => 'bool', + 'paused' => 'bool', + 'version' => 'string' ]; /** @@ -86,6 +89,7 @@ class Check implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => null, 'tags' => null, 'redirect_uri' => null, + 'privacy_notices_read_consent_given' => null, 'id' => 'uuid', 'created_at' => 'date-time', 'href' => null, @@ -94,7 +98,9 @@ class Check implements ModelInterface, ArrayAccess, \JsonSerializable 'form_uri' => null, 'results_uri' => null, 'report_ids' => 'uuid', - 'sandbox' => null + 'sandbox' => null, + 'paused' => null, + 'version' => null ]; /** @@ -108,6 +114,7 @@ class Check implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => false, 'tags' => false, 'redirect_uri' => false, + 'privacy_notices_read_consent_given' => false, 'id' => false, 'created_at' => false, 'href' => false, @@ -116,7 +123,9 @@ class Check implements ModelInterface, ArrayAccess, \JsonSerializable 'form_uri' => false, 'results_uri' => false, 'report_ids' => false, - 'sandbox' => false + 'sandbox' => false, + 'paused' => false, + 'version' => false ]; /** @@ -210,6 +219,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'applicant_provides_data', 'tags' => 'tags', 'redirect_uri' => 'redirect_uri', + 'privacy_notices_read_consent_given' => 'privacy_notices_read_consent_given', 'id' => 'id', 'created_at' => 'created_at', 'href' => 'href', @@ -218,7 +228,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'form_uri', 'results_uri' => 'results_uri', 'report_ids' => 'report_ids', - 'sandbox' => 'sandbox' + 'sandbox' => 'sandbox', + 'paused' => 'paused', + 'version' => 'version' ]; /** @@ -232,6 +244,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'setApplicantProvidesData', 'tags' => 'setTags', 'redirect_uri' => 'setRedirectUri', + 'privacy_notices_read_consent_given' => 'setPrivacyNoticesReadConsentGiven', 'id' => 'setId', 'created_at' => 'setCreatedAt', 'href' => 'setHref', @@ -240,7 +253,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'setFormUri', 'results_uri' => 'setResultsUri', 'report_ids' => 'setReportIds', - 'sandbox' => 'setSandbox' + 'sandbox' => 'setSandbox', + 'paused' => 'setPaused', + 'version' => 'setVersion' ]; /** @@ -254,6 +269,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'getApplicantProvidesData', 'tags' => 'getTags', 'redirect_uri' => 'getRedirectUri', + 'privacy_notices_read_consent_given' => 'getPrivacyNoticesReadConsentGiven', 'id' => 'getId', 'created_at' => 'getCreatedAt', 'href' => 'getHref', @@ -262,7 +278,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'getFormUri', 'results_uri' => 'getResultsUri', 'report_ids' => 'getReportIds', - 'sandbox' => 'getSandbox' + 'sandbox' => 'getSandbox', + 'paused' => 'getPaused', + 'version' => 'getVersion' ]; /** @@ -306,35 +324,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_IN_PROGRESS = 'in_progress'; - public const STATUS_AWAITING_APPLICANT = 'awaiting_applicant'; - public const STATUS_COMPLETE = 'complete'; - public const STATUS_WITHDRAWN = 'withdrawn'; - public const STATUS_PAUSED = 'paused'; - public const STATUS_REOPENED = 'reopened'; - public const STATUS_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; public const RESULT_CLEAR = 'clear'; public const RESULT_CONSIDER = 'consider'; public const RESULT_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_IN_PROGRESS, - self::STATUS_AWAITING_APPLICANT, - self::STATUS_COMPLETE, - self::STATUS_WITHDRAWN, - self::STATUS_PAUSED, - self::STATUS_REOPENED, - self::STATUS_UNKNOWN_DEFAULT_OPEN_API, - ]; - } - /** * Gets allowable values of the enum * @@ -369,6 +362,7 @@ public function __construct(array $data = null) $this->setIfExists('applicant_provides_data', $data ?? [], null); $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('redirect_uri', $data ?? [], null); + $this->setIfExists('privacy_notices_read_consent_given', $data ?? [], null); $this->setIfExists('id', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('href', $data ?? [], null); @@ -378,6 +372,8 @@ public function __construct(array $data = null) $this->setIfExists('results_uri', $data ?? [], null); $this->setIfExists('report_ids', $data ?? [], null); $this->setIfExists('sandbox', $data ?? [], null); + $this->setIfExists('paused', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); } /** @@ -413,15 +409,6 @@ public function listInvalidProperties() if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - $allowedValues = $this->getResultAllowableValues(); if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -581,6 +568,33 @@ public function setRedirectUri($redirect_uri) return $this; } + /** + * Gets privacy_notices_read_consent_given + * + * @return bool|null + */ + public function getPrivacyNoticesReadConsentGiven() + { + return $this->container['privacy_notices_read_consent_given']; + } + + /** + * Sets privacy_notices_read_consent_given + * + * @param bool|null $privacy_notices_read_consent_given privacy_notices_read_consent_given + * + * @return self + */ + public function setPrivacyNoticesReadConsentGiven($privacy_notices_read_consent_given) + { + if (is_null($privacy_notices_read_consent_given)) { + throw new \InvalidArgumentException('non-nullable privacy_notices_read_consent_given cannot be null'); + } + $this->container['privacy_notices_read_consent_given'] = $privacy_notices_read_consent_given; + + return $this; + } + /** * Gets id * @@ -665,7 +679,7 @@ public function setHref($href) /** * Gets status * - * @return string|null + * @return \Onfido\Model\CheckStatus|null */ public function getStatus() { @@ -675,7 +689,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status The current state of the check in the checking process. + * @param \Onfido\Model\CheckStatus|null $status status * * @return self */ @@ -684,16 +698,6 @@ public function setStatus($status) if (is_null($status)) { throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } $this->container['status'] = $status; return $this; @@ -843,6 +847,60 @@ public function setSandbox($sandbox) return $this; } + + /** + * Gets paused + * + * @return bool|null + */ + public function getPaused() + { + return $this->container['paused']; + } + + /** + * Sets paused + * + * @param bool|null $paused paused + * + * @return self + */ + public function setPaused($paused) + { + if (is_null($paused)) { + throw new \InvalidArgumentException('non-nullable paused cannot be null'); + } + $this->container['paused'] = $paused; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return self + */ + public function setVersion($version) + { + if (is_null($version)) { + throw new \InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/Model/CheckBuilder.php b/lib/Model/CheckBuilder.php index c7cadd9..d5acae2 100644 --- a/lib/Model/CheckBuilder.php +++ b/lib/Model/CheckBuilder.php @@ -62,6 +62,7 @@ class CheckBuilder implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => 'bool', 'tags' => 'string[]', 'redirect_uri' => 'string', + 'privacy_notices_read_consent_given' => 'bool', 'report_names' => '\Onfido\Model\ReportName[]', 'document_ids' => 'string[]', 'asynchronous' => 'bool', @@ -84,6 +85,7 @@ class CheckBuilder implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => null, 'tags' => null, 'redirect_uri' => null, + 'privacy_notices_read_consent_given' => null, 'report_names' => null, 'document_ids' => 'uuid', 'asynchronous' => null, @@ -104,6 +106,7 @@ class CheckBuilder implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_provides_data' => false, 'tags' => false, 'redirect_uri' => false, + 'privacy_notices_read_consent_given' => false, 'report_names' => false, 'document_ids' => false, 'asynchronous' => false, @@ -204,6 +207,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'applicant_provides_data', 'tags' => 'tags', 'redirect_uri' => 'redirect_uri', + 'privacy_notices_read_consent_given' => 'privacy_notices_read_consent_given', 'report_names' => 'report_names', 'document_ids' => 'document_ids', 'asynchronous' => 'asynchronous', @@ -224,6 +228,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'setApplicantProvidesData', 'tags' => 'setTags', 'redirect_uri' => 'setRedirectUri', + 'privacy_notices_read_consent_given' => 'setPrivacyNoticesReadConsentGiven', 'report_names' => 'setReportNames', 'document_ids' => 'setDocumentIds', 'asynchronous' => 'setAsynchronous', @@ -244,6 +249,7 @@ public function isNullableSetToNull(string $property): bool 'applicant_provides_data' => 'getApplicantProvidesData', 'tags' => 'getTags', 'redirect_uri' => 'getRedirectUri', + 'privacy_notices_read_consent_given' => 'getPrivacyNoticesReadConsentGiven', 'report_names' => 'getReportNames', 'document_ids' => 'getDocumentIds', 'asynchronous' => 'getAsynchronous', @@ -315,6 +321,7 @@ public function __construct(array $data = null) $this->setIfExists('applicant_provides_data', $data ?? [], false); $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('redirect_uri', $data ?? [], null); + $this->setIfExists('privacy_notices_read_consent_given', $data ?? [], null); $this->setIfExists('report_names', $data ?? [], null); $this->setIfExists('document_ids', $data ?? [], null); $this->setIfExists('asynchronous', $data ?? [], true); @@ -507,6 +514,33 @@ public function setRedirectUri($redirect_uri) return $this; } + /** + * Gets privacy_notices_read_consent_given + * + * @return bool|null + */ + public function getPrivacyNoticesReadConsentGiven() + { + return $this->container['privacy_notices_read_consent_given']; + } + + /** + * Sets privacy_notices_read_consent_given + * + * @param bool|null $privacy_notices_read_consent_given privacy_notices_read_consent_given + * + * @return self + */ + public function setPrivacyNoticesReadConsentGiven($privacy_notices_read_consent_given) + { + if (is_null($privacy_notices_read_consent_given)) { + throw new \InvalidArgumentException('non-nullable privacy_notices_read_consent_given cannot be null'); + } + $this->container['privacy_notices_read_consent_given'] = $privacy_notices_read_consent_given; + + return $this; + } + /** * Gets report_names * diff --git a/lib/Model/CheckResponse.php b/lib/Model/CheckResponse.php index 709c470..684f11c 100644 --- a/lib/Model/CheckResponse.php +++ b/lib/Model/CheckResponse.php @@ -60,12 +60,14 @@ class CheckResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'id' => 'string', 'created_at' => '\DateTime', 'href' => 'string', - 'status' => 'string', + 'status' => '\Onfido\Model\CheckStatus', 'result' => 'string', 'form_uri' => 'string', 'results_uri' => 'string', 'report_ids' => 'string[]', - 'sandbox' => 'bool' + 'sandbox' => 'bool', + 'paused' => 'bool', + 'version' => 'string' ]; /** @@ -84,7 +86,9 @@ class CheckResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'form_uri' => null, 'results_uri' => null, 'report_ids' => 'uuid', - 'sandbox' => null + 'sandbox' => null, + 'paused' => null, + 'version' => null ]; /** @@ -101,7 +105,9 @@ class CheckResponse implements ModelInterface, ArrayAccess, \JsonSerializable 'form_uri' => false, 'results_uri' => false, 'report_ids' => false, - 'sandbox' => false + 'sandbox' => false, + 'paused' => false, + 'version' => false ]; /** @@ -198,7 +204,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'form_uri', 'results_uri' => 'results_uri', 'report_ids' => 'report_ids', - 'sandbox' => 'sandbox' + 'sandbox' => 'sandbox', + 'paused' => 'paused', + 'version' => 'version' ]; /** @@ -215,7 +223,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'setFormUri', 'results_uri' => 'setResultsUri', 'report_ids' => 'setReportIds', - 'sandbox' => 'setSandbox' + 'sandbox' => 'setSandbox', + 'paused' => 'setPaused', + 'version' => 'setVersion' ]; /** @@ -232,7 +242,9 @@ public function isNullableSetToNull(string $property): bool 'form_uri' => 'getFormUri', 'results_uri' => 'getResultsUri', 'report_ids' => 'getReportIds', - 'sandbox' => 'getSandbox' + 'sandbox' => 'getSandbox', + 'paused' => 'getPaused', + 'version' => 'getVersion' ]; /** @@ -276,35 +288,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_IN_PROGRESS = 'in_progress'; - public const STATUS_AWAITING_APPLICANT = 'awaiting_applicant'; - public const STATUS_COMPLETE = 'complete'; - public const STATUS_WITHDRAWN = 'withdrawn'; - public const STATUS_PAUSED = 'paused'; - public const STATUS_REOPENED = 'reopened'; - public const STATUS_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; public const RESULT_CLEAR = 'clear'; public const RESULT_CONSIDER = 'consider'; public const RESULT_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_IN_PROGRESS, - self::STATUS_AWAITING_APPLICANT, - self::STATUS_COMPLETE, - self::STATUS_WITHDRAWN, - self::STATUS_PAUSED, - self::STATUS_REOPENED, - self::STATUS_UNKNOWN_DEFAULT_OPEN_API, - ]; - } - /** * Gets allowable values of the enum * @@ -343,6 +330,8 @@ public function __construct(array $data = null) $this->setIfExists('results_uri', $data ?? [], null); $this->setIfExists('report_ids', $data ?? [], null); $this->setIfExists('sandbox', $data ?? [], null); + $this->setIfExists('paused', $data ?? [], null); + $this->setIfExists('version', $data ?? [], null); } /** @@ -375,15 +364,6 @@ public function listInvalidProperties() if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - $allowedValues = $this->getResultAllowableValues(); if (!is_null($this->container['result']) && !in_array($this->container['result'], $allowedValues, true)) { $invalidProperties[] = sprintf( @@ -492,7 +472,7 @@ public function setHref($href) /** * Gets status * - * @return string|null + * @return \Onfido\Model\CheckStatus|null */ public function getStatus() { @@ -502,7 +482,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status The current state of the check in the checking process. + * @param \Onfido\Model\CheckStatus|null $status status * * @return self */ @@ -511,16 +491,6 @@ public function setStatus($status) if (is_null($status)) { throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } $this->container['status'] = $status; return $this; @@ -670,6 +640,60 @@ public function setSandbox($sandbox) return $this; } + + /** + * Gets paused + * + * @return bool|null + */ + public function getPaused() + { + return $this->container['paused']; + } + + /** + * Sets paused + * + * @param bool|null $paused paused + * + * @return self + */ + public function setPaused($paused) + { + if (is_null($paused)) { + throw new \InvalidArgumentException('non-nullable paused cannot be null'); + } + $this->container['paused'] = $paused; + + return $this; + } + + /** + * Gets version + * + * @return string|null + */ + public function getVersion() + { + return $this->container['version']; + } + + /** + * Sets version + * + * @param string|null $version version + * + * @return self + */ + public function setVersion($version) + { + if (is_null($version)) { + throw new \InvalidArgumentException('non-nullable version cannot be null'); + } + $this->container['version'] = $version; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/Model/CheckShared.php b/lib/Model/CheckShared.php index f9a7ab6..69ec3f5 100644 --- a/lib/Model/CheckShared.php +++ b/lib/Model/CheckShared.php @@ -61,7 +61,8 @@ class CheckShared implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_id' => 'string', 'applicant_provides_data' => 'bool', 'tags' => 'string[]', - 'redirect_uri' => 'string' + 'redirect_uri' => 'string', + 'privacy_notices_read_consent_given' => 'bool' ]; /** @@ -76,7 +77,8 @@ class CheckShared implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_id' => 'uuid', 'applicant_provides_data' => null, 'tags' => null, - 'redirect_uri' => null + 'redirect_uri' => null, + 'privacy_notices_read_consent_given' => null ]; /** @@ -89,7 +91,8 @@ class CheckShared implements ModelInterface, ArrayAccess, \JsonSerializable 'applicant_id' => false, 'applicant_provides_data' => false, 'tags' => false, - 'redirect_uri' => false + 'redirect_uri' => false, + 'privacy_notices_read_consent_given' => false ]; /** @@ -182,7 +185,8 @@ public function isNullableSetToNull(string $property): bool 'applicant_id' => 'applicant_id', 'applicant_provides_data' => 'applicant_provides_data', 'tags' => 'tags', - 'redirect_uri' => 'redirect_uri' + 'redirect_uri' => 'redirect_uri', + 'privacy_notices_read_consent_given' => 'privacy_notices_read_consent_given' ]; /** @@ -195,7 +199,8 @@ public function isNullableSetToNull(string $property): bool 'applicant_id' => 'setApplicantId', 'applicant_provides_data' => 'setApplicantProvidesData', 'tags' => 'setTags', - 'redirect_uri' => 'setRedirectUri' + 'redirect_uri' => 'setRedirectUri', + 'privacy_notices_read_consent_given' => 'setPrivacyNoticesReadConsentGiven' ]; /** @@ -208,7 +213,8 @@ public function isNullableSetToNull(string $property): bool 'applicant_id' => 'getApplicantId', 'applicant_provides_data' => 'getApplicantProvidesData', 'tags' => 'getTags', - 'redirect_uri' => 'getRedirectUri' + 'redirect_uri' => 'getRedirectUri', + 'privacy_notices_read_consent_given' => 'getPrivacyNoticesReadConsentGiven' ]; /** @@ -273,6 +279,7 @@ public function __construct(array $data = null) $this->setIfExists('applicant_provides_data', $data ?? [], null); $this->setIfExists('tags', $data ?? [], null); $this->setIfExists('redirect_uri', $data ?? [], null); + $this->setIfExists('privacy_notices_read_consent_given', $data ?? [], null); } /** @@ -454,6 +461,33 @@ public function setRedirectUri($redirect_uri) return $this; } + + /** + * Gets privacy_notices_read_consent_given + * + * @return bool|null + */ + public function getPrivacyNoticesReadConsentGiven() + { + return $this->container['privacy_notices_read_consent_given']; + } + + /** + * Sets privacy_notices_read_consent_given + * + * @param bool|null $privacy_notices_read_consent_given privacy_notices_read_consent_given + * + * @return self + */ + public function setPrivacyNoticesReadConsentGiven($privacy_notices_read_consent_given) + { + if (is_null($privacy_notices_read_consent_given)) { + throw new \InvalidArgumentException('non-nullable privacy_notices_read_consent_given cannot be null'); + } + $this->container['privacy_notices_read_consent_given'] = $privacy_notices_read_consent_given; + + return $this; + } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/Model/CheckStatus.php b/lib/Model/CheckStatus.php new file mode 100644 index 0000000..e81e158 --- /dev/null +++ b/lib/Model/CheckStatus.php @@ -0,0 +1,78 @@ + - */ -class ConsentsBuilder implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'consents_builder'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } - -} - - diff --git a/lib/Model/DeviceIntelligenceBreakdownPropertiesDevice.php b/lib/Model/DeviceIntelligenceBreakdownPropertiesDevice.php index a01b43f..4a6bc57 100644 --- a/lib/Model/DeviceIntelligenceBreakdownPropertiesDevice.php +++ b/lib/Model/DeviceIntelligenceBreakdownPropertiesDevice.php @@ -66,10 +66,6 @@ class DeviceIntelligenceBreakdownPropertiesDevice implements ModelInterface, Arr 'emulator' => 'bool', 'randomized_device' => 'bool', 'fake_network_request' => 'bool', - 'true_os' => 'string', - 'os_anomaly' => 'string', - 'rooted' => 'bool', - 'remote_software' => 'bool', 'ip_reputation' => 'string', 'device_fingerprint_reuse' => 'int', 'single_device_used' => 'bool', @@ -94,10 +90,6 @@ class DeviceIntelligenceBreakdownPropertiesDevice implements ModelInterface, Arr 'emulator' => null, 'randomized_device' => null, 'fake_network_request' => null, - 'true_os' => null, - 'os_anomaly' => null, - 'rooted' => null, - 'remote_software' => null, 'ip_reputation' => null, 'device_fingerprint_reuse' => null, 'single_device_used' => null, @@ -120,10 +112,6 @@ class DeviceIntelligenceBreakdownPropertiesDevice implements ModelInterface, Arr 'emulator' => false, 'randomized_device' => false, 'fake_network_request' => false, - 'true_os' => false, - 'os_anomaly' => false, - 'rooted' => false, - 'remote_software' => false, 'ip_reputation' => false, 'device_fingerprint_reuse' => false, 'single_device_used' => true, @@ -226,10 +214,6 @@ public function isNullableSetToNull(string $property): bool 'emulator' => 'emulator', 'randomized_device' => 'randomized_device', 'fake_network_request' => 'fake_network_request', - 'true_os' => 'true_os', - 'os_anomaly' => 'os_anomaly', - 'rooted' => 'rooted', - 'remote_software' => 'remote_software', 'ip_reputation' => 'ip_reputation', 'device_fingerprint_reuse' => 'device_fingerprint_reuse', 'single_device_used' => 'single_device_used', @@ -252,10 +236,6 @@ public function isNullableSetToNull(string $property): bool 'emulator' => 'setEmulator', 'randomized_device' => 'setRandomizedDevice', 'fake_network_request' => 'setFakeNetworkRequest', - 'true_os' => 'setTrueOs', - 'os_anomaly' => 'setOsAnomaly', - 'rooted' => 'setRooted', - 'remote_software' => 'setRemoteSoftware', 'ip_reputation' => 'setIpReputation', 'device_fingerprint_reuse' => 'setDeviceFingerprintReuse', 'single_device_used' => 'setSingleDeviceUsed', @@ -278,10 +258,6 @@ public function isNullableSetToNull(string $property): bool 'emulator' => 'getEmulator', 'randomized_device' => 'getRandomizedDevice', 'fake_network_request' => 'getFakeNetworkRequest', - 'true_os' => 'getTrueOs', - 'os_anomaly' => 'getOsAnomaly', - 'rooted' => 'getRooted', - 'remote_software' => 'getRemoteSoftware', 'ip_reputation' => 'getIpReputation', 'device_fingerprint_reuse' => 'getDeviceFingerprintReuse', 'single_device_used' => 'getSingleDeviceUsed', @@ -446,10 +422,6 @@ public function __construct(array $data = null) $this->setIfExists('emulator', $data ?? [], null); $this->setIfExists('randomized_device', $data ?? [], null); $this->setIfExists('fake_network_request', $data ?? [], null); - $this->setIfExists('true_os', $data ?? [], null); - $this->setIfExists('os_anomaly', $data ?? [], null); - $this->setIfExists('rooted', $data ?? [], null); - $this->setIfExists('remote_software', $data ?? [], null); $this->setIfExists('ip_reputation', $data ?? [], null); $this->setIfExists('device_fingerprint_reuse', $data ?? [], null); $this->setIfExists('single_device_used', $data ?? [], null); @@ -807,122 +779,6 @@ public function setFakeNetworkRequest($fake_network_request) return $this; } - /** - * Gets true_os - * - * @return string|null - * @deprecated - */ - public function getTrueOs() - { - return $this->container['true_os']; - } - - /** - * Sets true_os - * - * @param string|null $true_os The true operating system of the device. - * - * @return self - * @deprecated - */ - public function setTrueOs($true_os) - { - if (is_null($true_os)) { - throw new \InvalidArgumentException('non-nullable true_os cannot be null'); - } - $this->container['true_os'] = $true_os; - - return $this; - } - - /** - * Gets os_anomaly - * - * @return string|null - * @deprecated - */ - public function getOsAnomaly() - { - return $this->container['os_anomaly']; - } - - /** - * Sets os_anomaly - * - * @param string|null $os_anomaly The likelihood of an operating system anomaly between the true OS and the OS sent by the device. - * - * @return self - * @deprecated - */ - public function setOsAnomaly($os_anomaly) - { - if (is_null($os_anomaly)) { - throw new \InvalidArgumentException('non-nullable os_anomaly cannot be null'); - } - $this->container['os_anomaly'] = $os_anomaly; - - return $this; - } - - /** - * Gets rooted - * - * @return bool|null - * @deprecated - */ - public function getRooted() - { - return $this->container['rooted']; - } - - /** - * Sets rooted - * - * @param bool|null $rooted Whether the device is rooted. - * - * @return self - * @deprecated - */ - public function setRooted($rooted) - { - if (is_null($rooted)) { - throw new \InvalidArgumentException('non-nullable rooted cannot be null'); - } - $this->container['rooted'] = $rooted; - - return $this; - } - - /** - * Gets remote_software - * - * @return bool|null - * @deprecated - */ - public function getRemoteSoftware() - { - return $this->container['remote_software']; - } - - /** - * Sets remote_software - * - * @param bool|null $remote_software Whether the device is controlled via remote software. - * - * @return self - * @deprecated - */ - public function setRemoteSoftware($remote_software) - { - if (is_null($remote_software)) { - throw new \InvalidArgumentException('non-nullable remote_software cannot be null'); - } - $this->container['remote_software'] = $remote_software; - - return $this; - } - /** * Gets ip_reputation * diff --git a/lib/Model/DeviceIntelligenceBreakdownPropertiesIp.php b/lib/Model/DeviceIntelligenceBreakdownPropertiesIp.php index 2cf0981..68023ee 100644 --- a/lib/Model/DeviceIntelligenceBreakdownPropertiesIp.php +++ b/lib/Model/DeviceIntelligenceBreakdownPropertiesIp.php @@ -57,10 +57,7 @@ class DeviceIntelligenceBreakdownPropertiesIp implements ModelInterface, ArrayAc * @var string[] */ protected static $openAPITypes = [ - 'address' => 'string', - 'vpn_detection' => 'string', - 'proxy_detection' => 'string', - 'type' => 'string' + 'address' => 'string' ]; /** @@ -71,10 +68,7 @@ class DeviceIntelligenceBreakdownPropertiesIp implements ModelInterface, ArrayAc * @psalm-var array */ protected static $openAPIFormats = [ - 'address' => null, - 'vpn_detection' => null, - 'proxy_detection' => null, - 'type' => null + 'address' => null ]; /** @@ -83,10 +77,7 @@ class DeviceIntelligenceBreakdownPropertiesIp implements ModelInterface, ArrayAc * @var boolean[] */ protected static array $openAPINullables = [ - 'address' => false, - 'vpn_detection' => false, - 'proxy_detection' => false, - 'type' => false + 'address' => false ]; /** @@ -175,10 +166,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'address' => 'address', - 'vpn_detection' => 'vpn_detection', - 'proxy_detection' => 'proxy_detection', - 'type' => 'type' + 'address' => 'address' ]; /** @@ -187,10 +175,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'address' => 'setAddress', - 'vpn_detection' => 'setVpnDetection', - 'proxy_detection' => 'setProxyDetection', - 'type' => 'setType' + 'address' => 'setAddress' ]; /** @@ -199,10 +184,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'address' => 'getAddress', - 'vpn_detection' => 'getVpnDetection', - 'proxy_detection' => 'getProxyDetection', - 'type' => 'getType' + 'address' => 'getAddress' ]; /** @@ -263,9 +245,6 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('address', $data ?? [], null); - $this->setIfExists('vpn_detection', $data ?? [], null); - $this->setIfExists('proxy_detection', $data ?? [], null); - $this->setIfExists('type', $data ?? [], null); } /** @@ -336,93 +315,6 @@ public function setAddress($address) return $this; } - - /** - * Gets vpn_detection - * - * @return string|null - * @deprecated - */ - public function getVpnDetection() - { - return $this->container['vpn_detection']; - } - - /** - * Sets vpn_detection - * - * @param string|null $vpn_detection The likelihood of the network connection being a VPN. - * - * @return self - * @deprecated - */ - public function setVpnDetection($vpn_detection) - { - if (is_null($vpn_detection)) { - throw new \InvalidArgumentException('non-nullable vpn_detection cannot be null'); - } - $this->container['vpn_detection'] = $vpn_detection; - - return $this; - } - - /** - * Gets proxy_detection - * - * @return string|null - * @deprecated - */ - public function getProxyDetection() - { - return $this->container['proxy_detection']; - } - - /** - * Sets proxy_detection - * - * @param string|null $proxy_detection The likelihood of the network connection being a Proxy. - * - * @return self - * @deprecated - */ - public function setProxyDetection($proxy_detection) - { - if (is_null($proxy_detection)) { - throw new \InvalidArgumentException('non-nullable proxy_detection cannot be null'); - } - $this->container['proxy_detection'] = $proxy_detection; - - return $this; - } - - /** - * Gets type - * - * @return string|null - * @deprecated - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string|null $type The type of organization that owns this IP address. - * - * @return self - * @deprecated - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } /** * Returns true if offset exists. False otherwise. * diff --git a/lib/Model/Document.php b/lib/Model/Document.php index 249ebbf..bf7457d 100644 --- a/lib/Model/Document.php +++ b/lib/Model/Document.php @@ -58,7 +58,7 @@ class Document implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'file_type' => 'string', - 'type' => 'string', + 'type' => '\Onfido\Model\DocumentTypes', 'side' => 'string', 'issuing_country' => '\Onfido\Model\CountryCodes', 'applicant_id' => 'string', @@ -458,7 +458,7 @@ public function setFileType($file_type) /** * Gets type * - * @return string|null + * @return \Onfido\Model\DocumentTypes|null */ public function getType() { @@ -468,7 +468,7 @@ public function getType() /** * Sets type * - * @param string|null $type The type of document + * @param \Onfido\Model\DocumentTypes|null $type The type of document * * @return self */ diff --git a/lib/Model/DocumentShared.php b/lib/Model/DocumentShared.php index dacaba7..e086c18 100644 --- a/lib/Model/DocumentShared.php +++ b/lib/Model/DocumentShared.php @@ -58,7 +58,7 @@ class DocumentShared implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'file_type' => 'string', - 'type' => 'string', + 'type' => '\Onfido\Model\DocumentTypes', 'side' => 'string', 'issuing_country' => '\Onfido\Model\CountryCodes', 'applicant_id' => 'string' @@ -413,7 +413,7 @@ public function setFileType($file_type) /** * Gets type * - * @return string|null + * @return \Onfido\Model\DocumentTypes|null */ public function getType() { @@ -423,7 +423,7 @@ public function getType() /** * Sets type * - * @param string|null $type The type of document + * @param \Onfido\Model\DocumentTypes|null $type The type of document * * @return self */ diff --git a/lib/Model/DocumentTypes.php b/lib/Model/DocumentTypes.php index 189b0fb..238cb0f 100644 --- a/lib/Model/DocumentTypes.php +++ b/lib/Model/DocumentTypes.php @@ -92,6 +92,16 @@ class DocumentTypes public const INTERNATIONAL_DRIVING_LICENCE = 'international_driving_licence'; + public const HOME_OFFICE_LETTER = 'home_office_letter'; + + public const BIRTH_CERTIFICATE = 'birth_certificate'; + + public const VEHICLE_REGISTRATION_CERTIFICATE = 'vehicle_registration_certificate'; + + public const FORM_FOR_AFFIXING_THE_VISA = 'form_for_affixing_the_visa'; + + public const IDENTIFICATION_NUMBER_DOCUMENT = 'identification_number_document'; + public const UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; /** @@ -126,6 +136,11 @@ public static function getAllowableEnumValues() self::PROFESSIONAL_QUALIFICATION_CARD, self::CONSULAR_ID, self::INTERNATIONAL_DRIVING_LICENCE, + self::HOME_OFFICE_LETTER, + self::BIRTH_CERTIFICATE, + self::VEHICLE_REGISTRATION_CERTIFICATE, + self::FORM_FOR_AFFIXING_THE_VISA, + self::IDENTIFICATION_NUMBER_DOCUMENT, self::UNKNOWN_DEFAULT_OPEN_API ]; } diff --git a/lib/Model/TaskItem.php b/lib/Model/TaskItem.php index 19931d5..00b9594 100644 --- a/lib/Model/TaskItem.php +++ b/lib/Model/TaskItem.php @@ -58,7 +58,9 @@ class TaskItem implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'id' => 'string', + 'workflow_run_id' => 'string', 'task_def_id' => 'string', + 'task_def_version' => 'string', 'created_at' => '\DateTime', 'updated_at' => '\DateTime' ]; @@ -72,7 +74,9 @@ class TaskItem implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPIFormats = [ 'id' => null, + 'workflow_run_id' => 'uuid', 'task_def_id' => null, + 'task_def_version' => null, 'created_at' => 'date-time', 'updated_at' => 'date-time' ]; @@ -84,7 +88,9 @@ class TaskItem implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static array $openAPINullables = [ 'id' => false, + 'workflow_run_id' => false, 'task_def_id' => false, + 'task_def_version' => true, 'created_at' => false, 'updated_at' => false ]; @@ -176,7 +182,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $attributeMap = [ 'id' => 'id', + 'workflow_run_id' => 'workflow_run_id', 'task_def_id' => 'task_def_id', + 'task_def_version' => 'task_def_version', 'created_at' => 'created_at', 'updated_at' => 'updated_at' ]; @@ -188,7 +196,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $setters = [ 'id' => 'setId', + 'workflow_run_id' => 'setWorkflowRunId', 'task_def_id' => 'setTaskDefId', + 'task_def_version' => 'setTaskDefVersion', 'created_at' => 'setCreatedAt', 'updated_at' => 'setUpdatedAt' ]; @@ -200,7 +210,9 @@ public function isNullableSetToNull(string $property): bool */ protected static $getters = [ 'id' => 'getId', + 'workflow_run_id' => 'getWorkflowRunId', 'task_def_id' => 'getTaskDefId', + 'task_def_version' => 'getTaskDefVersion', 'created_at' => 'getCreatedAt', 'updated_at' => 'getUpdatedAt' ]; @@ -263,7 +275,9 @@ public function getModelName() public function __construct(array $data = null) { $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('workflow_run_id', $data ?? [], null); $this->setIfExists('task_def_id', $data ?? [], null); + $this->setIfExists('task_def_version', $data ?? [], null); $this->setIfExists('created_at', $data ?? [], null); $this->setIfExists('updated_at', $data ?? [], null); } @@ -350,6 +364,33 @@ public function setId($id) return $this; } + /** + * Gets workflow_run_id + * + * @return string|null + */ + public function getWorkflowRunId() + { + return $this->container['workflow_run_id']; + } + + /** + * Sets workflow_run_id + * + * @param string|null $workflow_run_id The workflow run id the task belongs to. + * + * @return self + */ + public function setWorkflowRunId($workflow_run_id) + { + if (is_null($workflow_run_id)) { + throw new \InvalidArgumentException('non-nullable workflow_run_id cannot be null'); + } + $this->container['workflow_run_id'] = $workflow_run_id; + + return $this; + } + /** * Gets task_def_id * @@ -382,6 +423,40 @@ public function setTaskDefId($task_def_id) return $this; } + /** + * Gets task_def_version + * + * @return string|null + */ + public function getTaskDefVersion() + { + return $this->container['task_def_version']; + } + + /** + * Sets task_def_version + * + * @param string|null $task_def_version The task definition version. + * + * @return self + */ + public function setTaskDefVersion($task_def_version) + { + if (is_null($task_def_version)) { + array_push($this->openAPINullablesSetToNull, 'task_def_version'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('task_def_version', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['task_def_version'] = $task_def_version; + + return $this; + } + /** * Gets created_at * diff --git a/lib/Model/WatchlistAmlProperties.php b/lib/Model/WatchlistAmlProperties.php index 5cbc1fd..b34a02b 100644 --- a/lib/Model/WatchlistAmlProperties.php +++ b/lib/Model/WatchlistAmlProperties.php @@ -293,6 +293,7 @@ public function valid() * Gets records * * @return string[]|null + * @deprecated */ public function getRecords() { @@ -305,6 +306,7 @@ public function getRecords() * @param string[]|null $records Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources. * * @return self + * @deprecated */ public function setRecords($records) { diff --git a/lib/Model/WatchlistStandardProperties.php b/lib/Model/WatchlistStandardProperties.php index 38054c0..d93ccff 100644 --- a/lib/Model/WatchlistStandardProperties.php +++ b/lib/Model/WatchlistStandardProperties.php @@ -293,6 +293,7 @@ public function valid() * Gets records * * @return string[]|null + * @deprecated */ public function getRecords() { @@ -305,6 +306,7 @@ public function getRecords() * @param string[]|null $records Returns any matches including, but not limited to, name and date of birth of match, aliases and associates, and relevant events and sources. * * @return self + * @deprecated */ public function setRecords($records) { diff --git a/lib/Model/WebhookEventObjectStatus.php b/lib/Model/WebhookEventObjectStatus.php new file mode 100644 index 0000000..528a241 --- /dev/null +++ b/lib/Model/WebhookEventObjectStatus.php @@ -0,0 +1,117 @@ + 'string', + 'resource_type' => '\Onfido\Model\WebhookEventResourceType', 'action' => '\Onfido\Model\WebhookEventType', 'object' => '\Onfido\Model\WebhookEventPayloadObject', - 'resource' => 'object' + 'resource' => '\Onfido\Model\WebhookEventPayloadResource' ]; /** @@ -316,7 +316,7 @@ public function valid() /** * Gets resource_type * - * @return string + * @return \Onfido\Model\WebhookEventResourceType */ public function getResourceType() { @@ -326,7 +326,7 @@ public function getResourceType() /** * Sets resource_type * - * @param string $resource_type Indicates the resource affected by this event. + * @param \Onfido\Model\WebhookEventResourceType $resource_type Indicates the resource affected by this event. * * @return self */ @@ -397,7 +397,7 @@ public function setObject($object) /** * Gets resource * - * @return object|null + * @return \Onfido\Model\WebhookEventPayloadResource|null */ public function getResource() { @@ -407,7 +407,7 @@ public function getResource() /** * Sets resource * - * @param object|null $resource The resource affected by this event. + * @param \Onfido\Model\WebhookEventPayloadResource|null $resource resource * * @return self */ diff --git a/lib/Model/WebhookEventPayloadObject.php b/lib/Model/WebhookEventPayloadObject.php index 86eff6f..4e4f3ce 100644 --- a/lib/Model/WebhookEventPayloadObject.php +++ b/lib/Model/WebhookEventPayloadObject.php @@ -59,7 +59,7 @@ class WebhookEventPayloadObject implements ModelInterface, ArrayAccess, \JsonSer */ protected static $openAPITypes = [ 'id' => 'string', - 'status' => 'string', + 'status' => '\Onfido\Model\WebhookEventObjectStatus', 'started_at_iso8601' => '\DateTime', 'completed_at_iso8601' => '\DateTime', 'href' => 'string' @@ -354,7 +354,7 @@ public function setId($id) /** * Gets status * - * @return string|null + * @return \Onfido\Model\WebhookEventObjectStatus|null */ public function getStatus() { @@ -364,7 +364,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status The current state of the object, if available. + * @param \Onfido\Model\WebhookEventObjectStatus|null $status status * * @return self */ diff --git a/lib/Model/WebhookEventPayloadResource.php b/lib/Model/WebhookEventPayloadResource.php new file mode 100644 index 0000000..2f7cb7d --- /dev/null +++ b/lib/Model/WebhookEventPayloadResource.php @@ -0,0 +1,910 @@ + + */ +class WebhookEventPayloadResource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'webhook_event_payload_resource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'applicant_id' => 'string', + 'created_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'dashboard_url' => 'string', + 'workflow_id' => 'string', + 'workflow_run_id' => 'string', + 'workflow_version_id' => 'int', + 'task_def_id' => 'string', + 'task_def_version' => 'string', + 'input' => 'object', + 'output' => 'object', + 'reasons' => 'string[]', + 'link' => '\Onfido\Model\WorkflowRunLink', + 'error' => '\Onfido\Model\WorkflowRunError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'applicant_id' => 'uuid', + 'created_at' => 'date-time', + 'updated_at' => 'date-time', + 'dashboard_url' => null, + 'workflow_id' => 'uuid', + 'workflow_run_id' => 'uuid', + 'workflow_version_id' => null, + 'task_def_id' => null, + 'task_def_version' => null, + 'input' => null, + 'output' => null, + 'reasons' => null, + 'link' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'applicant_id' => false, + 'created_at' => false, + 'updated_at' => false, + 'dashboard_url' => false, + 'workflow_id' => false, + 'workflow_run_id' => false, + 'workflow_version_id' => false, + 'task_def_id' => false, + 'task_def_version' => true, + 'input' => false, + 'output' => true, + 'reasons' => false, + 'link' => false, + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'applicant_id' => 'applicant_id', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at', + 'dashboard_url' => 'dashboard_url', + 'workflow_id' => 'workflow_id', + 'workflow_run_id' => 'workflow_run_id', + 'workflow_version_id' => 'workflow_version_id', + 'task_def_id' => 'task_def_id', + 'task_def_version' => 'task_def_version', + 'input' => 'input', + 'output' => 'output', + 'reasons' => 'reasons', + 'link' => 'link', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'applicant_id' => 'setApplicantId', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'dashboard_url' => 'setDashboardUrl', + 'workflow_id' => 'setWorkflowId', + 'workflow_run_id' => 'setWorkflowRunId', + 'workflow_version_id' => 'setWorkflowVersionId', + 'task_def_id' => 'setTaskDefId', + 'task_def_version' => 'setTaskDefVersion', + 'input' => 'setInput', + 'output' => 'setOutput', + 'reasons' => 'setReasons', + 'link' => 'setLink', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'applicant_id' => 'getApplicantId', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'dashboard_url' => 'getDashboardUrl', + 'workflow_id' => 'getWorkflowId', + 'workflow_run_id' => 'getWorkflowRunId', + 'workflow_version_id' => 'getWorkflowVersionId', + 'task_def_id' => 'getTaskDefId', + 'task_def_version' => 'getTaskDefVersion', + 'input' => 'getInput', + 'output' => 'getOutput', + 'reasons' => 'getReasons', + 'link' => 'getLink', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('applicant_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('dashboard_url', $data ?? [], null); + $this->setIfExists('workflow_id', $data ?? [], null); + $this->setIfExists('workflow_run_id', $data ?? [], null); + $this->setIfExists('workflow_version_id', $data ?? [], null); + $this->setIfExists('task_def_id', $data ?? [], null); + $this->setIfExists('task_def_version', $data ?? [], null); + $this->setIfExists('input', $data ?? [], null); + $this->setIfExists('output', $data ?? [], null); + $this->setIfExists('reasons', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['task_def_id']) && !preg_match("/^[0-9a-z_-]+$/", $this->container['task_def_id'])) { + $invalidProperties[] = "invalid value for 'task_def_id', must be conform to the pattern /^[0-9a-z_-]+$/."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The identifier of the resource. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets applicant_id + * + * @return string|null + */ + public function getApplicantId() + { + return $this->container['applicant_id']; + } + + /** + * Sets applicant_id + * + * @param string|null $applicant_id The unique identifier for the Applicant. + * + * @return self + */ + public function setApplicantId($applicant_id) + { + if (is_null($applicant_id)) { + throw new \InvalidArgumentException('non-nullable applicant_id cannot be null'); + } + $this->container['applicant_id'] = $applicant_id; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at The date and time when the resource was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at The date and time when the resource was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets dashboard_url + * + * @return string|null + */ + public function getDashboardUrl() + { + return $this->container['dashboard_url']; + } + + /** + * Sets dashboard_url + * + * @param string|null $dashboard_url The URL for viewing the resource on Onfido Dashboard. + * + * @return self + */ + public function setDashboardUrl($dashboard_url) + { + if (is_null($dashboard_url)) { + throw new \InvalidArgumentException('non-nullable dashboard_url cannot be null'); + } + $this->container['dashboard_url'] = $dashboard_url; + + return $this; + } + + /** + * Gets workflow_id + * + * @return string|null + */ + public function getWorkflowId() + { + return $this->container['workflow_id']; + } + + /** + * Sets workflow_id + * + * @param string|null $workflow_id The unique identifier for the Workflow. + * + * @return self + */ + public function setWorkflowId($workflow_id) + { + if (is_null($workflow_id)) { + throw new \InvalidArgumentException('non-nullable workflow_id cannot be null'); + } + $this->container['workflow_id'] = $workflow_id; + + return $this; + } + + /** + * Gets workflow_run_id + * + * @return string|null + */ + public function getWorkflowRunId() + { + return $this->container['workflow_run_id']; + } + + /** + * Sets workflow_run_id + * + * @param string|null $workflow_run_id workflow_run_id + * + * @return self + */ + public function setWorkflowRunId($workflow_run_id) + { + if (is_null($workflow_run_id)) { + throw new \InvalidArgumentException('non-nullable workflow_run_id cannot be null'); + } + $this->container['workflow_run_id'] = $workflow_run_id; + + return $this; + } + + /** + * Gets workflow_version_id + * + * @return int|null + */ + public function getWorkflowVersionId() + { + return $this->container['workflow_version_id']; + } + + /** + * Sets workflow_version_id + * + * @param int|null $workflow_version_id The identifier for the Workflow version. + * + * @return self + */ + public function setWorkflowVersionId($workflow_version_id) + { + if (is_null($workflow_version_id)) { + throw new \InvalidArgumentException('non-nullable workflow_version_id cannot be null'); + } + $this->container['workflow_version_id'] = $workflow_version_id; + + return $this; + } + + /** + * Gets task_def_id + * + * @return string|null + */ + public function getTaskDefId() + { + return $this->container['task_def_id']; + } + + /** + * Sets task_def_id + * + * @param string|null $task_def_id The identifier for the Task Definition. + * + * @return self + */ + public function setTaskDefId($task_def_id) + { + if (is_null($task_def_id)) { + throw new \InvalidArgumentException('non-nullable task_def_id cannot be null'); + } + + if ((!preg_match("/^[0-9a-z_-]+$/", ObjectSerializer::toString($task_def_id)))) { + throw new \InvalidArgumentException("invalid value for \$task_def_id when calling WebhookEventPayloadResource., must conform to the pattern /^[0-9a-z_-]+$/."); + } + + $this->container['task_def_id'] = $task_def_id; + + return $this; + } + + /** + * Gets task_def_version + * + * @return string|null + */ + public function getTaskDefVersion() + { + return $this->container['task_def_version']; + } + + /** + * Sets task_def_version + * + * @param string|null $task_def_version The task definition version. + * + * @return self + */ + public function setTaskDefVersion($task_def_version) + { + if (is_null($task_def_version)) { + array_push($this->openAPINullablesSetToNull, 'task_def_version'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('task_def_version', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['task_def_version'] = $task_def_version; + + return $this; + } + + /** + * Gets input + * + * @return object|null + */ + public function getInput() + { + return $this->container['input']; + } + + /** + * Sets input + * + * @param object|null $input Input object with the fields used by the Task execution. + * + * @return self + */ + public function setInput($input) + { + if (is_null($input)) { + throw new \InvalidArgumentException('non-nullable input cannot be null'); + } + $this->container['input'] = $input; + + return $this; + } + + /** + * Gets output + * + * @return object|null + */ + public function getOutput() + { + return $this->container['output']; + } + + /** + * Sets output + * + * @param object|null $output Output object with the fields produced by the Task execution. + * + * @return self + */ + public function setOutput($output) + { + if (is_null($output)) { + array_push($this->openAPINullablesSetToNull, 'output'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('output', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['output'] = $output; + + return $this; + } + + /** + * Gets reasons + * + * @return string[]|null + */ + public function getReasons() + { + return $this->container['reasons']; + } + + /** + * Sets reasons + * + * @param string[]|null $reasons The reasons the Workflow Run outcome was reached. Configurable when creating the Workflow Version. + * + * @return self + */ + public function setReasons($reasons) + { + if (is_null($reasons)) { + throw new \InvalidArgumentException('non-nullable reasons cannot be null'); + } + $this->container['reasons'] = $reasons; + + return $this; + } + + /** + * Gets link + * + * @return \Onfido\Model\WorkflowRunLink|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param \Onfido\Model\WorkflowRunLink|null $link Object for the configuration of the Workflow Run link. + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + return $this; + } + + /** + * Gets error + * + * @return \Onfido\Model\WorkflowRunError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Onfido\Model\WorkflowRunError|null $error Error object that details why a Workflow Run is in Error status. + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } + +} + + diff --git a/lib/Model/WebhookEventResourceType.php b/lib/Model/WebhookEventResourceType.php new file mode 100644 index 0000000..b930f92 --- /dev/null +++ b/lib/Model/WebhookEventResourceType.php @@ -0,0 +1,77 @@ + 'string', 'tags' => 'string[]', 'customer_user_id' => 'string', - 'link' => '\Onfido\Model\WorkflowRunSharedLink', + 'link' => '\Onfido\Model\WorkflowRunLink', 'created_at' => '\DateTime', 'updated_at' => '\DateTime', 'id' => 'string', 'workflow_version_id' => 'int', 'dashboard_url' => 'string', - 'status' => 'string', + 'status' => '\Onfido\Model\WorkflowRunStatus', 'output' => 'object', 'reasons' => 'string[]', - 'error' => '\Onfido\Model\WorkflowRunResponseError', + 'error' => '\Onfido\Model\WorkflowRunError', 'sdk_token' => 'string' ]; @@ -312,33 +312,6 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_AWAITING_INPUT = 'awaiting_input'; - public const STATUS_PROCESSING = 'processing'; - public const STATUS_ABANDONED = 'abandoned'; - public const STATUS_ERROR = 'error'; - public const STATUS_APPROVED = 'approved'; - public const STATUS_REVIEW = 'review'; - public const STATUS_DECLINED = 'declined'; - public const STATUS_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_AWAITING_INPUT, - self::STATUS_PROCESSING, - self::STATUS_ABANDONED, - self::STATUS_ERROR, - self::STATUS_APPROVED, - self::STATUS_REVIEW, - self::STATUS_DECLINED, - self::STATUS_UNKNOWN_DEFAULT_OPEN_API, - ]; - } /** * Associative array for storing property values @@ -416,15 +389,6 @@ public function listInvalidProperties() if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - return $invalidProperties; } @@ -566,7 +530,7 @@ public function setCustomerUserId($customer_user_id) /** * Gets link * - * @return \Onfido\Model\WorkflowRunSharedLink|null + * @return \Onfido\Model\WorkflowRunLink|null */ public function getLink() { @@ -576,7 +540,7 @@ public function getLink() /** * Sets link * - * @param \Onfido\Model\WorkflowRunSharedLink|null $link link + * @param \Onfido\Model\WorkflowRunLink|null $link Object for the configuration of the Workflow Run link. * * @return self */ @@ -728,7 +692,7 @@ public function setDashboardUrl($dashboard_url) /** * Gets status * - * @return string|null + * @return \Onfido\Model\WorkflowRunStatus|null */ public function getStatus() { @@ -738,7 +702,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status The status of the Workflow Run. + * @param \Onfido\Model\WorkflowRunStatus|null $status The status of the Workflow Run. * * @return self */ @@ -747,16 +711,6 @@ public function setStatus($status) if (is_null($status)) { throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } $this->container['status'] = $status; return $this; @@ -819,7 +773,7 @@ public function setReasons($reasons) /** * Gets error * - * @return \Onfido\Model\WorkflowRunResponseError|null + * @return \Onfido\Model\WorkflowRunError|null */ public function getError() { @@ -829,7 +783,7 @@ public function getError() /** * Sets error * - * @param \Onfido\Model\WorkflowRunResponseError|null $error error + * @param \Onfido\Model\WorkflowRunError|null $error Error object. Only set when the Workflow Run status is 'error'. * * @return self */ diff --git a/lib/Model/WorkflowRunBuilder.php b/lib/Model/WorkflowRunBuilder.php index 361d841..7c88fc4 100644 --- a/lib/Model/WorkflowRunBuilder.php +++ b/lib/Model/WorkflowRunBuilder.php @@ -61,7 +61,7 @@ class WorkflowRunBuilder implements ModelInterface, ArrayAccess, \JsonSerializab 'workflow_id' => 'string', 'tags' => 'string[]', 'customer_user_id' => 'string', - 'link' => '\Onfido\Model\WorkflowRunSharedLink', + 'link' => '\Onfido\Model\WorkflowRunLink', 'created_at' => '\DateTime', 'updated_at' => '\DateTime', 'custom_data' => 'array' @@ -478,7 +478,7 @@ public function setCustomerUserId($customer_user_id) /** * Gets link * - * @return \Onfido\Model\WorkflowRunSharedLink|null + * @return \Onfido\Model\WorkflowRunLink|null */ public function getLink() { @@ -488,7 +488,7 @@ public function getLink() /** * Sets link * - * @param \Onfido\Model\WorkflowRunSharedLink|null $link link + * @param \Onfido\Model\WorkflowRunLink|null $link Object for the configuration of the Workflow Run link. * * @return self */ diff --git a/lib/Model/WorkflowRunResponseError.php b/lib/Model/WorkflowRunError.php similarity index 96% rename from lib/Model/WorkflowRunResponseError.php rename to lib/Model/WorkflowRunError.php index 220f41e..1686899 100644 --- a/lib/Model/WorkflowRunResponseError.php +++ b/lib/Model/WorkflowRunError.php @@ -1,6 +1,6 @@ */ -class WorkflowRunResponseError implements ModelInterface, ArrayAccess, \JsonSerializable +class WorkflowRunError implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -50,7 +49,7 @@ class WorkflowRunResponseError implements ModelInterface, ArrayAccess, \JsonSeri * * @var string */ - protected static $openAPIModelName = 'workflow_run_response_error'; + protected static $openAPIModelName = 'workflow_run_error'; /** * Array of property to type mappings. Used for (de)serialization diff --git a/lib/Model/WorkflowRunSharedLink.php b/lib/Model/WorkflowRunLink.php similarity index 87% rename from lib/Model/WorkflowRunSharedLink.php rename to lib/Model/WorkflowRunLink.php index a3e3533..66e77da 100644 --- a/lib/Model/WorkflowRunSharedLink.php +++ b/lib/Model/WorkflowRunLink.php @@ -1,6 +1,6 @@ */ -class WorkflowRunSharedLink implements ModelInterface, ArrayAccess, \JsonSerializable +class WorkflowRunLink implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -50,7 +49,7 @@ class WorkflowRunSharedLink implements ModelInterface, ArrayAccess, \JsonSeriali * * @var string */ - protected static $openAPIModelName = 'workflow_run_shared_link'; + protected static $openAPIModelName = 'workflow_run_link'; /** * Array of property to type mappings. Used for (de)serialization @@ -87,10 +86,10 @@ class WorkflowRunSharedLink implements ModelInterface, ArrayAccess, \JsonSeriali */ protected static array $openAPINullables = [ 'url' => false, - 'completed_redirect_url' => false, - 'expired_redirect_url' => false, - 'expires_at' => false, - 'language' => false + 'completed_redirect_url' => true, + 'expired_redirect_url' => true, + 'expires_at' => true, + 'language' => true ]; /** @@ -401,7 +400,14 @@ public function getCompletedRedirectUrl() public function setCompletedRedirectUrl($completed_redirect_url) { if (is_null($completed_redirect_url)) { - throw new \InvalidArgumentException('non-nullable completed_redirect_url cannot be null'); + array_push($this->openAPINullablesSetToNull, 'completed_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('completed_redirect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $this->container['completed_redirect_url'] = $completed_redirect_url; @@ -428,7 +434,14 @@ public function getExpiredRedirectUrl() public function setExpiredRedirectUrl($expired_redirect_url) { if (is_null($expired_redirect_url)) { - throw new \InvalidArgumentException('non-nullable expired_redirect_url cannot be null'); + array_push($this->openAPINullablesSetToNull, 'expired_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expired_redirect_url', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $this->container['expired_redirect_url'] = $expired_redirect_url; @@ -455,7 +468,14 @@ public function getExpiresAt() public function setExpiresAt($expires_at) { if (is_null($expires_at)) { - throw new \InvalidArgumentException('non-nullable expires_at cannot be null'); + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $this->container['expires_at'] = $expires_at; @@ -482,10 +502,17 @@ public function getLanguage() public function setLanguage($language) { if (is_null($language)) { - throw new \InvalidArgumentException('non-nullable language cannot be null'); + array_push($this->openAPINullablesSetToNull, 'language'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('language', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } } $allowedValues = $this->getLanguageAllowableValues(); - if (!in_array($language, $allowedValues, true)) { + if (!is_null($language) && !in_array($language, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'language', must be one of '%s'", diff --git a/lib/Model/WorkflowRunResponse.php b/lib/Model/WorkflowRunResponse.php index 4a629be..30187b6 100644 --- a/lib/Model/WorkflowRunResponse.php +++ b/lib/Model/WorkflowRunResponse.php @@ -60,10 +60,10 @@ class WorkflowRunResponse implements ModelInterface, ArrayAccess, \JsonSerializa 'id' => 'string', 'workflow_version_id' => 'int', 'dashboard_url' => 'string', - 'status' => 'string', + 'status' => '\Onfido\Model\WorkflowRunStatus', 'output' => 'object', 'reasons' => 'string[]', - 'error' => '\Onfido\Model\WorkflowRunResponseError', + 'error' => '\Onfido\Model\WorkflowRunError', 'sdk_token' => 'string' ]; @@ -270,33 +270,6 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_AWAITING_INPUT = 'awaiting_input'; - public const STATUS_PROCESSING = 'processing'; - public const STATUS_ABANDONED = 'abandoned'; - public const STATUS_ERROR = 'error'; - public const STATUS_APPROVED = 'approved'; - public const STATUS_REVIEW = 'review'; - public const STATUS_DECLINED = 'declined'; - public const STATUS_UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_AWAITING_INPUT, - self::STATUS_PROCESSING, - self::STATUS_ABANDONED, - self::STATUS_ERROR, - self::STATUS_APPROVED, - self::STATUS_REVIEW, - self::STATUS_DECLINED, - self::STATUS_UNKNOWN_DEFAULT_OPEN_API, - ]; - } /** * Associative array for storing property values @@ -353,15 +326,6 @@ public function listInvalidProperties() if ($this->container['id'] === null) { $invalidProperties[] = "'id' can't be null"; } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - return $invalidProperties; } @@ -461,7 +425,7 @@ public function setDashboardUrl($dashboard_url) /** * Gets status * - * @return string|null + * @return \Onfido\Model\WorkflowRunStatus|null */ public function getStatus() { @@ -471,7 +435,7 @@ public function getStatus() /** * Sets status * - * @param string|null $status The status of the Workflow Run. + * @param \Onfido\Model\WorkflowRunStatus|null $status The status of the Workflow Run. * * @return self */ @@ -480,16 +444,6 @@ public function setStatus($status) if (is_null($status)) { throw new \InvalidArgumentException('non-nullable status cannot be null'); } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } $this->container['status'] = $status; return $this; @@ -552,7 +506,7 @@ public function setReasons($reasons) /** * Gets error * - * @return \Onfido\Model\WorkflowRunResponseError|null + * @return \Onfido\Model\WorkflowRunError|null */ public function getError() { @@ -562,7 +516,7 @@ public function getError() /** * Sets error * - * @param \Onfido\Model\WorkflowRunResponseError|null $error error + * @param \Onfido\Model\WorkflowRunError|null $error Error object. Only set when the Workflow Run status is 'error'. * * @return self */ diff --git a/lib/Model/WorkflowRunShared.php b/lib/Model/WorkflowRunShared.php index 32258aa..561cc36 100644 --- a/lib/Model/WorkflowRunShared.php +++ b/lib/Model/WorkflowRunShared.php @@ -61,7 +61,7 @@ class WorkflowRunShared implements ModelInterface, ArrayAccess, \JsonSerializabl 'workflow_id' => 'string', 'tags' => 'string[]', 'customer_user_id' => 'string', - 'link' => '\Onfido\Model\WorkflowRunSharedLink', + 'link' => '\Onfido\Model\WorkflowRunLink', 'created_at' => '\DateTime', 'updated_at' => '\DateTime' ]; @@ -471,7 +471,7 @@ public function setCustomerUserId($customer_user_id) /** * Gets link * - * @return \Onfido\Model\WorkflowRunSharedLink|null + * @return \Onfido\Model\WorkflowRunLink|null */ public function getLink() { @@ -481,7 +481,7 @@ public function getLink() /** * Sets link * - * @param \Onfido\Model\WorkflowRunSharedLink|null $link link + * @param \Onfido\Model\WorkflowRunLink|null $link Object for the configuration of the Workflow Run link. * * @return self */ diff --git a/lib/Model/WorkflowRunStatus.php b/lib/Model/WorkflowRunStatus.php new file mode 100644 index 0000000..6cacabe --- /dev/null +++ b/lib/Model/WorkflowRunStatus.php @@ -0,0 +1,83 @@ + Date: Mon, 21 Oct 2024 15:41:28 +0200 Subject: [PATCH 2/2] Add schedule to CI, fix and improve tests after library refresh --- .github/workflows/php.yml | 2 + ...hp => ClassicWebhookEventVerifierTest.php} | 20 +------ test/OnfidoTestCase.php | 9 ++- test/Resource/ChecksTest.php | 7 ++- .../QualifiedElectronicSignatureTest.php | 4 +- test/Resource/WorkflowRunOutputsTest.php | 9 +-- test/Resource/WorkflowRunsTest.php | 11 ++-- test/StudioWebhookEventVerifierTest.php | 57 +++++++++++++++++++ 8 files changed, 88 insertions(+), 31 deletions(-) rename test/{WebhookEventVerifierTest.php => ClassicWebhookEventVerifierTest.php} (67%) create mode 100644 test/StudioWebhookEventVerifierTest.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8b7af98..44c6007 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -18,6 +18,8 @@ on: release: types: - published + schedule: + - cron: "0 15 * * 0" # Every Sunday, 3 hours after midday jobs: integration-tests: diff --git a/test/WebhookEventVerifierTest.php b/test/ClassicWebhookEventVerifierTest.php similarity index 67% rename from test/WebhookEventVerifierTest.php rename to test/ClassicWebhookEventVerifierTest.php index 3927aa8..3dac07d 100644 --- a/test/WebhookEventVerifierTest.php +++ b/test/ClassicWebhookEventVerifierTest.php @@ -6,33 +6,19 @@ use Onfido as Onfido; -class WebhookEventVerifierTest extends TestCase +class ClassicWebhookEventVerifierTest extends TestCase { private static $rawEvent = "{\"payload\":{\"resource_type\":\"check\",\"action\":\"check.completed\",\"object\":{\"id\":\"f2302f45-227d-413d-ad61-09ec077a086a\",\"status\":\"complete\",\"completed_at_iso8601\":\"2024-04-04T09:21:21Z\",\"href\":\"https://api.onfido.com/v3.6/checks/f2302f45-227d-413d-ad61-09ec077a086a\"}}}"; private static $webhookToken = "wU99mE6jJ7nXOLFwZ0tJymM1lpI15pZh"; private static $webhookEventVerifier; - private static $expectedEvent; - /** * Setup before running any test case */ public static function setUpBeforeClass(): void { self::$webhookEventVerifier = new Onfido\WebhookEventVerifier(self::$webhookToken); - - self::$expectedEvent = new Onfido\Model\WebhookEvent( - [ 'payload' => new Onfido\Model\WebhookEventPayload( - [ 'action' => Onfido\Model\WebhookEventType::CHECK_COMPLETED, - 'resource_type' => 'check', - 'object' => new Onfido\Model\WebhookEventPayloadObject( - [ 'id' => 'f2302f45-227d-413d-ad61-09ec077a086a', - 'href' => 'https://api.onfido.com/v3.6/checks/f2302f45-227d-413d-ad61-09ec077a086a', - 'status' => 'complete', - 'completed_at_iso8601' => '2024-04-04T09:21:21Z' ]) - ]) - ]); } public function testValidSignature(): void @@ -44,10 +30,10 @@ public function testValidSignature(): void $object = $payload->getObject(); $this->assertSame(Onfido\Model\WebhookEventType::CHECK_COMPLETED, $payload->getAction()); - $this->assertSame('check', $payload->getResourceType()); + $this->assertSame(Onfido\Model\WebhookEventResourceType::CHECK, $payload->getResourceType()); $this->assertSame('f2302f45-227d-413d-ad61-09ec077a086a', $object->getId()); $this->assertSame('https://api.onfido.com/v3.6/checks/f2302f45-227d-413d-ad61-09ec077a086a', $object->getHref()); - $this->assertSame('complete', $object->getStatus()); + $this->assertSame(Onfido\Model\WebhookEventObjectStatus::COMPLETE, $object->getStatus()); $this->assertSame('2024-04-04T09:21:21+00:00', $object->getCompletedAtIso8601()->format('c')); } diff --git a/test/OnfidoTestCase.php b/test/OnfidoTestCase.php index 91aa269..f0d9735 100644 --- a/test/OnfidoTestCase.php +++ b/test/OnfidoTestCase.php @@ -62,6 +62,12 @@ protected function createApplicant(): Onfido\Model\Applicant ]), 'email' => 'first.last@gmail.com', 'phone_number' => '351911111111', + 'consents' => [ + new Onfido\Model\ApplicantConsentBuilder([ + 'name' => Onfido\Model\ApplicantConsentName::PRIVACY_NOTICES_READ, + 'granted' => true + ]) + ] ] ), ); @@ -106,7 +112,7 @@ protected static function cleanUpWebhooks(): void protected function uploadDocument(string $applicantId): Onfido\Model\Document { return self::$onfido->uploadDocument( - 'passport', + Onfido\Model\DocumentTypes::PASSPORT, $applicantId, new \SplFileObject('test/media/sample_driving_licence.png') ); @@ -220,6 +226,7 @@ protected function repeatRequestUntilHttpCodeChanges( $sleepTime = 1 ) { + $instance = null; $iteration = 0; while($iteration <= $maxRetries) { try { diff --git a/test/Resource/ChecksTest.php b/test/Resource/ChecksTest.php index f381d11..21165a3 100644 --- a/test/Resource/ChecksTest.php +++ b/test/Resource/ChecksTest.php @@ -5,6 +5,7 @@ use Onfido\Test\OnfidoTestCase as OnfidoTestCase; use Onfido\Model\ReportName as ReportName; use Onfido\Model\Check as Check; +use Onfido\Model\CheckStatus as CheckStatus; use Onfido\Model\CheckBuilder as CheckBuilder; use Onfido\Model\UsDrivingLicenceBuilder as UsDrivingLicenceBuilder; @@ -31,7 +32,7 @@ public function setUp(): void public function testCreateCheck(): void { $this->assertSame($this->applicantId, $this->check->getApplicantId()); - $this->assertSame(Check::STATUS_IN_PROGRESS, $this->check->getStatus()); + $this->assertSame(CheckStatus::IN_PROGRESS, $this->check->getStatus()); $this->assertSame(2, sizeOf($this->check->getReportIds())); } @@ -41,11 +42,13 @@ public function testCreateConsiderCheck(): void 'applicant_id' => $this->applicantId, 'document_ids' => [$this->documentId], 'report_names' => [ReportName::DOCUMENT], - 'consider' => [ReportName::DOCUMENT] + 'consider' => [ReportName::DOCUMENT], + 'privacy_notices_read_consent_given' => true ]); $check = $this->createCheck($checkBuilder); $this->assertSame($this->applicantId, $check->getApplicantId()); + $this->assertSame(true, $check->getPrivacyNoticesReadConsentGiven()); } public function testCreateDrivingLicenceCheck(): void diff --git a/test/Resource/QualifiedElectronicSignatureTest.php b/test/Resource/QualifiedElectronicSignatureTest.php index eae6366..bf127a6 100644 --- a/test/Resource/QualifiedElectronicSignatureTest.php +++ b/test/Resource/QualifiedElectronicSignatureTest.php @@ -25,8 +25,8 @@ public function testDownloadQesDocument(): void ] ]); $workflowRun = $this->createWorkflowRun($workflowRunBuilder); - - $task = self::$onfido->listTasks($workflowRun["id"])[0]; + + $task = self::$onfido->listTasks($workflowRun["id"])[1]; $workflowRunId = $workflowRun["id"]; $taskId = $task->getId(); diff --git a/test/Resource/WorkflowRunOutputsTest.php b/test/Resource/WorkflowRunOutputsTest.php index 36373b4..df896f3 100644 --- a/test/Resource/WorkflowRunOutputsTest.php +++ b/test/Resource/WorkflowRunOutputsTest.php @@ -4,6 +4,7 @@ use Onfido\Test\OnfidoTestCase as OnfidoTestCase; use Onfido\Model\WorkflowRun as WorkflowRun; +use Onfido\Model\WorkflowRunStatus as WorkflowRunStatus; use Onfido\Model\CompleteTaskBuilder as CompleteTaskBuilder; class WorkflowRunOutputsTest extends OnfidoTestCase @@ -56,13 +57,13 @@ public function testProfileDataCaptureAsOutput(): void $workflowRunOutputs = $this->repeatRequestUntilStatusChanges( $this->findWorkflowRunFn, [$workflowRunId], - WorkflowRun::STATUS_APPROVED + WorkflowRunStatus::APPROVED )->getOutput(); // Can't compare output with profileData directly due to issues with types, // so converting the output into array and comparing key by key value // (without the address which also causes issues and is compared separately) - $keysExceptAddress = array_filter(array_keys($this->profileData), + $keysExceptAddress = array_filter(array_keys($this->profileData), function($key) { return $key !== 'address'; } @@ -96,7 +97,7 @@ public function testDocumentAndFacialSimilarityReportAsOutput() 'last_name' => 'Last' ]]) ); - + $tasks = self::$onfido->listTasks($workflowRunId); $documentCaptureTaskId = $this->getTaskIdByPartialId($tasks, 'document'); self::$onfido->completeTask( @@ -120,7 +121,7 @@ public function testDocumentAndFacialSimilarityReportAsOutput() $workflowRunOutputs = $this->repeatRequestUntilStatusChanges( $this->findWorkflowRunFn, [$workflowRunId], - WorkflowRun::STATUS_APPROVED + WorkflowRunStatus::APPROVED )->getOutput(); $documentReportOutput = (array) $workflowRunOutputs['doc']; diff --git a/test/Resource/WorkflowRunsTest.php b/test/Resource/WorkflowRunsTest.php index 6ec2aca..366d26e 100644 --- a/test/Resource/WorkflowRunsTest.php +++ b/test/Resource/WorkflowRunsTest.php @@ -4,6 +4,7 @@ use Onfido\Test\OnfidoTestCase as OnfidoTestCase; use Onfido\Model\WorkflowRun as WorkflowRun; +use Onfido\Model\WorkflowRunStatus as WorkflowRunStatus; use Onfido\Model\WorkflowRunBuilder as WorkflowRunBuilder; class WorkflowRunsTest extends OnfidoTestCase @@ -22,7 +23,7 @@ public function setUp(): void public function testCreateWorkflowRun(): void { $this->assertSame($this->workflowId, $this->workflowRun->getWorkflowId()); - $this->assertSame(WorkflowRun::STATUS_AWAITING_INPUT, $this->workflowRun->getStatus()); + $this->assertSame(WorkflowRunStatus::AWAITING_INPUT, $this->workflowRun->getStatus()); } public function testCreateWorkflowRunWithCustomInputs(): void @@ -40,7 +41,7 @@ public function testCreateWorkflowRunWithCustomInputs(): void $workflowRun = $this->createWorkflowRun($workflowRunBuilder); $this->assertSame($workflowId, $workflowRun->getWorkflowId()); - $this->assertSame(WorkflowRun::STATUS_APPROVED, $workflowRun->getStatus()); + $this->assertSame(WorkflowRunStatus::APPROVED, $workflowRun->getStatus()); } public function testListWorkflowRuns(): void @@ -72,7 +73,7 @@ public function testGenerateTimelineFile(): void $this->repeatRequestUntilStatusChanges( $findWorkflowRunFn, [$workflowRunId], - WorkflowRun::STATUS_APPROVED + WorkflowRunStatus::APPROVED )->getOutput(); $workflowTimelineFileData = self::$onfido->createTimelineFile($workflowRunId); @@ -96,7 +97,7 @@ public function testDownloadTimelineFile(): void $this->repeatRequestUntilStatusChanges( $findWorkflowRunFn, [$workflowRunId], - WorkflowRun::STATUS_APPROVED + WorkflowRunStatus::APPROVED )->getOutput(); $workflowTimelineFileId = self::$onfido->createTimelineFile($workflowRunId) @@ -106,7 +107,7 @@ public function testDownloadTimelineFile(): void $getTimelineFileFn, [$workflowRunId, $workflowTimelineFileId] ); - + $this->assertGreaterThan(0, $file->getSize()); } } diff --git a/test/StudioWebhookEventVerifierTest.php b/test/StudioWebhookEventVerifierTest.php new file mode 100644 index 0000000..99f6edc --- /dev/null +++ b/test/StudioWebhookEventVerifierTest.php @@ -0,0 +1,57 @@ +readPayload(self::$rawEvent, $signature); + $payload = $event->getPayload(); + $object = $payload->getObject(); + + $this->assertSame(Onfido\Model\WebhookEventType::WORKFLOW_TASK_STARTED, $payload->getAction()); + $this->assertSame(Onfido\Model\WebhookEventResourceType::WORKFLOW_TASK, $payload->getResourceType()); + $this->assertSame('profile_1eb92', $object->getId()); + $this->assertSame('https://api.eu.onfido.com/v3.6/workflow_runs/bc77c6e5-753a-4580-96a6-aaed3e5a8d19/tasks/profile_1eb92', $object->getHref()); + $this->assertSame(Onfido\Model\WebhookEventObjectStatus::STARTED, $object->getStatus()); + $this->assertSame('2024-07-10T12:49:09+00:00', $object->getStartedAtIso8601()->format('c')); + + $resource = $payload->getResource(); + $this->assertSame('2024-07-10T12:49:09+00:00', $resource->getCreatedAt()->format('c')); + $this->assertSame('profile_1eb92', $resource->getId()); + $this->assertSame([], $resource->getInput()); + $this->assertSame(null, $resource->getOutput()); + $this->assertSame('profile_data', $resource->getTaskDefId()); + $this->assertSame(null, $resource->getTaskDefVersion()); + $this->assertSame('2024-07-10T12:49:09+00:00', $resource->getUpdatedAt()->format('c')); + $this->assertSame('bc77c6e5-753a-4580-96a6-aaed3e5a8d19', $resource->getWorkflowRunId()); + } + + public function testInvalidSignature() + { + $signature = "c95a5b785484f6fa1bc25f381b5595d66bf85cb442eefb06aa007802ee6a4dfb"; + + $this->expectException(Onfido\OnfidoInvalidSignatureError::class); + $event = self::$webhookEventVerifier->readPayload(self::$rawEvent, $signature); + } +}