-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK-2453 include requirements_not_met_details in scheme compliance (#472
) * Created class IdentityProfileRequirementsNotMetDetailResponse to parse/expose the RequirementsNotMetDetail object. Updated IdentityProfileFailureReasonResponse to use IdentityProfileRequirementsNotMetDetailResponse Modified IdentityProfileReportSchemesComplianceResponse to include conditionally requirementsNotMetDetails, as a list of IdentityProfileRequirementsNotMetDetailResponse * Fixes for JSDoc/Typescript
- Loading branch information
1 parent
d507f4a
commit 4cccee3
Showing
9 changed files
with
220 additions
and
82 deletions.
There are no files selected for viewing
41 changes: 6 additions & 35 deletions
41
src/idv_service/session/retrieve/identity.profile.failure.reason.response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/idv_service/session/retrieve/identity.profile.requirements.not.met.detail.response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
const Validation = require('../../../yoti_common/validation'); | ||
|
||
class IdentityProfileRequirementsNotMetDetailResponse { | ||
constructor(requirementsNotMetDetail) { | ||
Validation.isString(requirementsNotMetDetail.failure_type, 'failure_type'); | ||
/** @private @type {string} */ | ||
this.failureType = requirementsNotMetDetail.failure_type; | ||
|
||
Validation.isString(requirementsNotMetDetail.document_type, 'document_type'); | ||
/** @private @type {string} */ | ||
this.documentType = requirementsNotMetDetail.document_type; | ||
|
||
Validation.isString(requirementsNotMetDetail.document_country_iso_code, 'document_country_iso_code'); | ||
/** @private @type {string} */ | ||
this.documentCountryIsoCode = requirementsNotMetDetail.document_country_iso_code; | ||
|
||
Validation.isString(requirementsNotMetDetail.audit_id, 'audit_id', true); | ||
/** @private @type {string|undefined} */ | ||
this.auditId = requirementsNotMetDetail.audit_id; | ||
|
||
Validation.isString(requirementsNotMetDetail.details, 'details'); | ||
/** @private @type {string} */ | ||
this.details = requirementsNotMetDetail.details; | ||
} | ||
|
||
getFailureType() { | ||
return this.failureType; | ||
} | ||
|
||
getDocumentType() { | ||
return this.documentType; | ||
} | ||
|
||
getDocumentCountryIsoCode() { | ||
return this.documentCountryIsoCode; | ||
} | ||
|
||
getAuditId() { | ||
return this.auditId; | ||
} | ||
|
||
getDetails() { | ||
return this.details; | ||
} | ||
} | ||
|
||
module.exports = IdentityProfileRequirementsNotMetDetailResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...idv_service/session/retrieve/identity.profile.requirement.not.met.detail.response.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const IdentityProfileRequirementsNotMetDetailResponse = require('../../../../src/idv_service/session/retrieve/identity.profile.requirements.not.met.detail.response'); | ||
|
||
describe('IdentityProfileRequirementsNotMetDetailResponse', () => { | ||
let requirementsNotMetDetailResponse; | ||
|
||
beforeEach(() => { | ||
requirementsNotMetDetailResponse = new IdentityProfileRequirementsNotMetDetailResponse({ | ||
failure_type: 'ID_DOCUMENT_EXTRACTION', | ||
document_type: 'PASSPORT', | ||
document_country_iso_code: 'GBR', | ||
audit_id: 'audit-123', | ||
details: 'something not right', | ||
}); | ||
}); | ||
|
||
describe('#getFailureType', () => { | ||
it('Should return the failure type', () => { | ||
expect(requirementsNotMetDetailResponse.getFailureType()).toBe('ID_DOCUMENT_EXTRACTION'); | ||
}); | ||
}); | ||
|
||
describe('#getDocumentType', () => { | ||
it('Should return the document type', () => { | ||
expect(requirementsNotMetDetailResponse.getDocumentType()).toBe('PASSPORT'); | ||
}); | ||
}); | ||
|
||
describe('#getDocumentCountryIsoCode', () => { | ||
it('Should return the document country iso code', () => { | ||
expect(requirementsNotMetDetailResponse.getDocumentCountryIsoCode()).toBe('GBR'); | ||
}); | ||
}); | ||
|
||
describe('#getAuditId', () => { | ||
it('Should return the audit ID', () => { | ||
expect(requirementsNotMetDetailResponse.getAuditId()).toBe('audit-123'); | ||
}); | ||
}); | ||
|
||
describe('#getDetails', () => { | ||
it('Should return the details', () => { | ||
expect(requirementsNotMetDetailResponse.getDetails()).toBe('something not right'); | ||
}); | ||
}); | ||
|
||
describe('default instance object', () => { | ||
it('Should return an object with all the fields', () => { | ||
expect(requirementsNotMetDetailResponse).toEqual(expect.objectContaining({ | ||
failureType: 'ID_DOCUMENT_EXTRACTION', | ||
documentType: 'PASSPORT', | ||
documentCountryIsoCode: 'GBR', | ||
auditId: 'audit-123', | ||
details: 'something not right', | ||
})); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 4 additions & 27 deletions
31
types/src/idv_service/session/retrieve/identity.profile.failure.reason.response.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,11 @@ | ||
export = IdentityProfileFailureReasonResponse; | ||
/** | ||
* @typedef {Object} RequirementsNotMetDetail | ||
* @property {string} [failureType] | ||
* @property {string} [documentType] | ||
* @property {string} [documentCountryIsoCode] | ||
* @property {string} [auditId] | ||
* @property {string} [details] | ||
*/ | ||
declare class IdentityProfileFailureReasonResponse { | ||
constructor(failureReason: any); | ||
/** @private */ | ||
/** @private @type {string} */ | ||
private reasonCode; | ||
/** @private */ | ||
/** @private @type {IdentityProfileRequirementsNotMetDetailResponse[]} */ | ||
private requirementsNotMetDetails; | ||
/** | ||
* @returns {string} | ||
*/ | ||
getReasonCode(): string; | ||
/** | ||
* @returns {RequirementsNotMetDetail[]} | ||
*/ | ||
getRequirementsNotMetDetails(): RequirementsNotMetDetail[]; | ||
getRequirementsNotMetDetails(): IdentityProfileRequirementsNotMetDetailResponse[]; | ||
} | ||
declare namespace IdentityProfileFailureReasonResponse { | ||
export { RequirementsNotMetDetail }; | ||
} | ||
type RequirementsNotMetDetail = { | ||
failureType?: string; | ||
documentType?: string; | ||
documentCountryIsoCode?: string; | ||
auditId?: string; | ||
details?: string; | ||
}; | ||
import IdentityProfileRequirementsNotMetDetailResponse = require("./identity.profile.requirements.not.met.detail.response"); |
Oops, something went wrong.