Skip to content

Commit

Permalink
Merge pull request #2549 from hmcts/feature/CIV-11211-Hearing_Fee_HwF…
Browse files Browse the repository at this point in the history
…_Confirmation_Page

CIV-11211 hearing fee hw f confirmation page
  • Loading branch information
dharmendrak authored Nov 27, 2023
2 parents c0b3493 + d61db71 commit 478dea1
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/common/utils/pageSectionBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class PageSectionBuilder {
return this;
}

addButtonWithCancelLink(title: string, href: string, startButton?: false, cancelHref?: string) {
addButtonWithCancelLink(title: string, href: string, startButton = false, cancelHref?: string) {
const startButtonSection = ({
type: ClaimSummaryType.BUTTON_WITH_CANCEL_LINK,
data: {
Expand Down
12 changes: 11 additions & 1 deletion src/main/modules/i18n/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"SUBMIT_RESPONSE": "Cyflwyno'r ymateb",
"SUBMIT_RESPONSE_PAYMENT": "Submit and continue to payment (£{{ payment }})",
"SUBMIT": "Cyflwyno",
"START_NOW": "Dechrau nawr"
"START_NOW": "Dechrau nawr",
"CLOSE_AND_RETURN_TO_CASE_OVERVIEW": "Close and return to case overview"
},
"MICRO_TEXT": {
"HEARING_FEE": "Ffi gwrandawiad"
Expand Down Expand Up @@ -2886,6 +2887,15 @@
"AS_SOON_AS_POSSIBLE_AND_PAY": "as soon as possible and pay the appropriate fee.",
"YOU_WILL_NEED_TO_PHONE": "For any changes to accessibility requirements between now and the trial date you will need to phone the court on 0300 123 7050."
}
},
"PAY_HEARING_FEE": {
"CONFIRMATION_PAGE": {
"TITLE": "Confirmation of your hearing fee payment",
"CONFIRMATION_TITLE.HEARING": "Your application for help with the hearing fee is complete ",
"REFERENCE_NUMBER": "Your reference number",
"WHAT_HAPPENS_NEXT": "What happens next",
"YOU_WILL_RECEIVE": "You'll receive a decision on your application within 5 to 10 working days."
}
}
},
"FOOTER":{
Expand Down
12 changes: 11 additions & 1 deletion src/main/modules/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
"SUBMIT_RESPONSE": "Submit Response",
"SUBMIT_RESPONSE_PAYMENT": "Submit and continue to payment (£{{ payment }})",
"SUBMIT": "Submit",
"START_NOW": "Start now"
"START_NOW": "Start now",
"CLOSE_AND_RETURN_TO_CASE_OVERVIEW": "Close and return to case overview"
},
"MICRO_TEXT": {
"HEARING_FEE": "Hearing fee"
Expand Down Expand Up @@ -2886,6 +2887,15 @@
"AS_SOON_AS_POSSIBLE_AND_PAY": "as soon as possible and pay the appropriate fee.",
"YOU_WILL_NEED_TO_PHONE": "For any changes to accessibility requirements between now and the trial date you will need to phone the court on 0300 123 7050."
}
},
"PAY_HEARING_FEE": {
"CONFIRMATION_PAGE": {
"TITLE": "Confirmation of your hearing fee payment",
"CONFIRMATION_TITLE.HEARING": "Your application for help with the hearing fee is complete ",
"REFERENCE_NUMBER": "Your reference number",
"WHAT_HAPPENS_NEXT": "What happens next",
"YOU_WILL_RECEIVE": "You'll receive a decision on your application within 5 to 10 working days."
}
}
},
"FOOTER":{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {NextFunction, RequestHandler, Router} from 'express';
import {
DASHBOARD_CLAIMANT_URL, HEARING_FEE_CONFIRMATION_URL,
} from 'routes/urls';
import {constructResponseUrlWithIdParams} from 'common/utils/urlFormatter';
import {PageSectionBuilder} from 'common/utils/pageSectionBuilder';
import {FeeType} from 'form/models/helpWithFees/feeType';
import {t} from 'i18next';

const payHearingFeeStartScreenViewPath = 'features/caseProgression/hearingFee/pay-hearing-fee-confirmation';
const payHearingFeeConfirmationController = Router();

const getHearingFeeConfirmationContent = (claimId: string) => {
return new PageSectionBuilder()
.addTitle('PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.WHAT_HAPPENS_NEXT')
.addParagraph('PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.YOU_WILL_RECEIVE')
.addButton('COMMON.BUTTONS.CLOSE_AND_RETURN_TO_CASE_OVERVIEW',constructResponseUrlWithIdParams(claimId, DASHBOARD_CLAIMANT_URL)).build();
};

//TODO: we need to revisit this controller once we have all pay hearing fee journey in place
payHearingFeeConfirmationController.get(HEARING_FEE_CONFIRMATION_URL, (async (req, res, next: NextFunction) => {
const claimId = req.params.id;
res.render(payHearingFeeStartScreenViewPath, {
confirmationTitle : t(`PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.CONFIRMATION_TITLE.${FeeType.HEARING}`),
referenceNumber: claimId,
confirmationContent: getHearingFeeConfirmationContent(claimId),
});
}) as RequestHandler);

export default payHearingFeeConfirmationController;
3 changes: 3 additions & 0 deletions src/main/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ import cancelHearingFeeJourneyController
from 'routes/features/caseProgression/hearingFee/cancelHearingFeeJourneyController';
import applyHelpWithFeeController
from 'routes/features/caseProgression/hearingFee/applyHelpWithFeeController';
import payHearingFeeConfirmationController
from 'routes/features/caseProgression/hearingFee/payHearingFeeConfirmationController';
export default [
homeController,
dashboardController,
Expand Down Expand Up @@ -438,4 +440,5 @@ export default [
applyHelpWithFeeController,
applyHelpFeeSelectionController,
cancelHearingFeeJourneyController,
payHearingFeeConfirmationController,
];
1 change: 1 addition & 0 deletions src/main/routes/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,4 @@ export const APPLY_HELP_WITH_FEES = `${BASE_CASE_URL}/apply-help-with-fees`;
export const HEARING_FEE_APPLY_HELP_FEE_HEARING_FEE = `${BASE_CASE_PROGRESSION_URL}/apply-help-fee-hearing-fee`;
export const APPLY_HELP_WITH_FEES_START = `${APPLY_HELP_WITH_FEES}/start`;
export const APPLY_HELP_WITH_FEES_REFERENCE = `${APPLY_HELP_WITH_FEES}/reference-number`;
export const HEARING_FEE_CONFIRMATION_URL = `${PAY_HEARING_FEE_URL}/confirmation`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% extends "claim-details-tpl.njk" %}
{% from "govuk/components/panel/macro.njk" import govukPanel %}
{% from "../../../macro/contact-us-for-help.njk" import contactUsForHelp %}
{% from "../../../macro/csrf.njk" import csrfProtection %}
{% from "../../dashboard/item-content.njk" import itemContent %}
{% from "govuk/components/button/macro.njk" import govukButton %}

{% block pageTitle %}
{{ setPageTitle('PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.TITLE') }}
{% endblock %}

{% set panelContent %}
{{ t('PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.REFERENCE_NUMBER')}}
<br><strong>{{ referenceNumber }}</strong>
{% endset %}

{% block content %}
<div class="govuk-width-container govuk-!-padding-top-0">
<main class="govuk-main-wrapper govuk-!-padding-top-0" role="main">
<div class="govuk-grid-row govuk-!-margin-top-0">
<div class="govuk-grid-column-two-thirds govuk-!-margin-top-0">
{{ csrfProtection(csrf) }}
{{ govukPanel({
titleText: confirmationTitle,
html: panelContent
}) }}
{% for content in confirmationContent %}
{{ itemContent(content,t) }}
{% endfor %}
</div>
</div>
</main>
</div>
{% endblock %}
31 changes: 20 additions & 11 deletions src/test/unit/common/utils/pageSectionBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,31 +217,40 @@ describe('PageSectionBuilder tests', ()=> {

it('should add micro text', ()=> {
//Given
const microTextExpected = new PageSectionBuilder()
.addMicroText('text')
.build();
const microTextExpected = ({
type: ClaimSummaryType.MICRO_TEXT,
data: {
text: 'text',
variables: 'variables',
},
});

//When
const microTextResult = new PageSectionBuilder()
.addMicroText('text')
.addMicroText('text', microTextExpected.data.variables)
.build();

//Then
expect(microTextResult).toEqual(microTextExpected);
expect(microTextResult).toEqual([microTextExpected]);
});

it('should add addButtonWithCancelLink', ()=> {
//Given
const buttonWithCancelLinkExpected = new PageSectionBuilder()
.addButtonWithCancelLink('text', 'href')
.build();

const buttonWithCancelLinkExpected = ({
type: ClaimSummaryType.BUTTON_WITH_CANCEL_LINK,
data: {
text: 'title',
href: 'href',
isStartButton: true,
cancelHref: 'cancelHref',
},
});
//When
const buttonWithCancelLinkResult = new PageSectionBuilder()
.addButtonWithCancelLink('text', 'href')
.addButtonWithCancelLink('title', 'href', true, 'cancelHref')
.build();

//Then
expect(buttonWithCancelLinkExpected).toEqual(buttonWithCancelLinkResult);
expect(buttonWithCancelLinkResult).toEqual([buttonWithCancelLinkExpected]);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {app} from '../../../../../../main/app';
import {t} from 'i18next';
import {HEARING_FEE_CONFIRMATION_URL} from 'routes/urls';
import nock from 'nock';
import config from 'config';

const session = require('supertest-session');
const testSession = session(app);
const citizenRoleToken: string = config.get('citizenRoleToken');
describe('Pay Hearing Fee Confirmation Screen Controller', () => {
beforeAll((done) => {
const idamUrl: string = config.get('idamUrl');
nock(idamUrl)
.post('/o/token')
.reply(200, {id_token: citizenRoleToken});

testSession
.get('/oauth2/callback')
.query('code=ABCD')
.expect(302)
.end(function (err: Error) {
if (err) {
return done(err);
}
return done();
});
});

it('should return expected confirmation pay hearing fee page when claim exists', async () => {
//When
await testSession.get(HEARING_FEE_CONFIRMATION_URL.replace(':id', '123'))
//Then
.expect((res: { status: unknown; text: unknown; }) => {
expect(res.status).toBe(200);
expect(res.text).toContain(t('PAGES.PAY_HEARING_FEE.CONFIRMATION_PAGE.TITLE'));
});
});
});

0 comments on commit 478dea1

Please sign in to comment.