From 3fc5fe1b351bc31a785a454991973db3016dcf03 Mon Sep 17 00:00:00 2001 From: David Grayston Date: Thu, 10 Sep 2020 11:49:57 +0100 Subject: [PATCH] SDK-1717: Add ID document comparison to demo --- .../src/controllers/index.controller.js | 25 +++++++++++++++++++ examples/doc-scan/views/pages/success.ejs | 22 ++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/examples/doc-scan/src/controllers/index.controller.js b/examples/doc-scan/src/controllers/index.controller.js index 3e4eb816..d8b52d2c 100644 --- a/examples/doc-scan/src/controllers/index.controller.js +++ b/examples/doc-scan/src/controllers/index.controller.js @@ -8,6 +8,9 @@ const { RequestedTextExtractionTaskBuilder, RequestedFaceMatchCheckBuilder, SdkConfigBuilder, + RequiredIdDocumentBuilder, + OrthogonalRestrictionsFilterBuilder, + RequestedIdDocumentComparisonCheckBuilder, } = require('yoti'); /** @@ -37,6 +40,10 @@ async function createSession() { .withManualCheckNever() .build() ) + .withRequestedCheck( + new RequestedIdDocumentComparisonCheckBuilder() + .build() + ) .withRequestedTask( new RequestedTextExtractionTaskBuilder() .withManualCheckNever() @@ -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); diff --git a/examples/doc-scan/views/pages/success.ejs b/examples/doc-scan/views/pages/success.ejs index bcd8c774..202d5474 100644 --- a/examples/doc-scan/views/pages/success.ejs +++ b/examples/doc-scan/views/pages/success.ejs @@ -138,6 +138,28 @@ <% } %> + + <% if (sessionResult.getIdDocumentComparisonChecks().length > 0) { %> +
+
+

+ +

+
+ +
+
+ <% sessionResult.getIdDocumentComparisonChecks().forEach(function(check){ %> + <%- include('partials/check', { check }); %> + <% }); %> +
+
+
+ <% } %>