Skip to content

Commit

Permalink
Merge pull request #287 from getyoti/release/3.18.0
Browse files Browse the repository at this point in the history
Release/3.18.0
  • Loading branch information
laurent-yoti authored Aug 17, 2021
2 parents 3bba7f0 + 2fc8002 commit ab967ab
Show file tree
Hide file tree
Showing 74 changed files with 3,048 additions and 247 deletions.
21 changes: 21 additions & 0 deletions examples/doc-scan/src/controllers/index.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const {
RequestedIdDocumentComparisonCheckBuilder,
RequestedThirdPartyIdentityCheckBuilder,
RequestedWatchlistScreeningCheckBuilder,
RequestedWatchlistAdvancedCaCheckBuilder,
RequestedYotiAccountWatchlistAdvancedCaConfigBuilder,
RequestedFuzzyMatchingStrategyBuilder,
RequestedTypeListSourcesBuilder,
RequiredSupplementaryDocumentBuilder,
ProofOfAddressObjectiveBuilder,
RequestedSupplementaryDocTextExtractionTaskBuilder,
Expand All @@ -27,6 +31,18 @@ async function createSession() {
config.YOTI_PEM
);

const yotiAccountWatchListAdvancedCaConfig =
new RequestedYotiAccountWatchlistAdvancedCaConfigBuilder()
.withRemoveDeceased(true)
.withShareUrl(true)
.withSources(new RequestedTypeListSourcesBuilder()
.withTypes(['pep', 'fitness-probity', 'warning'])
.build())
.withMatchingStrategy(new RequestedFuzzyMatchingStrategyBuilder()
.withFuzziness(0.5)
.build())
.build();

const sessionSpec = new SessionSpecificationBuilder()
.withClientSessionTokenTtl(600)
.withResourcesTtl(90000)
Expand Down Expand Up @@ -60,6 +76,11 @@ async function createSession() {
.withSanctionsCategory()
.build()
)
.withRequestedCheck(
new RequestedWatchlistAdvancedCaCheckBuilder()
.withConfig(yotiAccountWatchListAdvancedCaConfig)
.build()
)
.withRequestedTask(
new RequestedTextExtractionTaskBuilder()
.withManualCheckAlways()
Expand Down
4 changes: 3 additions & 1 deletion examples/doc-scan/src/controllers/success.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ const {
} = require('yoti');

module.exports = async (req, res) => {
const sessionIdFromQuery = req.query && req.query.sessionID;
const sessionId = sessionIdFromQuery || req.session.DOC_SCAN_SESSION_ID;
const docScanClient = new DocScanClient(
config.YOTI_CLIENT_SDK_ID,
config.YOTI_PEM
);

try {
const sessionResult = await docScanClient.getSession(req.session.DOC_SCAN_SESSION_ID);
const sessionResult = await docScanClient.getSession(sessionId);
res.render('pages/success', { sessionResult });
} catch (error) {
res.render('pages/error', { error });
Expand Down
196 changes: 169 additions & 27 deletions examples/doc-scan/views/pages/partials/check.ejs

Large diffs are not rendered by default.

26 changes: 24 additions & 2 deletions examples/doc-scan/views/pages/success.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
<div id="collapse-third-party-identity-checks" class="collapse" aria-labelledby="collapse-third-party-identity-checks">
<div class="card-body">
<% sessionResult.getThirdPartyIdentityChecks().forEach(function(check){ %>
<%- include('partials/check', { check, hasGeneratedProfile: true }); %>
<%- include('partials/check', { check }); %>
<% }); %>
</div>
</div>
Expand All @@ -206,7 +206,29 @@
<div id="collapse-watch-list-screening-checks" class="collapse" aria-labelledby="collapse-watch-list-screening-checks">
<div class="card-body">
<% sessionResult.getWatchlistScreeningChecks().forEach(function(check){ %>
<%- include('partials/check', { check, hasGeneratedProfile: true, hasWatchlistSummary: true }); %>
<%- include('partials/check', { check }); %>
<% }); %>
</div>
</div>
</div>
<% } %>
<% if (sessionResult.getWatchlistAdvancedCaChecks().length > 0) { %>
<div class="card">
<div class="card-header" id="watch-list-advanced-ca-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-watch-list-advanced-ca-checks" aria-expanded="true"
aria-controls="collapse-watch-list-advanced-ca-checks">
Watchlist Advanced Checks
</button>
</h3>
</div>
<div id="collapse-watch-list-advanced-ca-checks" class="collapse" aria-labelledby="collapse-watch-list-advanced-ca-checks">
<div class="card-body">
<% sessionResult.getWatchlistAdvancedCaChecks().forEach(function(check){ %>
<%- include('partials/check', { check }); %>
<% }); %>
</div>
</div>
Expand Down
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const {
RequestedIdDocumentComparisonCheckBuilder,
RequestedThirdPartyIdentityCheckBuilder,
RequestedWatchlistScreeningCheckBuilder,
RequestedWatchlistAdvancedCaCheckBuilder,
RequestedFaceMatchCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
Expand All @@ -39,6 +40,12 @@ const {
DocumentRestrictionBuilder,
OrthogonalRestrictionsFilterBuilder,
ProofOfAddressObjectiveBuilder,
RequestedCustomAccountWatchlistAdvancedCaConfigBuilder,
RequestedYotiAccountWatchlistAdvancedCaConfigBuilder,
RequestedExactMatchingStrategyBuilder,
RequestedFuzzyMatchingStrategyBuilder,
RequestedSearchProfileSourcesBuilder,
RequestedTypeListSourcesBuilder,
} = require('./src/doc_scan_service');

module.exports = {
Expand Down Expand Up @@ -68,6 +75,7 @@ module.exports = {
RequestedIdDocumentComparisonCheckBuilder,
RequestedThirdPartyIdentityCheckBuilder,
RequestedWatchlistScreeningCheckBuilder,
RequestedWatchlistAdvancedCaCheckBuilder,
RequestedFaceMatchCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
Expand All @@ -78,4 +86,10 @@ module.exports = {
DocumentRestrictionBuilder,
OrthogonalRestrictionsFilterBuilder,
ProofOfAddressObjectiveBuilder,
RequestedCustomAccountWatchlistAdvancedCaConfigBuilder,
RequestedYotiAccountWatchlistAdvancedCaConfigBuilder,
RequestedExactMatchingStrategyBuilder,
RequestedFuzzyMatchingStrategyBuilder,
RequestedSearchProfileSourcesBuilder,
RequestedTypeListSourcesBuilder,
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yoti",
"version": "3.17.0",
"version": "3.18.0",
"description": "Yoti NodeJS SDK for back-end integration",
"author": "Yoti LTD <[email protected]> (https://www.yoti.com/developers)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.organization = getyoti

sonar.projectKey = getyoti:node
sonar.projectName = Node SDK
sonar.projectVersion = 3.17.0
sonar.projectVersion = 3.18.0
sonar.exclusions=tests/**,examples/**,node_modules/**,coverage/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.verbose = true
Expand Down
7 changes: 7 additions & 0 deletions src/doc_scan_service/doc.scan.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = Object.freeze({
ID_DOCUMENT_COMPARISON: 'ID_DOCUMENT_COMPARISON',
THIRD_PARTY_IDENTITY: 'THIRD_PARTY_IDENTITY',
WATCHLIST_SCREENING: 'WATCHLIST_SCREENING',
WATCHLIST_ADVANCED_CA: 'WATCHLIST_ADVANCED_CA',
ADVERSE_MEDIA: 'ADVERSE-MEDIA',
SANCTIONS: 'SANCTIONS',
LIVENESS: 'LIVENESS',
Expand All @@ -38,4 +39,10 @@ module.exports = Object.freeze({
PROOF_OF_ADDRESS: 'PROOF_OF_ADDRESS',
BASIC: 'BASIC',
BEARER: 'BEARER',
WITH_YOTI_ACCOUNT: 'WITH_YOTI_ACCOUNT',
WITH_CUSTOM_ACCOUNT: 'WITH_CUSTOM_ACCOUNT',
TYPE_LIST: 'TYPE_LIST',
PROFILE: 'PROFILE',
EXACT: 'EXACT',
FUZZY: 'FUZZY',
});
14 changes: 14 additions & 0 deletions src/doc_scan_service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const RequestedDocumentAuthenticityCheckBuilder = require('./session/create/chec
const RequestedIdDocumentComparisonCheckBuilder = require('./session/create/check/requested.id.document.comparison.check.builder');
const RequestedThirdPartyIdentityCheckBuilder = require('./session/create/check/requested.third.party.identity.check.builder');
const RequestedWatchlistScreeningCheckBuilder = require('./session/create/check/requested.watchlist.screening.check.builder');
const RequestedWatchlistAdvancedCaCheckBuilder = require('./session/create/check/requested.watchlist.advanced.ca.check.builder');
const RequestedFaceMatchCheckBuilder = require('./session/create/check/requested.face.match.check.builder');
const RequestedLivenessCheckBuilder = require('./session/create/check/requested.liveness.check.builder');
const RequestedTextExtractionTaskBuilder = require('./session/create/task/requested.text.extraction.task.builder');
Expand All @@ -19,6 +20,12 @@ const DocumentRestrictionsFilterBuilder = require('./session/create/filters/docu
const OrthogonalRestrictionsFilterBuilder = require('./session/create/filters/orthogonal/orthogonal.restrictions.filter.builder');
const DocumentRestrictionBuilder = require('./session/create/filters/document/document.restriction.builder');
const ProofOfAddressObjectiveBuilder = require('./session/create/objective/proof.of.address.objective.builder');
const RequestedYotiAccountWatchlistAdvancedCaConfigBuilder = require('./session/create/check/requested.yoti.account.watchlist.advanced.ca.config.builder');
const RequestedCustomAccountWatchlistAdvancedCaConfigBuilder = require('./session/create/check/requested.custom.account.watchlist.advanced.ca.config.builder');
const RequestedExactMatchingStrategyBuilder = require('./session/create/check/requested.exact.matching.strategy.builder');
const RequestedFuzzyMatchingStrategyBuilder = require('./session/create/check/requested.fuzzy.matching.strategy.builder');
const RequestedTypeListSourcesBuilder = require('./session/create/check/requested.type.list.sources.builder');
const RequestedSearchProfileSourcesBuilder = require('./session/create/check/requested.search.profile.sources.builder');

module.exports = {
DocScanService,
Expand All @@ -30,6 +37,7 @@ module.exports = {
RequestedIdDocumentComparisonCheckBuilder,
RequestedThirdPartyIdentityCheckBuilder,
RequestedWatchlistScreeningCheckBuilder,
RequestedWatchlistAdvancedCaCheckBuilder,
RequestedFaceMatchCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
Expand All @@ -40,4 +48,10 @@ module.exports = {
DocumentRestrictionBuilder,
OrthogonalRestrictionsFilterBuilder,
ProofOfAddressObjectiveBuilder,
RequestedYotiAccountWatchlistAdvancedCaConfigBuilder,
RequestedCustomAccountWatchlistAdvancedCaConfigBuilder,
RequestedExactMatchingStrategyBuilder,
RequestedFuzzyMatchingStrategyBuilder,
RequestedSearchProfileSourcesBuilder,
RequestedTypeListSourcesBuilder,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const Validation = require('../../../../yoti_common/validation');
/**
*
* @class RequestedCaMatchingStrategy
*/
class RequestedCaMatchingStrategy {
constructor(type) {
if (new.target === RequestedCaMatchingStrategy) {
throw TypeError('RequestedCaMatchingStrategy cannot be instantiated');
}

Validation.notNullOrEmpty(type, 'type');
Validation.isString(type, 'type');
this.type = type;
}
}

module.exports = RequestedCaMatchingStrategy;
20 changes: 20 additions & 0 deletions src/doc_scan_service/session/create/check/requested.ca.sources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

const Validation = require('../../../../yoti_common/validation');
/**
*
* @class RequestedCaSources
*/
class RequestedCaSources {
constructor(type) {
if (new.target === RequestedCaSources) {
throw TypeError('RequestedCaSources cannot be instantiated');
}

Validation.notNullOrEmpty(type, 'type');
Validation.isString(type, 'type');
this.type = type;
}
}

module.exports = RequestedCaSources;
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'use strict';

const Validation = require('../../../../yoti_common/validation');
const RequestedCustomAccountWatchlistAdvancedCaConfig = require('./requested.custom.account.watchlist.advanced.ca.config');
const RequestedWatchlistAdvancedCaConfigBuilder = require('./requested.watchlist.advanced.ca.config.builder');

/**
* Builder to assist creation of {@link RequestedCustomAccountWatchlistAdvancedCaConfig}.
*
* @class RequestedWatchlistScreeningConfig
*/
// eslint-disable-next-line max-len
class RequestedCustomAccountWatchlistAdvancedCaConfigBuilder extends RequestedWatchlistAdvancedCaConfigBuilder {
/**
* Sets monitoring used for custom account watchlist advanced ca
*
* @param apiKey {string}
*
* @returns {this}
*/
withApiKey(apiKey) {
Validation.notNullOrEmpty(apiKey, 'apiKey');
Validation.isString(apiKey, 'apiKey');
this.apiKey = apiKey;
return this;
}

/**
* Sets monitoring used for custom account watchlist advanced ca
*
* @param monitoring {boolean}
*
* @returns {this}
*/
withMonitoring(monitoring) {
Validation.isBoolean(monitoring, 'monitoring');
this.monitoring = monitoring;
return this;
}

/**
* Sets tags used for custom account watchlist advanced ca
*
* @param tags {object}
*
* @returns {this}
*/
withTags(tags) {
Validation.isPlainObject(tags, 'tags');
Validation.isArrayOfStrings(Object.keys(tags), 'tags.keys');
Object.keys(tags).forEach((key) => {
Validation.notNull(tags[key], `tags.${key}`);
});
this.tags = tags;
return this;
}

/**
* Sets monitoring used for custom account watchlist advanced ca
*
* @param clientRef {string}
*
* @returns {this}
*/
withClientRef(clientRef) {
Validation.notNullOrEmpty(clientRef, 'clientRef');
Validation.isString(clientRef, 'clientRef');
this.clientRef = clientRef;
return this;
}

/**
*
* @return {RequestedCustomAccountWatchlistAdvancedCaConfig}
*/
build() {
return new RequestedCustomAccountWatchlistAdvancedCaConfig(
this.removeDeceased,
this.shareUrl,
this.sources,
this.matchingStrategy,
this.apiKey,
this.monitoring,
this.tags,
this.clientRef
);
}
}

module.exports = RequestedCustomAccountWatchlistAdvancedCaConfigBuilder;
Loading

0 comments on commit ab967ab

Please sign in to comment.