Skip to content

Commit

Permalink
Add EnvelopeDocumentsEndpoint.invalidate and `EnvelopeDocumentsEndp…
Browse files Browse the repository at this point in the history
…oint.restore`
  • Loading branch information
tomasDostalDS committed Mar 28, 2024
1 parent 37f38fa commit 889f934
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
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

0 comments on commit 889f934

Please sign in to comment.