Skip to content

Commit a2fa015

Browse files
authored
Merge pull request #1726 from companieshouse/feature/ROECCT-631-create-paper-form-filing-page
ROECCT-631 Create paper form filing page
2 parents 253de53 + 09e5116 commit a2fa015

File tree

9 files changed

+117
-1
lines changed

9 files changed

+117
-1
lines changed

src/config/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const RELEVANT_PERIOD_REQUIRED_INFORMATION_CONFIRM_PAGE = "relevant-perio
9898
export const RELEVANT_PERIOD_SUBMIT_BY_PAPER_PAGE = "relevant-period-submit-by-paper";
9999
export const RELEVANT_PERIOD_COMBINED_STATEMENTS_PAGE = "provide-statements-for-the-pre-registration-period";
100100
export const RELEVANT_PERIOD_REVIEW_STATEMENTS_PAGE = "review-statements-for-the-pre-registration-period";
101+
export const RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE = "relevant-period-submit-year-by-paper";
101102
export const TRUST_DETAILS_PAGE = "trust-details";
102103
export const TRUST_INVOLVED_PAGE = "trust-involved";
103104
export const TRUST_HISTORICAL_BENEFICIAL_OWNER_PAGE = "trust-historical-beneficial-owner";
@@ -319,6 +320,7 @@ export const RELEVANT_PERIOD_SUBMIT_BY_PAPER_URL = UPDATE_AN_OVERSEAS_ENTITY_URL
319320
export const RELEVANT_PERIOD_INTERRUPT_URL = UPDATE_AN_OVERSEAS_ENTITY_URL + RELEVANT_PERIOD_INTERRUPT_PAGE;
320321
export const RELEVANT_PERIOD_COMBINED_STATEMENTS_PAGE_URL = UPDATE_AN_OVERSEAS_ENTITY_URL + RELEVANT_PERIOD_COMBINED_STATEMENTS_PAGE;
321322
export const RELEVANT_PERIOD_REVIEW_STATEMENTS_URL = UPDATE_AN_OVERSEAS_ENTITY_URL + RELEVANT_PERIOD_REVIEW_STATEMENTS_PAGE;
323+
export const RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_URL = UPDATE_AN_OVERSEAS_ENTITY_URL + RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE;
322324

323325
// REMOVE overseas entity routes
324326
export const REMOVE_SECTION = "remove/";

src/controllers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export * as relevantPeriodRequiredInformation from './update/relevant.period.req
102102
export * as relevantPeriodSubmitByPaper from './update/relevant.period.submit.by.paper.controller';
103103
export * as relevantPeriodCombinedStatements from './update/relevant.period.combined.statements.controller';
104104
export * as relevantPeriodReviewStatements from './update/relevant.period.review.statments.controller';
105+
export * as relevantPeriodSubmitYearByPaper from './update/relevant.period.submit.year.by.paper.controller';
105106

106107
// REMOVE controllers
107108
export * as removeSoldAllLandFilter from './update/remove.sold.all.land.filter.controller';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { NextFunction, Request, Response } from "express";
2+
3+
import { logger } from "../../utils/logger";
4+
import * as config from "../../config";
5+
import { ApplicationData } from "../../model";
6+
import { getApplicationData } from "../../utils/application.data";
7+
8+
export const get = async (req: Request, res: Response, next: NextFunction) => {
9+
try {
10+
logger.debugRequest(req, `GET ${config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE}`);
11+
const appData: ApplicationData = await getApplicationData(req.session);
12+
13+
return res.render(config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE, {
14+
backLinkUrl: '',
15+
templateName: config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE,
16+
...appData,
17+
});
18+
} catch (error) {
19+
logger.errorRequest(req, error);
20+
next(error);
21+
}
22+
};

src/routes/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ import {
107107
relevantPeriodSubmitByPaper,
108108
relevantPeriodCombinedStatements,
109109
relevantPeriodReviewStatements,
110+
relevantPeriodSubmitYearByPaper
110111
} from "../controllers";
111112

112113
import { serviceAvailabilityMiddleware } from "../middleware/service.availability.middleware";
@@ -604,6 +605,14 @@ router.route(config.RELEVANT_PERIOD_SUBMIT_BY_PAPER_URL)
604605
navigation.hasOverseasEntity)
605606
.get(relevantPeriodSubmitByPaper.get);
606607

