<?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);