Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EnvelopeDocumentsEndpoint.invalidate and EnvelopeDocumentsEndpoint.restore #226

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

## [Unreleased]
### Added
- Add `EnvelopeDocumentsEndpoint.invalidate`
- Add `EnvelopeDocumentsEndpoint.restore`
- Add `CompletedIdentificationReport.name`
- Add `ReportEndpoint.completedIdentifications` endpoint and `CompletedIdentificationReport` resource

Expand Down
10 changes: 10 additions & 0 deletions src/Endpoint/EnvelopeDocumentsEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ public function replaceFile(EnvelopeDocument|string $document, array $body): Env
);
}

public function invalidate(EnvelopeDocument|string $document): void
{
$this->postRequest('/{document}/invalidate', ['document' => $document]);
}

public function restore(EnvelopeDocument|string $document): void
{
$this->postRequest('/{document}/restore', ['document' => $document]);
}

public function signatureSheets(): EnvelopeDocumentSignatureSheets
{
return $this->createResource($this->getRequest('/signature-sheets'), EnvelopeDocumentSignatureSheets::class);
Expand Down
5 changes: 5 additions & 0 deletions src/Resource/EnvelopeDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace DigitalCz\DigiSign\Resource;

use DateTime;
use DigitalCz\DigiSign\Resource\Traits\EntityResourceTrait;

class EnvelopeDocument extends BaseResource
Expand Down Expand Up @@ -32,4 +33,8 @@ class EnvelopeDocument extends BaseResource
public int $labelPositionY;

public string $signatureValidity;

public bool $invalidate;

public ?DateTime $invalidatedAt = null;
}
12 changes: 12 additions & 0 deletions tests/Endpoint/EnvelopeDocumentsEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ public function testReplaceFile(): void
self::assertLastRequest('POST', '/api/envelopes/bar/documents/foo/replace-file', ['foo' => 'bar']);
}

public function testInvalidate(): void
{
self::endpoint()->invalidate('foo');
self::assertLastRequest('POST', '/api/envelopes/bar/documents/foo/invalidate');
}

public function testRestore(): void
{
self::endpoint()->restore('foo');
self::assertLastRequest('POST', '/api/envelopes/bar/documents/foo/restore');
}

public function testSignatureSheets(): void
{
self::endpoint()->signatureSheets();
Expand Down