generated from hmcts/expressjs-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2549 from hmcts/feature/CIV-11211-Hearing_Fee_HwF…
…_Confirmation_Page CIV-11211 hearing fee hw f confirmation page
- Loading branch information
Showing
9 changed files
with
149 additions
and
14 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
src/main/routes/features/caseProgression/hearingFee/payHearingFeeConfirmationController.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 |
---|---|---|
@@ -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; |
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
34 changes: 34 additions & 0 deletions
34
src/main/views/features/caseProgression/hearingFee/pay-hearing-fee-confirmation.njk
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,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 %} |
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
38 changes: 38 additions & 0 deletions
38
...it/routes/features/caseProgression/hearingFee/payHearingFeeConfirmationController.test.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 |
---|---|---|
@@ -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')); | ||
}); | ||
}); | ||
}); |