Skip to content

Commit

Permalink
Merge pull request #1431 from companieshouse/ROECCT-86-Tell-us-about-…
Browse files Browse the repository at this point in the history
…the-individual-person---part-2

ROECCT-180 modify page individual BO page template query param
  • Loading branch information
ConnorOS-ch committed Jul 4, 2024
2 parents 59385cd + ed01a61 commit 10957e9
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/controllers/update/beneficial.owner.type.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ const getNextPage = (beneficialOwnerTypeChoices: BeneficialOwnerTypeChoice | Man
return config.UPDATE_MANAGING_OFFICER_CORPORATE_URL;
case ManagingOfficerTypeChoice.individual:
return config.UPDATE_MANAGING_OFFICER_URL;
case BeneficialOwnerTypeChoice.relevantPeriodIndividual:
return config.UPDATE_BENEFICIAL_OWNER_INDIVIDUAL_URL + config.RELEVANT_PERIOD_QUERY_PARAM;
case BeneficialOwnerTypeChoice.relevantPeriodOtherLegal:
return config.UPDATE_BENEFICIAL_OWNER_OTHER_URL + config.RELEVANT_PERIOD_QUERY_PARAM;
case BeneficialOwnerTypeChoice.relevantPeriodGovernment:
Expand Down
1 change: 1 addition & 0 deletions src/model/beneficial.owner.type.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum BeneficialOwnerTypeChoice {
individual = "individualOwner",
otherLegal = "otherLegalOwner",
government = "governmentOrPublicOwner",
relevantPeriodIndividual = "relevantPeriodIndividualOwner",
relevantPeriodOtherLegal = "relevantPeriodOtherLegalOwner",
relevantPeriodGovernment = "relevantPeriodGovernment"
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/beneficial.owner.individual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export const getBeneficialOwnerIndividual = (req: Request, res: Response, templa
return res.render(templateName, {
backLinkUrl: backLinkUrl,
templateName: templateName,
...appData
...appData,
relevant_period: req.query["relevant-period"] === "true",
});
};

Expand Down
1 change: 1 addition & 0 deletions test/__mocks__/text.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export const RELEVANT_PERIOD_INDIVIDUAL_BENEFICIAL_OWNER = "Individual beneficia
export const RELEVANT_PERIOD_INFORMATION = "You need to enter information that is correct as at the date it ceased to be a registrable beneficial owner.";
export const SELECT_IF_REGISTER_DURING_PRE_REG_PERIOD = "Select yes if the overseas entity was the registered owner of UK land during the pre-registration period.";
export const RELEVANT_PERIOD_EXTRA_INFO_REQUIRED = "Based on the pre-registration statement you provided earlier in this service";
export const RELEVANT_PERIOD_INDIVIDUAL_INFORMATION = "You need to enter information that is correct as at the date they ceased to be a registrable beneficial owner.";
export const RELEVANT_PERIOD_OTHER_LEGAL_ENTITY_INFORMATION = "You need to enter information that is correct as at the date it ceased to be a registrable beneficial owner.";

// Remove journey
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
ALL_THE_OTHER_INFORMATION_ON_PUBLIC_REGISTER,
UPDATE_BENEFICIAL_OWNER_TYPE_PAGE_REDIRECT,
TRUSTS_NOC_HEADING,
RELEVANT_PERIOD,
RELEVANT_PERIOD_INDIVIDUAL_INFORMATION,
} from '../../__mocks__/text.mock';
import {
APPLICATION_DATA_UPDATE_BO_MOCK,
Expand Down Expand Up @@ -126,6 +128,19 @@ describe("UPDATE BENEFICIAL OWNER INDIVIDUAL controller", () => {
expect(resp.text).toContain(NOT_SHOW_BENEFICIAL_OWNER_INFORMATION_ON_PUBLIC_REGISTER);
expect(resp.text).not.toContain(TRUSTS_NOC_HEADING);
});

test(`renders the ${UPDATE_BENEFICIAL_OWNER_INDIVIDUAL_PAGE} page with relevant period content when query param is passed`, async () => {
mockGetApplicationData.mockReturnValueOnce({ ...APPLICATION_DATA_UPDATE_BO_MOCK });

const resp = await request(app).get(UPDATE_BENEFICIAL_OWNER_INDIVIDUAL_URL + "?relevant-period=true");

expect(resp.status).toEqual(200);
expect(resp.text).toContain(RELEVANT_PERIOD);
expect(resp.text).toContain(RELEVANT_PERIOD_INDIVIDUAL_INFORMATION);
expect(resp.text).toContain("1");
expect(resp.text).toContain("January");
expect(resp.text).toContain("2023");
});
});

