From 4c782a28d010c4e74c743d772dafa35b4ee603d9 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Fri, 13 Sep 2024 17:04:59 +0100 Subject: [PATCH 01/15] CIV-12317 Store "give evidence yourself" details --- .../ccdResponse/ccdEvidenceConfirmDetails.ts | 7 +++++++ .../ccdResponse/ccdRespondentLiPResponse.ts | 2 ++ src/main/common/models/civilClaimResponse.ts | 2 ++ .../translation/convertToCUI/convertToCUIDQs.ts | 2 ++ .../convertToCUIEvidenceConfirmDetails.ts | 16 ++++++++++++++++ .../convertToCCDEvidenceConfirmDetails.ts | 13 +++++++++++++ .../convertToCCDRespondentLiPResponse.ts | 2 ++ 7 files changed, 44 insertions(+) create mode 100644 src/main/common/models/ccdResponse/ccdEvidenceConfirmDetails.ts create mode 100644 src/main/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.ts create mode 100644 src/main/services/translation/response/convertToCCDEvidenceConfirmDetails.ts diff --git a/src/main/common/models/ccdResponse/ccdEvidenceConfirmDetails.ts b/src/main/common/models/ccdResponse/ccdEvidenceConfirmDetails.ts new file mode 100644 index 00000000000..abd890fd016 --- /dev/null +++ b/src/main/common/models/ccdResponse/ccdEvidenceConfirmDetails.ts @@ -0,0 +1,7 @@ +export interface CCDEvidenceConfirmDetails { + firstName: string, + lastName: string, + email?: string, + phone?: string, + jobTitle: string, +} diff --git a/src/main/common/models/ccdResponse/ccdRespondentLiPResponse.ts b/src/main/common/models/ccdResponse/ccdRespondentLiPResponse.ts index fb980b0935c..8835a106487 100644 --- a/src/main/common/models/ccdResponse/ccdRespondentLiPResponse.ts +++ b/src/main/common/models/ccdResponse/ccdRespondentLiPResponse.ts @@ -2,6 +2,7 @@ import {CCDMediation} from 'models/ccdResponse/ccdMediation'; import {CCDDQExtraDetails} from 'models/ccdResponse/ccdDQExtraDetails'; import {CCDHearingSupport} from 'models/ccdResponse/ccdHearingSupport'; import {CCDAddress} from 'models/ccdResponse/ccdAddress'; +import {CCDEvidenceConfirmDetails} from 'models/ccdResponse/ccdEvidenceConfirmDetails'; export interface CCDRespondentLiPResponse { timelineComment?: string; @@ -12,6 +13,7 @@ export interface CCDRespondentLiPResponse { respondent1LiPContactPerson?: string, respondent1LiPCorrespondenceAddress?: CCDAddress, respondent1ResponseLanguage?: CCDRespondentResponseLanguage; + respondent1DQEvidenceConfirmDetails?: CCDEvidenceConfirmDetails; } export enum CCDRespondentResponseLanguage { diff --git a/src/main/common/models/civilClaimResponse.ts b/src/main/common/models/civilClaimResponse.ts index 8bb225cb47c..b75ffd84616 100644 --- a/src/main/common/models/civilClaimResponse.ts +++ b/src/main/common/models/civilClaimResponse.ts @@ -88,6 +88,7 @@ import {CCDDisclosureOfElectronicDocuments} from 'models/ccdResponse/ccdDisclosu import {CCDDisclosureOfNonElectronicDocuments} from 'models/ccdResponse/ccdDisclosureOfNonElectronicDocuments'; import {CCDDocumentsToBeConsidered} from 'models/ccdResponse/ccdDocumentsToBeConsidered'; import {CCDGeneralApplication} from 'models/gaEvents/eventDto'; +import {CCDEvidenceConfirmDetails} from 'models/ccdResponse/ccdEvidenceConfirmDetails'; export class CivilClaimResponse { id: string; @@ -200,6 +201,7 @@ export interface CCDClaim extends ClaimUpdate { specRespondent1DQDisclosureOfElectronicDocuments?: CCDDisclosureOfElectronicDocuments; specRespondent1DQDisclosureOfNonElectronicDocuments?: CCDDisclosureOfNonElectronicDocuments; respondent1DQClaimantDocumentsToBeConsidered?: CCDDocumentsToBeConsidered; + respondent1DQEvidenceConfirmDetails?: CCDEvidenceConfirmDetails; sdoOrderDocument?: CaseDocument; respondToClaim?: CCDRespondToClaim; defenceRouteRequired?: string; diff --git a/src/main/services/translation/convertToCUI/convertToCUIDQs.ts b/src/main/services/translation/convertToCUI/convertToCUIDQs.ts index d803db41db1..d27ddc241a4 100644 --- a/src/main/services/translation/convertToCUI/convertToCUIDQs.ts +++ b/src/main/services/translation/convertToCUI/convertToCUIDQs.ts @@ -8,6 +8,7 @@ import {toCUIWitnesses} from 'services/translation/convertToCUI/convertToCUIWitn import {toCUIGenericYesNo} from 'services/translation/convertToCUI/convertToCUIYesNo'; import {toCUIExperts} from './convertToCUIExperts'; import {toCUIFixedRecoverableCosts} from 'services/translation/convertToCUI/convertToCUIFixedRecoverableCosts'; +import {convertToCUIEvidenceConfirmDetails} from 'services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails'; export const toCUIDQs = (ccdClaim: CCDClaim): DirectionQuestionnaire => { if (ccdClaim) { @@ -18,6 +19,7 @@ export const toCUIDQs = (ccdClaim: CCDClaim): DirectionQuestionnaire => { dq.witnesses = toCUIWitnesses(ccdClaim.respondent1DQWitnesses); dq.defendantYourselfEvidence = toCUIGenericYesNo(ccdClaim.respondent1LiPResponse?.respondent1DQExtraDetails?.giveEvidenceYourSelf); dq.experts = toCUIExperts(ccdClaim); + dq.confirmYourDetailsEvidence = convertToCUIEvidenceConfirmDetails(ccdClaim); dq.fixedRecoverableCosts = toCUIFixedRecoverableCosts(ccdClaim); return dq; } diff --git a/src/main/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.ts b/src/main/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.ts new file mode 100644 index 00000000000..7c5d1ab40ae --- /dev/null +++ b/src/main/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.ts @@ -0,0 +1,16 @@ +import {CCDClaim} from 'models/civilClaimResponse'; +import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; + +export const convertToCUIEvidenceConfirmDetails = (ccdClaim: CCDClaim) : ConfirmYourDetailsEvidence => { + if (ccdClaim) { + const confirmDetails: ConfirmYourDetailsEvidence = new ConfirmYourDetailsEvidence(); + if (ccdClaim.respondent1LiPResponse?.respondent1DQEvidenceConfirmDetails?.firstName) { + confirmDetails.firstName = ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.firstName; + confirmDetails.lastName = ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.lastName; + confirmDetails.emailAddress = ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.email; + confirmDetails.phoneNumber = ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.phone ? Number(ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.phone) : undefined; + confirmDetails.jobTitle = ccdClaim.respondent1LiPResponse.respondent1DQEvidenceConfirmDetails.jobTitle; + } + return confirmDetails; + } +}; diff --git a/src/main/services/translation/response/convertToCCDEvidenceConfirmDetails.ts b/src/main/services/translation/response/convertToCCDEvidenceConfirmDetails.ts new file mode 100644 index 00000000000..4ec6d6c71de --- /dev/null +++ b/src/main/services/translation/response/convertToCCDEvidenceConfirmDetails.ts @@ -0,0 +1,13 @@ +import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; + +export const convertToCCDEvidenceConfirmDetails = (confirmDetails: ConfirmYourDetailsEvidence) => { + if (confirmDetails?.firstName) { + return { + firstName: confirmDetails.firstName, + lastName: confirmDetails.lastName, + email: confirmDetails.emailAddress, + phone: confirmDetails.phoneNumber?.toString(), + jobTitle: confirmDetails.jobTitle, + }; + } +}; diff --git a/src/main/services/translation/response/convertToCCDRespondentLiPResponse.ts b/src/main/services/translation/response/convertToCCDRespondentLiPResponse.ts index de1a32a0784..9db1f793587 100644 --- a/src/main/services/translation/response/convertToCCDRespondentLiPResponse.ts +++ b/src/main/services/translation/response/convertToCCDRespondentLiPResponse.ts @@ -6,6 +6,7 @@ import {CCDRespondentLiPResponse, CCDRespondentResponseLanguage} from 'models/cc import {toCCDAddress} from 'services/translation/response/convertToCCDAddress'; import {YesNo} from 'form/models/yesNo'; import {ClaimBilingualLanguagePreference} from 'models/claimBilingualLanguagePreference'; +import {convertToCCDEvidenceConfirmDetails} from 'services/translation/response/convertToCCDEvidenceConfirmDetails'; export const toCCDRespondentLiPResponse = (claim: Claim): CCDRespondentLiPResponse => { return { @@ -19,6 +20,7 @@ export const toCCDRespondentLiPResponse = (claim: Claim): CCDRespondentLiPRespon respondent1LiPContactPerson: claim.respondent1?.partyDetails?.contactPerson, respondent1LiPCorrespondenceAddress: claim.respondent1?.partyDetails?.postToThisAddress === YesNo.YES ? toCCDAddress(claim.respondent1?.partyDetails?.correspondenceAddress) : undefined, respondent1ResponseLanguage: toCCDRespondentResponseLanguage(claim.claimBilingualLanguagePreference), + respondent1DQEvidenceConfirmDetails: convertToCCDEvidenceConfirmDetails(claim.directionQuestionnaire?.confirmYourDetailsEvidence), }; }; From 9aa775320577b364a3b2a6f93073da0913b38780 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Fri, 13 Sep 2024 17:26:31 +0100 Subject: [PATCH 02/15] test fix --- .../convertToCUI/convertToCUIDQs.test.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts b/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts index cbb59ef5e02..bf2c12b02b9 100644 --- a/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts +++ b/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts @@ -21,6 +21,7 @@ import {TypeOfDisclosureDocument} from 'models/directionsQuestionnaire/hearing/d import { HasAnAgreementBeenReachedOptions, } from 'models/directionsQuestionnaire/mintiMultitrack/hasAnAgreementBeenReachedOptions'; +import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; describe('translate CCDDQ to CUI DQ model', () => { it('should return undefined if ccdClaim doesnt exist', () => { @@ -39,11 +40,26 @@ describe('translate CCDDQ to CUI DQ model', () => { respondent1DQExtraDetails: { giveEvidenceYourSelf: YesNoUpperCamelCase.YES, }, + respondent1DQEvidenceConfirmDetails : { + firstName: 'Gordon', + lastName: 'Ramsay', + email: 'abc@def.ghi', + phone: '7788994455', + jobTitle: 'Chef', + } }, }; + + const confirmDetails: ConfirmYourDetailsEvidence = new ConfirmYourDetailsEvidence(); + confirmDetails.firstName = 'Gordon'; + confirmDetails.lastName = 'Ramsay'; + confirmDetails.emailAddress = 'abc@def.ghi'; + confirmDetails.phoneNumber = 7788994455; + confirmDetails.jobTitle = 'Chef'; + //When const output = toCUIDQs(input); - const expected : DirectionQuestionnaire = new DirectionQuestionnaire(new GenericYesNo(YesNo.YES), new Hearing(), undefined, new Experts()); + const expected : DirectionQuestionnaire = new DirectionQuestionnaire(new GenericYesNo(YesNo.YES), new Hearing(), undefined, new Experts(), undefined, undefined, confirmDetails); //Then expect(output).toEqual(expected); }); From d6cbd35f39d1f8a628b67a25a989b8e6946a7061 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 15:22:51 +0100 Subject: [PATCH 03/15] translate claimant fields --- .../directionQuestionnaireService.ts | 7 ++++++- .../claimantResponse/convertToCCDClaimantLiPResponse.ts | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/services/features/directionsQuestionnaire/directionQuestionnaireService.ts b/src/main/services/features/directionsQuestionnaire/directionQuestionnaireService.ts index 3c2101e4def..18daa4a8708 100644 --- a/src/main/services/features/directionsQuestionnaire/directionQuestionnaireService.ts +++ b/src/main/services/features/directionsQuestionnaire/directionQuestionnaireService.ts @@ -90,7 +90,12 @@ const saveDirectionQuestionnaire = async (claimId: string, value: any, direction const getConfirmYourDetailsEvidence = async (claimId: string, directionQuestionnairePropertyName: string, parentPropertyName?: string): Promise => { try { const claim = await getCaseDataFromStore(claimId); - const directionQuestionnaire: any = claim?.directionQuestionnaire ? claim.directionQuestionnaire : new DirectionQuestionnaire(); + let directionQuestionnaire: any; + if (claim.isClaimantIntentionPending()) { + directionQuestionnaire = claim.claimantResponse?.directionQuestionnaire ? claim.claimantResponse.directionQuestionnaire : new DirectionQuestionnaire(); + } else { + directionQuestionnaire = claim?.directionQuestionnaire ? claim.directionQuestionnaire : new DirectionQuestionnaire(); + } if (parentPropertyName && directionQuestionnaire[parentPropertyName] && directionQuestionnaire[parentPropertyName][directionQuestionnairePropertyName]) { return directionQuestionnaire[parentPropertyName][directionQuestionnairePropertyName]; } else if (!parentPropertyName && directionQuestionnaire[directionQuestionnairePropertyName]) { diff --git a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts index 1686d6ab6ca..ce6bda3f6b0 100644 --- a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts +++ b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts @@ -9,6 +9,8 @@ import {ChooseHowProceed} from 'common/models/chooseHowProceed'; import {CourtProposedDateOptions} from 'common/form/models/claimantResponse/courtProposedDate'; import { CourtProposedPlanOptions } from 'common/form/models/claimantResponse/courtProposedPlan'; import {RepaymentDecisionType} from 'models/claimantResponse/RepaymentDecisionType'; +import {convertToCCDEvidenceConfirmDetails} from 'services/translation/response/convertToCCDEvidenceConfirmDetails'; +import {CCDEvidenceConfirmDetails} from 'models/ccdResponse/ccdEvidenceConfirmDetails'; export enum CCDChoosesHowToProceed { SIGN_A_SETTLEMENT_AGREEMENT = 'SIGN_A_SETTLEMENT_AGREEMENT', @@ -24,6 +26,7 @@ export interface CCDClaimantLiPResponse { claimantCourtDecision?: RepaymentDecisionType, applicant1RejectedRepaymentReason?: string, applicant1SuggestedImmediatePaymentDeadLine?: Date, + applicant1DQEvidenceConfirmDetails: CCDEvidenceConfirmDetails, } const toChoosesHowToProceed = { @@ -41,5 +44,6 @@ export const toCCDClaimantLiPResponse = (claimantResponse: ClaimantResponse): CC claimantCourtDecision: claimantResponse?.courtDecision ? claimantResponse?.courtDecision : undefined, applicant1RejectedRepaymentReason: claimantResponse?.rejectionReason?.text, applicant1SuggestedImmediatePaymentDeadLine: claimantResponse?.suggestedImmediatePaymentDeadLine, + applicant1DQEvidenceConfirmDetails: convertToCCDEvidenceConfirmDetails(claimantResponse.directionQuestionnaire?.confirmYourDetailsEvidence), }; }; From e331cd6ea273e1460b36a7e702741065371a2718 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 15:27:32 +0100 Subject: [PATCH 04/15] lint fix --- .../translation/convertToCUI/convertToCUIDQs.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts b/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts index bf2c12b02b9..0659674b0a6 100644 --- a/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts +++ b/src/test/unit/services/translation/convertToCUI/convertToCUIDQs.test.ts @@ -46,16 +46,16 @@ describe('translate CCDDQ to CUI DQ model', () => { email: 'abc@def.ghi', phone: '7788994455', jobTitle: 'Chef', - } + }, }, }; const confirmDetails: ConfirmYourDetailsEvidence = new ConfirmYourDetailsEvidence(); - confirmDetails.firstName = 'Gordon'; - confirmDetails.lastName = 'Ramsay'; - confirmDetails.emailAddress = 'abc@def.ghi'; - confirmDetails.phoneNumber = 7788994455; - confirmDetails.jobTitle = 'Chef'; + confirmDetails.firstName = 'Gordon'; + confirmDetails.lastName = 'Ramsay'; + confirmDetails.emailAddress = 'abc@def.ghi'; + confirmDetails.phoneNumber = 7788994455; + confirmDetails.jobTitle = 'Chef'; //When const output = toCUIDQs(input); From 9a6439e437ac648c5efa71bbb0e78d1afa5fc428 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 15:31:47 +0100 Subject: [PATCH 05/15] test fix --- .../claimantResponse/convertToCCDClaimantLiPResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts index ce6bda3f6b0..06d8a415b01 100644 --- a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts +++ b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts @@ -26,7 +26,7 @@ export interface CCDClaimantLiPResponse { claimantCourtDecision?: RepaymentDecisionType, applicant1RejectedRepaymentReason?: string, applicant1SuggestedImmediatePaymentDeadLine?: Date, - applicant1DQEvidenceConfirmDetails: CCDEvidenceConfirmDetails, + applicant1DQEvidenceConfirmDetails?: CCDEvidenceConfirmDetails, } const toChoosesHowToProceed = { From ce38792cb6292fbd47a572db7a0c88a7b4d27e3c Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 15:58:47 +0100 Subject: [PATCH 06/15] test fix --- .../claimantResponse/convertToCCDClaimantLiPResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts index 06d8a415b01..2f7984d075a 100644 --- a/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts +++ b/src/main/services/translation/claimantResponse/convertToCCDClaimantLiPResponse.ts @@ -44,6 +44,6 @@ export const toCCDClaimantLiPResponse = (claimantResponse: ClaimantResponse): CC claimantCourtDecision: claimantResponse?.courtDecision ? claimantResponse?.courtDecision : undefined, applicant1RejectedRepaymentReason: claimantResponse?.rejectionReason?.text, applicant1SuggestedImmediatePaymentDeadLine: claimantResponse?.suggestedImmediatePaymentDeadLine, - applicant1DQEvidenceConfirmDetails: convertToCCDEvidenceConfirmDetails(claimantResponse.directionQuestionnaire?.confirmYourDetailsEvidence), + applicant1DQEvidenceConfirmDetails: convertToCCDEvidenceConfirmDetails(claimantResponse?.directionQuestionnaire?.confirmYourDetailsEvidence), }; }; From 1a5f0fe6fcef3c27cf7063ae8ca48421b2cb6190 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 16:22:32 +0100 Subject: [PATCH 07/15] sonar fix --- ...convertToCCDEvidenceConfirmDetails.test.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts diff --git a/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts b/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts new file mode 100644 index 00000000000..91879a97143 --- /dev/null +++ b/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts @@ -0,0 +1,40 @@ +import {Claim} from 'models/claim'; +import {DirectionQuestionnaire} from 'models/directionsQuestionnaire/directionQuestionnaire'; +import {convertToCCDEvidenceConfirmDetails} from 'services/translation/response/convertToCCDEvidenceConfirmDetails'; +import {CCDEvidenceConfirmDetails} from 'models/ccdResponse/ccdEvidenceConfirmDetails'; + +describe('translate DQ confirm details for evidence CCD model', () => { + const claim = new Claim(); + claim.directionQuestionnaire = new DirectionQuestionnaire(); + + it('should return undefined if data doesnt exist', () => { + //When + const dqExtraDetails = convertToCCDEvidenceConfirmDetails(claim.directionQuestionnaire.confirmYourDetailsEvidence); + //then + expect(dqExtraDetails).toEqual(undefined); + }); + + it('should return values if data exist',() => { + //given + claim.directionQuestionnaire.confirmYourDetailsEvidence = { + firstName: 'Ted', + lastName: 'Ned', + phoneNumber: 7788445566, + emailAddress: 'ted@ned.ed', + jobTitle: 'Person', + }; + + const expected: CCDEvidenceConfirmDetails = { + firstName: 'Ted', + lastName: 'Ned', + phone: '7788445566', + email: 'ted@ned.ed', + jobTitle: 'Person', + }; + + //When + const actual = convertToCCDEvidenceConfirmDetails(claim.directionQuestionnaire.confirmYourDetailsEvidence); + //then + expect(actual).toEqual(expected); + }); +}); From 99ef66269325c415d0c3f6ab658a45b5eafcce91 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 17 Sep 2024 16:53:44 +0100 Subject: [PATCH 08/15] sonar fix --- ...convertToCUIEvidenceConfirmDetails.test.ts | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts diff --git a/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts b/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts new file mode 100644 index 00000000000..75a98c8d8c9 --- /dev/null +++ b/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts @@ -0,0 +1,55 @@ +import {convertToCUIEvidenceConfirmDetails} from 'services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails'; +import {CCDClaim} from 'models/civilClaimResponse'; +import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; + +describe('translate CCD data to CUI DQ Evidence confirm details', () => { + it('should return undefined', () => { + // Given + const ccdClaim: CCDClaim = { + respondent1LiPResponse: { + respondent1LiPContactPerson: 'a', + }, + }; + + const expected: ConfirmYourDetailsEvidence = { + firstName: undefined, + lastName: undefined, + phoneNumber: undefined, + emailAddress: undefined, + jobTitle: undefined, + }; + + // When + const result = convertToCUIEvidenceConfirmDetails(ccdClaim); + // Then + expect(result).toEqual(expected); + }); + + it('should translate CCD data when values exist', () => { + // Given + const ccdClaim: CCDClaim = { + respondent1LiPResponse: { + respondent1DQEvidenceConfirmDetails: { + firstName: 'Ant', + lastName: 'Pant', + phone: '778899456', + email: 'ant@pant.com', + jobTitle: 'Chant', + }, + }, + }; + + const expected: ConfirmYourDetailsEvidence = { + firstName: 'Ant', + lastName: 'Pant', + phoneNumber: 778899456, + emailAddress: 'ant@pant.com', + jobTitle: 'Chant', + }; + + // When + const result = convertToCUIEvidenceConfirmDetails(ccdClaim); + // Then + expect(result).toMatchObject(expected); + }); +}); From feac3a7842a976e02a263d1e21c922c17c3cd5b5 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Fri, 4 Oct 2024 12:17:30 +0100 Subject: [PATCH 09/15] sonar fix --- .../convertToCCDRespondentLiPResponse.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts b/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts index c78af34e406..9fe793b818b 100644 --- a/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts +++ b/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts @@ -12,6 +12,9 @@ import {TimelineRow} from 'form/models/timeLineOfEvents/timelineRow'; import {YesNo} from 'common/form/models/yesNo'; import {ClaimDetails} from 'common/form/models/claim/details/claimDetails'; import {HelpWithFees} from 'common/form/models/claim/details/helpWithFees'; +import {DirectionQuestionnaire} from 'models/directionsQuestionnaire/directionQuestionnaire'; +import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; +import {CCDEvidenceConfirmDetails} from 'models/ccdResponse/ccdEvidenceConfirmDetails'; const setUpUndefinedDQExtraDetails = () : CCDDQExtraDetails => { return { @@ -66,6 +69,14 @@ const addressCCD: CCDAddress = { PostTown: 'london', }; +const evidenceConfirmDetails: CCDEvidenceConfirmDetails = { + firstName: 'John', + lastName: 'Doe', + email: 'test@test.com', + phone: '600000000', + jobTitle: 'Doctor', +} + describe('translate cui fields to CCD model', () => { it('should return undefined if it is undefined', () => { //Given @@ -82,12 +93,16 @@ describe('translate cui fields to CCD model', () => { input.respondent1.partyDetails.contactPerson = 'Example contactPerson'; input.respondent1.partyDetails.postToThisAddress = 'yes'; input.respondent1.partyDetails.correspondenceAddress = new Address('line 1', 'line 2', 'line 3', 'london', 'SW1A 2AA' ); + input.directionQuestionnaire = new DirectionQuestionnaire(); + input.directionQuestionnaire.confirmYourDetailsEvidence = new ConfirmYourDetailsEvidence('John', 'Doe', + 'test@test.com', 600000000, 'Doctor'); const expected : CCDRespondentLiPResponse = { respondent1MediationLiPResponse: undefined, respondent1DQHearingSupportLip: setUpUndefinedDQHearingSupport(), respondent1DQExtraDetails: setUpUndefinedDQExtraDetails(), respondent1LiPContactPerson: 'Example contactPerson', + respondent1DQEvidenceConfirmDetails: evidenceConfirmDetails, respondent1LiPCorrespondenceAddress: addressCCD, }; //When From 008dc718fed79adae57a1d9d4fd86fc405c53cd5 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Fri, 4 Oct 2024 12:25:05 +0100 Subject: [PATCH 10/15] lint fix --- .../response/convertToCCDRespondentLiPResponse.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts b/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts index 9fe793b818b..d3314eeb9e1 100644 --- a/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts +++ b/src/test/unit/services/translation/response/convertToCCDRespondentLiPResponse.test.ts @@ -75,7 +75,7 @@ const evidenceConfirmDetails: CCDEvidenceConfirmDetails = { email: 'test@test.com', phone: '600000000', jobTitle: 'Doctor', -} +}; describe('translate cui fields to CCD model', () => { it('should return undefined if it is undefined', () => { From 526853e04d900513939c6a1b8a4cfd7c391ce726 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 15 Oct 2024 12:05:02 +0100 Subject: [PATCH 11/15] add test --- .../convertToCUIEvidenceConfirmDetails.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts b/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts index 75a98c8d8c9..5fa7ec88baa 100644 --- a/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts +++ b/src/test/unit/services/translation/convertToCUI/convertToCUIEvidenceConfirmDetails.test.ts @@ -3,6 +3,24 @@ import {CCDClaim} from 'models/civilClaimResponse'; import {ConfirmYourDetailsEvidence} from 'form/models/confirmYourDetailsEvidence'; describe('translate CCD data to CUI DQ Evidence confirm details', () => { + it('should return undefined when no lip response', () => { + // Given + const ccdClaim: CCDClaim = {}; + + const expected: ConfirmYourDetailsEvidence = { + firstName: undefined, + lastName: undefined, + phoneNumber: undefined, + emailAddress: undefined, + jobTitle: undefined, + }; + + // When + const result = convertToCUIEvidenceConfirmDetails(ccdClaim); + // Then + expect(result).toEqual(expected); + }); + it('should return undefined', () => { // Given const ccdClaim: CCDClaim = { From 41c1068fe596b7659aef4b5f5bbfa160872b615b Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 15 Oct 2024 15:47:07 +0100 Subject: [PATCH 12/15] fix test --- .../defendantLipResponse/defendantDQ/confirmYourDetails.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/functionalTests/citizenFeatures/response/pages/defendantLipResponse/defendantDQ/confirmYourDetails.js b/src/test/functionalTests/citizenFeatures/response/pages/defendantLipResponse/defendantDQ/confirmYourDetails.js index 7076608b919..de421720584 100644 --- a/src/test/functionalTests/citizenFeatures/response/pages/defendantLipResponse/defendantDQ/confirmYourDetails.js +++ b/src/test/functionalTests/citizenFeatures/response/pages/defendantLipResponse/defendantDQ/confirmYourDetails.js @@ -6,7 +6,7 @@ const cButtons = require('../../../../../commonComponents/cButtons'); const fields ={ firstName : 'input[id="firstName"]', lastName: 'input[id="lastName"]', - email:'input[id="lastName"]', + email:'input[id="emailAddress"]', telephone: 'input[id="phoneNumber"]', jobTitle: 'input[id="jobTitle"]', }; @@ -32,7 +32,7 @@ const inputs = { class ConfirmYourDetails { async enterYourDetails() { - const { language } = sharedData; + const { language } = sharedData; await I.waitForContent(content.heading[language], config.WaitForText); await I.see(content.descriptionText[language]); await I.fillField(fields.firstName, 'John'); @@ -44,4 +44,4 @@ class ConfirmYourDetails { } } -module.exports = ConfirmYourDetails; \ No newline at end of file +module.exports = ConfirmYourDetails; From d496e8585eae743955a09ca38d62e41a5ed05ee4 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 15 Oct 2024 16:03:31 +0100 Subject: [PATCH 13/15] point to service PR --- .../civil-citizen-ui/values.elasticsearch.preview.template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml b/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml index 3f3ce8d8f06..14f4c64961a 100644 --- a/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml +++ b/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml @@ -76,7 +76,7 @@ civil-service: java: applicationPort: 4000 releaseNameOverride: ${SERVICE_NAME}-civil-service - image: 'hmctspublic.azurecr.io/civil/service:latest' + image: 'hmctspublic.azurecr.io/civil/service:pr-5630' imagePullPolicy: Always ingressHost: ${SERVICE_NAME}-civil-service.preview.platform.hmcts.net devcpuRequests: 500m From 4da341488aaee6c035ae75114b55c0dfcd1423c7 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 15 Oct 2024 17:24:20 +0100 Subject: [PATCH 14/15] point back to master --- .../civil-citizen-ui/values.elasticsearch.preview.template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml b/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml index 14f4c64961a..3f3ce8d8f06 100644 --- a/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml +++ b/charts/civil-citizen-ui/values.elasticsearch.preview.template.yaml @@ -76,7 +76,7 @@ civil-service: java: applicationPort: 4000 releaseNameOverride: ${SERVICE_NAME}-civil-service - image: 'hmctspublic.azurecr.io/civil/service:pr-5630' + image: 'hmctspublic.azurecr.io/civil/service:latest' imagePullPolicy: Always ingressHost: ${SERVICE_NAME}-civil-service.preview.platform.hmcts.net devcpuRequests: 500m From d932bf92163e0b3f0d0226bdd78c45fce08a7410 Mon Sep 17 00:00:00 2001 From: sankaviv1 Date: Tue, 15 Oct 2024 17:41:40 +0100 Subject: [PATCH 15/15] add test --- ...convertToCCDEvidenceConfirmDetails.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts b/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts index 91879a97143..656faa38678 100644 --- a/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts +++ b/src/test/unit/services/translation/response/convertToCCDEvidenceConfirmDetails.test.ts @@ -37,4 +37,26 @@ describe('translate DQ confirm details for evidence CCD model', () => { //then expect(actual).toEqual(expected); }); + + it('should return values if data exist - no phone number',() => { + //given + claim.directionQuestionnaire.confirmYourDetailsEvidence = { + firstName: 'Ted', + lastName: 'Ned', + emailAddress: 'ted@ned.ed', + jobTitle: 'Person', + }; + + const expected: CCDEvidenceConfirmDetails = { + firstName: 'Ted', + lastName: 'Ned', + email: 'ted@ned.ed', + jobTitle: 'Person', + }; + + //When + const actual = convertToCCDEvidenceConfirmDetails(claim.directionQuestionnaire.confirmYourDetailsEvidence); + //then + expect(actual).toEqual(expected); + }); });