Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-15600 test #4924

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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-5750'
imagePullPolicy: Always
ingressHost: ${SERVICE_NAME}-civil-service.preview.platform.hmcts.net
devcpuRequests: 500m
Expand Down
2 changes: 1 addition & 1 deletion charts/civil-citizen-ui/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ civil-wa:
civil-general-applications:
enabled: true
java:
image: 'hmctspublic.azurecr.io/civil/general-applications:latest'
image: 'hmctspublic.azurecr.io/civil/general-applications:pr-1547'
releaseNameOverride: ${SERVICE_NAME}-general-applications
ingressHost: ${SERVICE_NAME}-general-applications.preview.platform.hmcts.net
imagePullPolicy: Always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { CcdGeneralApplicationRespondentResponse } from '../ccdGeneralApplicatio
import { DateTime } from 'luxon';
import {CcdGARequestWrittenRepDocument} from 'models/ccdGeneralApplication/ccdGARequestWrittenRepDocument';
import {GeneralAppUrgencyRequirement} from 'models/generalApplication/response/urgencyRequirement';
import {CcdGeneralApplicationCertOfSC} from 'models/ccdGeneralApplication/ccdGeneralApplicationCertOfSC';

export class ApplicationResponse {
id: string;
Expand Down Expand Up @@ -85,6 +86,7 @@ export interface CCDApplication extends ApplicationUpdate {
applicationIsUncloakedOnce?: YesNoUpperCamelCase;
generalAppUrgencyRequirement?: GeneralAppUrgencyRequirement;
generalAppNotificationDeadlineDate?: string;
certOfSC?: CcdGeneralApplicationCertOfSC;
}

export interface JudicialRequestMoreInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ export const selectedApplicationTypeByOptions: Partial<{ [key in ApplicationType
[ApplicationTypeOption.UNLESS_ORDER]: ['PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.IMPOSE_SANCTION', 'PAGES.GENERAL_APPLICATION.SELECT_TYPE.ASK_IMPOSE_SANCTION_DESCRIPTION', 'Unless order'],
[ApplicationTypeOption.VARY_ORDER]: ['PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.RECONSIDER', 'PAGES.GENERAL_APPLICATION.SELECT_TYPE.ASK_RECONSIDER_DESCRIPTION', 'Vary order'],
[ApplicationTypeOption.VARY_PAYMENT_TERMS_OF_JUDGMENT]: ['PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.VARY_JUDGMENT', 'PAGES.GENERAL_APPLICATION.SELECT_TYPE.ASK_VARY_JUDGMENT_DESCRIPTION', 'Vary payment terms of judgment'],
[ApplicationTypeOption.CONFIRM_CCJ_DEBT_PAID]: ['PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.CONFIRM_YOU_PAID_CCJ', 'PAGES.GENERAL_APPLICATION.SELECT_TYPE.CONFIRM_YOU_PAID_DESCRIPTION', 'Confirm CCJ debt paid'],
[ApplicationTypeOption.CONFIRM_CCJ_DEBT_PAID]: ['PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.CONFIRM_YOU_PAID_CCJ', 'PAGES.GENERAL_APPLICATION.SELECT_TYPE.CONFIRM_YOU_PAID_DESCRIPTION', 'Confirm you\'ve paid a judgment debt'],
};
3 changes: 2 additions & 1 deletion src/main/modules/i18n/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,8 @@
"SUMMARY_JUDGMENT": "Dyfarniad Diannod",
"UNLESS_ORDER": "Gorchymyn Oni fydd",
"VARY_ORDER": "Amrywio gorchymyn",
"VARY_PAYMENT_TERMS_OF_JUDGMENT": "Amrywio telerau talu dyfarniad"
"VARY_PAYMENT_TERMS_OF_JUDGMENT": "Amrywio telerau talu dyfarniad",
"CONFIRM_CCJ_DEBT_PAID": "Cadarnhewch eich bod wedi talu dyled dyfarniad"
},
"COMPLETE": "Cwblhawyd",
"DETAILS": "Manylion",
Expand Down
3 changes: 2 additions & 1 deletion src/main/modules/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,8 @@
"SUMMARY_JUDGMENT": "Summary judgment",
"UNLESS_ORDER": "Unless order",
"VARY_ORDER": "Vary order",
"VARY_PAYMENT_TERMS_OF_JUDGMENT": "Vary payment terms of judgment"
"VARY_PAYMENT_TERMS_OF_JUDGMENT": "Vary payment terms of judgment",
"CONFIRM_CCJ_DEBT_PAID": "Confirm you've paid a judgment debt"
},
"COMPLETE": "Complete",
"DETAILS": "Details",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export const addHasEvidenceOfDebtPaymentRow = (claimId: string, claim: Claim, la
return rows;
};

