Skip to content

Commit

Permalink
SDK-1717: Add ID document comparison to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgrayston committed Sep 15, 2020
1 parent dcf32e2 commit 3fc5fe1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/doc-scan/src/controllers/index.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const {
RequestedTextExtractionTaskBuilder,
RequestedFaceMatchCheckBuilder,
SdkConfigBuilder,
RequiredIdDocumentBuilder,
OrthogonalRestrictionsFilterBuilder,
RequestedIdDocumentComparisonCheckBuilder,
} = require('yoti');

/**
Expand Down Expand Up @@ -37,6 +40,10 @@ async function createSession() {
.withManualCheckNever()
.build()
)
.withRequestedCheck(
new RequestedIdDocumentComparisonCheckBuilder()
.build()
)
.withRequestedTask(
new RequestedTextExtractionTaskBuilder()
.withManualCheckNever()
Expand All @@ -55,6 +62,24 @@ async function createSession() {
.withErrorUrl(`${config.YOTI_APP_BASE_URL}/error`)
.build()
)
.withRequiredDocument(
(new RequiredIdDocumentBuilder())
.withFilter(
(new OrthogonalRestrictionsFilterBuilder())
.withWhitelistedDocumentTypes(['PASSPORT'])
.build()
)
.build()
)
.withRequiredDocument(
(new RequiredIdDocumentBuilder())
.withFilter(
(new OrthogonalRestrictionsFilterBuilder())
.withWhitelistedDocumentTypes(['DRIVING_LICENCE'])
.build()
)
.build()
)
.build();

return docScanClient.createSession(sessionSpec);
Expand Down
22 changes: 22 additions & 0 deletions examples/doc-scan/views/pages/success.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,28 @@
</div>
</div>
<% } %>
<% if (sessionResult.getIdDocumentComparisonChecks().length > 0) { %>
<div class="card">
<div class="card-header" id="comparison-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-comparison-checks" aria-expanded="true"
aria-controls="collapse-comparison-checks">
ID Document Comparison Checks
</button>
</h3>
</div>
<div id="collapse-comparison-checks" class="collapse" aria-labelledby="comparison-checks">
<div class="card-body">
<% sessionResult.getIdDocumentComparisonChecks().forEach(function(check){ %>
<%- include('partials/check', { check }); %>
<% }); %>
</div>
</div>
</div>
<% } %>
</div>
</div>
</div>
Expand Down

0 comments on commit 3fc5fe1

Please sign in to comment.