Skip to content

Commit

Permalink
Add Identification.result and its sub-entities
Browse files Browse the repository at this point in the history
  • Loading branch information
spajxo committed Feb 26, 2024
1 parent 1ad6d4b commit bfa11d6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
18 changes: 18 additions & 0 deletions src/Endpoint/IdentificationsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
}
2 changes: 2 additions & 0 deletions src/Resource/Identification.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 30 additions & 0 deletions tests/Endpoint/IdentificationsEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bfa11d6

Please sign in to comment.