diff --git a/examples/doc-scan/app/Http/Controllers/HomeController.php b/examples/doc-scan/app/Http/Controllers/HomeController.php index 6f75236a..c00c723e 100644 --- a/examples/doc-scan/app/Http/Controllers/HomeController.php +++ b/examples/doc-scan/app/Http/Controllers/HomeController.php @@ -137,6 +137,7 @@ public function show(Request $request, DocScanClient $client) ->withSuccessUrl(config('app.url') . '/success') ->withErrorUrl(config('app.url') . '/error') ->withPrivacyPolicyUrl(config('app.url') . '/privacy-policy') + ->withBiometricConsentFlow('EARLY') ->build() ) ->withRequiredDocument( diff --git a/src/DocScan/Session/Create/SdkConfig.php b/src/DocScan/Session/Create/SdkConfig.php index 453ad44a..51b85112 100644 --- a/src/DocScan/Session/Create/SdkConfig.php +++ b/src/DocScan/Session/Create/SdkConfig.php @@ -63,6 +63,11 @@ class SdkConfig implements \JsonSerializable */ private $attemptsConfiguration; + /** + * @var string|null + */ + private $biometricConsentFlow; + /** * @param string|null $allowedCaptureMethods * @param string|null $primaryColour @@ -75,6 +80,7 @@ class SdkConfig implements \JsonSerializable * @param string|null $privacyPolicyUrl * @param bool|null $allowHandoff * @param array|null $idDocumentTextDataExtractionRetriesConfig + * @param string|null $biometricConsentFlow */ public function __construct( ?string $allowedCaptureMethods, @@ -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; @@ -102,6 +110,8 @@ public function __construct( if (!is_null($idDocumentTextDataExtractionRetriesConfig)) { $this->attemptsConfiguration = new AttemptsConfiguration($idDocumentTextDataExtractionRetriesConfig); } + $this->biometricConsentFlow = $biometricConsentFlow; + } /** @@ -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() ]); } @@ -211,4 +222,12 @@ public function getAttemptsConfiguration(): ?AttemptsConfiguration { return $this->attemptsConfiguration; } + + /** + * @return string|null + */ + public function getBiometricConsentFlow(): ?string + { + return $this->biometricConsentFlow; + } } diff --git a/src/DocScan/Session/Create/SdkConfigBuilder.php b/src/DocScan/Session/Create/SdkConfigBuilder.php index c91adc05..acf30fcc 100644 --- a/src/DocScan/Session/Create/SdkConfigBuilder.php +++ b/src/DocScan/Session/Create/SdkConfigBuilder.php @@ -66,6 +66,11 @@ class SdkConfigBuilder */ private $idDocumentTextDataExtractionRetriesConfig; + /** + * @var string|null + */ + private $biometricConsentFlow; + public function withAllowsCamera(): self { return $this->withAllowedCaptureMethod(self::CAMERA); @@ -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 * @@ -203,7 +213,8 @@ public function build(): SdkConfig $this->errorUrl, $this->privacyPolicyUrl, $this->allowHandoff, - $this->idDocumentTextDataExtractionRetriesConfig + $this->idDocumentTextDataExtractionRetriesConfig, + $this->biometricConsentFlow ); } } diff --git a/tests/DocScan/Session/Create/SdkConfigBuilderTest.php b/tests/DocScan/Session/Create/SdkConfigBuilderTest.php index 5377c5b9..3c84f5d2 100644 --- a/tests/DocScan/Session/Create/SdkConfigBuilderTest.php +++ b/tests/DocScan/Session/Create/SdkConfigBuilderTest.php @@ -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 @@ -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 = [ @@ -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));