diff --git a/index.js b/index.js index 1c9613ea3..0c1c6ddfb 100644 --- a/index.js +++ b/index.js @@ -58,7 +58,7 @@ const { AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, - + AllowedProviderBuilder, } = require('./src/idv_service'); const YotiCommon = require('./src/yoti_common'); @@ -124,4 +124,5 @@ module.exports = { AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, + AllowedProviderBuilder, }; diff --git a/src/idv_service/index.js b/src/idv_service/index.js index 7a24f3835..606be95cd 100644 --- a/src/idv_service/index.js +++ b/src/idv_service/index.js @@ -33,6 +33,7 @@ const AdvancedIdentityProfileBuilder = require('./session/create/identity_profil const AdvancedIdentityProfileRequirementsBuilder = require('./session/create/identity_profile/advanced/advanced.identity.profile.requirements.builder'); const AdvancedIdentityProfileSchemeBuilder = require('./session/create/identity_profile/advanced/advanced.identity.profile.scheme.builder'); const AdvancedIdentityProfileSchemeConfigBuilder = require('./session/create/identity_profile/advanced/advanced.identity.profile.scheme.config'); +const AllowedProviderBuilder = require('./session/create/filters/allowed.provider.builder'); module.exports = { IDVService, @@ -68,4 +69,5 @@ module.exports = { AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, AdvancedIdentityProfileSchemeConfigBuilder, + AllowedProviderBuilder, }; diff --git a/src/idv_service/session/create/filters/allowed.provider.builder.js b/src/idv_service/session/create/filters/allowed.provider.builder.js new file mode 100644 index 000000000..fbbceb19d --- /dev/null +++ b/src/idv_service/session/create/filters/allowed.provider.builder.js @@ -0,0 +1,23 @@ +'use strict'; + +const Validation = require('../../../../yoti_common/validation'); +const AllowedProvider = require('./allowed.provider'); + +class AllowedProviderBuilder { + withName(provider) { + Validation.isString(provider, 'provider'); + this.name = provider; + return this; + } + + /** + * @returns {AllowedProvider} + */ + build() { + return new AllowedProvider( + this.name + ); + } +} + +module.exports = AllowedProviderBuilder; diff --git a/src/idv_service/session/create/filters/allowed.provider.js b/src/idv_service/session/create/filters/allowed.provider.js new file mode 100644 index 000000000..6186c4049 --- /dev/null +++ b/src/idv_service/session/create/filters/allowed.provider.js @@ -0,0 +1,22 @@ +'use strict'; + +const Validation = require('../../../../yoti_common/validation'); + +class AllowedProvider { + /** + * @param {string} name + */ + constructor(name) { + Validation.isString(name, 'name'); + /** @private */ + this.name = name; + } + + toJSON() { + return { + name: this.name, + }; + } +} + +module.exports = AllowedProvider; diff --git a/src/idv_service/session/create/filters/document.filter.js b/src/idv_service/session/create/filters/document.filter.js index 874ef24ec..eb5d41d56 100644 --- a/src/idv_service/session/create/filters/document.filter.js +++ b/src/idv_service/session/create/filters/document.filter.js @@ -1,12 +1,17 @@ 'use strict'; const Validation = require('../../../../yoti_common/validation'); +const AllowedProvider = require('./allowed.provider'); class DocumentFilter { /** * @param {string} type + * @param {boolean} allowExpiredDocuments + * @param {boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(type) { + constructor(type, allowExpiredDocuments, allowNonLatinDocuments, allowDigitalIds, allowedProviders) { if (new.target === DocumentFilter) { throw TypeError('DocumentFilter cannot be instantiated'); } @@ -14,6 +19,60 @@ class DocumentFilter { Validation.isString(type, 'type'); /** @private */ this.type = type; + + Validation.isBoolean(allowExpiredDocuments, 'allowExpiredDocuments', true); + /** @private */ + this.allowExpiredDocuments = allowExpiredDocuments; + + Validation.isBoolean(allowNonLatinDocuments, 'allowNonLatinDocuments', true); + /** @private */ + this.allowNonLatinDocuments = allowNonLatinDocuments; + + Validation.isBoolean(allowDigitalIds, 'allowDigitalIds', true); + /** @private */ + this.allowDigitalIds = allowDigitalIds; + + if (allowedProviders) { + Validation.isArrayOfType(allowedProviders, AllowedProvider, 'allowedProviders'); + /** @private */ + this.allowedProviders = allowedProviders; + } + } + + /** + * Whether to allow non latin documents + * + * @return {boolean} flag + */ + getAllowNonLatinDocuments() { + return this.allowNonLatinDocuments; + } + + /** + * Whether to allow non expired documents + * + * @return {boolean} flag + */ + getAllowExpiredDocuments() { + return this.allowExpiredDocuments; + } + + /** + * Whether to allow digital IDs to satisfy the filter + * + * @return boolean flag + */ + getAllowDigitalIds() { + return this.allowDigitalIds; + } + + /** + * The list of digital ID providers that are allowed to satisfy the filter + * + * @return AllowedProvider[] the allowed providers + */ + getAllowedProviders() { + return this.allowedProviders; } toJSON() { diff --git a/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js b/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js index a71e52832..e421a12d0 100644 --- a/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js +++ b/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js @@ -5,6 +5,10 @@ const DocumentRestriction = require('./document.restriction'); const Validation = require('../../../../../yoti_common/validation'); const IDVConstants = require('../../../../idv.constants'); +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ + class DocumentRestrictionsFilterBuilder { constructor() { /** @private */ @@ -59,6 +63,26 @@ class DocumentRestrictionsFilterBuilder { return this; } + /** + * @param {Boolean} allowDigitalIds + * + * @returns {this} + */ + withAllowDigitalIds(allowDigitalIds) { + this.allowDigitalIds = allowDigitalIds; + return this; + } + + /** + * @param {AllowedProvider[]} allowedProviders + * + * @returns {this} + */ + withAllowedProviders(allowedProviders) { + this.allowedProviders = allowedProviders; + return this; + } + /** * @returns {DocumentRestrictionsFilter} */ @@ -67,7 +91,9 @@ class DocumentRestrictionsFilterBuilder { this.inclusion, this.documents, this.allowExpiredDocuments, - this.allowNonLatinDocuments + this.allowNonLatinDocuments, + this.allowDigitalIds, + this.allowedProviders ); } } diff --git a/src/idv_service/session/create/filters/document/document.restrictions.filter.js b/src/idv_service/session/create/filters/document/document.restrictions.filter.js index 7474d1a87..d3bcb892d 100644 --- a/src/idv_service/session/create/filters/document/document.restrictions.filter.js +++ b/src/idv_service/session/create/filters/document/document.restrictions.filter.js @@ -5,15 +5,21 @@ const DocumentFilter = require('../document.filter'); const DocumentRestriction = require('./document.restriction'); const IDVConstants = require('../../../../idv.constants'); +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ + class DocumentRestrictionsFilter extends DocumentFilter { /** * @param {string} inclusion * @param {DocumentRestriction[]} documents * @param {Boolean} allowExpiredDocuments * @param {Boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(inclusion, documents, allowExpiredDocuments, allowNonLatinDocuments) { - super(IDVConstants.DOCUMENT_RESTRICTIONS); + constructor(inclusion, documents, allowExpiredDocuments, allowNonLatinDocuments, allowDigitalIds, allowedProviders) { + super(IDVConstants.DOCUMENT_RESTRICTIONS, allowExpiredDocuments, allowNonLatinDocuments, allowDigitalIds, allowedProviders); Validation.isString(inclusion, 'inclusion'); /** @private */ @@ -22,14 +28,6 @@ class DocumentRestrictionsFilter extends DocumentFilter { Validation.isArrayOfType(documents, DocumentRestriction, 'documents'); /** @private */ this.documents = documents; - - Validation.isBoolean(allowExpiredDocuments, 'allowExpiredDocuments', true); - /** @private */ - this.allowExpiredDocuments = allowExpiredDocuments; - - Validation.isBoolean(allowNonLatinDocuments, 'allowNonLatinDocuments', true); - /** @private */ - this.allowNonLatinDocuments = allowNonLatinDocuments; } toJSON() { @@ -37,8 +35,10 @@ class DocumentRestrictionsFilter extends DocumentFilter { json.inclusion = this.inclusion; json.documents = this.documents; - json.allow_expired_documents = this.allowExpiredDocuments; - json.allow_non_latin_documents = this.allowNonLatinDocuments; + json.allow_expired_documents = this.getAllowExpiredDocuments(); + json.allow_non_latin_documents = this.getAllowNonLatinDocuments(); + json.allow_digital_ids = this.getAllowDigitalIds(); + json.allowed_providers = this.getAllowedProviders(); return json; } diff --git a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.js b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.js index 560cd0ade..d0c87cbdf 100644 --- a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.js +++ b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.js @@ -5,6 +5,10 @@ const TypeRestriction = require('./type.restriction'); const CountryRestriction = require('./country.restriction'); const IDVConstants = require('../../../../idv.constants'); +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ + class OrthogonalRestrictionsFilterBuilder { /** * @param {string[]} countryCodes @@ -78,6 +82,26 @@ class OrthogonalRestrictionsFilterBuilder { return this; } + /** + * @param {Boolean} allowDigitalIds + * + * @returns {this} + */ + withAllowDigitalIds(allowDigitalIds) { + this.allowDigitalIds = allowDigitalIds; + return this; + } + + /** + * @param {AllowedProvider[]} allowedProviders + * + * @returns {this} + */ + withAllowedProviders(allowedProviders) { + this.allowedProviders = allowedProviders; + return this; + } + /** * @returns {OrthogonalRestrictionsFilter} */ @@ -86,7 +110,9 @@ class OrthogonalRestrictionsFilterBuilder { this.countryRestriction, this.typeRestriction, this.allowExpiredDocuments, - this.allowNonLatinDocuments + this.allowNonLatinDocuments, + this.allowDigitalIds, + this.allowedProviders ); } } diff --git a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js index 7cec54ec6..17e3a951d 100644 --- a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js +++ b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js @@ -6,15 +6,21 @@ const IDVConstants = require('../../../../idv.constants'); const TypeRestriction = require('./type.restriction'); const CountryRestriction = require('./country.restriction'); +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ + class OrthogonalRestrictionsFilter extends DocumentFilter { /** * @param {CountryRestriction} countryRestriction * @param {TypeRestriction} typeRestriction * @param {Boolean} allowExpiredDocuments * @param {Boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(countryRestriction, typeRestriction, allowExpiredDocuments, allowNonLatinDocuments) { - super(IDVConstants.ORTHOGONAL_RESTRICTIONS); + constructor(countryRestriction, typeRestriction, allowExpiredDocuments, allowNonLatinDocuments, allowDigitalIds, allowedProviders) { + super(IDVConstants.ORTHOGONAL_RESTRICTIONS, allowExpiredDocuments, allowNonLatinDocuments, allowDigitalIds, allowedProviders); if (countryRestriction) { Validation.instanceOf(countryRestriction, CountryRestriction, 'countryRestriction'); @@ -27,14 +33,6 @@ class OrthogonalRestrictionsFilter extends DocumentFilter { /** @private */ this.typeRestriction = typeRestriction; } - - Validation.isBoolean(allowExpiredDocuments, 'allowExpiredDocuments', true); - /** @private */ - this.allowExpiredDocuments = allowExpiredDocuments; - - Validation.isBoolean(allowNonLatinDocuments, 'allowNonLatinDocuments', true); - /** @private */ - this.allowNonLatinDocuments = allowNonLatinDocuments; } toJSON() { @@ -42,8 +40,10 @@ class OrthogonalRestrictionsFilter extends DocumentFilter { json.country_restriction = this.countryRestriction; json.type_restriction = this.typeRestriction; - json.allow_expired_documents = this.allowExpiredDocuments; - json.allow_non_latin_documents = this.allowNonLatinDocuments; + json.allow_expired_documents = this.getAllowExpiredDocuments(); + json.allow_non_latin_documents = this.getAllowNonLatinDocuments(); + json.allow_digital_ids = this.getAllowDigitalIds(); + json.allowed_providers = this.getAllowedProviders(); return json; } diff --git a/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js b/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js index efa373a48..70e8ccfe4 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js @@ -10,6 +10,12 @@ class SupportedDocumentResponse { Validation.isString(supportedDocument.type, 'type'); /** @private */ this.type = supportedDocument.type; + + if (supportedDocument.providers) { + Validation.isArrayOfStrings(supportedDocument.providers, 'providers'); + /** @private */ + this.providers = supportedDocument.providers; + } } /** @@ -20,6 +26,15 @@ class SupportedDocumentResponse { getType() { return this.type; } + + /** + * Returns the digital ID providers supported for this document type. + * + * @return {string[] | null} + */ + getProviders() { + return this.providers; + } } module.exports = SupportedDocumentResponse; diff --git a/src/idv_service/session/retrieve/digital.id.share.error.response.js b/src/idv_service/session/retrieve/digital.id.share.error.response.js new file mode 100644 index 000000000..960601331 --- /dev/null +++ b/src/idv_service/session/retrieve/digital.id.share.error.response.js @@ -0,0 +1,25 @@ +'use strict'; + +const Validation = require('../../../yoti_common/validation'); + +class DigitalIdShareErrorResponse { + constructor(errorResponse) { + Validation.isString(errorResponse.code, 'code', true); + /** @private */ + this.code = errorResponse.code; + + Validation.isString(errorResponse.description, 'description', true); + /** @private */ + this.description = errorResponse.description; + } + + getCode() { + return this.code; + } + + getDescription() { + return this.description; + } +} + +module.exports = DigitalIdShareErrorResponse; diff --git a/src/idv_service/session/retrieve/digital.id.share.response.js b/src/idv_service/session/retrieve/digital.id.share.response.js new file mode 100644 index 000000000..d6f81e277 --- /dev/null +++ b/src/idv_service/session/retrieve/digital.id.share.response.js @@ -0,0 +1,99 @@ +'use strict'; + +const Validation = require('../../../yoti_common/validation'); +const DigitalIdShareErrorResponse = require('./digital.id.share.error.response'); +const { YotiDate } = require('../../../data_type/date'); + +class DigitalIdShareResponse { + constructor(response) { + Validation.isString(response.id, 'id'); + /** @private */ + this.id = response.id; + + Validation.isString(response.document_type, 'document_type'); + /** @private */ + this.documentType = response.document_type; + + Validation.isString(response.issuing_country, 'issuing_country'); + /** @private */ + this.issuingCountry = response.issuing_country; + + Validation.isString(response.provider, 'provider'); + /** @private */ + this.provider = response.provider; + + Validation.isStringDate(response.created_at, 'created_at'); + /** @private */ + this.createdAt = YotiDate.fromDateString(response.created_at); + + Validation.isStringDate(response.last_updated, 'last_updated'); + /** @private */ + this.lastUpdated = YotiDate.fromDateString(response.last_updated); + + Validation.isString(response.resource_id, 'resource_id'); + /** @private */ + this.resourceId = response.resource_id; + + if (response.error) { + this.error = new DigitalIdShareErrorResponse(response.error); + } + } + + /** + * @returns {string} + */ + getId() { + return this.id; + } + + /** + * @returns {string} + */ + getDocumentType() { + return this.documentType; + } + + /** + * @returns {string} + */ + getIssuingCountry() { + return this.issuingCountry; + } + + /** + * @returns {string} + */ + getProvider() { + return this.provider; + } + + /** + * @returns {YotiDate} + */ + getCreatedAt() { + return this.createdAt; + } + + /** + * @returns {YotiDate} + */ + getLastUpdated() { + return this.lastUpdated; + } + + /** + * @returns {string} + */ + getResourceId() { + return this.resourceId; + } + + /** + * @returns {DigitalIdShareErrorResponse|undefined} + */ + getError() { + return this.error; + } +} + +module.exports = DigitalIdShareResponse; diff --git a/src/idv_service/session/retrieve/get.session.result.js b/src/idv_service/session/retrieve/get.session.result.js index ac904f674..6881788a3 100644 --- a/src/idv_service/session/retrieve/get.session.result.js +++ b/src/idv_service/session/retrieve/get.session.result.js @@ -18,6 +18,7 @@ const IdentityProfileResponse = require('./identity_profile/identity.profile.res const AdvancedIdentityProfileResponse = require('./identity_profile/advanced/advanced.identity.profile.response'); const IDVConstants = require('../../idv.constants'); const { YotiDate } = require('../../../data_type/date'); +const DigitalIdShareResponse = require('./digital.id.share.response'); class GetSessionResult { constructor(response) { @@ -101,6 +102,12 @@ class GetSessionResult { /** @private */ this.advancedIdentityProfile = new AdvancedIdentityProfileResponse(response.advanced_identity_profile); } + + if (response.digital_id_shares) { + Validation.isArray(response.digital_id_shares, 'digital_id_shares'); + /** @private */ + this.digitalIdShares = response.digital_id_shares.map((didShareResponseData) => new DigitalIdShareResponse(didShareResponseData)); + } } /** @@ -265,6 +272,13 @@ class GetSessionResult { getAdvancedIdentityProfile() { return this.advancedIdentityProfile; } + + /** + * @returns {DigitalIdShareResponse} + */ + getDigitalIdShares() { + return this.digitalIdShares; + } } module.exports = GetSessionResult; diff --git a/src/idv_service/session/retrieve/id.document.resource.response.js b/src/idv_service/session/retrieve/id.document.resource.response.js index 3de314d4e..870600680 100644 --- a/src/idv_service/session/retrieve/id.document.resource.response.js +++ b/src/idv_service/session/retrieve/id.document.resource.response.js @@ -20,6 +20,10 @@ class IdDocumentResourceResponse extends ResourceResponse { /** @private */ this.issuingCountry = resource.issuing_country; + Validation.isString(resource.provider, 'provider', true); + /** @private */ + this.provider = resource.provider; + if (resource.pages) { Validation.isArray(resource.pages, 'pages'); /** @private */ @@ -61,6 +65,13 @@ class IdDocumentResourceResponse extends ResourceResponse { return this.issuingCountry; } + /** + * @returns {string} + */ + getProvider() { + return this.provider; + } + /** * @returns {PageResponse[]} */ diff --git a/tests/idv_service/session/create/filters/allowed.provider.builder.spec.js b/tests/idv_service/session/create/filters/allowed.provider.builder.spec.js new file mode 100644 index 000000000..0d724c37d --- /dev/null +++ b/tests/idv_service/session/create/filters/allowed.provider.builder.spec.js @@ -0,0 +1,26 @@ +const { + AllowedProviderBuilder, +} = require('../../../../..'); + +const AllowedProvider = require('../../../../../src/idv_service/session/create/filters/allowed.provider'); + +describe('AllowedProviderBuilder', () => { + it('builds instance of AllowedProvider (when name is specified)', () => { + const allowedProvider = new AllowedProviderBuilder() + .withName('some-provider') + .build(); + + expect(allowedProvider).toBeInstanceOf(AllowedProvider); + + expect(JSON.stringify(allowedProvider)) + .toBe(JSON.stringify({ + name: 'some-provider', + })); + }); + + it('throws when name is NOT specified', () => { + expect(() => { + new AllowedProviderBuilder().build(); + }).toThrow('name must be a string'); + }); +}); diff --git a/tests/idv_service/session/create/filters/document/document.restrictions.filter.builder.spec.js b/tests/idv_service/session/create/filters/document/document.restrictions.filter.builder.spec.js index deca8be12..9504cccc6 100644 --- a/tests/idv_service/session/create/filters/document/document.restrictions.filter.builder.spec.js +++ b/tests/idv_service/session/create/filters/document/document.restrictions.filter.builder.spec.js @@ -1,6 +1,7 @@ const { DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, + AllowedProviderBuilder, } = require('../../../../../..'); const SOME_DOCUMENT_TYPE = 'some-document-type'; @@ -130,4 +131,37 @@ describe('DocumentRestrictionsFilterBuilder', () => { allow_non_latin_documents: true, })); }); + + it('should build DocumentRestrictionsFilter with allowed Digital IDs', () => { + const documentRestrictionsFilter = new DocumentRestrictionsFilterBuilder() + .forWhitelist() + .withAllowDigitalIds(true) + .build(); + + expect(JSON.stringify(documentRestrictionsFilter)) + .toBe(JSON.stringify({ + type: 'DOCUMENT_RESTRICTIONS', + inclusion: 'WHITELIST', + documents: [], + allow_digital_ids: true, + })); + }); + + it('should build DocumentRestrictionsFilter with allowed providers', () => { + const documentRestrictionsFilter = new DocumentRestrictionsFilterBuilder() + .forWhitelist() + .withAllowedProviders([ + new AllowedProviderBuilder().withName('provider1').build(), + new AllowedProviderBuilder().withName('provider2').build(), + ]) + .build(); + + expect(JSON.stringify(documentRestrictionsFilter)) + .toBe(JSON.stringify({ + type: 'DOCUMENT_RESTRICTIONS', + inclusion: 'WHITELIST', + documents: [], + allowed_providers: [{ name: 'provider1' }, { name: 'provider2' }], + })); + }); }); diff --git a/tests/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.spec.js b/tests/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.spec.js index 161c074fe..03f3842b1 100644 --- a/tests/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.spec.js +++ b/tests/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.spec.js @@ -1,5 +1,6 @@ const { OrthogonalRestrictionsFilterBuilder, + AllowedProviderBuilder, } = require('../../../../../..'); const SOME_DOCUMENT_TYPE = 'some-document-type'; @@ -146,4 +147,31 @@ describe('OrthogonalRestrictionsFilterBuilder', () => { allow_non_latin_documents: true, })); }); + + it('should build OrthogonalRestrictionsFilter with allowed Digital IDs', () => { + const orthogonalRestrictionsFilter = new OrthogonalRestrictionsFilterBuilder() + .withAllowDigitalIds(true) + .build(); + + expect(JSON.stringify(orthogonalRestrictionsFilter)) + .toBe(JSON.stringify({ + type: 'ORTHOGONAL_RESTRICTIONS', + allow_digital_ids: true, + })); + }); + + it('should build OrthogonalRestrictionsFilter with allowed providers', () => { + const orthogonalRestrictionsFilter = new OrthogonalRestrictionsFilterBuilder() + .withAllowedProviders([ + new AllowedProviderBuilder().withName('provider1').build(), + new AllowedProviderBuilder().withName('provider2').build(), + ]) + .build(); + + expect(JSON.stringify(orthogonalRestrictionsFilter)) + .toBe(JSON.stringify({ + type: 'ORTHOGONAL_RESTRICTIONS', + allowed_providers: [{ name: 'provider1' }, { name: 'provider2' }], + })); + }); }); diff --git a/tests/idv_service/session/retrieve/configuration/capture/document/supported.document.response.spec.js b/tests/idv_service/session/retrieve/configuration/capture/document/supported.document.response.spec.js index 1aff7eb43..3cc5ff4a5 100644 --- a/tests/idv_service/session/retrieve/configuration/capture/document/supported.document.response.spec.js +++ b/tests/idv_service/session/retrieve/configuration/capture/document/supported.document.response.spec.js @@ -6,6 +6,7 @@ describe('SupportedDocumentResponse', () => { beforeEach(() => { supportedDocumentResponse = new SupportedDocumentResponse({ type: 'DRIVING_LICENCE', + providers: ['p1', 'p2'], }); }); @@ -14,4 +15,10 @@ describe('SupportedDocumentResponse', () => { expect(supportedDocumentResponse.getType()).toBe('DRIVING_LICENCE'); }); }); + + describe('#getProviders', () => { + it('should return providers list', () => { + expect(supportedDocumentResponse.getProviders()).toEqual(['p1', 'p2']); + }); + }); }); diff --git a/tests/idv_service/session/retrieve/digital.id.share.response.error.spec.js b/tests/idv_service/session/retrieve/digital.id.share.response.error.spec.js new file mode 100644 index 000000000..e60954340 --- /dev/null +++ b/tests/idv_service/session/retrieve/digital.id.share.response.error.spec.js @@ -0,0 +1,26 @@ +const DigitalIdShareErrorResponse = require('../../../../src/idv_service/session/retrieve/digital.id.share.error.response'); + +describe('DigitalIdShareErrorResponse', () => { + const rawResponse = { + code: 'SHARE_FAILED', + description: 'The share failed...', + }; + + let digitalIdShareErrorResponse; + + beforeEach(() => { + digitalIdShareErrorResponse = new DigitalIdShareErrorResponse(rawResponse); + }); + + describe('#getId', () => { + it('should return id', () => { + expect(digitalIdShareErrorResponse.getCode()).toBe('SHARE_FAILED'); + }); + }); + + describe('#getDescription', () => { + it('should return description', () => { + expect(digitalIdShareErrorResponse.getDescription()).toBe('The share failed...'); + }); + }); +}); diff --git a/tests/idv_service/session/retrieve/digital.id.share.response.spec.js b/tests/idv_service/session/retrieve/digital.id.share.response.spec.js new file mode 100644 index 000000000..94ef0eb01 --- /dev/null +++ b/tests/idv_service/session/retrieve/digital.id.share.response.spec.js @@ -0,0 +1,88 @@ +const DigitalIdShareResponse = require('../../../../src/idv_service/session/retrieve/digital.id.share.response'); +const DigitalIdShareErrorResponse = require('../../../../src/idv_service/session/retrieve/digital.id.share.error.response'); +const { YotiDate } = require('../../../../src/data_type/date'); + +describe('DigitalIdShareResponse', () => { + const rawResponse = { + id: 'fffe3bcf-ccd4-4704-ac85-3cdae5bd9eaf', + document_type: 'EPHIL_ID', + issuing_country: 'PHL', + provider: 'EPHIL_ID_QR', + created_at: '2026-06-29T10:00:50Z', + last_updated: '2026-06-29T10:01:01Z', + resource_id: 'a159072f-22b9-4fb0-8098-aa5bc8eb7615', + }; + + const rawResponseWithError = { + ...rawResponse, + error: { + code: 'BAD_SHARE', + description: 'This is a really bad share', + }, + }; + + let digitalIdShareResponse; + + beforeEach(() => { + digitalIdShareResponse = new DigitalIdShareResponse(rawResponse); + }); + + describe('#getId', () => { + it('should return id', () => { + expect(digitalIdShareResponse.getId()).toBe('fffe3bcf-ccd4-4704-ac85-3cdae5bd9eaf'); + }); + }); + + describe('#getDocumentType', () => { + it('should return document type', () => { + expect(digitalIdShareResponse.getDocumentType()).toBe('EPHIL_ID'); + }); + }); + + describe('#getIssuingCountry', () => { + it('should return issuing country', () => { + expect(digitalIdShareResponse.getIssuingCountry()).toBe('PHL'); + }); + }); + + describe('#getProvider', () => { + it('should return provider', () => { + expect(digitalIdShareResponse.getProvider()).toBe('EPHIL_ID_QR'); + }); + }); + + describe('#getCreatedAt', () => { + it('should return created at date', () => { + expect(digitalIdShareResponse.getCreatedAt()).toBeInstanceOf(YotiDate); + expect(digitalIdShareResponse.getCreatedAt().toISOString()).toBe('2026-06-29T10:00:50.000Z'); + }); + }); + + describe('#getLastUpdated', () => { + it('should return created at date', () => { + expect(digitalIdShareResponse.getLastUpdated()).toBeInstanceOf(YotiDate); + expect(digitalIdShareResponse.getLastUpdated().toISOString()).toBe('2026-06-29T10:01:01.000Z'); + }); + }); + + describe('#getResourceId', () => { + it('should return resource id', () => { + expect(digitalIdShareResponse.getResourceId()).toBe('a159072f-22b9-4fb0-8098-aa5bc8eb7615'); + }); + }); + + describe('#getError', () => { + it('should return undefined when no error', () => { + expect(digitalIdShareResponse.getError()).toBe(undefined); + }); + + it('should return error if present', () => { + digitalIdShareResponse = new DigitalIdShareResponse(rawResponseWithError); + expect(digitalIdShareResponse.getError()).toBeInstanceOf(DigitalIdShareErrorResponse); + + const digitalIdShareErrorResponse = digitalIdShareResponse.getError(); + expect(digitalIdShareErrorResponse.getCode()).toBe('BAD_SHARE'); + expect(digitalIdShareErrorResponse.getDescription()).toBe('This is a really bad share'); + }); + }); +}); diff --git a/tests/idv_service/session/retrieve/get.session.result.spec.js b/tests/idv_service/session/retrieve/get.session.result.spec.js index af83f50b4..0641bfa57 100644 --- a/tests/idv_service/session/retrieve/get.session.result.spec.js +++ b/tests/idv_service/session/retrieve/get.session.result.spec.js @@ -14,6 +14,7 @@ const ThirdPartyIdentityFraud1CheckResponse = require('../../../../src/idv_servi const FaceComparisonCheckResponse = require('../../../../src/idv_service/session/retrieve/face.comparison.check.response'); const IdentityProfileResponse = require('../../../../src/idv_service/session/retrieve/identity_profile/identity.profile.response'); const AdvancedIdentityProfileResponse = require('../../../../src/idv_service/session/retrieve/identity_profile/advanced/advanced.identity.profile.response'); +const DigitalIdShareResponse = require('../../../../src/idv_service/session/retrieve/digital.id.share.response'); const { YotiDate } = require('../../../..'); const ID_DOCUMENT_AUTHENTICITY = 'ID_DOCUMENT_AUTHENTICITY'; @@ -177,6 +178,17 @@ describe('GetSessionResult', () => { media: {}, }, }, + digital_id_shares: [ + { + id: 'fffe3bcf-ccd4-4704-ac85-3cdae5bd9eaf', + document_type: 'EPHIL_ID', + issuing_country: 'PHL', + provider: 'EPHIL_ID_QR', + created_at: '2026-06-29T10:00:50Z', + last_updated: '2026-06-29T10:01:01Z', + resource_id: 'a159072f-22b9-4fb0-8098-aa5bc8eb7615', + }, + ], }); }); @@ -214,7 +226,7 @@ describe('GetSessionResult', () => { describe('when checks are available', () => { it('should return array of checks', () => { const checks = session.getChecks(); - expect(checks.length).toBe(11); + expect(checks).toHaveLength(11); expect(checks[0]).toBeInstanceOf(AuthenticityCheckResponse); expect(checks[1]).toBeInstanceOf(LivenessCheckResponse); expect(checks[2]).toBeInstanceOf(FaceMatchCheckResponse); @@ -234,7 +246,7 @@ describe('GetSessionResult', () => { session = new GetSessionResult({}); const checks = session.getChecks(); expect(checks).toBeInstanceOf(Array); - expect(checks.length).toBe(0); + expect(checks).toHaveLength(0); }); }); }); @@ -242,7 +254,7 @@ describe('GetSessionResult', () => { describe('#getAuthenticityChecks', () => { it('should return array of AuthenticityCheckResponse', () => { const checks = session.getAuthenticityChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(AuthenticityCheckResponse); expect(checks[0].getType()).toBe(ID_DOCUMENT_AUTHENTICITY); }); @@ -251,7 +263,7 @@ describe('GetSessionResult', () => { describe('#getIdDocumentComparisonChecks', () => { it('should return array of AuthenticityCheckResponse', () => { const checks = session.getIdDocumentComparisonChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(IdDocumentComparisonCheckResponse); expect(checks[0].getType()).toBe(ID_DOCUMENT_COMPARISON); }); @@ -260,7 +272,7 @@ describe('GetSessionResult', () => { describe('#getLivenessChecks', () => { it('should return array of ZoomLivenessCheckResponse', () => { const checks = session.getLivenessChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(LivenessCheckResponse); expect(checks[0].getType()).toBe(LIVENESS); }); @@ -269,7 +281,7 @@ describe('GetSessionResult', () => { describe('#getTextDataChecks', () => { it('should return array of TextDataCheckResponse', () => { const checks = session.getTextDataChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(TextDataCheckResponse); expect(checks[0].getType()).toBe(ID_DOCUMENT_TEXT_DATA_CHECK); }); @@ -278,7 +290,7 @@ describe('GetSessionResult', () => { describe('#getIdDocumentTextDataChecks', () => { it('should return array of TextDataCheckResponse', () => { const checks = session.getIdDocumentTextDataChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(TextDataCheckResponse); expect(checks[0].getType()).toBe(ID_DOCUMENT_TEXT_DATA_CHECK); }); @@ -287,7 +299,7 @@ describe('GetSessionResult', () => { describe('#getSupplementaryDocumentTextDataChecks', () => { it('should return array of SupplementaryDocumentTextDataCheckResponse', () => { const checks = session.getSupplementaryDocumentTextDataChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(SupplementaryDocumentTextDataCheckResponse); expect(checks[0].getType()).toBe(SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK); }); @@ -296,7 +308,7 @@ describe('GetSessionResult', () => { describe('#getThirdPartyIdentityChecks', () => { it('should return array of ThirdPartyIdentityCheckResponse', () => { const checks = session.getThirdPartyIdentityChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(ThirdPartyIdentityCheckResponse); expect(checks[0].getType()).toBe(THIRD_PARTY_IDENTITY); }); @@ -305,7 +317,7 @@ describe('GetSessionResult', () => { describe('#getWatchlistScreeningChecks', () => { it('should return array of WatchlistScreeningCheckResponse', () => { const checks = session.getWatchlistScreeningChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(WatchlistScreeningCheckResponse); expect(checks[0].getType()).toBe(WATCHLIST_SCREENING); }); @@ -314,7 +326,7 @@ describe('GetSessionResult', () => { describe('#getWatchlistAdvancedCaChecks', () => { it('should return array of WatchlistAdvancedCaCheckResponse', () => { const checks = session.getWatchlistAdvancedCaChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(WatchlistAdvancedCaCheckResponse); expect(checks[0].getType()).toBe(WATCHLIST_ADVANCED_CA); }); @@ -323,7 +335,7 @@ describe('GetSessionResult', () => { describe('#getFaceMatchChecks', () => { it('should return array of FaceMatchCheckResponse', () => { const checks = session.getFaceMatchChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(FaceMatchCheckResponse); expect(checks[0].getType()).toBe(ID_DOCUMENT_FACE_MATCH); }); @@ -332,7 +344,7 @@ describe('GetSessionResult', () => { describe('#getThirdPartyIdentityFraud1Checks', () => { it('should return array of ThirdPartyIdentityFraud1Checks', () => { const checks = session.getThirdPartyIdentityFraud1Checks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(ThirdPartyIdentityFraud1CheckResponse); expect(checks[0].getType()).toBe(THIRD_PARTY_IDENTITY_FRAUD_1); }); @@ -341,7 +353,7 @@ describe('GetSessionResult', () => { describe('#getFaceComparisonChecks', () => { it('should return array of FaceComparisonCheckResponse', () => { const checks = session.getFaceComparisonChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(FaceComparisonCheckResponse); expect(checks[0].getType()).toBe(FACE_COMPARISON); }); @@ -365,7 +377,7 @@ describe('GetSessionResult', () => { }); const checks = session.getChecks(); - expect(checks.length).toBe(1); + expect(checks).toHaveLength(1); expect(checks[0]).toBeInstanceOf(CheckResponse); expect(checks[0].getType()).toBe(SOME_UNKNOWN_CHECK); }); @@ -395,4 +407,13 @@ describe('GetSessionResult', () => { expect(advancedIdentityProfile).toBeInstanceOf(AdvancedIdentityProfileResponse); }); }); + + describe('#getDigitalIdShares', () => { + it('should return list of DigitalIdShareResponse', () => { + const digitalIdShares = session.getDigitalIdShares(); + + expect(digitalIdShares).toHaveLength(1); + expect(digitalIdShares[0]).toBeInstanceOf(DigitalIdShareResponse); + }); + }); }); diff --git a/tests/idv_service/session/retrieve/id.document.resource.response.spec.js b/tests/idv_service/session/retrieve/id.document.resource.response.spec.js index 4723d7940..73637ad57 100644 --- a/tests/idv_service/session/retrieve/id.document.resource.response.spec.js +++ b/tests/idv_service/session/retrieve/id.document.resource.response.spec.js @@ -27,6 +27,7 @@ describe('IdDocumentResourceResponse', () => { type: 'SOME_UNKNOWN_TYPE', }, ], + provider: 'some_provider', }); }); @@ -45,7 +46,7 @@ describe('IdDocumentResourceResponse', () => { describe('#getPages', () => { it('should return array of page info', () => { const pages = documentResourceResponse.getPages(); - expect(pages.length).toBe(1); + expect(pages).toHaveLength(1); expect(pages[0]).toBeInstanceOf(PageResponse); }); }); @@ -88,4 +89,11 @@ describe('IdDocumentResourceResponse', () => { }); }); }); + + describe('#getProvider', () => { + it('should return the provider', () => { + const provider = documentResourceResponse.getProvider(); + expect(provider).toBe('some_provider'); + }); + }); }); diff --git a/types/index.d.ts b/types/index.d.ts index 36bf13b03..30d4ffaf8 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -54,10 +54,11 @@ import { AdvancedIdentityProfileSchemeConfigBuilder } from "./src/idv_service"; import { AdvancedIdentityProfileBuilder } from "./src/idv_service"; import { AdvancedIdentityProfileSchemeBuilder } from "./src/idv_service"; import { AdvancedIdentityProfileRequirementsBuilder } from "./src/idv_service"; +import { AllowedProviderBuilder } from "./src/idv_service"; export declare namespace internals { export { IDVService }; export { YotiCommon }; export { YotiRequest }; export { IDVError }; } -export { YotiClient as Client, IDVClient, DigitalIdentityClient, IDVConstants, AmlAddress, AmlProfile, DigitalIdentityBuilders, DynamicScenarioBuilder, DynamicPolicyBuilder, WantedAttributeBuilder, ExtensionBuilder, LocationConstraintExtensionBuilder, ThirdPartyAttributeExtensionBuilder, TransactionalFlowExtensionBuilder, WantedAnchorBuilder, ConstraintsBuilder, SourceConstraintBuilder, RequestBuilder, Payload, YotiDate, constants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder, AdvancedIdentityProfileSchemeConfigBuilder, AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder }; +export { YotiClient as Client, IDVClient, DigitalIdentityClient, IDVConstants, AmlAddress, AmlProfile, DigitalIdentityBuilders, DynamicScenarioBuilder, DynamicPolicyBuilder, WantedAttributeBuilder, ExtensionBuilder, LocationConstraintExtensionBuilder, ThirdPartyAttributeExtensionBuilder, TransactionalFlowExtensionBuilder, WantedAnchorBuilder, ConstraintsBuilder, SourceConstraintBuilder, RequestBuilder, Payload, YotiDate, constants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder, AdvancedIdentityProfileSchemeConfigBuilder, AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, AllowedProviderBuilder }; diff --git a/types/src/idv_service/index.d.ts b/types/src/idv_service/index.d.ts index 57a80e2aa..62d521f11 100644 --- a/types/src/idv_service/index.d.ts +++ b/types/src/idv_service/index.d.ts @@ -31,4 +31,5 @@ import AdvancedIdentityProfileBuilder = require("./session/create/identity_profi import AdvancedIdentityProfileSchemeBuilder = require("./session/create/identity_profile/advanced/advanced.identity.profile.scheme.builder"); import AdvancedIdentityProfileRequirementsBuilder = require("./session/create/identity_profile/advanced/advanced.identity.profile.requirements.builder"); import AdvancedIdentityProfileSchemeConfigBuilder = require("./session/create/identity_profile/advanced/advanced.identity.profile.scheme.config"); -export { IDVService, IDVConstants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder, AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, AdvancedIdentityProfileSchemeConfigBuilder }; +import AllowedProviderBuilder = require("./session/create/filters/allowed.provider.builder"); +export { IDVService, IDVConstants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder, AdvancedIdentityProfileBuilder, AdvancedIdentityProfileSchemeBuilder, AdvancedIdentityProfileRequirementsBuilder, AdvancedIdentityProfileSchemeConfigBuilder, AllowedProviderBuilder }; diff --git a/types/src/idv_service/session/create/filters/allowed.provider.builder.d.ts b/types/src/idv_service/session/create/filters/allowed.provider.builder.d.ts new file mode 100644 index 000000000..e313e99ff --- /dev/null +++ b/types/src/idv_service/session/create/filters/allowed.provider.builder.d.ts @@ -0,0 +1,10 @@ +export = AllowedProviderBuilder; +declare class AllowedProviderBuilder { + withName(provider: any): this; + name: any; + /** + * @returns {AllowedProvider} + */ + build(): AllowedProvider; +} +import AllowedProvider = require("./allowed.provider"); diff --git a/types/src/idv_service/session/create/filters/allowed.provider.d.ts b/types/src/idv_service/session/create/filters/allowed.provider.d.ts new file mode 100644 index 000000000..eb4098a87 --- /dev/null +++ b/types/src/idv_service/session/create/filters/allowed.provider.d.ts @@ -0,0 +1,12 @@ +export = AllowedProvider; +declare class AllowedProvider { + /** + * @param {string} name + */ + constructor(name: string); + /** @private */ + private name; + toJSON(): { + name: string; + }; +} diff --git a/types/src/idv_service/session/create/filters/document.filter.d.ts b/types/src/idv_service/session/create/filters/document.filter.d.ts index cf4c5567f..26ffc24cb 100644 --- a/types/src/idv_service/session/create/filters/document.filter.d.ts +++ b/types/src/idv_service/session/create/filters/document.filter.d.ts @@ -2,11 +2,48 @@ export = DocumentFilter; declare class DocumentFilter { /** * @param {string} type + * @param {boolean} allowExpiredDocuments + * @param {boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(type: string); + constructor(type: string, allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean, allowDigitalIds: boolean, allowedProviders: AllowedProvider[]); /** @private */ private type; + /** @private */ + private allowExpiredDocuments; + /** @private */ + private allowNonLatinDocuments; + /** @private */ + private allowDigitalIds; + /** @private */ + private allowedProviders; + /** + * Whether to allow non latin documents + * + * @return {boolean} flag + */ + getAllowNonLatinDocuments(): boolean; + /** + * Whether to allow non expired documents + * + * @return {boolean} flag + */ + getAllowExpiredDocuments(): boolean; + /** + * Whether to allow digital IDs to satisfy the filter + * + * @return boolean flag + */ + getAllowDigitalIds(): boolean; + /** + * The list of digital ID providers that are allowed to satisfy the filter + * + * @return AllowedProvider[] the allowed providers + */ + getAllowedProviders(): AllowedProvider[]; toJSON(): { type: string; }; } +import AllowedProvider = require("./allowed.provider"); diff --git a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts index 962a27f21..7969884dc 100644 --- a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts +++ b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts @@ -1,4 +1,7 @@ export = DocumentRestrictionsFilterBuilder; +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ declare class DocumentRestrictionsFilterBuilder { /** @private */ private documents; @@ -31,10 +34,28 @@ declare class DocumentRestrictionsFilterBuilder { */ withAllowNonLatinDocuments(allowNonLatinDocuments: boolean): this; allowNonLatinDocuments: boolean; + /** + * @param {Boolean} allowDigitalIds + * + * @returns {this} + */ + withAllowDigitalIds(allowDigitalIds: boolean): this; + allowDigitalIds: boolean; + /** + * @param {AllowedProvider[]} allowedProviders + * + * @returns {this} + */ + withAllowedProviders(allowedProviders: AllowedProvider[]): this; + allowedProviders: import("./../allowed.provider")[]; /** * @returns {DocumentRestrictionsFilter} */ build(): DocumentRestrictionsFilter; } +declare namespace DocumentRestrictionsFilterBuilder { + export { AllowedProvider }; +} import DocumentRestriction = require("./document.restriction"); import DocumentRestrictionsFilter = require("./document.restrictions.filter"); +type AllowedProvider = import('./../allowed.provider'); diff --git a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts index c2c4a62a6..289992b30 100644 --- a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts +++ b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts @@ -1,20 +1,25 @@ export = DocumentRestrictionsFilter; +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ declare class DocumentRestrictionsFilter extends DocumentFilter { /** * @param {string} inclusion * @param {DocumentRestriction[]} documents * @param {Boolean} allowExpiredDocuments * @param {Boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(inclusion: string, documents: DocumentRestriction[], allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean); + constructor(inclusion: string, documents: DocumentRestriction[], allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean, allowDigitalIds: boolean, allowedProviders: AllowedProvider[]); /** @private */ private inclusion; /** @private */ private documents; - /** @private */ - private allowExpiredDocuments; - /** @private */ - private allowNonLatinDocuments; +} +declare namespace DocumentRestrictionsFilter { + export { AllowedProvider }; } import DocumentFilter = require("../document.filter"); import DocumentRestriction = require("./document.restriction"); +type AllowedProvider = import('./../allowed.provider'); diff --git a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts index 40d9e5788..8b94c4fad 100644 --- a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts +++ b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts @@ -1,4 +1,7 @@ export = OrthogonalRestrictionsFilterBuilder; +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ declare class OrthogonalRestrictionsFilterBuilder { /** * @param {string[]} countryCodes @@ -40,11 +43,29 @@ declare class OrthogonalRestrictionsFilterBuilder { */ withAllowNonLatinDocuments(allowNonLatinDocuments: boolean): this; allowNonLatinDocuments: boolean; + /** + * @param {Boolean} allowDigitalIds + * + * @returns {this} + */ + withAllowDigitalIds(allowDigitalIds: boolean): this; + allowDigitalIds: boolean; + /** + * @param {AllowedProvider[]} allowedProviders + * + * @returns {this} + */ + withAllowedProviders(allowedProviders: AllowedProvider[]): this; + allowedProviders: import("./../allowed.provider")[]; /** * @returns {OrthogonalRestrictionsFilter} */ build(): OrthogonalRestrictionsFilter; } +declare namespace OrthogonalRestrictionsFilterBuilder { + export { AllowedProvider }; +} import CountryRestriction = require("./country.restriction"); import TypeRestriction = require("./type.restriction"); import OrthogonalRestrictionsFilter = require("./orthogonal.restrictions.filter"); +type AllowedProvider = import('./../allowed.provider'); diff --git a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts index 93971a1ad..1e623e19e 100644 --- a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts +++ b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts @@ -1,21 +1,26 @@ export = OrthogonalRestrictionsFilter; +/** + * @typedef {import('./../allowed.provider')} AllowedProvider + */ declare class OrthogonalRestrictionsFilter extends DocumentFilter { /** * @param {CountryRestriction} countryRestriction * @param {TypeRestriction} typeRestriction * @param {Boolean} allowExpiredDocuments * @param {Boolean} allowNonLatinDocuments + * @param {boolean} allowDigitalIds + * @param {AllowedProvider[]} allowedProviders */ - constructor(countryRestriction: CountryRestriction, typeRestriction: TypeRestriction, allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean); + constructor(countryRestriction: CountryRestriction, typeRestriction: TypeRestriction, allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean, allowDigitalIds: boolean, allowedProviders: AllowedProvider[]); /** @private */ private countryRestriction; /** @private */ private typeRestriction; - /** @private */ - private allowExpiredDocuments; - /** @private */ - private allowNonLatinDocuments; +} +declare namespace OrthogonalRestrictionsFilter { + export { AllowedProvider }; } import DocumentFilter = require("../document.filter"); import CountryRestriction = require("./country.restriction"); import TypeRestriction = require("./type.restriction"); +type AllowedProvider = import('./../allowed.provider'); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts index 7bc04f543..dcdc711a8 100644 --- a/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts @@ -6,10 +6,18 @@ declare class SupportedDocumentResponse { constructor(supportedDocument: object); /** @private */ private type; + /** @private */ + private providers; /** * Returns the type of document that is supported. * * @return {string | null} */ getType(): string | null; + /** + * Returns the digital ID providers supported for this document type. + * + * @return {string[] | null} + */ + getProviders(): string[] | null; } diff --git a/types/src/idv_service/session/retrieve/digital.id.share.error.response.d.ts b/types/src/idv_service/session/retrieve/digital.id.share.error.response.d.ts new file mode 100644 index 000000000..d0e24c008 --- /dev/null +++ b/types/src/idv_service/session/retrieve/digital.id.share.error.response.d.ts @@ -0,0 +1,10 @@ +export = DigitalIdShareErrorResponse; +declare class DigitalIdShareErrorResponse { + constructor(errorResponse: any); + /** @private */ + private code; + /** @private */ + private description; + getCode(): any; + getDescription(): any; +} diff --git a/types/src/idv_service/session/retrieve/digital.id.share.response.d.ts b/types/src/idv_service/session/retrieve/digital.id.share.response.d.ts new file mode 100644 index 000000000..205c80b06 --- /dev/null +++ b/types/src/idv_service/session/retrieve/digital.id.share.response.d.ts @@ -0,0 +1,53 @@ +export = DigitalIdShareResponse; +declare class DigitalIdShareResponse { + constructor(response: any); + /** @private */ + private id; + /** @private */ + private documentType; + /** @private */ + private issuingCountry; + /** @private */ + private provider; + /** @private */ + private createdAt; + /** @private */ + private lastUpdated; + /** @private */ + private resourceId; + error: DigitalIdShareErrorResponse; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getDocumentType(): string; + /** + * @returns {string} + */ + getIssuingCountry(): string; + /** + * @returns {string} + */ + getProvider(): string; + /** + * @returns {YotiDate} + */ + getCreatedAt(): YotiDate; + /** + * @returns {YotiDate} + */ + getLastUpdated(): YotiDate; + /** + * @returns {string} + */ + getResourceId(): string; + /** + * @returns {DigitalIdShareErrorResponse|undefined} + */ + getError(): DigitalIdShareErrorResponse | undefined; +} +import DigitalIdShareErrorResponse = require("./digital.id.share.error.response"); +import { YotiDate } from "../../../data_type/date"; diff --git a/types/src/idv_service/session/retrieve/get.session.result.d.ts b/types/src/idv_service/session/retrieve/get.session.result.d.ts index f9a2b2b5b..51f0897fb 100644 --- a/types/src/idv_service/session/retrieve/get.session.result.d.ts +++ b/types/src/idv_service/session/retrieve/get.session.result.d.ts @@ -21,6 +21,8 @@ declare class GetSessionResult { private identityProfile; /** @private */ private advancedIdentityProfile; + /** @private */ + private digitalIdShares; /** * @returns {string} */ @@ -111,6 +113,10 @@ declare class GetSessionResult { * @returns {AdvancedIdentityProfileResponse} */ getAdvancedIdentityProfile(): AdvancedIdentityProfileResponse; + /** + * @returns {DigitalIdShareResponse} + */ + getDigitalIdShares(): DigitalIdShareResponse; } import CheckResponse = require("./check.response"); import AuthenticityCheckResponse = require("./authenticity.check.response"); @@ -128,3 +134,4 @@ import ResourceContainer = require("./resource.container"); import { YotiDate } from "../../../data_type/date"; import IdentityProfileResponse = require("./identity_profile/identity.profile.response"); import AdvancedIdentityProfileResponse = require("./identity_profile/advanced/advanced.identity.profile.response"); +import DigitalIdShareResponse = require("./digital.id.share.response"); diff --git a/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts index aa0abfd76..0e56380f6 100644 --- a/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts +++ b/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts @@ -5,6 +5,8 @@ declare class IdDocumentResourceResponse extends ResourceResponse { /** @private */ private issuingCountry; /** @private */ + private provider; + /** @private */ private pages; /** @private */ private documentFields; @@ -20,6 +22,10 @@ declare class IdDocumentResourceResponse extends ResourceResponse { * @returns {string} */ getIssuingCountry(): string; + /** + * @returns {string} + */ + getProvider(): string; /** * @returns {PageResponse[]} */