From 697307a296defdd92a25054eb470b78ef125cb62 Mon Sep 17 00:00:00 2001 From: Pavel Stejskal Date: Mon, 26 Feb 2024 10:50:01 +0100 Subject: [PATCH 1/2] Add `Identification.result` and its sub-entities --- src/Resource/Identification.php | 1 + src/Resource/IdentificationBankStatement.php | 14 ++++++++++++++ src/Resource/IdentificationDocument.php | 16 ++++++++++++++++ src/Resource/IdentificationInspection.php | 12 ++++++++++++ src/Resource/IdentificationResult.php | 18 ++++++++++++++++++ src/Resource/IdentificationSelfie.php | 14 ++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 src/Resource/IdentificationBankStatement.php create mode 100644 src/Resource/IdentificationDocument.php create mode 100644 src/Resource/IdentificationInspection.php create mode 100644 src/Resource/IdentificationResult.php create mode 100644 src/Resource/IdentificationSelfie.php diff --git a/src/Resource/Identification.php b/src/Resource/Identification.php index b72f527..17f19ba 100644 --- a/src/Resource/Identification.php +++ b/src/Resource/Identification.php @@ -23,5 +23,6 @@ class Identification extends BaseResource public ?DateTime $deniedAt; public ?DateTime $forReviewAt; public ?string $denialMessage; + public ?IdentificationResult $result; public ?IdentifyScenarioVersionInfo $scenarioVersion; } diff --git a/src/Resource/IdentificationBankStatement.php b/src/Resource/IdentificationBankStatement.php new file mode 100644 index 0000000..6252cd0 --- /dev/null +++ b/src/Resource/IdentificationBankStatement.php @@ -0,0 +1,14 @@ + Date: Mon, 26 Feb 2024 10:50:10 +0100 Subject: [PATCH 2/2] Add `IdentificationEndpoint.cancel|discard|restore` --- CHANGELOG.md | 6 ++++ src/Endpoint/IdentificationsEndpoint.php | 18 +++++++++++ src/Resource/Identification.php | 2 ++ .../Endpoint/IdentificationsEndpointTest.php | 30 +++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65400de..203af04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip ## [Unreleased] ### Added +- Add `Identificaiton.cancelledAt` +- Add `Identificaiton.discardedAt` +- Add `Identification.result` and its sub-entities +- Add `IdentificationsEndpoint.cancel` +- Add `IdentificationsEndpoint.discard` +- Add `IdentificationsEndpoint.restore` - Add `Identification.forReviewAt` - Add `EnvelopeRecipient.channelForNotifications` - Add `EnvelopeTemplateRecipient.channelForNotifications` diff --git a/src/Endpoint/IdentificationsEndpoint.php b/src/Endpoint/IdentificationsEndpoint.php index bf6e4f5..98e51ca 100644 --- a/src/Endpoint/IdentificationsEndpoint.php +++ b/src/Endpoint/IdentificationsEndpoint.php @@ -36,4 +36,22 @@ public function deny(Identification|string $id, array $body = []): Identificatio { return $this->makeResource($this->postRequest('/{id}/deny', ['id' => $id, 'json' => $body])); } + + public function cancel(Identification|string $id): Identification + { + return $this->makeResource($this->postRequest('/{id}/cancel', ['id' => $id])); + } + + /** + * @param mixed[] $body + */ + public function discard(Identification|string $id, array $body = []): Identification + { + return $this->makeResource($this->postRequest('/{id}/discard', ['id' => $id, 'json' => $body])); + } + + public function restore(Identification|string $id): Identification + { + return $this->makeResource($this->postRequest('/{id}/restore', ['id' => $id])); + } } diff --git a/src/Resource/Identification.php b/src/Resource/Identification.php index 17f19ba..a72b580 100644 --- a/src/Resource/Identification.php +++ b/src/Resource/Identification.php @@ -22,6 +22,8 @@ class Identification extends BaseResource public ?DateTime $approvedAt; public ?DateTime $deniedAt; public ?DateTime $forReviewAt; + public ?DateTime $cancelledAt; + public ?DateTime $discardedAt; public ?string $denialMessage; public ?IdentificationResult $result; public ?IdentifyScenarioVersionInfo $scenarioVersion; diff --git a/tests/Endpoint/IdentificationsEndpointTest.php b/tests/Endpoint/IdentificationsEndpointTest.php index 9019b1f..30e3b32 100644 --- a/tests/Endpoint/IdentificationsEndpointTest.php +++ b/tests/Endpoint/IdentificationsEndpointTest.php @@ -26,6 +26,36 @@ public function testDeny(): void self::assertLastRequest('POST', '/api/identifications/foo/deny'); } + public function testDenyWithBody(): void + { + self::endpoint()->deny('foo', ['foo' => 'bar']); + self::assertLastRequest('POST', '/api/identifications/foo/deny', ['foo' => 'bar']); + } + + public function testCancel(): void + { + self::endpoint()->cancel('foo'); + self::assertLastRequest('POST', '/api/identifications/foo/cancel'); + } + + public function testDiscard(): void + { + self::endpoint()->discard('foo'); + self::assertLastRequest('POST', '/api/identifications/foo/discard'); + } + + public function testDiscardWithBody(): void + { + self::endpoint()->discard('foo', ['foo' => 'bar']); + self::assertLastRequest('POST', '/api/identifications/foo/discard', ['foo' => 'bar']); + } + + public function testRestore(): void + { + self::endpoint()->restore('foo'); + self::assertLastRequest('POST', '/api/identifications/foo/restore'); + } + protected static function endpoint(): IdentificationsEndpoint { return self::dgs()->identifications();