From cd9b1c40068a6e77b587a866a828bf1cda099a7f Mon Sep 17 00:00:00 2001 From: Conor Till Date: Wed, 25 Aug 2021 17:25:17 +0100 Subject: [PATCH 1/4] Adding non-levy content for transfers section and changing Transfers page title --- .../Views/EmployerTeam/Index.cshtml | 20 ++++++++++++++++++- .../Views/Transfers/Index.cshtml | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml index 503b64d60e..0ec99ee3a6 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml @@ -103,7 +103,25 @@ else } - @if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy + @if (Html.IsAuthorized("EmployerFeature.TransfersMatching")) + { + if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy) + { +
+

Your transfers

+

View your 25% transfers balance and manage your transfers, including finding a business to transfer your levy to.

+
+ } + else if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.NonLevy) + { +
+

Your transfers

+

View your apprentices funded by a transfer. Find a large business to fund your apprenticeship training with a transfer.

+
+ } + } + + @if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy && Html.IsAuthorized("EmployerFeature.TransfersMatching")) {
diff --git a/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/Index.cshtml b/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/Index.cshtml index f5d4fb7d94..d605cfc97f 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/Index.cshtml +++ b/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/Index.cshtml @@ -3,12 +3,12 @@ @{ ViewBag.PageID = "transfers"; ViewBag.Section = "finance"; - ViewBag.Title = "Transfers"; + ViewBag.Title = "Manage transfers"; ViewBag.AnalyticsData.Vpv = $"/finance/transfers"; ViewBag.ZenDeskLabel = "eas-finance"; } -

Transfers

+

Manage transfers

My pledges

From e57bef35310fca0f0acf2513e9e066ba3940c6ad Mon Sep 17 00:00:00 2001 From: Conor Till Date: Thu, 26 Aug 2021 09:01:21 +0100 Subject: [PATCH 2/4] Removing duplicate code --- .../Views/EmployerTeam/Index.cshtml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml b/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml index 0ec99ee3a6..eb85477782 100644 --- a/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml +++ b/src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml @@ -121,14 +121,6 @@ else } } - @if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy - && Html.IsAuthorized("EmployerFeature.TransfersMatching")) - { -
-

Your transfers

-

View your 25% transfers balance and manage your transfers, including finding a business to transfer your levy to.

-
- }
From cf0198a3a8282d69ab71a7923c8b3d7e86d7e746 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 22 Sep 2021 11:02:46 +0100 Subject: [PATCH 3/4] [CON-3695] Ongoing investigation for a while as to why after 55 minutes of running as part of the monthly payments pull, requests for provider information began to return 400 response codes. The issue is that when setting the httpClient default request headers on each request. The value is continuously appended to what was previously there. Eventually getting to the point of a malformed request. Changed to add the headers to each individual request itself. --- .../Infrastructure/ApiClient.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SFA.DAS.EmployerFinance/Infrastructure/ApiClient.cs b/src/SFA.DAS.EmployerFinance/Infrastructure/ApiClient.cs index 44cc1d2a9b..4805218437 100644 --- a/src/SFA.DAS.EmployerFinance/Infrastructure/ApiClient.cs +++ b/src/SFA.DAS.EmployerFinance/Infrastructure/ApiClient.cs @@ -23,19 +23,21 @@ public ApiClient ( public async Task Get(IGetApiRequest request) { - AddHeaders(); + var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, request.GetUrl); + + AddHeaders(httpRequestMessage); - var response = await _httpClient.GetAsync(request.GetUrl).ConfigureAwait(false); + var response = await _httpClient.SendAsync(httpRequestMessage).ConfigureAwait(false); response.EnsureSuccessStatusCode(); var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false); return JsonConvert.DeserializeObject(json); } - private void AddHeaders() + private void AddHeaders(HttpRequestMessage httpRequestMessage) { - _httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", _config.Key); - _httpClient.DefaultRequestHeaders.Add("X-Version", "1"); + httpRequestMessage.Headers.Add("Ocp-Apim-Subscription-Key", _config.Key); + httpRequestMessage.Headers.Add("X-Version", "1"); } } } \ No newline at end of file From 08041f7cc2eb022c086c07ff03d643c8d0016385 Mon Sep 17 00:00:00 2001 From: Corey Date: Wed, 22 Sep 2021 11:15:45 +0100 Subject: [PATCH 4/4] [CON-3695] Slight change to unit tests to catch duplicate request headers in the future. --- .../Infrastructure/WhenHandlingAGetRequest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SFA.DAS.EmployerFinance.UnitTests/Infrastructure/WhenHandlingAGetRequest.cs b/src/SFA.DAS.EmployerFinance.UnitTests/Infrastructure/WhenHandlingAGetRequest.cs index 8e3865961d..d47dd59550 100644 --- a/src/SFA.DAS.EmployerFinance.UnitTests/Infrastructure/WhenHandlingAGetRequest.cs +++ b/src/SFA.DAS.EmployerFinance.UnitTests/Infrastructure/WhenHandlingAGetRequest.cs @@ -80,9 +80,9 @@ public static Mock SetupMessageHandlerMock(HttpResponseMessa ItExpr.Is(c => c.Method.Equals(HttpMethod.Get) && c.Headers.Contains("Ocp-Apim-Subscription-Key") - && c.Headers.GetValues("Ocp-Apim-Subscription-Key").First().Equals(key) + && c.Headers.GetValues("Ocp-Apim-Subscription-Key").Single().Equals(key) && c.Headers.Contains("X-Version") - && c.Headers.GetValues("X-Version").First().Equals("1") + && c.Headers.GetValues("X-Version").Single().Equals("1") && c.RequestUri.AbsoluteUri.Equals(url)), ItExpr.IsAny() )