Skip to content

Commit

Permalink
SDK-2265 added missing features
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmet-yoti committed Jun 20, 2024
1 parent d61b0cd commit 1c8629c
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.1.29","version":"3.59.3:v3.59.3#30ba9ecc2b0e5205e578fe29973c15653d9bfd29","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"no_unused_imports":true,"ordered_imports":{"imports_order":["const","class","function"]},"php_unit_fqcn_annotation":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true},"hashes":{"\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32718\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder30753\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24222\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder25907\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder35317\/src\/DigitalIdentityClient.php":"9fba09c315d5bba5bd7b90ae9a717003","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3167\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder667\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32289\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder821\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder8036\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3553\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder9961\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder34449\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32249\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37291\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3093\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28127\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder33456\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37936\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe"}}
{"php":"8.1.29","version":"3.59.3:v3.59.3#30ba9ecc2b0e5205e578fe29973c15653d9bfd29","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"no_unused_imports":true,"ordered_imports":{"imports_order":["const","class","function"]},"php_unit_fqcn_annotation":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true},"hashes":{"\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32718\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder30753\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder24222\/tests\/Util\/JsonTest.php":"229e164156257a33bc40ec45910f1561","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder25907\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder35317\/src\/DigitalIdentityClient.php":"9fba09c315d5bba5bd7b90ae9a717003","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3167\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder667\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32289\/src\/Identity\/DigitalIdentityService.php":"d1ca6e501e690798ca13ec028cbf505e","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder821\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder8036\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3553\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder9961\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder34449\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder32249\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37291\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder3093\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder28127\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder33456\/src\/Profile\/Util\/Attribute\/AnchorConverter.php":"c348f7a24bc5c13dc8b7362319cbfc9a","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder37936\/tests\/DigitalIdentityClientTest.php":"7afddf255900f83a72e0a37a93a6f6fe","\/private\/var\/folders\/hs\/kw0d0_0d2kj8xl5yd5_t2rz40000gn\/T\/PHP CS Fixertemp_folder20323\/tests\/Identity\/DigitalIdentityServiceTest.php":"a2830bae77f9853790b730ab1c52a9c0"}}
21 changes: 20 additions & 1 deletion src/DocScan/Session/Create/SdkConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class SdkConfig implements \JsonSerializable
*/
private $attemptsConfiguration;

/**
* @var string|null
*/
private $biometricConsentFlow;

/**
* @param string|null $allowedCaptureMethods
* @param string|null $primaryColour
Expand All @@ -75,6 +80,7 @@ class SdkConfig implements \JsonSerializable
* @param string|null $privacyPolicyUrl
* @param bool|null $allowHandoff
* @param array<string, int>|null $idDocumentTextDataExtractionRetriesConfig
* @param string|null $biometricConsentFlow
*/
public function __construct(
?string $allowedCaptureMethods,
Expand All @@ -87,7 +93,9 @@ public function __construct(
?string $errorUrl,
?string $privacyPolicyUrl = null,
?bool $allowHandoff = null,
?array $idDocumentTextDataExtractionRetriesConfig = null
?array $idDocumentTextDataExtractionRetriesConfig = null,
?string $biometricConsentFlow = null

) {
$this->allowedCaptureMethods = $allowedCaptureMethods;
$this->primaryColour = $primaryColour;
Expand All @@ -102,6 +110,8 @@ public function __construct(
if (!is_null($idDocumentTextDataExtractionRetriesConfig)) {
$this->attemptsConfiguration = new AttemptsConfiguration($idDocumentTextDataExtractionRetriesConfig);
}
$this->biometricConsentFlow = $biometricConsentFlow;

}

/**
Expand All @@ -121,6 +131,7 @@ public function jsonSerialize(): \stdClass
'privacy_policy_url' => $this->getPrivacyPolicyUrl(),
'allow_handoff' => $this->getAllowHandoff(),
'attempts_configuration' => $this->getAttemptsConfiguration(),
'biometric_consent_flow' => $this->getBiometricConsentFlow()
]);
}

Expand Down Expand Up @@ -211,4 +222,12 @@ public function getAttemptsConfiguration(): ?AttemptsConfiguration
{
return $this->attemptsConfiguration;
}

/**
* @return string|null
*/
public function getBiometricConsentFlow(): ?string
{
return $this->biometricConsentFlow;
}
}
13 changes: 12 additions & 1 deletion src/DocScan/Session/Create/SdkConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class SdkConfigBuilder
*/
private $idDocumentTextDataExtractionRetriesConfig;

/**
* @var string|null
*/
private $biometricConsentFlow;

public function withAllowsCamera(): self
{
return $this->withAllowedCaptureMethod(self::CAMERA);
Expand Down Expand Up @@ -136,6 +141,11 @@ public function withAllowHandoff(bool $allowHandoff): self
return $this;
}

public function withBiometricConsentFlow(string $biometricConsentFlow): self
{
$this->biometricConsentFlow = $biometricConsentFlow;
return $this;
}
/**
* Allows configuring the number of attempts permitted for text extraction on an ID document
*
Expand Down Expand Up @@ -203,7 +213,8 @@ public function build(): SdkConfig
$this->errorUrl,
$this->privacyPolicyUrl,
$this->allowHandoff,
$this->idDocumentTextDataExtractionRetriesConfig
$this->idDocumentTextDataExtractionRetriesConfig,
$this->biometricConsentFlow
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,32 @@ public function withManualCheck(string $manualCheck): self
return $this->setManualCheck($manualCheck);
}

/**
* @var bool
*/
private $createExpandedDocumentFields;

/**
*
* @param string $createExpandedDocumentFields
*
* @return $this
*/
public function withCreateExpandedDocumentFields(bool $createExpandedDocumentFields): self
{
$this->createExpandedDocumentFields = $createExpandedDocumentFields;
return $this;
}

/**
* @return RequestedTextExtractionTask
*/
public function build(): RequestedTextExtractionTask
{
Validation::notEmptyString($this->manualCheck, 'manualCheck');

$config = new RequestedTextExtractionTaskConfig($this->manualCheck, $this->chipData);
$config = new RequestedTextExtractionTaskConfig($this->manualCheck, $this->chipData,
$this->createExpandedDocumentFields);
return new RequestedTextExtractionTask($config);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ class RequestedTextExtractionTaskConfig implements RequestedTaskConfigInterface
*/
private $chipData;

/**
* @var bool|null
*/
private $createExpandedDocumentFields;

/**
* @param string $manualCheck
* @param string|null $chipData
* @param bool|null $createExpandedDocumentFields
*/
public function __construct(string $manualCheck, ?string $chipData = null)
public function __construct(string $manualCheck, ?string $chipData = null, ?bool $createExpandedDocumentFields = false)
{
$this->manualCheck = $manualCheck;
$this->chipData = $chipData;
$this->createExpandedDocumentFields = $createExpandedDocumentFields;
}

/**
Expand All @@ -37,6 +44,7 @@ public function jsonSerialize(): stdClass
return (object)Json::withoutNullValues([
'manual_check' => $this->getManualCheck(),
'chip_data' => $this->getChipData(),
'create_expanded_document_fields' => $this->getCreateExpandedDocumentFields(),
]);
}

Expand All @@ -55,4 +63,12 @@ public function getChipData(): ?string
{
return $this->chipData;
}

/**
* @return bool
*/
public function getCreateExpandedDocumentFields(): ?bool
{
return $this->createExpandedDocumentFields;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(array $searchConfig)
$this->apiKey = $searchConfig['api_key'];
$this->monitoring = $searchConfig['monitoring'];
$this->clientRef = $searchConfig['client_ref'];
$this->tags = json_decode($searchConfig['tags'], true);
$this->tags = array_key_exists('tags', $searchConfig) ? json_decode($searchConfig['tags'], true) : [];
}

/**
Expand Down
17 changes: 17 additions & 0 deletions src/DocScan/Session/Retrieve/IdDocumentResourceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class IdDocumentResourceResponse extends ResourceResponse
*/
private $documentFields;

/**
* @var ExpandedDocumentFieldsResponse|null
*/
private $expandedDocumentFields;

/**
* @var DocumentIdPhotoResponse|null
*/
Expand All @@ -49,6 +54,10 @@ public function __construct(array $idDocument)
$this->documentFields = isset($idDocument['document_fields'])
? new DocumentFieldsResponse($idDocument['document_fields'])
: null;

$this->expandedDocumentFields = isset($idDocument['expanded_document_fields'])
? new ExpandedDocumentFieldsResponse($idDocument['expanded_document_fields'])
: null;

$this->documentIdPhoto = isset($idDocument['document_id_photo'])
? new DocumentIdPhotoResponse($idDocument['document_id_photo'])
Expand Down Expand Up @@ -87,6 +96,14 @@ public function getDocumentFields(): ?DocumentFieldsResponse
return $this->documentFields;
}

/**
* @return ExpandedDocumentFieldsResponse|null
*/
public function getExpandedDocumentFields(): ?ExpandedDocumentFieldsResponse
{
return $this->expandedDocumentFields;
}

/**
* @return DocumentIdPhotoResponse|null
*/
Expand Down
4 changes: 4 additions & 0 deletions tests/DocScan/Session/Create/SdkConfigBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class SdkConfigBuilderTest extends TestCase
private const SOME_PRIVACY_POLICY_URL = 'somePrivacyPolicyUrl';
private const SOME_CATEGORY = 'someCategory';
private const SOME_NUMBER_RETRIES = 5;
private const SOME_BIOMETRIC_CONSENT_FLOW = 'someBiometricConsentFlow';


/**
* @test
Expand Down Expand Up @@ -118,6 +120,7 @@ public function shouldProduceTheCorrectJsonString()
->withErrorUrl(self::SOME_ERROR_URL)
->withPrivacyPolicyUrl(self::SOME_PRIVACY_POLICY_URL)
->withAllowHandoff(true)
->withBiometricConsentFlow(self::SOME_BIOMETRIC_CONSENT_FLOW)
->build();

$expected = [
Expand All @@ -131,6 +134,7 @@ public function shouldProduceTheCorrectJsonString()
'error_url' => self::SOME_ERROR_URL,
'privacy_policy_url' => self::SOME_PRIVACY_POLICY_URL,
'allow_handoff' => true,
'biometric_consent_flow' => self::SOME_BIOMETRIC_CONSENT_FLOW
];

$this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class RequestedSupplementaryDocTextExtractionTaskConfigTest extends TestCase
{
private const SOME_MANUAL_CHECK = 'someManualCheck';
private const SOME_EXPANDED_DOCUMENT_FIELDS = 'false';

/**
* @test
Expand All @@ -23,7 +24,7 @@ public function shouldSerializeToJsonCorrectlyWithRequiredProperties()
$result = new RequestedSupplementaryDocTextExtractionTaskConfig(self::SOME_MANUAL_CHECK);

$expected = [
'manual_check' => self::SOME_MANUAL_CHECK,
'manual_check' => self::SOME_MANUAL_CHECK
];

$this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class RequestedTextExtractionTaskConfigTest extends TestCase
{
private const SOME_MANUAL_CHECK = 'someManualCheck';
private const SOME_CHIP_DATA = 'someChipData';
private const SOME_EXPANDED_DOCUMENT_FIELDS = false;


/**
* @test
Expand All @@ -25,6 +27,7 @@ public function shouldSerializeToJsonCorrectlyWithRequiredProperties()

$expected = [
'manual_check' => self::SOME_MANUAL_CHECK,
'create_expanded_document_fields' => self::SOME_EXPANDED_DOCUMENT_FIELDS
];

$this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($result));
Expand All @@ -44,6 +47,7 @@ public function shouldSerializeToJsonCorrectlyWithAllProperties()
$expected = [
'manual_check' => self::SOME_MANUAL_CHECK,
'chip_data' => self::SOME_CHIP_DATA,
'create_expanded_document_fields' => self::SOME_EXPANDED_DOCUMENT_FIELDS
];

$this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($result));
Expand Down

0 comments on commit 1c8629c

Please sign in to comment.