Skip to content

Commit

Permalink
Merge pull request #122 from companieshouse/IDVA5-568-updateUrls
Browse files Browse the repository at this point in the history
update urls
  • Loading branch information
sardhani-ch authored Mar 1, 2024
2 parents c34c423 + 0ee604b commit 9abe86c
Show file tree
Hide file tree
Showing 32 changed files with 275 additions and 252 deletions.
4 changes: 2 additions & 2 deletions src/main/controllers/features/SoleTrader/indexController.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NextFunction, Request, Response } from "express";
import * as config from "../../../config";
import { BASE_URL, SOLE_TRADER_TYPE_OF_BUSINESS } from "../../../types/pageURL";
import { BASE_URL, TYPE_OF_BUSINESS } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
res.render(config.HOME, { title: "" });
};

export const post = async (req: Request, res: Response, next: NextFunction) => {
res.redirect(BASE_URL + SOLE_TRADER_TYPE_OF_BUSINESS);
res.redirect(BASE_URL + TYPE_OF_BUSINESS);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { validationResult } from "express-validator";
import * as config from "../../../config";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { SOLE_TRADER_TYPE_OF_BUSINESS, SOLE_TRADER_ROLE, SOLE_TRADER_OTHER_TYPE_OFBUSINESS, BASE_URL } from "../../../types/pageURL";
import { TYPE_OF_BUSINESS, SOLE_TRADER_WHAT_IS_YOUR_ROLE, OTHER_TYPE_OFBUSINESS, BASE_URL } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
const locales = getLocalesService();
res.render(config.SOLE_TRADER_OTHER_TYPE_OFBUSINESS, {
previousPage: addLangToUrl(SOLE_TRADER_TYPE_OF_BUSINESS, lang),
previousPage: addLangToUrl(BASE_URL + TYPE_OF_BUSINESS, lang),
title: "What other type of business are you registering?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + SOLE_TRADER_OTHER_TYPE_OFBUSINESS
currentUrl: BASE_URL + OTHER_TYPE_OFBUSINESS
});
};