describe("GET BY ID tests", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,18 @@ describe("BENEFICIAL OWNER TYPE controller", () => {
expect(resp.header.location).toContain(config.UPDATE_CHECK_YOUR_ANSWERS_URL);
});

test(`redirects to the ${config.UPDATE_BENEFICIAL_OWNER_TYPE_URL + "?relevant-period=true"} page when the relevant_period=true and Other leegal entity button selected`, async () => {
appData = APPLICATION_DATA_UPDATE_NO_BO_OR_MO_TO_REVIEW;
appData[UpdateKey] = UPDATE_OBJECT_MOCK_RELEVANT_PERIOD_CHANGE;

const resp = await request(app)
.post(config.UPDATE_BENEFICIAL_OWNER_TYPE_URL)
.send({ [BeneficialOwnerTypeKey]: BeneficialOwnerTypeChoice.relevantPeriodIndividual });

expect(resp.status).toEqual(302);
expect(resp.header.location).toEqual(config.UPDATE_BENEFICIAL_OWNER_INDIVIDUAL_URL + "?relevant-period=true");
});

test(`redirects to the ${config.UPDATE_BENEFICIAL_OWNER_TYPE_URL + RELEVANT_PERIOD_QUERY_PARAM } page when the relevant_period=true and Other leegal entity button selected`, async () => {
appData = APPLICATION_DATA_UPDATE_NO_BO_OR_MO_TO_REVIEW;
appData[UpdateKey] = UPDATE_OBJECT_MOCK_RELEVANT_PERIOD_CHANGE;
Expand Down
19 changes: 14 additions & 5 deletions views/includes/page-templates/beneficial-owner-individual.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
<div class="govuk-grid-column-two-thirds">
{% include "includes/list/errors.html" %}

{% if relevant_period %}
{% include "includes/page-templates/important-banner.html" %}
{% endif %}

<span class="govuk-caption-xl">Beneficial owner</span>

<h1 class="govuk-heading-xl govuk-!-margin-0">{{ title }}</h1>
<br> <p class="govuk-body">You can add more later.</p> <br>

{% if entity_number %}
{% include "includes/ceased-date-details-summary-new-bo.html" %}
{% if relevant_period %}
{{ govukInsetText({
text: "You need to enter information that is correct as at the date they ceased to be a registrable beneficial owner."
}) }}
{% else %}
<br> <p class="govuk-body">You can add more later.</p> <br>
{% if entity_number %}
{% include "includes/ceased-date-details-summary-new-bo.html" %}
{% endif %}
{% endif %}

<form method="post">
{% include "includes/csrf_token.html" %}
{% include "includes/csrf_token.html" %}
{% include "includes/inputs/fields/first-name-input.html" %}

{% set hintLastNameText = "This is also known as your family name." %}
Expand Down
6 changes: 5 additions & 1 deletion views/update/update-beneficial-owner-individual.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% extends "update-layout.html" %}

{% set title = "Tell us about the individual person" %}
{% if not relevant_period %}
{% set title = "Tell us about the individual person" %}
{% else %}
{% set title = "Tell us about the individual person involved in the pre-registration period" %}
{% endif %}

{% block pageTitle %}
{% include "includes/update-page-title.html" %}
Expand Down

0 comments on commit 10957e9

Please sign in to comment.