Skip to content

Commit

Permalink
Merging TM-133
Browse files Browse the repository at this point in the history
  • Loading branch information
ConorTill committed Sep 23, 2021
2 parents 5a10e18 + be52a22 commit 2019f02
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
22 changes: 16 additions & 6 deletions src/SFA.DAS.EmployerAccounts.Web/Views/EmployerTeam/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,25 @@ else
</div>
}

@if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy
&& Html.IsAuthorized("EmployerFeature.TransfersMatching"))
@if (Html.IsAuthorized("EmployerFeature.TransfersMatching"))
{
<div class="card">
<h3 class="heading-medium"><a href="@Url.EmployerFinanceAction("transfers")">Your transfers</a></h3>
<p>View your 25% transfers balance and manage your transfers, including finding a business to transfer your levy to.</p>
</div>
if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.Levy)
{
<div class="card">
<h3 class="heading-medium"><a href="@Url.EmployerFinanceAction("transfers")">Your transfers</a></h3>
<p>View your 25% transfers balance and manage your transfers, including finding a business to transfer your levy to.</p>
</div>
}
else if (Model.Data.ApprenticeshipEmployerType == ApprenticeshipEmployerType.NonLevy)
{
<div class="card">
<h3 class="heading-medium"><a href="@Url.EmployerFinanceAction("transfers")">Your transfers</a></h3>
<p>View your apprentices funded by a transfer. Find a large business to fund your apprenticeship training with a transfer.</p>
</div>
}
}


</div>
</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public static Mock<HttpMessageHandler> SetupMessageHandlerMock(HttpResponseMessa
ItExpr.Is<HttpRequestMessage>(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<CancellationToken>()
)
Expand Down
4 changes: 2 additions & 2 deletions src/SFA.DAS.EmployerFinance.Web/Views/Transfers/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

<h1 class="heading-xlarge">Transfers</h1>
<h1 class="heading-xlarge">Manage transfers</h1>

<div class="govuk-grid-row">
@if (Model.Data.CanViewPledgesSection)
Expand Down
12 changes: 7 additions & 5 deletions src/SFA.DAS.EmployerFinance/Infrastructure/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ public ApiClient(

public async Task<TResponse> Get<TResponse>(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<TResponse>(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");
}
}
}

0 comments on commit 2019f02

Please sign in to comment.