Expand All @@ -24,14 +24,14 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
if (!errorList.isEmpty()) {
const pageProperties = getPageProperties(formatValidationError(errorList.array(), lang));
res.status(400).render(config.SOLE_TRADER_OTHER_TYPE_OFBUSINESS, {
previousPage: addLangToUrl(BASE_URL + SOLE_TRADER_TYPE_OF_BUSINESS, lang),
previousPage: addLangToUrl(BASE_URL + TYPE_OF_BUSINESS, lang),
title: "What other type of business are you registering?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + SOLE_TRADER_OTHER_TYPE_OFBUSINESS,
currentUrl: BASE_URL + OTHER_TYPE_OFBUSINESS,
...pageProperties
});
} else {
var nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_ROLE, lang);
var nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_ROLE, lang);
res.redirect(nextPageUrl);
}
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NextFunction, Request, Response } from "express";
import * as config from "../../../config";
import { validationResult } from "express-validator";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { BASE_URL } from "../../../types/pageURL";
import { BASE_URL, SOLE_TRADER_WHAT_IS_YOUR_NAME, SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY } from "../../../types/pageURL";
import { Session } from "@companieshouse/node-session-handler";
import { USER_DATA } from "../../../common/__utils/constants";
import { UserData } from "../../../model/UserData";
Expand All @@ -13,7 +13,7 @@ export const get = async (req: Request, res: Response, next: NextFunction) => {

res.render(config.SOLE_TRADER_DOB, {
title: "What is your date of Birth?",
previousPage: BASE_URL + "/sole-trader/name",
previousPage: BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NAME,
firstName: userData?.firstName,
lastName: userData?.lastName
});
Expand All @@ -28,14 +28,14 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
const pageProperties = getPageProperties(formatValidationError(errorList.array()));
res.status(400).render(config.SOLE_TRADER_DOB, {
title: "What is your date of Birth?",
previousPage: BASE_URL + "/sole-trader/name",
previousPage: BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NAME,
pageProperties: pageProperties,
payload: req.body,
firstName: userData?.firstName,
lastName: userData?.lastName
});
} else {
res.redirect(BASE_URL + "/sole-trader/nationality");
res.redirect(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY);
}
} catch (error) {
next(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NextFunction, Request, Response, Router } from "express";
import * as config from "../../../config";
import { validationResult } from "express-validator";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { BASE_URL } from "../../../types/pageURL";
import { BASE_URL, SOLE_TRADER_DATE_OF_BIRTH, SOLE_TRADER } from "../../../types/pageURL";
import { Session } from "@companieshouse/node-session-handler";
import { USER_DATA } from "../../../common/__utils/constants";
import { UserData } from "../../../model/UserData";
Expand All @@ -11,7 +11,7 @@ import logger from "../../../../../lib/Logger";
export const get = async (req: Request, res: Response, next: NextFunction) => {
res.render(config.SOLE_TRADER_NAME, {
title: "What is your name?",
previousPage: BASE_URL + "/sole-trader/"
previousPage: BASE_URL + SOLE_TRADER
});
};

Expand All @@ -22,7 +22,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
const pageProperties = getPageProperties(formatValidationError(errorList.array()));
res.status(400).render(config.SOLE_TRADER_NAME, {
title: "What is your name?",
previousPage: BASE_URL + "/sole-trader/",
previousPage: BASE_URL + SOLE_TRADER,
pageProperties: pageProperties,
payload: req.body
});
Expand All @@ -35,7 +35,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
if (session) {
session.setExtraData(USER_DATA, userData);
}
res.redirect(BASE_URL + "/sole-trader/date-of-birth");
res.redirect(BASE_URL + SOLE_TRADER_DATE_OF_BIRTH);
}
} catch (error) {
next(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { validationResult } from "express-validator";
import countryList from "../../../../../lib/countryList";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import * as config from "../../../config";
import { BASE_URL } from "../../../types/pageURL";
import { Session } from "@companieshouse/node-session-handler";
import { USER_DATA } from "../../../common/__utils/constants";
import { UserData } from "../../../model/UserData";
import { BASE_URL, SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY, SOLE_TRADER_WHAT_IS_THE_BUSINESS_NAME } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const session: Session = req.session as any as Session;
const userData : UserData = session?.getExtraData(USER_DATA)!;
res.render(config.SOLE_TRADER_WHERE_DO_YOU_LIVE, {
countryList: countryList,
title: "Where do you live?",
previousPage: BASE_URL + "/sole-trader/nationality",
previousPage: BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY,
firstName: userData?.firstName,
lastName: userData?.lastName
});
Expand All @@ -29,10 +29,10 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
countryList: countryList,
pageProperties: pageProperties,
title: "Where do you live?",
previousPage: BASE_URL + "/sole-trader/nationality"
previousPage: BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_NATIONALITY
});
} else {
res.redirect(BASE_URL + "/sole-trader/business-name");
res.redirect(BASE_URL + SOLE_TRADER_WHAT_IS_THE_BUSINESS_NAME);
}
} catch (error) {
next(error);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextFunction, Request, Response } from "express";
import * as config from "../../../config";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM, SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS, SOLE_TRADER_AUTO_LOOKUP_ADDRESS, BASE_URL } from "../../../types/pageURL";
import { SOLE_TRADER_CORRESPONDENCE_ADDRESS_CONFIRM, SOLE_TRADER_MANUAL_CORRESPONDENCE_ADDRESS, SOLE_TRADER_AUTO_LOOKUP_ADDRESS, BASE_URL, TYPE_OF_BUSINESS } from "../../../types/pageURL";
import { Address } from "../../../model/Address";
import { UserData } from "../../../model/UserData";
import { Session } from "@companieshouse/node-session-handler";
Expand Down Expand Up @@ -29,5 +29,5 @@ export const get = async (req: Request, res: Response, next: NextFunction) => {
};

export const post = async (req: Request, res: Response, next: NextFunction) => {
res.redirect(BASE_URL + "/type-of-acsp");
res.redirect(BASE_URL + TYPE_OF_BUSINESS);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Request, Response, NextFunction } from "express";
import { StatementRelevantOfficerService } from "../../../services/role/statementRelevantOfficerService";
import * as config from "../../../config";
import { BASE_URL } from "../../../types/pageURL";
import { BASE_URL, STOP_NOT_RELEVANT_OFFICER, SOLE_TRADER_NAME_REGISTERED_WITH_AML } from "../../../types/pageURL";

const handler = new StatementRelevantOfficerService();