608+
router.route(config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_URL)
609+
.all(
610+
isFeatureEnabled(config.FEATURE_FLAG_ENABLE_RELEVANT_PERIOD),
611+
authentication,
612+
companyAuthentication,
613+
navigation.hasOverseasEntity)
614+
.get(relevantPeriodSubmitYearByPaper.get);
615+
607616
router.route(config.RELEVANT_PERIOD_COMBINED_STATEMENTS_PAGE_URL)
608617
.all(
609618
isFeatureEnabled(config.FEATURE_FLAG_ENABLE_RELEVANT_PERIOD),

src/utils/navigation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ export const NAVIGATION: Navigation = {
126126
previousPage: () => config.RELEVANT_PERIOD_REQUIRED_INFORMATION_CONFIRM_URL,
127127
nextPage: []
128128
},
129+
[config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_URL]: {
130+
currentPage: config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE,
131+
previousPage: () => "",
132+
nextPage: []
133+
},
129134
[config.RELEVANT_PERIOD_INTERRUPT_URL]: {
130135
currentPage: config.RELEVANT_PERIOD_INTERRUPT_PAGE,
131136
previousPage: () => "",

test/__mocks__/text.mock.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export const RELEVANT_SECURE_REGISTER_CHANGE_LINK = "/update-an-overseas-entity/
307307
export const RELEVANT_SECURE_FILTER_PAGE_HEADING = "Do any beneficial owners or managing officers have personal information protected at Companies House?";
308308
export const RELEVANT_PERIOD_OWNED_LAND_CHANGE_LINK = "/update-an-overseas-entity/registered-owner-during-pre-registration-period";
309309
export const IMPORTANT_BANNER_TEXT = "You need to provide some information about the overseas entity from the pre-registration period.";
310+
export const RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_TITLE = "You'll need to file this year's update statement using the paper form";
310311

311312
// Remove journey
312313
export const REMOVE_SOLD_ALL_LAND_FILTER_PAGE_TITLE = "Has the overseas entity disposed of all relevant property or land in the UK?";
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
jest.mock("ioredis");
2+
jest.mock("../../../src/utils/logger");
3+
jest.mock('../../../src/middleware/authentication.middleware');
4+
jest.mock('../../../src/middleware/company.authentication.middleware');
5+
jest.mock('../../../src/utils/application.data');
6+
jest.mock('../../../src/middleware/navigation/update/has.presenter.middleware');
7+
jest.mock('../../../src/middleware/service.availability.middleware');
8+
jest.mock('../../../src/utils/feature.flag');
9+
10+
import mockCsrfProtectionMiddleware from "../../__mocks__/csrfProtectionMiddleware.mock";
11+
import { NextFunction, Request, Response } from "express";
12+
import { beforeEach, expect, jest, test, describe } from "@jest/globals";
13+
import request from "supertest";
14+
15+
import * as config from "../../../src/config";
16+
import app from "../../../src/app";
17+
import { RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_TITLE } from "../../__mocks__/text.mock";
18+
import { APPLICATION_DATA_MOCK } from "../../__mocks__/session.mock";
19+
import { getApplicationData } from "../../../src/utils/application.data";
20+
import { authentication } from "../../../src/middleware/authentication.middleware";
21+
import { companyAuthentication } from "../../../src/middleware/company.authentication.middleware";
22+
import { hasUpdatePresenter } from "../../../src/middleware/navigation/update/has.presenter.middleware";
23+
import { serviceAvailabilityMiddleware } from "../../../src/middleware/service.availability.middleware";
24+
import { isActiveFeature } from "../../../src/utils/feature.flag";
25+
26+
mockCsrfProtectionMiddleware.mockClear();
27+
const mockHasUpdatePresenter = hasUpdatePresenter as jest.Mock;
28+
mockHasUpdatePresenter.mockImplementation((req: Request, res: Response, next: NextFunction) => next());
29+
30+
const mockAuthenticationMiddleware = authentication as jest.Mock;
31+
mockAuthenticationMiddleware.mockImplementation((req: Request, res: Response, next: NextFunction) => next() );
32+
33+
const mockCompanyAuthenticationMiddleware = companyAuthentication as jest.Mock;
34+
mockCompanyAuthenticationMiddleware.mockImplementation((req: Request, res: Response, next: NextFunction) => next());
35+
36+
const mockServiceAvailabilityMiddleware = serviceAvailabilityMiddleware as jest.Mock;
37+
mockServiceAvailabilityMiddleware.mockImplementation((req: Request, res: Response, next: NextFunction) => next());
38+
39+
const mockGetApplicationData = getApplicationData as jest.Mock;
40+
41+
const mockIsActiveFeature = isActiveFeature as jest.Mock;
42+
mockIsActiveFeature.mockReturnValue(true);
43+
44+
describe("Relevant period submit year by paper controller", () => {
45+
46+
beforeEach(() => {
47+
jest.clearAllMocks();
48+
});
49+
describe("GET tests", () => {
50+
test(`renders the ${config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_PAGE} page`, async () => {
51+
mockGetApplicationData.mockReturnValue({ ...APPLICATION_DATA_MOCK });
52+
const resp = await request(app).get(config.RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_URL);
53+
54+
expect(resp.status).toEqual(200);
55+
expect(resp.text).toContain(RELEVANT_PERIOD_SUBMIT_YEAR_BY_PAPER_TITLE);
56+
});
57+
});
58+
});
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{% extends "submit-by-paper-template.html" %}
2+
3+
{% set title = "You'll need to file this year's update statement using the paper form" %}
4+
5+
{% block content %}
6+
7+
<div class="govuk-grid-row">
8+
<div class="govuk-grid-column-two-thirds">
9+
<h1 class="govuk-heading-xl">You'll need to file this year's update statement using the paper form</h1>
10+
<p class="govuk-body">You've told us that you want to provide this overseas entity's pre-registration information as part of its next update statment.</p>
11+
<p class="govuk-body">This means you need to file this year's update statement on paper.</p>
12+
<p class="govuk-body">Contact us at <a href="mailto: [email protected]" class="govuk-link">[email protected]</a> if you need us to send you a paper form. </p>
13+
</div>
14+
</div>
15+
16+
{% endblock %}

views/update/submit-by-paper-template.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{% extends "update-layout.html" %}
22

3-
{% set title = "You'll need to file an update statement using the paper form" %}
3+
{% if not title %}
4+
{% set title = "You'll need to file an update statement using the paper form" %}
5+
{% endif %}
46

57
{% block pageTitle %}
68
{% include "includes/update-page-title.html" %}

0 commit comments

Comments
 (0)