function getEvidencePaymentOption(evidenceOption: string) : string {
export function getEvidencePaymentOption(evidenceOption: string) : string {
switch(evidenceOption) {
case debtPaymentOptions.UPLOAD_EVIDENCE_DEBT_PAID_IN_FULL :
return 'PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.COSC.UPLOAD_EVIDENCE_PAID_IN_FULL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {HearingTypeOptions} from 'models/generalApplication/hearingArrangement';
import {CcdHearingType} from 'models/ccdGeneralApplication/ccdGeneralApplicationHearingDetails';
import {formatDateToFullDate} from 'common/utils/dateUtils';
import {CcdSupportRequirement} from 'models/ccdGeneralApplication/ccdSupportRequirement';
import {debtPaymentOptions} from 'models/generalApplication/debtPaymentOptions';
import {getEvidencePaymentOption} from 'services/features/generalApplication/checkAnswers/addCheckAnswersRows';
import {CASE_DOCUMENT_VIEW_URL} from 'routes/urls';
import {documentIdExtractor} from 'common/utils/stringUtils';

Expand Down Expand Up @@ -254,6 +256,42 @@ export const addHearingSupportRows = (application: ApplicationResponse, lang: st
return rows;
};

export const addFinalPaymentDateDetails = (application: ApplicationResponse, lang: string): SummaryRow[] => {
const lng = getLng(lang);
const rows: SummaryRow[] = [];
if (application.case_data.certOfSC) {
const finalPaymentDate = formatDateToFullDate(application.case_data.certOfSC.defendantFinalPaymentDate, lang);
rows.push(
summaryRow(t('PAGES.GENERAL_APPLICATION.FINAL_DEFENDANT_PAYMENT_DATE.FORM_HEADER_1', {lng}), finalPaymentDate),
);
}
return rows;
};

export const addEvidenceOfDebtPaymentRow = (application: ApplicationResponse, lang: string): SummaryRow[] => {
const lng = getLng(lang);
let rowValue: string;
const rows: SummaryRow[] = [];
if (application.case_data.certOfSC) {
const evidenceOption = application.case_data.certOfSC.debtPaymentEvidence.debtPaymentOption;
if (evidenceOption === debtPaymentOptions.UNABLE_TO_PROVIDE_EVIDENCE_OF_FULL_PAYMENT) {
rowValue = `<p class="govuk-border-colour-border-bottom-1 govuk-!-padding-bottom-2 govuk-!-margin-top-0">
${t('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.COSC.UPLOAD_EVIDENCE_PAID_IN_FULL_NO', {lng})}</p>`;

rowValue += `<p class="govuk-!-padding-bottom-2 govuk-!-margin-top-0">
${application.case_data.certOfSC.debtPaymentEvidence.provideDetails}</p>`;
rows.push(
summaryRow(t('PAGES.GENERAL_APPLICATION.DEBT_PAYMENT.DO_YOU_WANT_PROVIDE_EVIDENCE', {lng}), t(rowValue, {lng})));
} else {
const evidenceDetails = getEvidencePaymentOption(application.case_data.certOfSC.debtPaymentEvidence.debtPaymentOption);
rows.push(
summaryRow(t('PAGES.GENERAL_APPLICATION.DEBT_PAYMENT.DO_YOU_WANT_PROVIDE_EVIDENCE', {lng}), t(evidenceDetails, {lng})),
);
}
return rows;
}
};

const toCUIHearingPreferencesPreferredType = (hearingTypeOption: CcdHearingType): HearingTypeOptions => {
switch (hearingTypeOption) {
case CcdHearingType.IN_PERSON:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
addApplicationTypesAndDescriptionRows,
addApplicationTypesRows,
addDocumentUploadRow,
addEvidenceOfDebtPaymentRow,
addFinalPaymentDateDetails,
addHearingArrangementsRows,
addHearingContactDetailsRows,
addHearingSupportRows,
Expand All @@ -29,26 +31,36 @@ import {documentIdExtractor} from 'common/utils/stringUtils';
import { buildResponseFromCourtSection } from './responseFromCourtService';
import { CourtResponseSummaryList } from 'common/models/generalApplication/CourtResponseSummary';
import {CASE_DOCUMENT_VIEW_URL} from 'routes/urls';
import {displayToEnumKey} from 'services/translation/convertToCUI/cuiTranslation';

export type ViewApplicationSummaries = {
summaryRows: SummaryRow[],
responseSummaries?: SummaryRow[],
}

const buildApplicationSections = (application: ApplicationResponse, lang: string ): SummaryRow[] => {
return [
...addApplicationStatus(application, lang),
...addApplicationTypesRows(application, lang),
...addOtherPartiesAgreedRow(application, lang),
...addInformOtherPartiesRow(application, lang),
...addOrderJudgeRows(application, lang),
...addRequestingReasonRows(application, lang),
...addDocumentUploadRow(application, lang),
...addHearingArrangementsRows(application, lang),
...addHearingContactDetailsRows(application, lang),
...addUnavailableDatesRows(application, lang),
...addHearingSupportRows(application, lang),
];
if (displayToEnumKey(application.case_data.applicationTypes) === 'CONFIRM_CCJ_DEBT_PAID') {
return [
...addApplicationStatus(application, lang),
...addApplicationTypesRows(application, lang),
...addFinalPaymentDateDetails(application, lang),
...addEvidenceOfDebtPaymentRow(application, lang),
];
} else {
return [
...addApplicationStatus(application, lang),
...addApplicationTypesRows(application, lang),
...addOtherPartiesAgreedRow(application, lang),
...addInformOtherPartiesRow(application, lang),
...addOrderJudgeRows(application, lang),
...addRequestingReasonRows(application, lang),
...addDocumentUploadRow(application, lang),
...addHearingArrangementsRows(application, lang),
...addHearingContactDetailsRows(application, lang),
...addUnavailableDatesRows(application, lang),
...addHearingSupportRows(application, lang),
];
}
};

const buildViewApplicationToRespondentSections = (application: ApplicationResponse, lang: string): SummaryRow[] => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const translateCoScApplicationToCCD = (
};
};

const toCCDCoScEvidenceDocuments = (evidenceOption: string, uploadDocuments: UploadGAFiles[]): CcdGeneralApplicationEvidenceDocument[] => {
const toCCDCoScEvidenceDocuments = (evidenceOption?: string, uploadDocuments?: UploadGAFiles[]): CcdGeneralApplicationEvidenceDocument[] => {
return (evidenceOption == debtPaymentOptions.UPLOAD_EVIDENCE_DEBT_PAID_IN_FULL || evidenceOption == debtPaymentOptions.MADE_FULL_PAYMENT_TO_COURT)
? uploadDocuments?.map(uploadDocument => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
import {getClaimById} from 'modules/utilityService';
import { CcdGAMakeWithNoticeDocument } from 'common/models/ccdGeneralApplication/ccdGAMakeWithNoticeDocument';
import {CcdGeneralApplicationHearingDetails} from 'models/ccdGeneralApplication/ccdGeneralApplicationHearingDetails';
import {ApplicationTypeOption} from 'models/generalApplication/applicationType';
import {formatDateToFullDate} from 'common/utils/dateUtils';

jest.mock('../../../../../../main/modules/i18n');
jest.mock('../../../../../../main/app/client/gaServiceClient');
Expand Down Expand Up @@ -183,6 +185,10 @@ function setMockRequestForInformationDocument(): CcdGAMakeWithNoticeDocument[] {
describe('View Application service', () => {
const mockGetApplication = jest.spyOn(GaServiceClient.prototype, 'getApplication');
const mockGetClaimById = jest.spyOn(utilityService, 'getClaimById');
beforeEach(() => {
jest.resetAllMocks();
});

describe('Build view application content for general application', () => {

it('view application content test for applicant', async () => {
Expand Down Expand Up @@ -544,4 +550,95 @@ describe('View Application service', () => {
expect(result[0].rows[2].value.html).toContain('Application_Hearing_Notice_2024-08-01 12:15:34.pdf');
});
});

describe('View application content for CoSc general application', () => {
let application : ApplicationResponse;
const date = new Date(Date.now());
beforeEach(() => {
application = Object.assign(new ApplicationResponse(), mockApplication);
application.case_data.parentClaimantIsApplicant = YesNoUpperCamelCase.NO;
application.case_data.generalAppType.types =[ApplicationTypeOption.CONFIRM_CCJ_DEBT_PAID];
application.case_data.applicationTypes = 'Confirm you\'ve paid a judgment debt';
const claim = new Claim();
claim.caseRole = CaseRole.DEFENDANT;
mockGetClaimById.mockResolvedValueOnce(claim);
});

it('view cosc application with not able to provide evidence of full payment - applicant', async () => {
//given
const certOfSC = {
debtPaymentEvidence: {
provideDetails: 'unable to provide evidence',
debtPaymentOption: 'UNABLE_TO_PROVIDE_EVIDENCE_OF_FULL_PAYMENT',
},
defendantFinalPaymentDate: date,
};
application.case_data.certOfSC = certOfSC;
mockGetApplication.mockResolvedValue(application);
//when
const result = (await getApplicationSections(mockedAppRequest, '1718105701451856', 'en')).summaryRows;
//then
expect(result).toHaveLength(4);
expect(result[0].key.text).toEqual('PAGES.GENERAL_APPLICATION.VIEW_APPLICATION.STATUS.TITLE');
expect(result[0].value.html).toEqual('PAGES.GENERAL_APPLICATION.VIEW_APPLICATION.STATUS.AWAITING_RESPONSE');
expect(result[1].key.text).toEqual('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.APPLICATION_TYPE');
expect(result[1].value.html).toEqual('PAGES.GENERAL_APPLICATION.SELECTED_APPLICATION_TYPE.CONFIRM_YOU_PAID_CCJ');
expect(result[2].key.text).toEqual('PAGES.GENERAL_APPLICATION.FINAL_DEFENDANT_PAYMENT_DATE.FORM_HEADER_1');
expect(result[2].value.html).toEqual(formatDateToFullDate(date));
expect(result[3].key.text).toEqual('PAGES.GENERAL_APPLICATION.DEBT_PAYMENT.DO_YOU_WANT_PROVIDE_EVIDENCE');
expect(result[3].value.html).toContain('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.COSC.UPLOAD_EVIDENCE_PAID_IN_FULL_NO');
});

it('view cosc application content - want to upload evidence that debt has been paid in full - applicant', async () => {
//given
const certOfSC = {
proofOfDebtDoc: [{
value: {
document_url: 'http://dm-store:8080/documents/d4559b',
document_binary_url: 'http://dm-store:8080/documents/d4559b/binary',
document_filename: 'test.doc',
category_id: '231',
},
}],
debtPaymentEvidence: {
debtPaymentOption: 'UPLOAD_EVIDENCE_DEBT_PAID_IN_FULL',
},
defendantFinalPaymentDate: date,
};
application.case_data.certOfSC = certOfSC;
mockGetApplication.mockResolvedValue(application);
//when
const result = (await getApplicationSections(mockedAppRequest, '1718105701451856', 'en')).summaryRows;
//then
expect(result).toHaveLength(4);
expect(result[3].key.text).toEqual('PAGES.GENERAL_APPLICATION.DEBT_PAYMENT.DO_YOU_WANT_PROVIDE_EVIDENCE');
expect(result[3].value.html).toContain('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.COSC.UPLOAD_EVIDENCE_PAID_IN_FULL');
});

it('view cosc application content - made full payment to the court - applicant', async () => {
//given
const certOfSC = {
proofOfDebtDoc: [{
value: {
document_url: 'http://dm-store:8080/documents/d4559b',
document_binary_url: 'http://dm-store:8080/documents/d4559b/binary',
document_filename: 'test.doc',
category_id: '231',
},
}],
debtPaymentEvidence: {
debtPaymentOption: 'MADE_FULL_PAYMENT_TO_COURT',
},
defendantFinalPaymentDate: date,
};
application.case_data.certOfSC = certOfSC;
mockGetApplication.mockResolvedValue(application);
//when
const result = (await getApplicationSections(mockedAppRequest, '1718105701451856', 'en')).summaryRows;
//then
expect(result).toHaveLength(4);
expect(result[3].key.text).toEqual('PAGES.GENERAL_APPLICATION.DEBT_PAYMENT.DO_YOU_WANT_PROVIDE_EVIDENCE');
expect(result[3].value.html).toContain('PAGES.GENERAL_APPLICATION.CHECK_YOUR_ANSWER.COSC.HAS_DEBT_BEEN_PAID_TO_COURT');
});
});
});
Loading