From beb530f503dcf843cdbde00da721bae1b592d19d Mon Sep 17 00:00:00 2001 From: Chris Woodcock Date: Fri, 1 Oct 2021 11:31:48 +0100 Subject: [PATCH 1/8] Added terms and conditions to employer accounts --- .../Controllers/HomeController.cs | 7 ++++ src/SFA.DAS.EAS.Web/Startup.cs | 2 - .../ViewModels/UserLinksViewModel.cs | 1 - .../Views/Shared/_Layout.cshtml | 2 +- .../WhenIViewTermsAndCondition.cs | 8 ++-- .../Controllers/HomeController.cs | 18 ++++++-- .../SFA.DAS.EmployerAccounts.Web.csproj | 5 ++- ...l.cs => TermsAndConditionsNewViewModel.cs} | 2 +- .../Views/Home/TermsAndConditions.cshtml | 4 +- .../Home/TermsAndConditionsOverview.cshtml | 42 +++++++++++++++++++ .../IdentityServerConfiguration.cs | 1 - .../SFA.DAS.EmployerFinance.Web.csproj | 2 +- 12 files changed, 76 insertions(+), 18 deletions(-) rename src/SFA.DAS.EmployerAccounts.Web/ViewModels/{TermsAndConditionViewModel.cs => TermsAndConditionsNewViewModel.cs} (77%) create mode 100644 src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml diff --git a/src/SFA.DAS.EAS.Web/Controllers/HomeController.cs b/src/SFA.DAS.EAS.Web/Controllers/HomeController.cs index 38a049900a..326a607297 100644 --- a/src/SFA.DAS.EAS.Web/Controllers/HomeController.cs +++ b/src/SFA.DAS.EAS.Web/Controllers/HomeController.cs @@ -99,6 +99,13 @@ public ActionResult ServiceStartPage() return Redirect(Url.EmployerAccountsAction("service/start", false)); } + [HttpGet] + [Route("termsAndConditions/overview")] + public ActionResult TermsAndConditionsOverview() + { + return Redirect(Url.EmployerAccountsAction("service/termsAndConditions/overview", false)); + } + private string GetTrackerQueryString() { var trackerValue = Url.RequestContext.HttpContext.Request.QueryString[GoogleTag]; diff --git a/src/SFA.DAS.EAS.Web/Startup.cs b/src/SFA.DAS.EAS.Web/Startup.cs index d63884e25d..7bf8b9ecff 100644 --- a/src/SFA.DAS.EAS.Web/Startup.cs +++ b/src/SFA.DAS.EAS.Web/Startup.cs @@ -71,7 +71,6 @@ public void Configuration(IAppBuilder app) JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary(); UserLinksViewModel.ChangePasswordLink = $"{constants.ChangePasswordLink()}{urlHelper.Encode("https://" + config.DashboardUrl + "/service/password/change")}"; UserLinksViewModel.ChangeEmailLink = $"{constants.ChangeEmailLink()}{urlHelper.Encode("https://" + config.DashboardUrl + "/service/email/change")}"; - UserLinksViewModel.TermsAndConditionsLink = constants.TermsAndConditionsLink(); } private static Func GetSigningCertificate(bool useCertificate) @@ -150,6 +149,5 @@ public Constants(IdentityServerConfiguration configuration) public string RequiresVerification() => _baseUrl + "requires_verification"; public string TokenEndpoint() => $"{_configuration.BaseAddress}{_configuration.TokenEndpoint}"; public string UserInfoEndpoint() => $"{_configuration.BaseAddress}{_configuration.UserInfoEndpoint}"; - public string TermsAndConditionsLink() => $"{_configuration.BaseAddress.Replace("/identity", "")}{_configuration.TermsAndConditionsLink}"; } } \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Web/ViewModels/UserLinksViewModel.cs b/src/SFA.DAS.EAS.Web/ViewModels/UserLinksViewModel.cs index 7daf17359c..74b6c87209 100644 --- a/src/SFA.DAS.EAS.Web/ViewModels/UserLinksViewModel.cs +++ b/src/SFA.DAS.EAS.Web/ViewModels/UserLinksViewModel.cs @@ -4,6 +4,5 @@ public static class UserLinksViewModel { public static string ChangePasswordLink { get; set; } public static string ChangeEmailLink { get; set; } - public static string TermsAndConditionsLink { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml b/src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml index 53b28cf443..a52c96a058 100644 --- a/src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml +++ b/src/SFA.DAS.EAS.Web/Views/Shared/_Layout.cshtml @@ -199,7 +199,7 @@
  • Help
  • Feedback
  • Privacy and cookies
  • -
  • Terms and conditions
  • +
  • Terms and conditions
  • Built by the Education and Skills Funding Agency
  • diff --git a/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/HomeControllerTests/WhenIViewTermsAndCondition.cs b/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/HomeControllerTests/WhenIViewTermsAndCondition.cs index 8a7050a38c..33b8518a41 100644 --- a/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/HomeControllerTests/WhenIViewTermsAndCondition.cs +++ b/src/SFA.DAS.EmployerAccounts.Web.UnitTests/Controllers/HomeControllerTests/WhenIViewTermsAndCondition.cs @@ -69,8 +69,8 @@ public void ThenTheViewModelIsMappedCorrectly() var viewResult = (ViewResult)result; var viewModel = viewResult.Model; - Assert.IsInstanceOf(viewModel); - var termsAndConditionViewModel = (TermsAndConditionViewModel)viewModel; + Assert.IsInstanceOf(viewModel); + var termsAndConditionViewModel = (TermsAndConditionsNewViewModel)viewModel; Assert.AreEqual("returnUrl", termsAndConditionViewModel.ReturnUrl); Assert.AreEqual("hashedId", termsAndConditionViewModel.HashedAccountId); @@ -80,7 +80,7 @@ public void ThenTheViewModelIsMappedCorrectly() [Test] public async Task ThenIsRedirectedToEmployerTeamController() { - var termsAndConditionViewModel = new TermsAndConditionViewModel() { HashedAccountId = "HashedId", ReturnUrl = "EmployerTeam" }; + var termsAndConditionViewModel = new TermsAndConditionsNewViewModel() { HashedAccountId = "HashedId", ReturnUrl = "EmployerTeam" }; //Act var result = await _homeController.TermsAndConditions(termsAndConditionViewModel); @@ -94,7 +94,7 @@ public async Task ThenIsRedirectedToEmployerTeamController() [Test] public async Task ThenIsRedirectedToHomeController() { - var termsAndConditionViewModel = new TermsAndConditionViewModel() { HashedAccountId = "HashedId", ReturnUrl = "Home" }; + var termsAndConditionViewModel = new TermsAndConditionsNewViewModel() { HashedAccountId = "HashedId", ReturnUrl = "Home" }; //Act var result = await _homeController.TermsAndConditions(termsAndConditionViewModel); diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs index ad16d1260b..d0f05b1409 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs @@ -110,20 +110,32 @@ public async Task Index() return RedirectToAction(ControllerConstants.GetApprenticeshipFundingActionName, ControllerConstants.EmployerAccountControllerName); } + [HttpGet] + [Route("termsAndConditions/overview")] + public ActionResult TermsAndConditionsOverview() + { + var model = new + { + HideHeaderSignInLink = true + }; + + return View(model); + } + [HttpGet] [DasAuthorize] [Route("termsAndConditions")] public ActionResult TermsAndConditions(string returnUrl, string hashedAccountId) { - var termsAndConditionViewModel = new TermsAndConditionViewModel { ReturnUrl = returnUrl, HashedAccountId = hashedAccountId }; - return View(termsAndConditionViewModel); + var termsAndConditionsNewViewModel = new TermsAndConditionsNewViewModel { ReturnUrl = returnUrl, HashedAccountId = hashedAccountId }; + return View(termsAndConditionsNewViewModel); } [HttpPost] [DasAuthorize] [Route("termsAndConditions")] - public async Task TermsAndConditions(TermsAndConditionViewModel termsAndConditionViewModel) + public async Task TermsAndConditions(TermsAndConditionsNewViewModel termsAndConditionViewModel) { var userRef = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName); await _homeOrchestrator.UpdateTermAndConditionsAcceptedOn(userRef); diff --git a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj index 4dd1022ac2..d0daaa18c5 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj +++ b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj @@ -138,7 +138,7 @@ 1.0.16 - 1.1.75 + 1.1.77 @@ -255,7 +255,7 @@ - + @@ -875,6 +875,7 @@ + diff --git a/src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionViewModel.cs b/src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionsNewViewModel.cs similarity index 77% rename from src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionViewModel.cs rename to src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionsNewViewModel.cs index ed9cad9d8d..85ac502f2a 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionViewModel.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/ViewModels/TermsAndConditionsNewViewModel.cs @@ -1,6 +1,6 @@ namespace SFA.DAS.EmployerAccounts.Web.ViewModels { - public class TermsAndConditionViewModel + public class TermsAndConditionsNewViewModel { public string ReturnUrl { get; set; } public string HashedAccountId { get; set; } diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditions.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditions.cshtml index 54c7c2dec2..5296008dc7 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditions.cshtml +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditions.cshtml @@ -1,8 +1,8 @@ -@model SFA.DAS.EmployerAccounts.Web.ViewModels.TermsAndConditionViewModel +@model SFA.DAS.EmployerAccounts.Web.ViewModels.TermsAndConditionsNewViewModel @{ ViewBag.PageID = "page-terms-and-condition"; ViewBag.Section = "home"; - ViewBag.Title = "Term and Conditions"; + ViewBag.Title = "Terms and Conditions"; Layout = "~/Views/Shared/_Layout_CDN.cshtml"; string returnUrl = string.Empty; if (Model.ReturnUrl == "EmployerTeam") diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml new file mode 100644 index 0000000000..16fb83541f --- /dev/null +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml @@ -0,0 +1,42 @@ +@{ + ViewBag.PageID = "page-terms-and-conditions-overview"; + ViewBag.Section = "home"; + ViewBag.Title = "Terms and Conditions"; + Layout = "~/Views/Shared/_Layout_CDN.cshtml"; +} +
    +
    +

    Terms of use

    +

    + To use this service you agree to:  +

    +

    +

      +
    • Sign out at the end of each session
    • +
    • Input truthful and accurate information
    • +
    • Adhere to the Computer Misuse Act 1990
    • +
    • Use only a legitimate email address that you or people in your organisation has access to
    • +
    • Keep your sign in details secure and do not share them with third parties
    • +
    • Not use discriminatory wording as set out in the Equality Act 2010
    • +
    • Make sure the published rates of pay comply with the National Minimum Wage guidelines and are not misleading to candidates
    • +
    • Adhere to all relevant UK employment law
    • +
    • If you are a commercial organisation as defined in section 54 of the Modern Slavery Act 2015, adhere to the annual reporting requirements
    • +
    • Your apprenticeship adverts being publicly accessible, including the possibility of partner websites displaying them
    • +
    • Comply with the government safeguarding policies for children and vulnerable adults
    • +
    • Not provide feedback on a training provider when you are an employer provider
    • +
    • Be an active and trading business at the point of creating an apprenticeship service account
    • +
    • Only add apprentices that are linked to the PAYE scheme registered in your employer account
    • +
    • Comply at all times with the Apprenticeship Agreement for Employers and Apprenticeship Funding Rules
    • +
    +

    +

    When you sign up for an apprenticeship service account we may need to verify and validate your company. You may not be granted an account if you fail the checks conducted by ESFA.

    +

    Your contact details and information associated with your account will be collected and used for the support and administration of your account.

    +

    We will not:

    +
      +
    • Use or disclose this information for other purposes (except where we’re legally required to do so)
    • +
    • Use your details for any marketing purposes or for any reason unrelated to the use of your account
    • +
    +

    We may update these terms and conditions at any time without notice. You’ll agree to any changes if you continue to use this service after the terms and conditions have been updated.

    +
    +
    + diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/IdentityServerConfiguration.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/IdentityServerConfiguration.cs index 4d76138c57..5dff9ca2e1 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/IdentityServerConfiguration.cs +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/IdentityServerConfiguration.cs @@ -17,6 +17,5 @@ public class IdentityServerConfiguration public string ChangeEmailLink { get; set; } public string RegisterLink { get; set; } public string AccountActivationUrl { get; set; } - public string TermsAndConditionsLink { get; set; } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj b/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj index 9c1c8385c1..b259eb0513 100644 --- a/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj +++ b/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj @@ -97,7 +97,7 @@ 1.0.5
    - 1.1.75 + 1.1.77 From aa345bd424d205a54faccd1ff5c1393edec16046 Mon Sep 17 00:00:00 2001 From: Kola samuel Date: Fri, 1 Oct 2021 14:26:22 +0100 Subject: [PATCH 2/8] Update Cookie content --- .../Views/CookieConsent/Details.cshtml | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/CookieConsent/Details.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/CookieConsent/Details.cshtml index c2a4b25226..d3a7a5a83f 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Views/CookieConsent/Details.cshtml +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/CookieConsent/Details.cshtml @@ -64,10 +64,10 @@ _ga - Used by Google Analytics, this registers a unique ID to generate statistics about how you use the website + Used by Google Analytics to distinguish users. - 1 year + 2 year @@ -78,7 +78,7 @@ Google Analytics throttling rate request - 1 year + 1 minute @@ -86,10 +86,10 @@ _gid - Google Analytics cookie that registers a unique ID to generate statistics about how you use the website + Used by Google Analytics to distinguish users. - 1 year + 1 day @@ -150,16 +150,48 @@ This monitors the performance of the website Session + + + sfa-das-employerapprenticeshipsservice-accountcontext + + This enables the website to function properly + 1 day + + + + recruit-data + + This enables the website to function properly + Session + + + + setup-employer-[AccountID] + + This enables the website to function properly + Session + + + + __cfruid + + Used by the content network, Cloudflare, to identify trusted web traffic. + 1 year + + + + SFA.DAS.EmployerCommitmentsV2.Web.Auth + + This enables the website to function properly + Session + + -

    Change your settings

    You can change which cookies you're happy for us to use.

    - - -
    From 2b3c1469d1894257860892766b03e35be205d798 Mon Sep 17 00:00:00 2001 From: Chris Woodcock Date: Fri, 1 Oct 2021 14:51:11 +0100 Subject: [PATCH 3/8] Hide navigation bar on terms and conditions page --- .../Controllers/HomeController.cs | 7 +------ .../Views/Home/TermsAndConditionsOverview.cshtml | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs b/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs index d0f05b1409..ee96079907 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Controllers/HomeController.cs @@ -114,12 +114,7 @@ public async Task Index() [Route("termsAndConditions/overview")] public ActionResult TermsAndConditionsOverview() { - var model = new - { - HideHeaderSignInLink = true - }; - - return View(model); + return View(); } diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml index 16fb83541f..836e3cdaf0 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/Home/TermsAndConditionsOverview.cshtml @@ -2,6 +2,7 @@ ViewBag.PageID = "page-terms-and-conditions-overview"; ViewBag.Section = "home"; ViewBag.Title = "Terms and Conditions"; + ViewBag.HideNav = true; Layout = "~/Views/Shared/_Layout_CDN.cshtml"; }
    From e12f4c53cb333bff08116cd661468318a8fbfefd Mon Sep 17 00:00:00 2001 From: Chris Woodcock Date: Fri, 1 Oct 2021 16:22:53 +0100 Subject: [PATCH 4/8] Update shared ui package to latest --- .../SFA.DAS.EmployerAccounts.Web.csproj | 2 +- .../SFA.DAS.EmployerFinance.Web.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj index d0daaa18c5..59ade2fd1b 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj +++ b/src/SFA.DAS.EmployerAccounts.Web/SFA.DAS.EmployerAccounts.Web.csproj @@ -138,7 +138,7 @@ 1.0.16 - 1.1.77 + 1.1.79 diff --git a/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj b/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj index b259eb0513..239bcde92d 100644 --- a/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj +++ b/src/SFA.DAS.EmployerFinance.Web/SFA.DAS.EmployerFinance.Web.csproj @@ -97,7 +97,7 @@ 1.0.5 - 1.1.77 + 1.1.79 From e1aea94483f6e07c2b033878e758ffbefb16ba48 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 6 Oct 2021 16:26:37 +0100 Subject: [PATCH 5/8] [CON-4047] Employer accounts Vacancy DTO requires new status' added as part of "Collaborate" journey in order to map the response from the API. --- src/SFA.DAS.EmployerAccounts/Models/Recruit/VacancyStatus.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SFA.DAS.EmployerAccounts/Models/Recruit/VacancyStatus.cs b/src/SFA.DAS.EmployerAccounts/Models/Recruit/VacancyStatus.cs index 140a72b82c..969e38f524 100644 --- a/src/SFA.DAS.EmployerAccounts/Models/Recruit/VacancyStatus.cs +++ b/src/SFA.DAS.EmployerAccounts/Models/Recruit/VacancyStatus.cs @@ -3,8 +3,10 @@ public enum VacancyStatus { Draft, + Review, + Rejected, // Rejected by employer during "Collaborate" Submitted, - Referred, // rejected + Referred, // Rejected by QA Live, Closed, Approved From b192b51420a8e7e8b330a94708df66e9e65ad8d3 Mon Sep 17 00:00:00 2001 From: Paul Howes Date: Thu, 7 Oct 2021 10:18:47 +0100 Subject: [PATCH 6/8] Update HtmlHelperExtensions.cs --- .../Extensions/HtmlHelperExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs b/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs index 6a3cb68aee..627c379669 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs +++ b/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs @@ -65,7 +65,7 @@ public static IHeaderViewModel GetHeaderViewModel(this HtmlHelper html, bool use AuthenticationAuthorityUrl = configuration.Identity.BaseAddress, ClientId = configuration.Identity.ClientId, EmployerRecruitBaseUrl = configuration.EmployerRecruitBaseUrl, - SignOutUrl = new Uri($"{configuration.EmployerFinanceBaseUrl}/services/signOut/"), + SignOutUrl = new Uri($"{configuration.EmployerFinanceBaseUrl}/service/signOut/"), ChangeEmailReturnUrl = requestUrl, ChangePasswordReturnUrl = requestUrl }, From 459b5822033a24e6cc99831196d0bf68a7ef5db3 Mon Sep 17 00:00:00 2001 From: Paul Howes Date: Fri, 8 Oct 2021 15:40:50 +0100 Subject: [PATCH 7/8] Removed / --- .../Extensions/HtmlHelperExtensions.cs | 7 ++++--- .../Extensions/HtmlHelperExtensions.cs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/Extensions/HtmlHelperExtensions.cs b/src/SFA.DAS.EmployerAccounts.Web/Extensions/HtmlHelperExtensions.cs index 7eb1ac33b2..a4aae103cc 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Extensions/HtmlHelperExtensions.cs +++ b/src/SFA.DAS.EmployerAccounts.Web/Extensions/HtmlHelperExtensions.cs @@ -85,6 +85,7 @@ public static string GetZenDeskCobrowsingSnippetKey(this HtmlHelper html) public static IHeaderViewModel GetHeaderViewModel(this HtmlHelper html, bool useLegacyStyles = false) { var configuration = DependencyResolver.Current.GetService(); + var employerAccountsBaseUrl = configuration.EmployerAccountsBaseUrl + (configuration.EmployerAccountsBaseUrl.EndsWith("/") ? "" : "/"); var headerModel = new HeaderViewModel(new HeaderConfiguration { @@ -96,9 +97,9 @@ public static IHeaderViewModel GetHeaderViewModel(this HtmlHelper html, bool use AuthenticationAuthorityUrl = configuration.Identity.BaseAddress, ClientId = configuration.Identity.ClientId, EmployerRecruitBaseUrl = configuration.EmployerRecruitBaseUrl, - SignOutUrl = new Uri($"{configuration.EmployerAccountsBaseUrl}/service/signOut"), - ChangeEmailReturnUrl = new System.Uri(configuration.EmployerAccountsBaseUrl + "/service/email/change"), - ChangePasswordReturnUrl = new System.Uri(configuration.EmployerAccountsBaseUrl + "/service/password/change") + SignOutUrl = new Uri($"{employerAccountsBaseUrl}service/signOut"), + ChangeEmailReturnUrl = new Uri($"{employerAccountsBaseUrl}service/email/change"), + ChangePasswordReturnUrl = new Uri($"{employerAccountsBaseUrl}service/password/change") }, new UserContext { diff --git a/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs b/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs index 627c379669..5514dca1f5 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs +++ b/src/SFA.DAS.EmployerFinance.Web/Extensions/HtmlHelperExtensions.cs @@ -53,7 +53,7 @@ public static string GetZenDeskCobrowsingSnippetKey(this HtmlHelper html) public static IHeaderViewModel GetHeaderViewModel(this HtmlHelper html, bool useLegacyStyles = false) { var configuration = DependencyResolver.Current.GetService(); - + var employerFinanceBaseUrl = configuration.EmployerFinanceBaseUrl + (configuration.EmployerFinanceBaseUrl.EndsWith("/") ? "" : "/"); var requestUrl = html.ViewContext.HttpContext.Request.Url; var headerModel = new HeaderViewModel(new HeaderConfiguration @@ -65,7 +65,7 @@ public static IHeaderViewModel GetHeaderViewModel(this HtmlHelper html, bool use AuthenticationAuthorityUrl = configuration.Identity.BaseAddress, ClientId = configuration.Identity.ClientId, EmployerRecruitBaseUrl = configuration.EmployerRecruitBaseUrl, - SignOutUrl = new Uri($"{configuration.EmployerFinanceBaseUrl}/service/signOut/"), + SignOutUrl = new Uri($"{employerFinanceBaseUrl}service/signOut"), ChangeEmailReturnUrl = requestUrl, ChangePasswordReturnUrl = requestUrl }, From e5082e767d6f823a6e9b239ed037baaa05465f5b Mon Sep 17 00:00:00 2001 From: VasanthaKasirajan3008 <56582101+VasanthaKasirajan3008@users.noreply.github.com> Date: Thu, 21 Oct 2021 12:13:38 +0100 Subject: [PATCH 8/8] CON-4016- remove the unused references and configuration for Loqate AKA PostcodesAnywhere Api (#2216) --- .../WhenIGetAddressesFromAPostcode.cs | 68 ------------- .../EmployerAccountsConfiguration.cs | 1 - ...oyerApprenticeshipsServiceConfiguration.cs | 1 - .../PostcodeAnywhereConfiguration.cs | 11 --- .../DependencyResolution/ServicesRegistry.cs | 3 +- .../Interfaces/IAddressLookupService.cs | 11 --- .../GetPostcodeAddressHandler.cs | 36 ------- .../GetPostcodeAddressRequest.cs | 9 -- .../GetPostcodeAddressResponse.cs | 10 -- .../GetPostcodeAddressValidator.cs | 48 --------- .../Services/AddressLookupService.cs | 98 ------------------- ...oyerApprenticeshipsServiceConfiguration.cs | 1 - .../PostcodeAnywhereConfiguration.cs | 11 --- .../SFA.DAS.EAS.Domain.csproj | 1 - 14 files changed, 1 insertion(+), 308 deletions(-) delete mode 100644 src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetPostcodeAddressTests/WhenIGetAddressesFromAPostcode.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Configuration/PostcodeAnywhereConfiguration.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Interfaces/IAddressLookupService.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressHandler.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressRequest.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressResponse.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressValidator.cs delete mode 100644 src/SFA.DAS.EmployerAccounts/Services/AddressLookupService.cs delete mode 100644 src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/PostcodeAnywhereConfiguration.cs diff --git a/src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetPostcodeAddressTests/WhenIGetAddressesFromAPostcode.cs b/src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetPostcodeAddressTests/WhenIGetAddressesFromAPostcode.cs deleted file mode 100644 index bc8d948833..0000000000 --- a/src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetPostcodeAddressTests/WhenIGetAddressesFromAPostcode.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Moq; -using NUnit.Framework; -using SFA.DAS.EmployerAccounts.Interfaces; -using SFA.DAS.EmployerAccounts.Models; -using SFA.DAS.EmployerAccounts.Queries.GetPostcodeAddress; -using SFA.DAS.NLog.Logger; -using SFA.DAS.Validation; - -namespace SFA.DAS.EmployerAccounts.UnitTests.Queries.GetPostcodeAddressTests -{ - public class WhenIGetAddressesFromAPostcode : QueryBaseTest - { - private Mock _addressLookupService; - private Mock _logger; - private ICollection
    _addresses; - - public override GetPostcodeAddressRequest Query { get; set; } - public override GetPostcodeAddressHandler RequestHandler { get; set; } - public override Mock> RequestValidator { get; set; } - - - [SetUp] - public void Arrange() - { - base.SetUp(); - - _addresses = new List
    - { - new Address() - }; - - _addressLookupService = new Mock(); - _logger = new Mock(); - - _addressLookupService.Setup(x => x.GetAddressesByPostcode(It.IsAny())) - .ReturnsAsync(_addresses); - - Query = new GetPostcodeAddressRequest {Postcode = "TE12 3ST"}; - - RequestHandler = new GetPostcodeAddressHandler( - _addressLookupService.Object, - RequestValidator.Object, - _logger.Object); - } - - [Test] - public override async Task ThenIfTheMessageIsValidTheRepositoryIsCalled() - { - //Act - await RequestHandler.Handle(Query); - - //Assert - _addressLookupService.Verify(x => x.GetAddressesByPostcode(Query.Postcode), Times.Once); - } - - [Test] - public override async Task ThenIfTheMessageIsValidTheValueIsReturnedInTheResponse() - { - //Act - var result = await RequestHandler.Handle(Query); - - //Assert - Assert.AreEqual(_addresses, result.Addresses); - } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs index 490dff252b..3c4d56152c 100644 --- a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs +++ b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerAccountsConfiguration.cs @@ -32,7 +32,6 @@ public class EmployerAccountsConfiguration : ITopicMessagePublisherConfiguration public string LegacyServiceBusConnectionString { get; set; } public string MessageServiceBusConnectionString => LegacyServiceBusConnectionString; public string NServiceBusLicense { get; set; } - public PostcodeAnywhereConfiguration PostcodeAnywhere { get; set; } public string PublicAllowedHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringSalt { get; set; } diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerApprenticeshipsServiceConfiguration.cs b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerApprenticeshipsServiceConfiguration.cs index 27defd0bc3..474ad2dfcb 100644 --- a/src/SFA.DAS.EmployerAccounts/Configuration/EmployerApprenticeshipsServiceConfiguration.cs +++ b/src/SFA.DAS.EmployerAccounts/Configuration/EmployerApprenticeshipsServiceConfiguration.cs @@ -25,7 +25,6 @@ public class EmployerApprenticeshipsServiceConfiguration : ITopicMessagePublishe public IdProcessorConfiguration IdProcessor { get; set; } public string MessageServiceBusConnectionString { get; set; } public string NServiceBusLicense { get; set; } - public PostcodeAnywhereConfiguration PostcodeAnywhere { get; set; } public string PublicAllowedHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringSalt { get; set; } diff --git a/src/SFA.DAS.EmployerAccounts/Configuration/PostcodeAnywhereConfiguration.cs b/src/SFA.DAS.EmployerAccounts/Configuration/PostcodeAnywhereConfiguration.cs deleted file mode 100644 index f1a9f8782e..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Configuration/PostcodeAnywhereConfiguration.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SFA.DAS.EmployerAccounts.Configuration -{ - public class PostcodeAnywhereConfiguration - { - public string Key { get; set; } - - public string FindPartsBaseUrl { get; set; } - - public string RetrieveServiceBaseUrl { get; set; } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/DependencyResolution/ServicesRegistry.cs b/src/SFA.DAS.EmployerAccounts/DependencyResolution/ServicesRegistry.cs index f6de582a38..6d351c9fb0 100644 --- a/src/SFA.DAS.EmployerAccounts/DependencyResolution/ServicesRegistry.cs +++ b/src/SFA.DAS.EmployerAccounts/DependencyResolution/ServicesRegistry.cs @@ -8,8 +8,7 @@ namespace SFA.DAS.EmployerAccounts.DependencyResolution public class ServicesRegistry : Registry { public ServicesRegistry() - { - For().Use(); + { For().Use(); For().Use(); For().Use(); diff --git a/src/SFA.DAS.EmployerAccounts/Interfaces/IAddressLookupService.cs b/src/SFA.DAS.EmployerAccounts/Interfaces/IAddressLookupService.cs deleted file mode 100644 index 93a98ee3e7..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Interfaces/IAddressLookupService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using SFA.DAS.EmployerAccounts.Models; - -namespace SFA.DAS.EmployerAccounts.Interfaces -{ - public interface IAddressLookupService - { - Task> GetAddressesByPostcode(string postcode); - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressHandler.cs b/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressHandler.cs deleted file mode 100644 index 6269a7cab5..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Threading.Tasks; -using MediatR; -using SFA.DAS.EmployerAccounts.Interfaces; -using SFA.DAS.NLog.Logger; -using SFA.DAS.Validation; - -namespace SFA.DAS.EmployerAccounts.Queries.GetPostcodeAddress -{ - public class GetPostcodeAddressHandler : IAsyncRequestHandler - { - private readonly IAddressLookupService _addressLookupService; - private readonly IValidator _validator; - private readonly ILog _logger; - - public GetPostcodeAddressHandler(IAddressLookupService addressLookupService, IValidator validator, ILog logger) - { - _addressLookupService = addressLookupService; - _validator = validator; - _logger = logger; - } - - public async Task Handle(GetPostcodeAddressRequest request) - { - var validationResult = _validator.Validate(request); - - if (!validationResult.IsValid()) - { - throw new InvalidRequestException(validationResult.ValidationDictionary); - } - - var addresses = await _addressLookupService.GetAddressesByPostcode(request.Postcode); - - return new GetPostcodeAddressResponse {Addresses = addresses}; - } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressRequest.cs b/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressRequest.cs deleted file mode 100644 index 93ab6d8760..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressRequest.cs +++ /dev/null @@ -1,9 +0,0 @@ -using MediatR; - -namespace SFA.DAS.EmployerAccounts.Queries.GetPostcodeAddress -{ - public class GetPostcodeAddressRequest : IAsyncRequest - { - public string Postcode { get; set; } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressResponse.cs b/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressResponse.cs deleted file mode 100644 index f41e61f133..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressResponse.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using SFA.DAS.EmployerAccounts.Models; - -namespace SFA.DAS.EmployerAccounts.Queries.GetPostcodeAddress -{ - public class GetPostcodeAddressResponse - { - public ICollection
    Addresses { get; set; } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressValidator.cs b/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressValidator.cs deleted file mode 100644 index de92c96975..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Queries/GetPostcodeAddress/GetPostcodeAddressValidator.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using SFA.DAS.Validation; - -namespace SFA.DAS.EmployerAccounts.Queries.GetPostcodeAddress -{ - public class GetPostcodeAddressValidator : IValidator - { - //This is postcode regex found off stackoverflow that was an old version of the gov.uk office postcode - //regex pattern. Given we only need to do basic validation on the postcode format this should be more - //than enough to cover this. You can see the stackoverflow post here: - //http://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive - private const string PostcodeRegExPattern = - "(GIR 0AA)|(GIR0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)" + - "|(([A-Z-[QVX]][0-9][A-HJKPSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY]" + - "))))[ ]?[0-9][A-Z-[CIKMOV]]{2})"; - - private const short MaxPostCodeLength = 8; - - - public ValidationResult Validate(GetPostcodeAddressRequest item) - { - var results = new ValidationResult(); - - if (string.IsNullOrEmpty(item.Postcode)) - { - results.ValidationDictionary.Add(nameof(item.Postcode), "Enter a valid postcode"); - } - - if (!results.ValidationDictionary.ContainsKey(nameof(item.Postcode)) && - (!string.IsNullOrEmpty(item.Postcode) && item.Postcode.Trim().Length > MaxPostCodeLength)) - results.ValidationDictionary.Add(nameof(item.Postcode), "Enter a valid postcode"); - - if (!results.ValidationDictionary.ContainsKey(nameof(item.Postcode)) && - (!string.IsNullOrEmpty(item.Postcode) && - !Regex.IsMatch(item.Postcode.ToUpper(), PostcodeRegExPattern))) - results.ValidationDictionary.Add(nameof(item.Postcode), "Enter a valid postcode"); - - return results; - } - - public Task ValidateAsync(GetPostcodeAddressRequest item) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/SFA.DAS.EmployerAccounts/Services/AddressLookupService.cs b/src/SFA.DAS.EmployerAccounts/Services/AddressLookupService.cs deleted file mode 100644 index 7dee14c00a..0000000000 --- a/src/SFA.DAS.EmployerAccounts/Services/AddressLookupService.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using SFA.DAS.EmployerAccounts.Interfaces; -using SFA.DAS.EmployerAccounts.Models; -using RestSharp; -using SFA.DAS.EmployerAccounts.Configuration; -using SFA.DAS.EmployerAccounts.Models.PostcodeAnywhere; - -namespace SFA.DAS.EmployerAccounts.Services -{ - public class AddressLookupService : IAddressLookupService - { - private const string ParameterAddressIdString = "&key={key}&id={id}"; - private const string ParameterPostCodeOnlyString = "&key={key}&Postcode={postcode}"; - - private readonly IRestService _findByPostCodeService; - private readonly IRestService _findByIdService; - private readonly PostcodeAnywhereConfiguration _configuration; - - public AddressLookupService( - IRestServiceFactory restServiceFactory, - EmployerAccountsConfiguration configuration) - { - _configuration = configuration.PostcodeAnywhere; - _findByPostCodeService = restServiceFactory.Create(_configuration.FindPartsBaseUrl); - _findByIdService = restServiceFactory.Create(_configuration.RetrieveServiceBaseUrl); - } - - public async Task> GetAddressesByPostcode(string postcode) - { - if (string.IsNullOrWhiteSpace(postcode)) - { - return null; - } - - return await Task.Run(() => - { - var restRequest = _findByPostCodeService.Create( - ParameterPostCodeOnlyString, - new KeyValuePair("key", _configuration.Key), - new KeyValuePair("postcode", postcode)); - - restRequest.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; }; - - return ValidatedPostalAddresses(restRequest); - }); - } - - private ICollection
    ValidatedPostalAddresses(IRestRequest request) - { - - var result = _findByPostCodeService.Execute>(request); - - var addresses = result.Data?.Where(x => x.Id != null).ToArray(); - - if (addresses == null || !addresses.Any()) - { - return null; - } - - var validatedAddresses = addresses.Select(x => RetrieveValidatedAddress(x.Id)) - .Where(x => x != null) - .ToList(); - return validatedAddresses; - } - - private Address RetrieveValidatedAddress(string addressId) - { - var request = _findByIdService.Create( - ParameterAddressIdString, - new KeyValuePair("key", _configuration.Key), - new KeyValuePair("id", addressId)); - - request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; }; - - var addresses = _findByIdService.Execute>(request); - - var address = addresses.Data?.SingleOrDefault(); - - if (address?.Udprn == null) - { - return null; - } - - var result = new Address - { - Line1 = address.Line1, - Line2 = address.Line2, - TownOrCity = address.PostTown, - County = address.County, - PostCode = address.Postcode - }; - - return result; - } - } -} diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs index 99a352aa25..4f194cc334 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/EmployerApprenticeshipsServiceConfiguration.cs @@ -22,7 +22,6 @@ public class EmployerApprenticeshipsServiceConfiguration : ITopicMessagePublishe public IdProcessorConfiguration IdProcessor { get; set; } public string MessageServiceBusConnectionString { get; set; } public string NServiceBusLicense { get; set; } - public PostcodeAnywhereConfiguration PostcodeAnywhere { get; set; } public string PublicAllowedHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringCharacters { get; set; } public string PublicAllowedAccountLegalEntityHashstringSalt { get; set; } diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/PostcodeAnywhereConfiguration.cs b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/PostcodeAnywhereConfiguration.cs deleted file mode 100644 index 5dbcbf0146..0000000000 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/Configuration/PostcodeAnywhereConfiguration.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SFA.DAS.EAS.Domain.Configuration -{ - public class PostcodeAnywhereConfiguration - { - public string Key { get; set; } - - public string FindPartsBaseUrl { get; set; } - - public string RetrieveServiceBaseUrl { get; set; } - } -} diff --git a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj index 32a64e1552..353bae01b4 100644 --- a/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj +++ b/src/SFA.DAS.EmployerApprenticeshipsService.Domain/SFA.DAS.EAS.Domain.csproj @@ -107,7 +107,6 @@ -