Expand All @@ -17,12 +17,11 @@ export const get = async (req: Request, res: Response, next: NextFunction) => {
export const post = async (req: Request, res: Response, next: NextFunction) => {
try {
const selectedRole = req.body.WhatIsYourRole;

if (selectedRole === "director" || selectedRole === "general-partner" || selectedRole === "member-of-the-partnership" || selectedRole === "sole-trader") { // selectedRole equal to value base on HTML radio element
res.redirect(BASE_URL + "/how-are-you-aml-supervised");// endpoint name based on prototype
res.redirect(BASE_URL + SOLE_TRADER_NAME_REGISTERED_WITH_AML);// endpoint name based on prototype

} else if (selectedRole === "someone-else") {
res.redirect(BASE_URL + "/sole-trader/stop-not-relevant-officer");
res.redirect(BASE_URL + STOP_NOT_RELEVANT_OFFICER);
} else {
res.status(400).send("Invalid role selection");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validationResult } from "express-validator";
import * as config from "../../../config";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { SOLE_TRADER_TYPE_OF_BUSINESS, START, SOLE_TRADER_OTHER_TYPE_OFBUSINESS, SOLE_TRADER_ROLE, BASE_URL } from "../../../types/pageURL";
import { TYPE_OF_BUSINESS, START, OTHER_TYPE_OFBUSINESS, SOLE_TRADER_WHAT_IS_YOUR_ROLE, BASE_URL } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
Expand All @@ -12,7 +12,7 @@ export const get = async (req: Request, res: Response, next: NextFunction) => {
previousPage: addLangToUrl(START, lang),
title: "What type of business are you registering?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + SOLE_TRADER_TYPE_OF_BUSINESS,
currentUrl: BASE_URL + TYPE_OF_BUSINESS,
typeOfBusiness: req.query.typeOfBusiness
});
};
Expand All @@ -28,13 +28,13 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
previousPage: addLangToUrl(START, lang),
title: "What type of business are you registering?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + SOLE_TRADER_TYPE_OF_BUSINESS,
currentUrl: BASE_URL + TYPE_OF_BUSINESS,
...pageProperties
});
} else {
var nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_ROLE, lang);
var nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_WHAT_IS_YOUR_ROLE, lang);
if (req.body.typeOfBusinessRadio === "OTHER") {
nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_OTHER_TYPE_OFBUSINESS, lang);
nextPageUrl = addLangToUrl(BASE_URL + OTHER_TYPE_OFBUSINESS, lang);
}
res.redirect(nextPageUrl);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { NextFunction, Request, Response, Router } from "express";
import * as config from "../../../config";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { BASE_URL, LIMITED_BUSINESS_MUSTBE_AML_REGISTERED, LIMITED_NAME_REGISTERED_WITH_AML, SOLE_TRADER_TYPE_OF_BUSINESS, AML_REGISTRATION } from "../../../types/pageURL";
import { BASE_URL, LIMITED_BUSINESS_MUSTBE_AML_REGISTERED_KICKOUT, LIMITED_NAME_REGISTERED_WITH_AML, TYPE_OF_BUSINESS, AML_REGISTRATION } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
const locales = getLocalesService();
res.render(config.LIMITED_BUSINESS_MUSTBE_AML_REGISTERED, {
previousPage: addLangToUrl(BASE_URL + LIMITED_NAME_REGISTERED_WITH_AML, lang),
soleTrader: addLangToUrl(BASE_URL + SOLE_TRADER_TYPE_OF_BUSINESS + "?typeOfBusiness=SOLE_TRADER", lang),
soleTrader: addLangToUrl(BASE_URL + TYPE_OF_BUSINESS + "?typeOfBusiness=SOLE_TRADER", lang),
amlRegistration: addLangToUrl(AML_REGISTRATION, lang),
title: "Your business must be registered with an AML supervisory body",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + LIMITED_BUSINESS_MUSTBE_AML_REGISTERED
currentUrl: BASE_URL + LIMITED_BUSINESS_MUSTBE_AML_REGISTERED_KICKOUT
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CompanyDetailsService } from "../../../services/company-details/company
import * as config from "../../../config";
import { ACSPServiceClient } from "../../../clients/ASCPServiceClient";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { BASE_URL, LIMITED_IS_THIS_YOUR_COMPANY, LIMITED_ONE_LOGIN_PASSWORD, LIMITED_COMPANY_NUMBER } from "../../../types/pageURL";
import { BASE_URL, LIMITED_IS_THIS_YOUR_COMPANY, LIMITED_ONE_LOGIN_PASSWORD, LIMITED_WHAT_IS_THE_COMPANY_NUMBER } from "../../../types/pageURL";
import logger from "../../../../../lib/Logger";

const acspServiceClientOne = new ACSPServiceClient(config.ACSP_API_LOCALHOST);
Expand All @@ -18,7 +18,7 @@ export const get = async (req: Request, res: Response, next: NextFunction) => {
previousPage: addLangToUrl(BASE_URL + LIMITED_ONE_LOGIN_PASSWORD, lang),
title: "What is the company number?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + LIMITED_COMPANY_NUMBER
currentUrl: BASE_URL + LIMITED_WHAT_IS_THE_COMPANY_NUMBER
});
};

