diff --git a/src/SFA.DAS.EmployerFinance.Web.UnitTests/Controllers/TransfersControllerTests/TransfersControllerTests.cs b/src/SFA.DAS.EmployerFinance.Web.UnitTests/Controllers/TransfersControllerTests/TransfersControllerTests.cs index d2f03f6a1c..0002299c66 100644 --- a/src/SFA.DAS.EmployerFinance.Web.UnitTests/Controllers/TransfersControllerTests/TransfersControllerTests.cs +++ b/src/SFA.DAS.EmployerFinance.Web.UnitTests/Controllers/TransfersControllerTests/TransfersControllerTests.cs @@ -76,7 +76,7 @@ public async Task FinancialBreakdownReturnsAViewModel() var viewModel = view?.Model as OrchestratorResponse; Assert.IsNotNull(viewModel); - Assert.AreEqual(2000, viewModel.Data.AcceptedPledgeApplications); + Assert.AreEqual(4000, viewModel.Data.AcceptedPledgeApplications); } [Test] @@ -106,6 +106,15 @@ public async Task FinancialBreakdownPageShowsCorrectTotalPledgedAndTransferConne Assert.AreEqual(totalPledgedAndTransferConnections, viewModel.Data.TotalPledgedAndTransferConnections); } + [Test] + public async Task FinancialBreakdownPageShowsCorrectAvailablePledgedFunds() + { + var viewModel = await GetViewModel(); + + var availablePledgedFunds = viewModel.Data.AmountPledged - (viewModel.Data.ApprovedPledgeApplications + viewModel.Data.AcceptedPledgeApplications); + Assert.AreEqual(availablePledgedFunds, viewModel.Data.AvailablePledgedFunds); + } + private async Task> GetViewModel() { var result = await _controller.FinancialBreakdown(HashedAccountId); diff --git a/src/SFA.DAS.EmployerFinance.Web/Orchestrators/TransfersOrchestrator.cs b/src/SFA.DAS.EmployerFinance.Web/Orchestrators/TransfersOrchestrator.cs index 73446da701..85099f86e9 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Orchestrators/TransfersOrchestrator.cs +++ b/src/SFA.DAS.EmployerFinance.Web/Orchestrators/TransfersOrchestrator.cs @@ -81,7 +81,7 @@ public async Task> GetFinancia { TransferConnections = financialBreakdownTask.Result.TransferConnections, HashedAccountID = hashedAccountId, - AcceptedPledgeApplications = financialBreakdownTask.Result.AcceptedPledgeApplications, + AcceptedPledgeApplications = financialBreakdownTask.Result.AcceptedPledgeApplications + financialBreakdownTask.Result.PledgeOriginatedCommitments, ApprovedPledgeApplications = financialBreakdownTask.Result.ApprovedPledgeApplications, Commitments = financialBreakdownTask.Result.Commitments, PledgeOriginatedCommitments = financialBreakdownTask.Result.PledgeOriginatedCommitments, diff --git a/src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/FinancialBreakdownViewModel.cs b/src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/FinancialBreakdownViewModel.cs index 744cb2d194..d7f31c941a 100644 --- a/src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/FinancialBreakdownViewModel.cs +++ b/src/SFA.DAS.EmployerFinance.Web/ViewModels/Transfers/FinancialBreakdownViewModel.cs @@ -21,5 +21,6 @@ public class FinancialBreakdownViewModel public decimal EstimatedRemainingAllowance { get { return TotalAvailableTransferAllowance - TotalEstimatedSpend; } } public decimal TotalPledgedAndTransferConnections { get { return AmountPledged + TransferConnections; } } public decimal TotalAvailablePledgedFunds { get { return TotalAvailableTransferAllowance - TotalPledgedAndTransferConnections; } } + public decimal AvailablePledgedFunds { get { return AmountPledged - (ApprovedPledgeApplications + AcceptedPledgeApplications); } } } } \ No newline at end of file diff --git a/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/FinancialBreakdown.cshtml b/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/FinancialBreakdown.cshtml index efcdd2315f..535bbc0903 100644 --- a/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/FinancialBreakdown.cshtml +++ b/src/SFA.DAS.EmployerFinance.Web/Views/Transfers/FinancialBreakdown.cshtml @@ -102,39 +102,37 @@

- Available pledge funds for financial year 2021/22 + Available pledge funds for financial year @Model.Data.FinancialYearString

- + - - + + - - + + +
You have pledged£20@Model.Data.AmountPledged.ToString("C0", culture)
Approved applications: live£20Approved applications: accepted by applicant@Model.Data.AcceptedPledgeApplications.ToString("C0", culture)
Approved applications: not yet live£20Approved applications: awaiting acceptance by applicant@Model.Data.ApprovedPledgeApplications.ToString("C0", culture)
-

- Of your £20 estimated remaining allowance, this is allocated to your available pledge funds. -

How are my available pledge funds calculated?
-

Content

+

Your available pledge funds is calculated by subtracting your approved applications (accepted by applicant and awaiting acceptance by applicant) from the amount you have pledged.

-
Available pledge funds for 2021/22
-
£200,000
+
Available pledge funds for @Model.Data.FinancialYearString
+
@Model.Data.AvailablePledgedFunds.ToString("C0", culture)