Skip to content

Commit

Permalink
SDK-2453 revert parsing of requirements_not_met_details in scheme com…
Browse files Browse the repository at this point in the history
…pliance, keeps IdentityProfileRequirementsNotMetDetailResponse class
  • Loading branch information
laurent-yoti committed Jun 4, 2024
1 parent ff51050 commit ae0ff82
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const Validation = require('../../../yoti_common/validation');
const IdentityProfileRequirementsNotMetDetailResponse = require('./identity.profile.requirements.not.met.detail.response');

class IdentityProfileReportSchemesComplianceResponse {
constructor(schemesCompliance) {
Expand All @@ -17,17 +16,6 @@ class IdentityProfileReportSchemesComplianceResponse {
Validation.isString(schemesCompliance.requirements_not_met_info, 'requirements_not_met_info');
/** @private @type {string|undefined} */
this.requirementsNotMetInfo = schemesCompliance.requirements_not_met_info;

/** @private @type {IdentityProfileRequirementsNotMetDetailResponse[]|undefined} */
this.requirementsNotMetDetails = [];

if (schemesCompliance.requirements_not_met_details) {
Validation.isArray(schemesCompliance.requirements_not_met_details, 'requirements not met details');

this.requirementsNotMetDetails = schemesCompliance.requirements_not_met_details
// eslint-disable-next-line max-len
.map((requirementsNotMetDetail) => new IdentityProfileRequirementsNotMetDetailResponse(requirementsNotMetDetail));
}
}
}

Expand All @@ -45,10 +33,6 @@ class IdentityProfileReportSchemesComplianceResponse {
getRequirementsNotMetInfo() {
return this.requirementsNotMetInfo;
}

getRequirementsNotMetDetails() {
return this.requirementsNotMetDetails;
}
}

module.exports = IdentityProfileReportSchemesComplianceResponse;
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const IdentityProfileReportSchemesComplianceResponse = require('../../../../src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response');
const IdentityProfileRequirementsNotMetDetailResponse = require('../../../../src/idv_service/session/retrieve/identity.profile.requirements.not.met.detail.response');

describe('IdentityProfileReportSchemesComplianceResponse', () => {
let identityProfileReportSchemesComplianceResponse;
Expand All @@ -12,6 +11,7 @@ describe('IdentityProfileReportSchemesComplianceResponse', () => {
objective: 'STANDARD',
},
requirements_met: true,
requirements_not_met_info: 'some string here',
});
});

Expand All @@ -30,63 +30,9 @@ describe('IdentityProfileReportSchemesComplianceResponse', () => {
});
});

describe('with requirements not met', () => {
beforeAll(() => {
identityProfileReportSchemesComplianceResponse = new
IdentityProfileReportSchemesComplianceResponse({
scheme: {
type: 'DBS',
objective: 'STANDARD',
},
requirements_met: false,
requirements_not_met_info: 'some string here',
requirements_not_met_details: [
{
failure_type: 'ID_DOCUMENT_EXTRACTION',
document_type: 'PASSPORT',
document_country_iso_code: 'GBR',
audit_id: 'audit-123',
details: 'something not right',
},
{
failure_type: 'ID_DOCUMENT_AUTHENTICITY',
document_type: 'PASSPORT',
document_country_iso_code: 'GBR',
audit_id: 'audit-456',
details: 'something still not right',
},
],
});
});
describe('#getRequirementsNotMetInfo', () => {
it('Should return requirements_not_met_info string', () => {
expect(identityProfileReportSchemesComplianceResponse.getRequirementsNotMetInfo()).toBe('some string here');
});
});

describe('#getRequirementsNotMetDetails', () => {
it('Should return the list of RequirementsNotMetDetail', () => {
// eslint-disable-next-line max-len
const requirementsNotMetDetails = identityProfileReportSchemesComplianceResponse.getRequirementsNotMetDetails();
expect(requirementsNotMetDetails).toHaveLength(2);
const [firstDetail, secondDetail] = requirementsNotMetDetails;
expect(firstDetail).toBeInstanceOf(IdentityProfileRequirementsNotMetDetailResponse);
expect(firstDetail).toEqual(expect.objectContaining({
failureType: 'ID_DOCUMENT_EXTRACTION',
documentType: 'PASSPORT',
documentCountryIsoCode: 'GBR',
auditId: 'audit-123',
details: 'something not right',
}));
expect(firstDetail).toBeInstanceOf(IdentityProfileRequirementsNotMetDetailResponse);
expect(secondDetail).toEqual(expect.objectContaining({
failureType: 'ID_DOCUMENT_AUTHENTICITY',
documentType: 'PASSPORT',
documentCountryIsoCode: 'GBR',
auditId: 'audit-456',
details: 'something still not right',
}));
});
describe('#getRequirementsNotMetInfo', () => {
it('Should return requirements_not_met_info string', () => {
expect(identityProfileReportSchemesComplianceResponse.getRequirementsNotMetInfo()).toBe('some string here');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ declare class IdentityProfileReportSchemesComplianceResponse {
private requirementsMet;
/** @private @type {string|undefined} */
private requirementsNotMetInfo;
/** @private @type {IdentityProfileRequirementsNotMetDetailResponse[]|undefined} */
private requirementsNotMetDetails;
/**
* @returns {object}
*/
getScheme(): object;
isRequirementsMet(): boolean;
getRequirementsNotMetInfo(): string;
getRequirementsNotMetDetails(): IdentityProfileRequirementsNotMetDetailResponse[];
}
import IdentityProfileRequirementsNotMetDetailResponse = require("./identity.profile.requirements.not.met.detail.response");

0 comments on commit ae0ff82

Please sign in to comment.