Expand All @@ -34,7 +34,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
payload: req.body,
title: "What is the company number?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + LIMITED_COMPANY_NUMBER,
currentUrl: BASE_URL + LIMITED_WHAT_IS_THE_COMPANY_NUMBER,
pageProperties: pageProperties

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { validationResult } from "express-validator";
import * as config from "../../../config";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { SOLE_TRADER_SECTOR_YOU_WORK_IN, LIMITED_NAME_REGISTERED_WITH_AML, LIMITED_WHAT_IS_YOUR_ROLE, BASE_URL, YOUR_BUSINESS_MUST_BE_REGISTERED_KICKOUT, SOLE_TRADER_OTHER_TYPE_OFBUSINESS } from "../../../types/pageURL";
import { SOLE_TRADER_SECTOR_YOU_WORK_IN, LIMITED_NAME_REGISTERED_WITH_AML, LIMITED_WHAT_IS_YOUR_ROLE, BASE_URL, LIMITED_BUSINESS_MUSTBE_AML_REGISTERED_KICKOUT, OTHER_TYPE_OFBUSINESS } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
Expand Down Expand Up @@ -33,7 +33,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
});
} else {
const nextPageUrl = addLangToUrl(BASE_URL + SOLE_TRADER_SECTOR_YOU_WORK_IN, lang);
const nextPageUrlForBoth = addLangToUrl(BASE_URL + YOUR_BUSINESS_MUST_BE_REGISTERED_KICKOUT, lang);
const nextPageUrlForBoth = addLangToUrl(BASE_URL + LIMITED_BUSINESS_MUSTBE_AML_REGISTERED_KICKOUT, lang);
// res.redirect(nextPageUrl);
switch (selectedOption) {
case "YOUR_NAME":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { validationResult } from "express-validator";
import * as config from "../../../config";
import { FormattedValidationErrors, formatValidationError } from "../../../validation/validation";
import { selectLang, addLangToUrl, getLocalesService, getLocaleInfo } from "../../../utils/localise";
import { UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME, SOLE_TRADER_SECTOR_YOU_WORK_IN, BASE_URL, UNINCORPORATED_WHAT_BUSINESS_TYPE } from "../../../types/pageURL";
import { UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME, SOLE_TRADER_SECTOR_YOU_WORK_IN, BASE_URL, TYPE_OF_BUSINESS } from "../../../types/pageURL";

export const get = async (req: Request, res: Response, next: NextFunction) => {
const lang = selectLang(req.query.lang);
const locales = getLocalesService();
res.render(config.UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME, {
previousPage: addLangToUrl(BASE_URL + UNINCORPORATED_WHAT_BUSINESS_TYPE, lang),
previousPage: addLangToUrl(BASE_URL + TYPE_OF_BUSINESS, lang),
title: "What is the business name?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME
Expand All @@ -24,7 +24,7 @@ export const post = async (req: Request, res: Response, next: NextFunction) => {
if (!errorList.isEmpty()) {
const pageProperties = getPageProperties(formatValidationError(errorList.array(), lang));
res.status(400).render(config.UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME, {
previousPage: addLangToUrl(BASE_URL + UNINCORPORATED_WHAT_BUSINESS_TYPE, lang),
previousPage: addLangToUrl(BASE_URL + TYPE_OF_BUSINESS, lang),
title: "What is the business name?",
...getLocaleInfo(locales, lang),
currentUrl: BASE_URL + UNINCORPORATED_WHAT_IS_THE_BUSINESS_NAME,
Expand Down
Loading

0 comments on commit 9abe86c

Please sign in to comment.