generated from companieshouse/node-review-web-starter-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #177 from companieshouse/feature/add-no-dob-match-…
…stop-screen
- Loading branch information
Showing
28 changed files
with
486 additions
and
85 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
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 |
---|---|---|
@@ -1,13 +1,23 @@ | ||
{ | ||
"dob_mismatch_main_title": "The details linked to this personal code do not match the details on our records", | ||
"dob_mismatch_reasons": "This may be for a number of reasons - depending on how the identity was verified, or how the PSC's details were entered into our system. You cannot continue without fixing the issue.", | ||
"dob_mismatch_reasons": "This may be for a number of reasons – depending on how the identity was verified, or how the PSC's details were entered into our system. You cannot continue without fixing the issue.", | ||
"dob_mismatch_check_personal_code": "Check you've entered the correct personal code", | ||
"dob_mismatch_character_code": "Make sure the 11 character code you entered matches the code received when you verified your identity.", | ||
"dob_mismatch_try_again_link_text": "Go back to the previous screen and try again.", | ||
"dob_mismatch_try_again_link_text": "Go back to the previous screen and try again", | ||
"dob_mismatch_check_dob": "Check the PSC's date of birth on the Companies House register", | ||
"dob_mismatch_if_wrong": "If the date of birth entered into the Companies House register is wrong, you need to contact the company to", | ||
"dob_mismatch_corrections_link_text": "submit the paper corrections forms with the correct date of birth.", | ||
"dob_mismatch_corrections_link_text": "submit the paper corrections forms with the correct date of birth", | ||
"dob_mismatch_up_to_date": "When the details are up to date on the register, you will be able to return to this service and provide your Companies House personal code.", | ||
"dob_mismatch_authorised_agent": "If you verififed using an authroised agent, check they entered the correct date of birth", | ||
"dob_mismatch_verified_identity": "If you verififed your identity through an authorised agent (such as an accountant), confirm that they typed your details in correctly when they verified your identity." | ||
"dob_mismatch_authorised_agent": "If you verified using an authorised agent, check they entered the correct date of birth", | ||
"dob_mismatch_verified_identity": "If you verified your identity through an authorised agent (such as an accountant), confirm that they typed your details in correctly when they verified your identity.", | ||
"rp01_guidance_main_title": "Correcting the PSC date of birth on the Companies House register", | ||
"rp01_guidance_intro": "To correct the date of birth on the Companies House register, someone authorised to file for this company will need to submit a paper corrections form. They should follow this process.", | ||
"rp01_guidance_step_1": "Print and fill in the RP01 form:", | ||
"rp01_guidance_step_1_link_text": "‘Replace a document not meeting requirements’", | ||
"rp01_guidance_step_2": "Print and fill in the PSC01 form with the correct date of birth:", | ||
"rp01_guidance_step_2_link_text": "‘Give notice of individual person with significant control’", | ||
"rp01_guidance_step_3": "Send the completed paper forms together", | ||
"rp01_guidance_step_3_link_text": "by post to Companies House", | ||
"rp01_guidance_summary": "Once received, the submitted updates may take up to a couple of weeks to show on the register. When the PSC details are up to date, you will be able to successfully", | ||
"rp01_guidance_summary_link_text": "provide identity verification details for the PSC" | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { Request, Response } from "express"; | ||
import { PrefixedUrls, STOP_TYPE, toStopScreenPrefixedUrl } from "../../../constants"; | ||
import { getLocaleInfo, getLocalesService, selectLang } from "../../../utils/localise"; | ||
import { BaseViewData, GenericHandler, ViewModel } from "../generic"; | ||
import { addSearchParams } from "../../../utils/queryParams"; | ||
import { getUrlWithStopType, getUrlWithTransactionIdAndSubmissionId } from "../../../utils/url"; | ||
import { env } from "../../../config"; | ||
|
||
interface StopScreenHandlerViewData extends BaseViewData { | ||
extraData?: string[]; | ||
} | ||
|
||
export class StopScreenHandler extends GenericHandler<StopScreenHandlerViewData> { | ||
|
||
private static templateBasePath = "router_views/stop_screen/"; | ||
|
||
public async getViewData (req: Request, res: Response): Promise<StopScreenHandlerViewData> { | ||
|
||
const baseViewData = await super.getViewData(req, res); | ||
const stopType = req.params?.stopType as STOP_TYPE; | ||
|
||
return setContent(req, stopType, baseViewData); | ||
} | ||
|
||
public async executeGet (req: Request, res: Response): Promise<ViewModel<StopScreenHandlerViewData>> { | ||
const viewData = await this.getViewData(req, res); | ||
|
||
return { | ||
templatePath: StopScreenHandler.templateBasePath + req.params?.stopType, | ||
viewData | ||
}; | ||
} | ||
} | ||
|
||
const setContent = async (req: Request, stopType: STOP_TYPE, baseViewData: BaseViewData) => { | ||
|
||
const lang = selectLang(req.query.lang); | ||
const locales = getLocalesService(); | ||
const stopScreenPrefixedUrl = toStopScreenPrefixedUrl(stopType); | ||
|
||
switch (stopType) { | ||
case STOP_TYPE.PSC_DOB_MISMATCH: { | ||
return { | ||
...baseViewData, | ||
...getLocaleInfo(locales, lang), | ||
templateName: stopType, | ||
currentUrl: resolveUrlTemplate(stopScreenPrefixedUrl, stopType), | ||
backURL: resolveUrlTemplate(PrefixedUrls.PERSONAL_CODE), | ||
backLinkDataEvent: "psc-dob-mismatch-back-link", | ||
extraData: [resolveUrlTemplate(stopScreenPrefixedUrl, STOP_TYPE.RP01_GUIDANCE)] | ||
}; | ||
} | ||
case STOP_TYPE.RP01_GUIDANCE: { | ||
return { | ||
...baseViewData, | ||
...getLocaleInfo(locales, lang), | ||
templateName: stopType, | ||
currentUrl: resolveUrlTemplate(stopScreenPrefixedUrl, stopType), | ||
backURL: resolveUrlTemplate(stopScreenPrefixedUrl, STOP_TYPE.PSC_DOB_MISMATCH), | ||
backLinkDataEvent: "rp01-guidance-back-link", | ||
extraData: [env.GET_RP01_LINK, env.GET_PSC01_LINK, env.POST_TO_CH_LINK, PrefixedUrls.START] | ||
}; | ||
} | ||
default: { | ||
throw new Error("Unrecognised stop screen type: " + stopType); | ||
} | ||
|
||
} | ||
|
||
function resolveUrlTemplate (prefixedUrl: string, stopType?: STOP_TYPE): string { | ||
const url = stopType ? getUrlWithStopType(prefixedUrl, stopType) : prefixedUrl; | ||
|
||
return addSearchParams(getUrlWithTransactionIdAndSubmissionId(url, req.params.transactionId, req.params.submissionId), { lang }); | ||
} | ||
|
||
}; |
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,13 @@ | ||
import { Request, Response, Router } from "express"; | ||
import { handleExceptions } from "../utils/asyncHandler"; | ||
import { StopScreenHandler } from "./handlers/stop-screen/stopScreenHandler"; | ||
|
||
const stopScreenRouter: Router = Router({ mergeParams: true }); | ||
|
||
stopScreenRouter.get("/", handleExceptions(async (req: Request, res: Response) => { | ||
const handler = new StopScreenHandler(); | ||
const { templatePath, viewData } = await handler.executeGet(req, res); | ||
res.render(templatePath, viewData); | ||
})); | ||
|
||
export default stopScreenRouter; |
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
Oops, something went wrong.