Skip to content
Open
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: 1 addition & 1 deletion .php-cs-fixer.cache

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions src/DocScan/Session/Retrieve/StaticLivenessResourceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ class StaticLivenessResourceResponse extends LivenessResourceResponse
*/
private $image;

/**
* The capture type of the static liveness resource.
*
* This is a string specific to STATIC liveness resources and may be null or
* absent for older sessions. It is populated when the Relying Business
* fetches the session.
*
* @var string|null
*/
private $captureType;


/**
* StaticLivenessResourceResponse constructor.
Expand All @@ -24,6 +35,8 @@ public function __construct(array $zoomLiveness)
if (isset($zoomLiveness['image'])) {
$this->image = new MediaResponse($zoomLiveness['image']['media']);
}

$this->captureType = $zoomLiveness['capture_type'] ?? null;
}

/**
Expand All @@ -33,4 +46,18 @@ public function getImage(): ?MediaResponse
{
return $this->image;
}

/**
* The capture type of the static liveness resource.
*
* This is specific to STATIC liveness resources and may be null when the
* value is absent (e.g. for older sessions). It is populated when the
* Relying Business fetches the session.
*
* @return string|null
*/
public function getCaptureType(): ?string
{
return $this->captureType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ class StaticLivenessResourceResponseTest extends TestCase
{
private const SOME_LIVENESS_TYPE = 'someLivenessType';
private const SOME_ID = '493ru49358gh945fh305';
private const SOME_CAPTURE_TYPE = 'someCaptureType';

/**
* @test
* @covers ::__construct
* @covers ::getLivenessType
* @covers ::getImage
* @covers ::getCaptureType
*/
public function shouldBuildCorrectly()
{
$input = [
'liveness_type' => self::SOME_LIVENESS_TYPE,
'capture_type' => self::SOME_CAPTURE_TYPE,
'image' => [
'media' => [
'id' => self::SOME_ID,
Expand All @@ -38,6 +41,7 @@ public function shouldBuildCorrectly()
$result = new StaticLivenessResourceResponse($input);

$this->assertEquals(self::SOME_LIVENESS_TYPE, $result->getLivenessType());
$this->assertEquals(self::SOME_CAPTURE_TYPE, $result->getCaptureType());
$this->assertEquals(self::SOME_ID, $result->getImage()->getId());
$this->assertNotNull($result->getImage());
$this->assertInstanceOf(MediaResponse::class, $result->getImage());
Expand All @@ -48,12 +52,14 @@ public function shouldBuildCorrectly()
* @covers ::__construct
* @covers ::getLivenessType
* @covers ::getImage
* @covers ::getCaptureType
*/
public function shouldNotThrowExceptionIfMissingValues()
{
$result = new StaticLivenessResourceResponse([]);

$this->assertNull($result->getLivenessType());
$this->assertNull($result->getImage());
$this->assertNull($result->getCaptureType());
}
}
Loading