Skip to content

Commit 25cbde5

Browse files
LuborRodRodion Liuborets
andauthored
 SDK-1913 add support for watchlist advanced ca check (#235)
* SDK-1913:Add new check * SDK-1913:Add new response * SDK-1913:Add tests * SDK-1913: Update demo project with WATCHLIST_ADVANCED_CA check * SDK-1913 Small fix for WatchlistCheckResponse * SDK-1913 Add several tests Co-authored-by: Rodion Liuborets <[email protected]>
1 parent fc310fe commit 25cbde5

File tree

45 files changed

+1487
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1487
-90
lines changed

examples/doc-scan/app/Http/Controllers/HomeController.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
use Illuminate\Http\Request;
66
use Illuminate\Routing\Controller as BaseController;
77
use Yoti\DocScan\DocScanClient;
8+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedFuzzyMatchingStrategy;
9+
use Yoti\DocScan\Session\Create\Check\Advanced\RequestedSearchProfileSources;
810
use Yoti\DocScan\Session\Create\Check\RequestedDocumentAuthenticityCheckBuilder;
911
use Yoti\DocScan\Session\Create\Check\RequestedFaceMatchCheckBuilder;
1012
use Yoti\DocScan\Session\Create\Check\RequestedIdDocumentComparisonCheckBuilder;
1113
use Yoti\DocScan\Session\Create\Check\RequestedLivenessCheckBuilder;
1214
use Yoti\DocScan\Session\Create\Check\RequestedThirdPartyIdentityCheckBuilder;
15+
use Yoti\DocScan\Session\Create\Check\RequestedWatchlistAdvancedCaCheckBuilder;
1316
use Yoti\DocScan\Session\Create\Check\RequestedWatchlistScreeningCheckBuilder;
1417
use Yoti\DocScan\Session\Create\Check\RequestedWatchlistScreeningConfigBuilder;
18+
use Yoti\DocScan\Session\Create\Check\RequestedYotiAccountWatchlistAdvancedCaConfigBuilder;
1519
use Yoti\DocScan\Session\Create\Filters\Orthogonal\OrthogonalRestrictionsFilterBuilder;
1620
use Yoti\DocScan\Session\Create\Filters\RequiredIdDocumentBuilder;
1721
use Yoti\DocScan\Session\Create\Filters\RequiredSupplementaryDocumentBuilder;
@@ -30,6 +34,13 @@ public function show(Request $request, DocScanClient $client)
3034
->withAdverseMediaCategory()
3135
->build();
3236

37+
$watchlistAdvancedConfig = (new RequestedYotiAccountWatchlistAdvancedCaConfigBuilder())
38+
->withRemoveDeceased(true)
39+
->withShareUrl(false)
40+
->withSources(new RequestedSearchProfileSources('SOME_PROFILE'))
41+
->withMatchingStrategy(new RequestedFuzzyMatchingStrategy(0.5))
42+
->build();
43+
3344
$sessionSpec = (new SessionSpecificationBuilder())
3445
->withClientSessionTokenTtl(600)
3546
->withResourcesTtl(90000)
@@ -61,6 +72,11 @@ public function show(Request $request, DocScanClient $client)
6172
->withConfig($watchScreeningConfig)
6273
->build()
6374
)
75+
->withRequestedCheck(
76+
(new RequestedWatchlistAdvancedCaCheckBuilder())
77+
->withConfig($watchlistAdvancedConfig)
78+
->build()
79+
)
6480
->withRequestedTask(
6581
(new RequestedTextExtractionTaskBuilder())
6682
->withManualCheckAlways()
Lines changed: 80 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
<table class="table table-striped">
22
<tbody>
3-
<tr>
4-
<td>ID</td>
5-
<td>{{ $check->getId() }}</td>
6-
</tr>
7-
<tr>
8-
<td>State</td>
9-
<td>
3+
<tr>
4+
<td>ID</td>
5+
<td>{{ $check->getId() }}</td>
6+
</tr>
7+
<tr>
8+
<td>State</td>
9+
<td>
1010
<span class="badge badge-{{ $check->getState() == 'DONE' ? 'success' : 'secondary' }}">
1111
{{ $check->getState() }}
1212
</span>
13-
</td>
14-
</tr>
15-
<tr>
16-
<td>Created</td>
17-
<td>{{ $check->getCreated()->format('r') }}</td>
18-
</tr>
19-
<tr>
20-
<td>Last Updated</td>
21-
<td>{{ $check->getLastUpdated()->format('r') }}</td>
22-
</tr>
23-
<tr>
24-
<td>Resources Used</td>
25-
<td>{{ implode(', ', $check->getResourcesUsed()) }}</td>
26-
</tr>
13+
</td>
14+
</tr>
15+
<tr>
16+
<td>Created</td>
17+
<td>{{ $check->getCreated()->format('r') }}</td>
18+
</tr>
19+
<tr>
20+
<td>Last Updated</td>
21+
<td>{{ $check->getLastUpdated()->format('r') }}</td>
22+
</tr>
23+
<tr>
24+
<td>Resources Used</td>
25+
<td>{{ implode(', ', $check->getResourcesUsed()) }}</td>
26+
</tr>
2727

2828

29-
@if ($check->getReport())
29+
@if ($check->getReport())
3030

3131
@if ($check->getReport()->getRecommendation())
32-
<tr>
33-
<td>Recommendation</td>
34-
<td>
35-
<table class="table table-bordered">
36-
<tbody>
32+
<tr>
33+
<td>Recommendation</td>
34+
<td>
35+
<table class="table table-bordered">
36+
<tbody>
3737
<tr>
3838
<td>Value</td>
3939
<td>{{ $check->getReport()->getRecommendation()->getValue() }}</td>
@@ -46,60 +46,60 @@
4646
<td>Recovery Suggestion</td>
4747
<td>{{ $check->getReport()->getRecommendation()->getRecoverySuggestion() }}</td>
4848
</tr>
49-
</tbody>
50-
</table>
51-
</td>
52-
</tr>
49+
</tbody>
50+
</table>
51+
</td>
52+
</tr>
5353
@endif
5454

5555
@if (count($check->getReport()->getBreakdown()) > 0)
56-
<tr>
57-
<td>Breakdown</td>
58-
<td>
59-
@foreach ($check->getReport()->getBreakdown() as $breakdown)
60-
<table class="table table-bordered">
61-
<tbody>
62-
<tr>
63-
<td>Sub Check</td>
64-
<td>{{ $breakdown->getSubCheck() }}</td>
65-
</tr>
66-
<tr>
67-
<td>Result</td>
68-
<td>{{ $breakdown->getResult() }}</td>
69-
</tr>
70-
@if (count($breakdown->getDetails()) > 0)
71-
<tr>
72-
<td>Details</td>
73-
<td>
74-
<table class="table table-striped">
75-
<tbody>
76-
@foreach ($breakdown->getDetails() as $details)
77-
<tr>
78-
<td>{{ $details->getName() }}</td>
79-
<td>{{ $details->getValue() }}</td>
80-
</tr>
81-
@endforeach
82-
</tbody>
83-
</table>
84-
</td>
85-
</tr>
86-
@endif
87-
</tbody>
88-
</table>
89-
@endforeach
90-
</td>
91-
</tr>
56+
<tr>
57+
<td>Breakdown</td>
58+
<td>
59+
@foreach ($check->getReport()->getBreakdown() as $breakdown)
60+
<table class="table table-bordered">
61+
<tbody>
62+
<tr>
63+
<td>Sub Check</td>
64+
<td>{{ $breakdown->getSubCheck() }}</td>
65+
</tr>
66+
<tr>
67+
<td>Result</td>
68+
<td>{{ $breakdown->getResult() }}</td>
69+
</tr>
70+
@if (count($breakdown->getDetails()) > 0)
71+
<tr>
72+
<td>Details</td>
73+
<td>
74+
<table class="table table-striped">
75+
<tbody>
76+
@foreach ($breakdown->getDetails() as $details)
77+
<tr>
78+
<td>{{ $details->getName() }}</td>
79+
<td>{{ $details->getValue() }}</td>
80+
</tr>
81+
@endforeach
82+
</tbody>
83+
</table>
84+
</td>
85+
</tr>
86+
@endif
87+
</tbody>
88+
</table>
89+
@endforeach
90+
</td>
91+
</tr>
9292
@endif
9393

94-
@endif
94+
@endif
9595

96-
@if (count($check->getGeneratedMedia()) > 0)
96+
@if (count($check->getGeneratedMedia()) > 0)
9797
<tr>
9898
<td>Generated Media</td>
9999
<td>
100100
@foreach ($check->getGeneratedMedia() as $media)
101-
<table class="table table-striped">
102-
<tbody>
101+
<table class="table table-striped">
102+
<tbody>
103103
<tr>
104104
<td>ID</td>
105105
<td><a href="/media/{{ $media->getId() }}">{{ $media->getId() }}</a></td>
@@ -108,12 +108,18 @@
108108
<td>Type</td>
109109
<td>{{ $media->getType() }}</td>
110110
</tr>
111-
</tbody>
112-
</table>
111+
</tbody>
112+
</table>
113113
@endforeach
114114
</td>
115115
</tr>
116-
@endif
116+
@endif
117+
118+
@if ($check->getType() == 'WATCHLIST_ADVANCED_CA' && $check->getReport() != null)
119+
<tr>
120+
@include('partial/watchlist_advanced_raw_media', ['check' => $check])
121+
</tr>
122+
@endif
117123

118124
</tbody>
119125
</table>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<tr>
2+
<td>Raw Results Media</td>
3+
@if($check->getReport() != null)
4+
@if($check->getReport()->getWatchlistSummary() != null)
5+
<table class="table table-striped">
6+
<tbody>
7+
<tr>
8+
<td>ID</td>
9+
<td>
10+
<a href="/media/{{$check->getReport()->getWatchlistSummary()->getRawResults()->getMedia()->getId()}}">
11+
{{$check->getReport()->getWatchlistSummary()->getRawResults()->getMedia()->getId()}}
12+
</a>
13+
</td>
14+
</tr>
15+
<tr>
16+
<td>Type</td>
17+
<td>{{$check->getReport()->getWatchlistSummary()->getRawResults()->getMedia()->getType()}}</td>
18+
</tr>
19+
</tbody>
20+
</table>
21+
@endif
22+
@endif
23+
</tr>

examples/doc-scan/resources/views/success.blade.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,30 @@
242242
</div>
243243
</div>
244244
@endif
245+
246+
@if (count($sessionResult->getWatchlistAdvancedCaChecks()) > 0)
247+
<div class="card">
248+
<div class="card-header" id="watchlist-advanced-ca-checks">
249+
<h3 class="mb-0">
250+
<button class="btn btn-link" type="button" data-toggle="collapse"
251+
data-target="#collapse-watchlist-advanced-ca-checks"
252+
aria-expanded="true"
253+
aria-controls="collapse-watchlist-advanced-ca-checks">
254+
Watchlist Advanced Checks
255+
</button>
256+
</h3>
257+
</div>
258+
259+
<div id="collapse-watchlist-advanced-ca-checks" class="collapse"
260+
aria-labelledby="watchlist-advanced-ca-checks">
261+
<div class="card-body">
262+
@foreach($sessionResult->getWatchlistAdvancedCaChecks() as $check)
263+
@include('partial/check', ['check' => $check])
264+
@endforeach
265+
</div>
266+
</div>
267+
</div>
268+
@endif
245269
</div>
246270
</div>
247271
</div>
@@ -642,7 +666,7 @@ class="badge badge-primary">{{ $document->getIssuingCountry() }}</span></h3>
642666

643667
<div class="accordion mt-3">
644668

645-
@if (count($livenessResource->getFrames()) > 0)
669+
@if ($livenessResource->getFrames() != null && count($livenessResource->getFrames()) > 0)
646670
<div class="card">
647671
<div class="card-header" id="liveness-{{ $livenessNum }}-frames">
648672
<h3 class="mb-0">

src/DocScan/Constants.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,19 @@ class Constants
1010
public const SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK = 'SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK';
1111
public const ID_DOCUMENT_FACE_MATCH = 'ID_DOCUMENT_FACE_MATCH';
1212
public const THIRD_PARTY_IDENTITY = 'THIRD_PARTY_IDENTITY';
13-
public const WATCHLIST_SCREENING = 'WATCHLIST_SCREENING';
1413
public const LIVENESS = 'LIVENESS';
14+
public const WATCHLIST_SCREENING = 'WATCHLIST_SCREENING';
15+
public const WATCHLIST_ADVANCED_CA = 'WATCHLIST_ADVANCED_CA';
16+
17+
public const WITH_YOTI_ACCOUNT = 'WITH_YOTI_ACCOUNT';
18+
public const WITH_CUSTOM_ACCOUNT = 'WITH_CUSTOM_ACCOUNT';
19+
public const TYPE_LIST = 'TYPE_LIST';
20+
public const PROFILE = 'PROFILE';
21+
public const EXACT = 'EXACT';
22+
public const FUZZY = 'FUZZY';
1523
public const FACE_CAPTURE = 'FACE_CAPTURE';
1624

25+
1726
public const ADVERSE_MEDIA = 'ADVERSE-MEDIA';
1827
public const SANCTIONS = 'SANCTIONS';
1928

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create\Check\Advanced;
6+
7+
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaMatchingStrategy;
8+
9+
class RequestedExactMatchingStrategy extends RequestedCaMatchingStrategy
10+
{
11+
/**
12+
* @return bool
13+
*/
14+
public function isExactMatch(): bool
15+
{
16+
return true;
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create\Check\Advanced;
6+
7+
class RequestedExactMatchingStrategyBuilder
8+
{
9+
/**
10+
* @return RequestedExactMatchingStrategy
11+
*/
12+
public function build(): RequestedExactMatchingStrategy
13+
{
14+
return new RequestedExactMatchingStrategy();
15+
}
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yoti\DocScan\Session\Create\Check\Advanced;
6+
7+
use Yoti\DocScan\Session\Create\Check\Contracts\Advanced\RequestedCaMatchingStrategy;
8+
9+
class RequestedFuzzyMatchingStrategy extends RequestedCaMatchingStrategy
10+
{
11+
/**
12+
* @var float
13+
*/
14+
private $fuzziness;
15+
16+
public function __construct(float $fuzziness)
17+
{
18+
$this->fuzziness = $fuzziness;
19+
}
20+
21+
/**
22+
* @return float
23+
*/
24+
public function getFuzziness(): float
25+
{
26+
return $this->fuzziness;
27+
}
28+
}

0 commit comments

Comments
 (0)