diff --git a/CHANGELOG.md b/CHANGELOG.md index 38bb96c..e185513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip - Add `anonymizeAt` and `anonymizedAt` to `Envelope` - Add anonymize action to `Envelope` - Add `AccountEmailSendersEndpoint` and `AccountEmailSender` resource +- Add `approvedAt`, `deniedAt` and `denailMessage` to `Identification` +- Add `Identification.approve` endpoint and `Identification.deny` endpoint ### Changed - Change `EnvelopeDocument.file` to nullable diff --git a/src/Endpoint/IdentificationsEndpoint.php b/src/Endpoint/IdentificationsEndpoint.php index 1ef54dd..bf6e4f5 100644 --- a/src/Endpoint/IdentificationsEndpoint.php +++ b/src/Endpoint/IdentificationsEndpoint.php @@ -10,6 +10,9 @@ /** * @extends ResourceEndpoint + * @method Identification get(string $id) + * @method Identification create(array $body) + * @method Identification update(string $id, array $body) */ final class IdentificationsEndpoint extends ResourceEndpoint { @@ -20,4 +23,17 @@ public function __construct(DigiSign $parent) { parent::__construct($parent, '/api/identifications', Identification::class); } + + public function approve(Identification|string $id): Identification + { + return $this->makeResource($this->postRequest('/{id}/approve', ['id' => $id])); + } + + /** + * @param mixed[] $body + */ + public function deny(Identification|string $id, array $body = []): Identification + { + return $this->makeResource($this->postRequest('/{id}/deny', ['id' => $id, 'json' => $body])); + } } diff --git a/src/Resource/Identification.php b/src/Resource/Identification.php index 84a5cde..bb95d58 100644 --- a/src/Resource/Identification.php +++ b/src/Resource/Identification.php @@ -19,4 +19,7 @@ class Identification extends BaseResource public ?DateTime $startedAt; public ?DateTime $openedAt; public ?DateTime $completedAt; + public ?DateTime $approvedAt; + public ?DateTime $deniedAt; + public ?string $denialMessage; } diff --git a/tests/Endpoint/IdentificationsEndpointTest.php b/tests/Endpoint/IdentificationsEndpointTest.php index e9e993f..9019b1f 100644 --- a/tests/Endpoint/IdentificationsEndpointTest.php +++ b/tests/Endpoint/IdentificationsEndpointTest.php @@ -14,6 +14,18 @@ public function testCRUD(): void self::assertCrudRequests(self::endpoint(), '/api/identifications'); } + public function testApprove(): void + { + self::endpoint()->approve('foo'); + self::assertLastRequest('POST', '/api/identifications/foo/approve'); + } + + public function testDeny(): void + { + self::endpoint()->deny('foo'); + self::assertLastRequest('POST', '/api/identifications/foo/deny'); + } + protected static function endpoint(): IdentificationsEndpoint { return self::dgs()->identifications();