Skip to content

1.1.0

Compare
Choose a tag to compare
@davidgrayston davidgrayston released this 29 May 10:28
· 57 commits to master since this release
fed64a4

Added

  • Doc Scan sandbox support

Deprecated

  • Boolean argument 4 passed to Yoti\Sandbox\Profile\Request\Attribute\SandboxAttribute::__construct is deprecated and should be removed before 2.0.0
  • Boolean argument 2 passed to Yoti\Sandbox\Profile\Request\TokenRequestBuilder set methods is deprecated and should be removed before 2.0.0

Doc Scan Example

<?php

use Yoti\Sandbox\DocScan\Request\Check\Report\SandboxBreakdownBuilder;
use Yoti\Sandbox\DocScan\Request\Check\Report\SandboxRecommendationBuilder;
use Yoti\Sandbox\DocScan\Request\Check\SandboxDocumentAuthenticityCheckBuilder;
use Yoti\Sandbox\DocScan\Request\Check\SandboxDocumentFaceMatchCheckBuilder;
use Yoti\Sandbox\DocScan\Request\Check\SandboxDocumentTextDataCheckBuilder;
use Yoti\Sandbox\DocScan\Request\Check\SandboxZoomLivenessCheckBuilder;
use Yoti\Sandbox\DocScan\Request\SandboxCheckReportsBuilder;
use Yoti\Sandbox\DocScan\Request\SandboxDocumentFilterBuilder;
use Yoti\Sandbox\DocScan\Request\SandboxResponseConfigBuilder;
use Yoti\Sandbox\DocScan\Request\SandboxTaskResultsBuilder;
use Yoti\Sandbox\DocScan\Request\Task\SandboxDocumentTextDataExtractionTaskBuilder;
use Yoti\Sandbox\DocScan\SandboxClient;

$documentFilter = (new SandboxDocumentFilterBuilder())
    ->withCountryCode('GBR')
    ->withDocumentType('PASSPORT')
    ->build();

$responseConfig = (new SandboxResponseConfigBuilder())
    ->withCheckReports(
        (new SandboxCheckReportsBuilder())
            ->withAsyncReportDelay(10)
            ->withDocumentAuthenticityCheck(
                (new SandboxDocumentAuthenticityCheckBuilder())
                    ->withBreakdown(
                        (new SandboxBreakdownBuilder())
                            ->withSubCheck('security_features')
                            ->withResult('NOT_AVAILABLE')
                            ->withDetail('some_detail', 'some_detail_value')
                            ->build()
                    )
                    ->withRecommendation(
                        (new SandboxRecommendationBuilder())
                            ->withValue('NOT_AVAILABLE')
                            ->withReason('PICTURE_TOO_DARK')
                            ->withRecoverySuggestion('BETTER_LIGHTING')
                            ->build()
                    )
                    ->withDocumentFilter($documentFilter)
                    ->build()
            )
            ->withDocumentFaceMatchCheck(
                (new SandboxDocumentFaceMatchCheckBuilder())
                    ->withBreakdown(
                        (new SandboxBreakdownBuilder())
                            ->withSubCheck('security_features')
                            ->withResult('PASS')
                            ->build()
                    )
                    ->withRecommendation(
                        (new SandboxRecommendationBuilder())
                            ->withValue('APPROVE')
                            ->build()
                    )
                    ->withDocumentFilter($documentFilter)
                    ->build()
            )
            ->withDocumentTextDataCheck(
                (new SandboxDocumentTextDataCheckBuilder())
                    ->withBreakdown(
                        (new SandboxBreakdownBuilder())
                            ->withSubCheck('document_in_date')
                            ->withResult('PASS')
                            ->build()
                    )
                    ->withRecommendation(
                        (new SandboxRecommendationBuilder())
                            ->withValue('APPROVE')
                            ->build()
                    )
                    ->withDocumentFilter($documentFilter)
                    ->withDocumentFields([
                        'full_name' => 'John Doe',
                        'nationality' => 'GBR',
                        'date_of_birth' => '1986-06-01',
                        'document_number' => '123456789',
                    ])
                    ->build()
            )
            ->withLivenessCheck(
                (new SandboxZoomLivenessCheckBuilder())
                    ->withBreakdown(
                        (new SandboxBreakdownBuilder())
                            ->withSubCheck('security_features')
                            ->withResult('PASS')
                            ->build()
                    )
                    ->withRecommendation(
                        (new SandboxRecommendationBuilder())
                            ->withValue('APPROVE')
                            ->build()
                    )
                    ->build()
            )
            ->build()
    )
    ->withTaskResults(
        (new SandboxTaskResultsBuilder())
            ->withDocumentTextDataExtractionTask(
                (new SandboxDocumentTextDataExtractionTaskBuilder())
                    ->withDocumentFields([
                        'full_name' => 'John Doe',
                        'nationality' => 'GBR',
                        'date_of_birth' => '1986-06-01',
                        'document_number' => '123456789',
                    ])
                    ->withDocumentFilter($documentFilter)
                    ->build()
            )
            ->build()
    )
    ->build();

$client = new SandboxClient('SANDBOX_CLIENT_SDK_ID', '/path/to/your-pem-file.pem');
$client->configureSessionResponse('SESSION_ID', $responseConfig);