Skip to content

Commit

Permalink
Merge pull request #257 from getyoti/release/3.14.0
Browse files Browse the repository at this point in the history
Release 3.14.0
  • Loading branch information
laurent-yoti authored Jan 8, 2021
2 parents fb1eabd + 3a665f6 commit 03babf5
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 18 deletions.
1 change: 1 addition & 0 deletions examples/doc-scan/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ router.get('/', controllers.indexController);
router.get('/success', controllers.successController);
router.get('/media', controllers.mediaController);
router.get('/error', controllers.errorController);
router.get('/privacy-policy', async (req, res) => res.render('pages/privacy-policy'));

app.use('/', router);

Expand Down
1 change: 1 addition & 0 deletions examples/doc-scan/src/controllers/index.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ async function createSession() {
.withPresetIssuingCountry('GBR')
.withSuccessUrl(`${config.YOTI_APP_BASE_URL}/success`)
.withErrorUrl(`${config.YOTI_APP_BASE_URL}/error`)
.withPrivacyPolicyUrl(`${config.YOTI_APP_BASE_URL}/privacy-policy`)
.build()
)
.withRequiredDocument(
Expand Down
10 changes: 10 additions & 0 deletions examples/doc-scan/views/pages/privacy-policy.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%- include('layout/header'); -%>
<div class="container">
<div class="row pt-4">
<div class="col">
<h1>Privacy Policy</h1>
<p>Demo Privacy Policy</p>
</div>
</div>
</div>
<%- include('layout/footer'); -%>
8 changes: 3 additions & 5 deletions examples/doc-scan/views/pages/success.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,9 @@
<div class="card">
<div class="card-header" id="sup-doc-file-<%= supDocNum %>">
<h4 class="mb-0">
<button class="btn btn-link" type="button">
<a href="/media?mediaId=<%= document.getDocumentFile().getMedia().getId() %>">
<a class="btn btn-link" type="button" href="/media?mediaId=<%= document.getDocumentFile().getMedia().getId() %>">
Download File
</a>
</button>
</a>
</h4>
</div>
</div>
Expand Down Expand Up @@ -633,4 +631,4 @@
<% } %>
</div>
<%- include('layout/footer'); -%>
<%- include('layout/footer'); -%>
53 changes: 44 additions & 9 deletions 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.13.1",
"version": "3.14.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.13.1
sonar.projectVersion = 3.14.0
sonar.exclusions=tests/**,examples/**,node_modules/**,coverage/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.verbose = true
Expand Down
16 changes: 15 additions & 1 deletion src/doc_scan_service/session/create/sdk.config.builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ class SdkConfigBuilder {
return this;
}

/**
* Sets the privacy policy URL
*
* @param {string} privacyPolicyUrl the privacy policy URL
*
* @returns {this}
*/
withPrivacyPolicyUrl(privacyPolicyUrl) {
Validation.isString(privacyPolicyUrl, 'privacyPolicyUrl');
this.privacyPolicyUrl = privacyPolicyUrl;
return this;
}

/**
* Builds the {@link SdkConfig} using the values supplied to the builder
*
Expand All @@ -152,7 +165,8 @@ class SdkConfigBuilder {
this.locale,
this.presetIssuingCountry,
this.successUrl,
this.errorUrl
this.errorUrl,
this.privacyPolicyUrl
);
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/doc_scan_service/session/create/sdk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SdkConfig {
* The success URL
* @param {string} errorUrl
* The error URL
* @param {string} privacyPolicyUrl
* The privacy policy URL
*/
constructor(
allowedCaptureMethods,
Expand All @@ -29,7 +31,8 @@ class SdkConfig {
locale,
presetIssuingCountry,
successUrl,
errorUrl
errorUrl,
privacyPolicyUrl
) {
Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true);
this.allowedCaptureMethods = allowedCaptureMethods;
Expand All @@ -54,6 +57,9 @@ class SdkConfig {

Validation.isString(errorUrl, 'errorUrl', true);
this.errorUrl = errorUrl;

Validation.isString(privacyPolicyUrl, 'privacyPolicyUrl', true);
this.privacyPolicyUrl = privacyPolicyUrl;
}

/**
Expand All @@ -69,6 +75,7 @@ class SdkConfig {
preset_issuing_country: this.presetIssuingCountry,
success_url: this.successUrl,
error_url: this.errorUrl,
privacy_policy_url: this.privacyPolicyUrl,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('SdkConfigBuilder', () => {
.withSuccessUrl('some-success-url')
.withLocale('some-url')
.withPresetIssuingCountry('some-country')
.withPrivacyPolicyUrl('some-privacy-policy-url')
.build();

const expectedJson = JSON.stringify({
Expand All @@ -24,6 +25,7 @@ describe('SdkConfigBuilder', () => {
preset_issuing_country: 'some-country',
success_url: 'some-success-url',
error_url: 'some-error-url',
privacy_policy_url: 'some-privacy-policy-url',
});

expect(JSON.stringify(sdkConfig)).toBe(expectedJson);
Expand Down

0 comments on commit 03babf5

Please sign in to comment.