diff --git a/CHANGELOG.md b/CHANGELOG.md index 77fb9c1..8ff1ad2 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();