diff --git a/examples/doc-scan/index.js b/examples/doc-scan/index.js index 6a4678e5..feef93fa 100644 --- a/examples/doc-scan/index.js +++ b/examples/doc-scan/index.js @@ -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); diff --git a/examples/doc-scan/src/controllers/index.controller.js b/examples/doc-scan/src/controllers/index.controller.js index 7fd26056..25de95f2 100644 --- a/examples/doc-scan/src/controllers/index.controller.js +++ b/examples/doc-scan/src/controllers/index.controller.js @@ -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( diff --git a/examples/doc-scan/views/pages/privacy-policy.ejs b/examples/doc-scan/views/pages/privacy-policy.ejs new file mode 100755 index 00000000..ffc0513b --- /dev/null +++ b/examples/doc-scan/views/pages/privacy-policy.ejs @@ -0,0 +1,10 @@ +<%- include('layout/header'); -%> +
+
+
+

Privacy Policy

+

Demo Privacy Policy

+
+
+
+<%- include('layout/footer'); -%> \ No newline at end of file diff --git a/examples/doc-scan/views/pages/success.ejs b/examples/doc-scan/views/pages/success.ejs index eb60240b..64063006 100644 --- a/examples/doc-scan/views/pages/success.ejs +++ b/examples/doc-scan/views/pages/success.ejs @@ -502,11 +502,9 @@

- +

@@ -633,4 +631,4 @@ <% } %> -<%- include('layout/footer'); -%> \ No newline at end of file +<%- include('layout/footer'); -%> diff --git a/package-lock.json b/package-lock.json index 07df3001..b33cf242 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "yoti", - "version": "3.13.1", + "version": "3.14.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1109,6 +1109,16 @@ "unset-value": "^1.0.0" } }, + "call-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", + "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.0" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -1292,9 +1302,9 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "confusing-browser-globals": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz", - "integrity": "sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz", + "integrity": "sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA==", "dev": true }, "contains-path": { @@ -1709,14 +1719,28 @@ } }, "eslint-config-airbnb-base": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.0.tgz", - "integrity": "sha512-Snswd5oC6nJaevs3nZoLSTvGJBvzTfnBqOIArkf3cbyTyq9UD79wOk8s+RiL6bhca0p/eRO6veczhf6A/7Jy8Q==", + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", "dev": true, "requires": { - "confusing-browser-globals": "^1.0.9", - "object.assign": "^4.1.0", + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", "object.entries": "^1.1.2" + }, + "dependencies": { + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + } } }, "eslint-import-resolver-node": { @@ -2334,6 +2358,17 @@ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-intrinsic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", + "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", diff --git a/package.json b/package.json index 614f712e..4b60a546 100644 --- a/package.json +++ b/package.json @@ -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 (https://www.yoti.com/developers)", "license": "MIT", diff --git a/sonar-project.properties b/sonar-project.properties index f38fc803..2ea81f85 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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 diff --git a/src/doc_scan_service/session/create/sdk.config.builder.js b/src/doc_scan_service/session/create/sdk.config.builder.js index f505fb2e..3c385d88 100644 --- a/src/doc_scan_service/session/create/sdk.config.builder.js +++ b/src/doc_scan_service/session/create/sdk.config.builder.js @@ -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 * @@ -152,7 +165,8 @@ class SdkConfigBuilder { this.locale, this.presetIssuingCountry, this.successUrl, - this.errorUrl + this.errorUrl, + this.privacyPolicyUrl ); } } diff --git a/src/doc_scan_service/session/create/sdk.config.js b/src/doc_scan_service/session/create/sdk.config.js index a26f1de6..f7b6d668 100644 --- a/src/doc_scan_service/session/create/sdk.config.js +++ b/src/doc_scan_service/session/create/sdk.config.js @@ -20,6 +20,8 @@ class SdkConfig { * The success URL * @param {string} errorUrl * The error URL + * @param {string} privacyPolicyUrl + * The privacy policy URL */ constructor( allowedCaptureMethods, @@ -29,7 +31,8 @@ class SdkConfig { locale, presetIssuingCountry, successUrl, - errorUrl + errorUrl, + privacyPolicyUrl ) { Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true); this.allowedCaptureMethods = allowedCaptureMethods; @@ -54,6 +57,9 @@ class SdkConfig { Validation.isString(errorUrl, 'errorUrl', true); this.errorUrl = errorUrl; + + Validation.isString(privacyPolicyUrl, 'privacyPolicyUrl', true); + this.privacyPolicyUrl = privacyPolicyUrl; } /** @@ -69,6 +75,7 @@ class SdkConfig { preset_issuing_country: this.presetIssuingCountry, success_url: this.successUrl, error_url: this.errorUrl, + privacy_policy_url: this.privacyPolicyUrl, }; } } diff --git a/tests/doc_scan_service/session/create/sdk.config.builder.test.js b/tests/doc_scan_service/session/create/sdk.config.builder.test.js index 52dc3e5b..c12fafd1 100644 --- a/tests/doc_scan_service/session/create/sdk.config.builder.test.js +++ b/tests/doc_scan_service/session/create/sdk.config.builder.test.js @@ -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({ @@ -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);