From 15b0268513264c2ea9181d90fbe19f74b743c0b7 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:56:33 +0100 Subject: [PATCH 01/14] [CVSRP-4673] Extend to September and render the lower percentage views where needed --- app/controllers/ConfirmationController.scala | 46 +++++++--------- .../ConfirmationViewBreakdown.scala | 18 +++--- ...SeventyPercentConfirmationView.scala.html} | 20 +++---- ...> SixtyPercentConfirmationView.scala.html} | 18 +++--- app/views/helper/FurloughCapHelper.scala | 32 +++++------ ...urloughBreakdownSeventyPercent.scala.html} | 9 +-- ...dFurloughBreakdownSixtyPercent.scala.html} | 9 +-- conf/application.conf | 2 +- conf/messages.cy | 54 +++++++++--------- conf/messages.en | 55 ++++++++++--------- test/views/helper/FurloughCapHelperSpec.scala | 12 ++++ 11 files changed, 143 insertions(+), 132 deletions(-) rename app/views/{SeptemberConfirmationView.scala.html => SeventyPercentConfirmationView.scala.html} (83%) rename app/views/{OctoberConfirmationView.scala.html => SixtyPercentConfirmationView.scala.html} (85%) rename app/views/helper/{phaseTwoDetailedFurloughBreakdownSeptember.scala.html => phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html} (81%) rename app/views/helper/{phaseTwoDetailedFurloughBreakdownOctober.scala.html => phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html} (81%) diff --git a/app/controllers/ConfirmationController.scala b/app/controllers/ConfirmationController.scala index 853a59cb8..ec28338f1 100644 --- a/app/controllers/ConfirmationController.scala +++ b/app/controllers/ConfirmationController.scala @@ -31,8 +31,9 @@ import viewmodels.{ConfirmationDataResultWithoutNicAndPension, PhaseOneConfirmat import views.html._ import java.time.Month._ +import java.time.YearMonth import javax.inject.Inject -import scala.concurrent.{ExecutionContext, Future} +import scala.concurrent.ExecutionContext class ConfirmationController @Inject()( override val messagesApi: MessagesApi, @@ -52,7 +53,7 @@ class ConfirmationController @Inject()( extends BaseController with ConfirmationControllerRequestHandler with CalculatorVersionConfiguration with YearMonthHelper { //scalastyle:off - def onPageLoad: Action[AnyContent] = (identify andThen getData andThen requireData).async { implicit request => + def onPageLoad: Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => /** Uncomment line to create integration test cases when going through journeys, either manually or via test packs. * Set the number of cases to the amount of cases that will be executed. */ // printOutConfirmationTestCases(request.userAnswers, loadResultData(request.userAnswers), 6) @@ -60,41 +61,36 @@ class ConfirmationController @Inject()( loadResultData(request.userAnswers) match { case Valid(data: PhaseOneConfirmationDataResult) => auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful(Ok(viewWithDetailedBreakdowns(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf))) + Ok(viewWithDetailedBreakdowns(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case Valid(data: PhaseTwoConfirmationDataResult) => auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful(Ok(phaseTwoView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf))) + Ok(phaseTwoView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case Valid(data: ConfirmationDataResultWithoutNicAndPension) => + auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) data.metaData.claimPeriod.start.getYearMonth match { case yearMonth if yearMonth == AUGUST.inYear(y2020) => - auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful(Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf))) - case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) => - auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful( - Ok(septemberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf))) - case yearMonth if yearMonth == OCTOBER.inYear(y2020) => - auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful(Ok(octoberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf))) + Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) + case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) || yearMonth == JULY.inYear(y2021) => + Ok(septemberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) + case yearMonth + if yearMonth == OCTOBER.inYear(y2020) || yearMonth == AUGUST.inYear(y2021) || yearMonth == SEPTEMBER.inYear(y2021) => + Ok(octoberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case yearMonth if yearMonth.isBetweenInclusive(appConfig.extensionStartDate.getYearMonth, appConfig.schemeEndDate.getYearMonth) => - auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - Future.successful( - Ok( - extensionView( - data.confirmationViewBreakdown, - data.metaData.claimPeriod, - calculatorVersionConf, - employeeTypeService.isType5NewStarter() - )) - ) + Ok( + extensionView( + data.confirmationViewBreakdown, + data.metaData.claimPeriod, + calculatorVersionConf, + employeeTypeService.isType5NewStarter() + )) case _ => - Future.successful(Redirect(routes.ErrorController.somethingWentWrong())) + Redirect(routes.ErrorController.somethingWentWrong()) } case Invalid(e) => auditService.sendCalculationFailed(request.userAnswers) PagerDutyHelper.alert(CALCULATION_FAILED) UserAnswers.logErrors(e)(logger) - Future.successful(Redirect(routes.ErrorController.somethingWentWrong())) + Redirect(routes.ErrorController.somethingWentWrong()) } } diff --git a/app/viewmodels/ConfirmationViewBreakdown.scala b/app/viewmodels/ConfirmationViewBreakdown.scala index 176d24967..1979019e3 100644 --- a/app/viewmodels/ConfirmationViewBreakdown.scala +++ b/app/viewmodels/ConfirmationViewBreakdown.scala @@ -230,24 +230,24 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo ) } else None - def detailedBreakdownMessageKeysSept()(implicit messages: Messages, - dataRequest: DataRequest[_], - appConfig: FrontendAppConfig): Seq[String] = { + def detailedBreakdownMessageKeysSeventyPercent()(implicit messages: Messages, + dataRequest: DataRequest[_], + appConfig: FrontendAppConfig): Seq[String] = { val helper = new BeenOnStatutoryLeaveHelper() furlough.periodBreakdowns.headOption .map { _.paymentWithPeriod match { case _: RegularPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.september.p1.regular") + messages("phaseTwoDetailedBreakdown.seventyPercent.p1.regular") ) case _: AveragePaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.september.p1.average") + messages("phaseTwoDetailedBreakdown.seventyPercent.p1.average") ) case _: CylbPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.september.no.nic.pension.p1.cylb.1"), + messages("phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1"), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2"), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3", helper.boundaryEnd()) ) @@ -265,15 +265,15 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo _.paymentWithPeriod match { case _: RegularPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.october.p1.regular") + messages("phaseTwoDetailedBreakdown.sixtyPercent.p1.regular") ) case _: AveragePaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.october.p1.average") + messages("phaseTwoDetailedBreakdown.sixtyPercent.p1.average") ) case _: CylbPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.october.no.nic.pension.p1.cylb.1"), + messages("phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1"), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2"), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3", helper.boundaryEnd()) ) diff --git a/app/views/SeptemberConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html similarity index 83% rename from app/views/SeptemberConfirmationView.scala.html rename to app/views/SeventyPercentConfirmationView.scala.html index 189c0ec83..88f19e7d9 100644 --- a/app/views/SeptemberConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -39,17 +39,17 @@ @(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) -@govukLayout(pageTitle = Some(titleNoForm("confirmation.september.title")), showBackButton = false, thisPage = ConfirmationPage) { +@govukLayout(pageTitle = Some(titleNoForm("confirmation.seventyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { @confirmation { -@h1(Html(messages("confirmation.september.heading")), classes = Some("")) +@h1(Html(messages("confirmation.seventyPercent.heading")), classes = Some(""))

- @messages("confirmation.september.p1") + @messages("confirmation.seventyPercent.p1")
- @messages("confirmation.september.p2") + @messages("confirmation.seventyPercent.p2", messages(s"month.${claimPeriod.start.getMonthValue}"))

£@cvb.furlough.seventy.formatted("%.2f")

@@ -58,11 +58,11 @@
@p{ - @messages("confirmation.september.inset.p1.1") + @messages("confirmation.seventyPercent.inset.p1.1") £@cvb.furlough.seventyDiff.formatted("%.2f") - @messages("confirmation.september.inset.p1.2", cvb.furlough.seventy.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) + @messages("confirmation.seventyPercent.inset.p1.2", cvb.furlough.seventy.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) } - @p(Html(messages("confirmation.september.inset.p2"))) + @p(Html(messages("confirmation.seventyPercent.inset.p2")))
@p { @@ -93,7 +93,7 @@ -@for(text <- cvb.detailedBreakdownMessageKeysSept) { +@for(text <- cvb.detailedBreakdownMessageKeysSeventyPercent) { @p(Html(text)) } @@ -106,13 +106,13 @@ @for(detailedBreakdown <- cvb.detailedBreakdowns) { @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) }

- @messages("confirmation.september.eligibility") + @messages("confirmation.seventyPercent.eligibility") £@cvb.furlough.seventyDiff.formatted("%.2f.")

@messages("confirmation.disclaimer")

diff --git a/app/views/OctoberConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html similarity index 85% rename from app/views/OctoberConfirmationView.scala.html rename to app/views/SixtyPercentConfirmationView.scala.html index 18d74419a..f73cb7f40 100644 --- a/app/views/OctoberConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -39,17 +39,17 @@ @(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) -@govukLayout(pageTitle = Some(titleNoForm("confirmation.october.title")), showBackButton = false, thisPage = ConfirmationPage) { +@govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { @confirmation { -@h1(Html(messages("confirmation.october.heading")), classes = Some("")) +@h1(Html(messages("confirmation.sixtyPercent.heading")), classes = Some(""))

- @messages("confirmation.october.p1") + @messages("confirmation.sixtyPercent.p1")
- @messages("confirmation.october.p2") + @messages("confirmation.sixtyPercent.p2", messages(s"month.${claimPeriod.start.getMonthValue}"))

£@cvb.furlough.sixty.formatted("%.2f")

@@ -58,11 +58,11 @@
@p{ - @messages("confirmation.october.inset.p1.1") + @messages("confirmation.sixtyPercent.inset.p1.1") £@cvb.furlough.sixtyDiff.formatted("%.2f") - @messages("confirmation.october.inset.p1.2", cvb.furlough.sixty.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) + @messages("confirmation.sixtyPercent.inset.p1.2", cvb.furlough.sixty.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) } - @p(Html(messages("confirmation.october.inset.p2"))) + @p(Html(messages("confirmation.sixtyPercent.inset.p2")))
@p { @@ -106,13 +106,13 @@ @for(detailedBreakdown <- cvb.detailedBreakdowns) { @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) }

- @messages("confirmation.october.eligibility") + @messages("confirmation.sixtyPercent.eligibility") £@cvb.furlough.sixtyDiff.formatted("%.2f.")

@messages("confirmation.disclaimer")

diff --git a/app/views/helper/FurloughCapHelper.scala b/app/views/helper/FurloughCapHelper.scala index 8c908a93b..894c5c716 100644 --- a/app/views/helper/FurloughCapHelper.scala +++ b/app/views/helper/FurloughCapHelper.scala @@ -43,10 +43,10 @@ class FurloughCapHelper @Inject()() { messages( "furloughBreakdown.furloughCap.periodSpansMonthCap", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), monthOneDaily.formatted("%.2f"), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), monthTwoDaily.formatted("%.2f"), value.formatted("%.2f") ) @@ -63,10 +63,10 @@ class FurloughCapHelper @Inject()() { messages( "phaseTwoFurloughBreakdown.furloughCap.periodSpansMonthCap.partTime", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), monthOneDaily.formatted("%.2f"), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), monthTwoDaily.formatted("%.2f"), usual.formatted("%.2f"), furloughed.formatted("%.2f"), @@ -92,10 +92,10 @@ class FurloughCapHelper @Inject()() { ) } - def calculationForSept(cap: FurloughCap)(implicit messages: Messages): String = + def calculationForSeventyPercent(cap: FurloughCap, month: Month)(implicit messages: Messages): String = cap match { case FullPeriodCap(value) => - messages("furloughBreakdown.september.furloughCap.fullPeriodCap", seventy(value)) + messages("furloughBreakdown.seventyPercent.furloughCap.fullPeriodCap", seventy(value), messages(s"month.${month.getValue}")) case FullPeriodCapWithPartTime(value, unadjusted, usual, furloughed) => messages( "phaseTwoFurloughBreakdown.furloughCap.fullPeriodCap.partTime", @@ -108,10 +108,10 @@ class FurloughCapHelper @Inject()() { messages( "furloughBreakdown.furloughCap.periodSpansMonthCap", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), seventy(monthOneDaily), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), seventy(monthTwoDaily), seventy(value) ) @@ -128,10 +128,10 @@ class FurloughCapHelper @Inject()() { messages( "phaseTwoFurloughBreakdown.furloughCap.periodSpansMonthCap.partTime", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), seventy(monthOneDaily), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), seventy(monthTwoDaily), usual.formatted("%.2f"), furloughed.formatted("%.2f"), @@ -157,10 +157,10 @@ class FurloughCapHelper @Inject()() { ) } - def calculationForOct(cap: FurloughCap)(implicit messages: Messages): String = + def calculationForSixtyPercent(cap: FurloughCap, month: Month)(implicit messages: Messages): String = cap match { case FullPeriodCap(value) => - messages("furloughBreakdown.october.furloughCap.fullPeriodCap", sixty(value)) + messages("furloughBreakdown.sixtyPercent.furloughCap.fullPeriodCap", sixty(value), messages(s"month.${month.getValue}")) case FullPeriodCapWithPartTime(value, unadjusted, usual, furloughed) => messages( "phaseTwoFurloughBreakdown.furloughCap.fullPeriodCap.partTime", @@ -173,10 +173,10 @@ class FurloughCapHelper @Inject()() { messages( "furloughBreakdown.furloughCap.periodSpansMonthCap", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), sixty(monthOneDaily), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), sixty(monthTwoDaily), sixty(value) ) @@ -193,10 +193,10 @@ class FurloughCapHelper @Inject()() { messages( "phaseTwoFurloughBreakdown.furloughCap.periodSpansMonthCap.partTime", monthOneFurloughDays, - Month.of(monthOne).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthOne"), sixty(monthOneDaily), monthTwoFurloughDays, - Month.of(monthTwo).getDisplayName(TextStyle.FULL, Locale.ENGLISH), + messages(s"month.$monthTwo"), sixty(monthTwoDaily), usual.formatted("%.2f"), furloughed.formatted("%.2f"), diff --git a/app/views/helper/phaseTwoDetailedFurloughBreakdownSeptember.scala.html b/app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html similarity index 81% rename from app/views/helper/phaseTwoDetailedFurloughBreakdownSeptember.scala.html rename to app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html index 70267d8ea..2180406e5 100644 --- a/app/views/helper/phaseTwoDetailedFurloughBreakdownSeptember.scala.html +++ b/app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html @@ -15,6 +15,7 @@ *@ @import views.helper.FurloughCapHelper +@import java.time.Month @this( h4: components.h4, @@ -24,7 +25,7 @@ appConfig: config.FrontendAppConfig ) -@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, isNewStarterType5:Boolean = false)(implicit messages: Messages) +@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, month: Month, isNewStarterType5:Boolean = false)(implicit messages: Messages) @referencePayBreakdown(breakdown.paymentWithPeriod, period, isNewStarterType5) @@ -36,13 +37,13 @@ } else {
  • @messages("phaseTwoFurloughBreakdown.l1", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
  • } -
  • @messages("phaseTwoFurloughBreakdown.september.l2")
  • +
  • @messages("phaseTwoFurloughBreakdown.seventyPercent.l2", messages(s"month.${month.getValue}"))
  • @if(breakdown.isCapped) { @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedSeventy))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForSept(breakdown.furloughCap)))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForSept(breakdown.furloughCap)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForSeventyPercent(breakdown.furloughCap, month)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForSeventyPercent(breakdown.furloughCap, month)))) }
    diff --git a/app/views/helper/phaseTwoDetailedFurloughBreakdownOctober.scala.html b/app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html similarity index 81% rename from app/views/helper/phaseTwoDetailedFurloughBreakdownOctober.scala.html rename to app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html index 94ed23699..3f167d13d 100644 --- a/app/views/helper/phaseTwoDetailedFurloughBreakdownOctober.scala.html +++ b/app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html @@ -15,6 +15,7 @@ *@ @import views.helper.FurloughCapHelper +@import java.time.Month @this( h4: components.h4, @@ -24,7 +25,7 @@ appConfig: config.FrontendAppConfig ) -@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, isNewStarterType5:Boolean = false)(implicit messages: Messages) +@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, month: Month, isNewStarterType5:Boolean = false)(implicit messages: Messages) @referencePayBreakdown(breakdown.paymentWithPeriod, period, isNewStarterType5) @@ -36,13 +37,13 @@ } else {
  • @messages("phaseTwoFurloughBreakdown.l1", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
  • } -
  • @messages("phaseTwoFurloughBreakdown.october.l2")
  • +
  • @messages("phaseTwoFurloughBreakdown.sixtyPercent.l2", messages(s"month.${month.getValue}"))
  • @if(breakdown.isCapped) { @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedSixty))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForOct(breakdown.furloughCap)))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForOct(breakdown.furloughCap)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForSixtyPercent(breakdown.furloughCap, month)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForSixtyPercent(breakdown.furloughCap, month)))) }
    diff --git a/conf/application.conf b/conf/application.conf index c1dfc0897..03ce3deff 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -139,7 +139,7 @@ host = "http://localhost:9264" scheme { startDate = "2020-03-01" - endDate = "2021-06-30" + endDate = "2021-09-30" phaseTwoStartDate = "2020-07-01" extensionStartDate = "2020-11-01" may2021extensionStartDate = "2021-05-01" diff --git a/conf/messages.cy b/conf/messages.cy index 8864229e7..4fa7d406d 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -336,23 +336,23 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Cynllun Cadw Swyddi yn sgil Coron confirmation.no.nic.pension.breakdown.summary = Dadansoddiad o gyfrifiadau confirmation.no.nic.pension.disclaimer = Mae canlyniadau’r cyfrifiad yn dibynnu ar gywirdeb yr wybodaeth a nodwyd gennych, yr ydych yn gyfrifol amdani. Ni allwch hawlio am fwy o arian nag yr ydych yn mynd i’w dalu allan o dan y cynllun. -confirmation.september.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.september.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.september.p1 = Grant ffyrlo -confirmation.september.p2 = (Cyfradd mis Medi: 70% o gyflogau) -confirmation.september.inset.p1.1 = Mae’n rhaid i chi dalu -confirmation.september.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). -confirmation.september.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. -confirmation.september.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw - -confirmation.october.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.october.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.october.p1 = Grant ffyrlo -confirmation.october.p2 = (Cyfradd mis Hydref: 60% o gyflogau) -confirmation.october.inset.p1.1 = Mae’n rhaid i chi dalu -confirmation.october.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). -confirmation.october.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. -confirmation.october.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw +confirmation.seventyPercent.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.seventyPercent.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.seventyPercent.p1 = Grant ffyrlo +confirmation.seventyPercent.p2 = (Cyfradd mis {0}: 70% o gyflogau) +confirmation.seventyPercent.inset.p1.1 = Mae’n rhaid i chi dalu +confirmation.seventyPercent.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). +confirmation.seventyPercent.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. +confirmation.seventyPercent.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw + +confirmation.sixtyPercent.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.sixtyPercent.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.sixtyPercent.p1 = Grant ffyrlo +confirmation.sixtyPercent.p2 = (Cyfradd mis {0}: 60% o gyflogau) +confirmation.sixtyPercent.inset.p1.1 = Mae’n rhaid i chi dalu +confirmation.sixtyPercent.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). +confirmation.sixtyPercent.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. +confirmation.sixtyPercent.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw confirmation.extension.p2 = (Cyfradd yr Estyniad i’r Cynllun Cadw Swyddi yn sgil Coronafeirws: 80% o gyflogau) @@ -632,8 +632,8 @@ furloughBreakdown.total = Cyfanswm y grant ffyrlo ar gyfer y cyfnod cyflog = £{ furloughBreakdown.furloughCap.p1 = Grant ffyrlo wedi’i gyfrifo = £{0} furloughBreakdown.furloughCap.p2 = Mae’r grant ffyrlo amcangyfrifedig yn fwy na’r grant ffyrlo uchaf ar gyfer y cyfnod cyflog hwn. Oherwydd hyn, mae’n rhaid i chi ddefnyddio’r grant ffyrlo uchaf, sef £{0}. furloughBreakdown.furloughCap.fullPeriodCap = £{0} -furloughBreakdown.september.furloughCap.fullPeriodCap = £{0} (uchafswm mis Medi) -furloughBreakdown.october.furloughCap.fullPeriodCap = £{0} (uchafswm mis Hydref) +furloughBreakdown.seventyPercent.furloughCap.fullPeriodCap = £{0} (uchafswm mis {1}) +furloughBreakdown.sixtyPercent.furloughCap.fullPeriodCap = £{0} (uchafswm mis {1}) furloughBreakdown.furloughCap.periodSpansMonthCap = {0} o ddiwrnodau ffyrlo ym mis {1} ar £{2} + {3} o ddiwrnodau ffyrlo ym mis {4} ar £{5} = £{6}. furloughBreakdown.furloughCap.partialPeriodCap ={0} o ddiwrnodau ffyrlo ym mis {1} ar £{2} = £{3} furloughBreakdown.furloughCap.p3 = Grant ffyrlo gwirioneddol = £{0} @@ -734,11 +734,11 @@ partTimeNormalHours.p2 = Dewch o hyd i ragor o wybodaeth am sut i {0} partTimeNormalHours.link = gyfrifo oriau arferol ac oriau ffyrlo eich cyflogai (yn agor ffenestr neu dab newydd). phaseTwoDetailedBreakdown.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 80% o hyn. -phaseTwoDetailedBreakdown.september.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.october.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. +phaseTwoDetailedBreakdown.seventyPercent.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. +phaseTwoDetailedBreakdown.sixtyPercent.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.september.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.october.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. +phaseTwoDetailedBreakdown.seventyPercent.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. +phaseTwoDetailedBreakdown.sixtyPercent.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 # ---------------------------------------------------------- @@ -751,8 +751,8 @@ phaseTwoDetailedBreakdown.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn c phaseTwoDetailedBreakdown.p1.cylb.2 = Dull 1: rydym wedi defnyddio’r dull ‘edrych yn ôl ar y calendr’ i ystyried y symiau a dalwyd i’r cyflogai yn ystod cyfnodau cyflog cyfatebol. Yna, gwnaethom ddefnyddio hyn wrth ystyried nifer y diwrnodau ffyrlo ym mhob cyfnod cyflog. phaseTwoDetailedBreakdown.p1.cylb.3 = Dull 2: rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn ystod y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm ei gyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 80% o hyn. -phaseTwoDetailedBreakdown.september.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.october.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 60% o hyn. +phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 70% o hyn. +phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 60% o hyn. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2 = Dull 1: rydym wedi ystyried y symiau a dalwyd iddo ar gyfer cyfnodau cyflog cyfatebol yn y flwyddyn dreth flaenorol, ac wedi defnyddio’r rhain wrth ystyried nifer y diwrnodau ffyrlo a’r oriau ffyrlo ym mhob cyfnod cyflog. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3 = Dull 2: we’ve worked out their average daily earnings in the last tax year, by dividing their total pay by the number of calendar days between 6 April 2019 and {0}. Then we’ve multiplied that by the number of furlough days in each pay period. phaseTwoDetailedBreakdown.p2 = Mae yna uchafswm y gallwch ei hawlio am grant ffyrlo a chyfraniadau Yswiriant Gwladol y cyflogwr. Os yw hyn yn effeithio ar eich hawliad, rydym wedi addasu’r cyfrifiadau. @@ -823,8 +823,8 @@ phaseTwoFurloughBreakdown.h4 = Grant ffyrlo phaseTwoFurloughBreakdown.l1 = Cymerwch £{0} (cyflog yn seiliedig ar ddiwrnodau ffyrlo). phaseTwoFurloughBreakdown.l1.partTime = Cymerwch £{0} (cyflog yn seiliedig ar yr oriau a weithiwyd yn ystod y cyfnod cyflog hwn). phaseTwoFurloughBreakdown.l2 = Lluoswch â 80%. -phaseTwoFurloughBreakdown.september.l2 = Lluoswch â 70% (cyfradd mis Medi). -phaseTwoFurloughBreakdown.october.l2 = Lluoswch â 60% (cyfradd mis Hydref). +phaseTwoFurloughBreakdown.seventyPercent.l2 = Lluoswch â 70% (cyfradd mis {0}). +phaseTwoFurloughBreakdown.sixtyPercent.l2 = Lluoswch â 60% (cyfradd mis {0}). phaseTwoFurloughBreakdown.total = Cyfanswm y grant ffyrlo ar gyfer y cyfnod cyflog = £{0} phaseTwoFurloughBreakdown.furloughCap.p1 = Grant ffyrlo wedi’i gyfrifo = £{0} phaseTwoFurloughBreakdown.furloughCap.p2 = Mae’r grant ffyrlo amcangyfrifedig yn fwy na’r grant ffyrlo uchaf ar gyfer y cyfnod cyflog hwn. Oherwydd hyn, mae’n rhaid i chi ddefnyddio’r grant ffyrlo uchaf, sef £{0}. diff --git a/conf/messages.en b/conf/messages.en index ac0328de7..b15d23659 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -329,23 +329,24 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Coronavirus Job Retention Scheme confirmation.no.nic.pension.breakdown.summary = Breakdown of calculations confirmation.no.nic.pension.disclaimer = The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. You cannot claim for more money than you are going to pay out under the scheme. -confirmation.september.title = What you can claim for this employee -confirmation.september.heading = What you can claim for this employee -confirmation.september.p1 = Furlough grant -confirmation.september.p2 = (September rate: 70% of wages) -confirmation.september.inset.p1.1 = You must pay this employee -confirmation.september.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). -confirmation.september.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. -confirmation.september.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is - -confirmation.october.title = What you can claim for this employee -confirmation.october.heading = What you can claim for this employee -confirmation.october.p1 = Furlough grant -confirmation.october.p2 = (October rate: 60% of wages) -confirmation.october.inset.p1.1 = You must pay this employee -confirmation.october.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). -confirmation.october.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. -confirmation.october.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is +confirmation.seventyPercent.title = What you can claim for this employee +confirmation.seventyPercent.heading = What you can claim for this employee +confirmation.seventyPercent.p1 = Furlough grant +confirmation.seventyPercent.p2 = ({0} rate: 70% of wages) +confirmation.seventyPercent.inset.p1.1 = You must pay this employee +confirmation.seventyPercent.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). +confirmation.seventyPercent.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. +confirmation.seventyPercent.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is + +confirmation.sixtyPercent.title = What you can claim for this employee +confirmation.sixtyPercent.heading = What you can claim for this employee +confirmation.sixtyPercent.p1 = Furlough grant +confirmation.sixtyPercent.p2 = ({0} rate: 60% of wages) +confirmation.sixtyPercent.inset.p1.1 = You must pay this employee +confirmation.sixtyPercent.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). +confirmation.sixtyPercent.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. +confirmation.sixtyPercent.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is + confirmation.breakdown.heading = Breakdown of calculations confirmation.breakdown.p2 = You told us your employee gets paid a {0} @@ -624,8 +625,8 @@ furloughBreakdown.total = Total furlough grant for pay period = £{0} furloughBreakdown.furloughCap.p1 = Calculated furlough grant = £{0} furloughBreakdown.furloughCap.p2 = The calculated furlough grant is more than the maximum furlough grant for this pay period. Because of this, you must use the maximum furlough grant, which is {0} furloughBreakdown.furloughCap.fullPeriodCap = £{0} -furloughBreakdown.september.furloughCap.fullPeriodCap = £{0} (September cap). -furloughBreakdown.october.furloughCap.fullPeriodCap = £{0} (October cap). +furloughBreakdown.seventyPercent.furloughCap.fullPeriodCap = £{0} ({1} cap). +furloughBreakdown.sixtyPercent.furloughCap.fullPeriodCap = £{0} ({1}} cap). furloughBreakdown.furloughCap.periodSpansMonthCap = {0} furlough days in {1} at £{2} + {3} furlough days in {4} at £{5} = £{6}. furloughBreakdown.furloughCap.partialPeriodCap ={0} furlough days in {1} at £{2} = £{3} furloughBreakdown.furloughCap.p3 = Actual furlough grant = {0} @@ -729,8 +730,8 @@ partTimeNormalHours.link = work out your employee’s usual hours and furloughed # Regular Pay, Employee Type 1 & 2 - Pre-Covid & Normal Pay Period before 30th October 2020 - Messages # ---------------------------------------------------------- phaseTwoDetailedBreakdown.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.september.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.october.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. +phaseTwoDetailedBreakdown.seventyPercent.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. +phaseTwoDetailedBreakdown.sixtyPercent.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. # Variable Pay, Employee Type 3 - Worked a Full Year Pre Covid - Messages for Pre-Sept, Sept, & Oct. JrsExtension uses default 80% version of messages # ---------------------------------------------------------- @@ -739,8 +740,8 @@ phaseTwoDetailedBreakdown.p1.cylb.2 = Method 1: we’ve taken the amounts they w phaseTwoDetailedBreakdown.p1.cylb.3 = Method 2: we’ve worked out their average daily earnings in the last tax year, by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020 if later). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.september.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.october.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 60% of this. +phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 70% of this. +phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 60% of this. phaseTwoDetailedBreakdown.statLeave.method2 = You told us this employee was on statutory leave between {0} and {1}. Because of this, for Method 2 we have to remove the number of days they were on statutory leave, and the amount they were paid for these periods from the calculation. phaseTwoDetailedBreakdown.statLeave = You told us this employee was on statutory leave between {0} and {1}. Because of this, we have to remove the number of days they were on statutory leave, and the amount they were paid for these periods from the calculation. @@ -753,8 +754,8 @@ phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3 = Method 2: we’ve worked ou # ---------------------------------------------------------- phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.september.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.october.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. +phaseTwoDetailedBreakdown.seventyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. +phaseTwoDetailedBreakdown.sixtyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 @@ -837,8 +838,8 @@ phaseTwoFurloughBreakdown.h4 = Furlough grant phaseTwoFurloughBreakdown.l1 = Take £{0} (pay based on furlough days). phaseTwoFurloughBreakdown.l1.partTime = Take £{0} (pay based on hours worked in this pay period). phaseTwoFurloughBreakdown.l2 = Multiply by 80% -phaseTwoFurloughBreakdown.september.l2 = Multiply by 70% (September rate). -phaseTwoFurloughBreakdown.october.l2 = Multiply by 60% (October rate). +phaseTwoFurloughBreakdown.seventyPercent.l2 = Multiply by 70% ({0} rate). +phaseTwoFurloughBreakdown.sixtyPercent.l2 = Multiply by 60% ({0} rate). phaseTwoFurloughBreakdown.total = Total furlough grant for pay period = £{0} phaseTwoFurloughBreakdown.furloughCap.p1 = Calculated furlough grant = £{0} phaseTwoFurloughBreakdown.furloughCap.p2 = The calculated furlough grant is more than the maximum furlough grant for this pay period. Because of this, you must use the maximum furlough grant, which is {0} diff --git a/test/views/helper/FurloughCapHelperSpec.scala b/test/views/helper/FurloughCapHelperSpec.scala index 14a24a70e..ca70ac75b 100644 --- a/test/views/helper/FurloughCapHelperSpec.scala +++ b/test/views/helper/FurloughCapHelperSpec.scala @@ -29,6 +29,18 @@ class FurloughCapHelperSpec extends SpecBase { Helpers.stubMessagesApi( Map( "en" -> Map( + "month.1" -> "January", + "month.2" -> "February", + "month.3" -> "March", + "month.4" -> "April", + "month.5" -> "May", + "month.6" -> "June", + "month.7" -> "July", + "month.8" -> "August", + "month.9" -> "September", + "month.10" -> "October", + "month.11" -> "November", + "month.12" -> "December", "furloughBreakdown.furloughCap.fullPeriodCap" -> "{0}", "phaseTwoFurloughBreakdown.furloughCap.fullPeriodCap.partTime" -> "{0}|{1}|{2}|{3}", "furloughBreakdown.furloughCap.periodSpansMonthCap" -> "{0}|{1}|{2}|{3}|{4}|{5}|{6}", From f05530ef38509cd8d728217c082b3ced05932359 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Tue, 13 Apr 2021 11:13:36 +0100 Subject: [PATCH 02/14] [CVSRP-4673] Minor refactor to naming --- app/controllers/ConfirmationController.scala | 8 ++++---- app/views/SeventyPercentConfirmationView.scala.html | 2 +- app/views/SixtyPercentConfirmationView.scala.html | 2 +- test/controllers/ConfirmationControllerSpec.scala | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/ConfirmationController.scala b/app/controllers/ConfirmationController.scala index ec28338f1..dd56f17da 100644 --- a/app/controllers/ConfirmationController.scala +++ b/app/controllers/ConfirmationController.scala @@ -45,8 +45,8 @@ class ConfirmationController @Inject()( viewWithDetailedBreakdowns: ConfirmationViewWithDetailedBreakdowns, phaseTwoView: PhaseTwoConfirmationView, noNicAndPensionView: NoNicAndPensionConfirmationView, - septemberConfirmationView: SeptemberConfirmationView, - octoberConfirmationView: OctoberConfirmationView, + seventyPercentConfirmationView: SeventyPercentConfirmationView, + sixtyPercentConfirmationView: SixtyPercentConfirmationView, extensionView: JrsExtensionConfirmationView, auditService: AuditService, val navigator: Navigator)(implicit val errorHandler: ErrorHandler, ec: ExecutionContext, appConfig: FrontendAppConfig) @@ -71,10 +71,10 @@ class ConfirmationController @Inject()( case yearMonth if yearMonth == AUGUST.inYear(y2020) => Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) || yearMonth == JULY.inYear(y2021) => - Ok(septemberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) + Ok(seventyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case yearMonth if yearMonth == OCTOBER.inYear(y2020) || yearMonth == AUGUST.inYear(y2021) || yearMonth == SEPTEMBER.inYear(y2021) => - Ok(octoberConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) + Ok(sixtyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case yearMonth if yearMonth.isBetweenInclusive(appConfig.extensionStartDate.getYearMonth, appConfig.schemeEndDate.getYearMonth) => Ok( extensionView( diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index 88f19e7d9..acb6a6dbd 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -28,7 +28,7 @@ h3: components.h3, p: components.p, confirmation: components.confirmation, -furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeptember, +furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, button: components.button, diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index f73cb7f40..b738d657e 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -28,7 +28,7 @@ h3: components.h3, p: components.p, confirmation: components.confirmation, -furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownOctober, +furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, button: components.button, diff --git a/test/controllers/ConfirmationControllerSpec.scala b/test/controllers/ConfirmationControllerSpec.scala index b3f06e787..17aac7681 100644 --- a/test/controllers/ConfirmationControllerSpec.scala +++ b/test/controllers/ConfirmationControllerSpec.scala @@ -46,8 +46,8 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa val view = app.injector.instanceOf[ConfirmationViewWithDetailedBreakdowns] val noNicView = app.injector.instanceOf[NoNicAndPensionConfirmationView] val phaseTwoView = app.injector.instanceOf[PhaseTwoConfirmationView] - val septView = app.injector.instanceOf[SeptemberConfirmationView] - val octView = app.injector.instanceOf[OctoberConfirmationView] + val septView = app.injector.instanceOf[SeventyPercentConfirmationView] + val octView = app.injector.instanceOf[SixtyPercentConfirmationView] val extensionView = app.injector.instanceOf[JrsExtensionConfirmationView] val audit = app.injector.instanceOf[AuditService] val service = app.injector.instanceOf[EmployeeTypeService] @@ -62,8 +62,8 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa viewWithDetailedBreakdowns = view, phaseTwoView = phaseTwoView, noNicAndPensionView = noNicView, - septemberConfirmationView = septView, - octoberConfirmationView = octView, + seventyPercentConfirmationView = septView, + sixtyPercentConfirmationView = octView, extensionView = extensionView, auditService = audit, navigator = navigator From cfa5bdb69d073f56c86f4ac0190482749e1b4535 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Tue, 13 Apr 2021 15:57:00 +0100 Subject: [PATCH 03/14] [CVSRP-4673] Added tests to the controller for the sixty and seventy percent view rendering --- .../ConfirmationControllerSpec.scala | 204 ++++++++++++++++-- 1 file changed, 192 insertions(+), 12 deletions(-) diff --git a/test/controllers/ConfirmationControllerSpec.scala b/test/controllers/ConfirmationControllerSpec.scala index 17aac7681..9bfee3a44 100644 --- a/test/controllers/ConfirmationControllerSpec.scala +++ b/test/controllers/ConfirmationControllerSpec.scala @@ -43,14 +43,14 @@ import scala.concurrent.Future class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDataBuilder { - val view = app.injector.instanceOf[ConfirmationViewWithDetailedBreakdowns] - val noNicView = app.injector.instanceOf[NoNicAndPensionConfirmationView] - val phaseTwoView = app.injector.instanceOf[PhaseTwoConfirmationView] - val septView = app.injector.instanceOf[SeventyPercentConfirmationView] - val octView = app.injector.instanceOf[SixtyPercentConfirmationView] - val extensionView = app.injector.instanceOf[JrsExtensionConfirmationView] - val audit = app.injector.instanceOf[AuditService] - val service = app.injector.instanceOf[EmployeeTypeService] + val view = app.injector.instanceOf[ConfirmationViewWithDetailedBreakdowns] + val noNicView = app.injector.instanceOf[NoNicAndPensionConfirmationView] + val phaseTwoView = app.injector.instanceOf[PhaseTwoConfirmationView] + val seventyPercentView = app.injector.instanceOf[SeventyPercentConfirmationView] + val sixtyPercentView = app.injector.instanceOf[SixtyPercentConfirmationView] + val extensionView = app.injector.instanceOf[JrsExtensionConfirmationView] + val audit = app.injector.instanceOf[AuditService] + val service = app.injector.instanceOf[EmployeeTypeService] val controller = new ConfirmationController( messagesApi = messagesApi, @@ -62,8 +62,8 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa viewWithDetailedBreakdowns = view, phaseTwoView = phaseTwoView, noNicAndPensionView = noNicView, - seventyPercentConfirmationView = septView, - sixtyPercentConfirmationView = octView, + seventyPercentConfirmationView = seventyPercentView, + sixtyPercentConfirmationView = sixtyPercentView, extensionView = extensionView, auditService = audit, navigator = navigator @@ -90,7 +90,7 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa "Confirmation Controller" must { - "return OK and the confirmation view with detailed breakdowns for a GET" in new CalculatorVersionConfiguration { + "return OK and the confirmation view with detailed breakdowns for a GET (March 2020 journey)" in new CalculatorVersionConfiguration { when(mockSessionRepository.get(any())) thenReturn Future.successful(Some(dummyUserAnswers)) @@ -138,7 +138,7 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa appConf).toString } - "return OK and the JRSExtension view with calculations, for a GET for dates 1st to 31st March 2021" in new CalculatorVersionConfiguration { + "return OK and the JRSExtension view with calculations, for a GET for dates 1st to 31st March 2021 (80% Grant)" in new CalculatorVersionConfiguration { def userAnswers(): UserAnswers = emptyUserAnswers @@ -209,5 +209,185 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa actual must include(VariableExtensionType5.heading) } + + "return OK and the JRSMayExtension view with calculations, for a GET for dates 1st to 31st July 2021 (70% Grant)" in new CalculatorVersionConfiguration { + + val claimStartDate = "2021, 7, 1" + val claimEndDate = "2021, 7, 31" + val employeeIncomeForPeriod: Amount = Amount(10000.00) + + def userAnswers(): UserAnswers = + mandatoryAnswersOnRegularMonthly + .withClaimPeriodStart(claimStartDate) + .withClaimPeriodEnd(claimEndDate) + .withFurloughStartDate("2020-03-01") + .withLastPayDate("2021-07-31") + .withRegularPayAmount(employeeIncomeForPeriod.value) + .withPayDate(List("2021-06-30", "2021-07-31")) + + when(mockSessionRepository.get(any())) thenReturn Future.successful(Some(userAnswers())) + + val maxMonthFurloughGrant: BigDecimal = 2500 + + val payment: RegularPaymentWithPhaseTwoPeriod = { + RegularPaymentWithPhaseTwoPeriod( + regularPay = employeeIncomeForPeriod, + referencePay = employeeIncomeForPeriod, + phaseTwoPeriod = PhaseTwoPeriod( + periodWithPaymentDate = fullPeriodWithPaymentDate(start = claimStartDate, end = claimEndDate, paymentDate = claimEndDate), + actualHours = None, + usualHours = None + ) + ) + } + + val breakdown: ConfirmationViewBreakdownWithoutNicAndPension = { + ConfirmationViewBreakdownWithoutNicAndPension( + furlough = PhaseTwoFurloughCalculationResult( + total = maxMonthFurloughGrant, + periodBreakdowns = Seq( + PhaseTwoFurloughBreakdown(grant = Amount(maxMonthFurloughGrant), + paymentWithPeriod = payment, + furloughCap = FullPeriodCap(maxMonthFurloughGrant)) + ) + ) + ) + } + + val request: FakeRequest[AnyContentAsEmpty.type] = FakeRequest(GET, routes.ConfirmationController.onPageLoad().url) + val dataRequest = DataRequest(request, userAnswers().id, userAnswers()) + + val result: Future[Result] = controller.onPageLoad()(request) + + val actual: String = contentAsString(result) + val expected: String = seventyPercentView( + cvb = breakdown, + claimPeriod = period(start = claimStartDate, end = claimEndDate), + version = calculatorVersionConf + )(dataRequest, messages, appConf).toString + + status(result) mustEqual OK + actual mustBe expected + } + + "return OK and the JRSMayExtension view with calculations, for a GET for dates 1st to 31st August 2021 (60% Grant)" in new CalculatorVersionConfiguration { + + val claimStartDate = "2021, 8, 1" + val claimEndDate = "2021, 8, 31" + val employeeIncomeForPeriod: Amount = Amount(10000.00) + + def userAnswers(): UserAnswers = + mandatoryAnswersOnRegularMonthly + .withClaimPeriodStart(claimStartDate) + .withClaimPeriodEnd(claimEndDate) + .withFurloughStartDate("2020-03-01") + .withLastPayDate("2021-08-31") + .withRegularPayAmount(employeeIncomeForPeriod.value) + .withPayDate(List("2021-07-31", "2021-08-31")) + + when(mockSessionRepository.get(any())) thenReturn Future.successful(Some(userAnswers())) + + val maxMonthFurloughGrant: BigDecimal = 2500 + + val payment: RegularPaymentWithPhaseTwoPeriod = { + RegularPaymentWithPhaseTwoPeriod( + regularPay = employeeIncomeForPeriod, + referencePay = employeeIncomeForPeriod, + phaseTwoPeriod = PhaseTwoPeriod( + periodWithPaymentDate = fullPeriodWithPaymentDate(start = claimStartDate, end = claimEndDate, paymentDate = claimEndDate), + actualHours = None, + usualHours = None + ) + ) + } + + val breakdown: ConfirmationViewBreakdownWithoutNicAndPension = { + ConfirmationViewBreakdownWithoutNicAndPension( + furlough = PhaseTwoFurloughCalculationResult( + total = maxMonthFurloughGrant, + periodBreakdowns = Seq( + PhaseTwoFurloughBreakdown(grant = Amount(maxMonthFurloughGrant), + paymentWithPeriod = payment, + furloughCap = FullPeriodCap(maxMonthFurloughGrant)) + ) + ) + ) + } + + val request: FakeRequest[AnyContentAsEmpty.type] = FakeRequest(GET, routes.ConfirmationController.onPageLoad().url) + val dataRequest = DataRequest(request, userAnswers().id, userAnswers()) + + val result: Future[Result] = controller.onPageLoad()(request) + + val actual: String = contentAsString(result) + val expected: String = sixtyPercentView( + cvb = breakdown, + claimPeriod = period(start = claimStartDate, end = claimEndDate), + version = calculatorVersionConf + )(dataRequest, messages, appConf).toString + + status(result) mustEqual OK + actual mustBe expected + } + + "return OK and the JRSMayExtension view with calculations, for a GET for dates 1st to 31st September 2021 (60% Grant)" in new CalculatorVersionConfiguration { + + val claimStartDate = "2021, 9, 1" + val claimEndDate = "2021, 9, 30" + val employeeIncomeForPeriod: Amount = Amount(10000.00) + + def userAnswers(): UserAnswers = + mandatoryAnswersOnRegularMonthly + .withClaimPeriodStart(claimStartDate) + .withClaimPeriodEnd(claimEndDate) + .withFurloughStartDate("2020-03-01") + .withLastPayDate("2021-09-30") + .withRegularPayAmount(employeeIncomeForPeriod.value) + .withPayDate(List("2021-08-31", "2021-09-30")) + + when(mockSessionRepository.get(any())) thenReturn Future.successful(Some(userAnswers())) + + val maxMonthFurloughGrant: BigDecimal = 2500 + + val payment: RegularPaymentWithPhaseTwoPeriod = { + RegularPaymentWithPhaseTwoPeriod( + regularPay = employeeIncomeForPeriod, + referencePay = employeeIncomeForPeriod, + phaseTwoPeriod = PhaseTwoPeriod( + periodWithPaymentDate = fullPeriodWithPaymentDate(start = claimStartDate, end = claimEndDate, paymentDate = claimEndDate), + actualHours = None, + usualHours = None + ) + ) + } + + val breakdown: ConfirmationViewBreakdownWithoutNicAndPension = { + ConfirmationViewBreakdownWithoutNicAndPension( + furlough = PhaseTwoFurloughCalculationResult( + total = maxMonthFurloughGrant, + periodBreakdowns = Seq( + PhaseTwoFurloughBreakdown(grant = Amount(maxMonthFurloughGrant), + paymentWithPeriod = payment, + furloughCap = FullPeriodCap(maxMonthFurloughGrant)) + ) + ) + ) + } + + val request: FakeRequest[AnyContentAsEmpty.type] = FakeRequest(GET, routes.ConfirmationController.onPageLoad().url) + val dataRequest = DataRequest(request, userAnswers().id, userAnswers()) + + val result: Future[Result] = controller.onPageLoad()(request) + + val actual: String = contentAsString(result) + val expected: String = sixtyPercentView( + cvb = breakdown, + claimPeriod = period(start = claimStartDate, end = claimEndDate), + version = calculatorVersionConf + )(dataRequest, messages, appConf).toString + + status(result) mustEqual OK + actual mustBe expected + } } } From aa1c4f01a78b0b6ec629f9e81e9cede1b7a1f544 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 10:03:42 +0100 Subject: [PATCH 04/14] [CVSRP-4673] Update the content in the heading block for all pages and make common (excludes preAugust 2020 as that still has C2 NIC and Pension) --- .../JrsExtensionConfirmationView.scala.html | 18 +---- ...NoNicAndPensionConfirmationView.scala.html | 13 +--- .../SeventyPercentConfirmationView.scala.html | 17 +---- .../SixtyPercentConfirmationView.scala.html | 17 +---- .../helper/confirmationHeading.scala.html | 35 ++++++++++ conf/messages.cy | 3 +- conf/messages.en | 20 +++--- .../ConfirmationControllerISpec.scala | 10 +-- .../JRSExtensionConfirmationMessages.scala | 22 +++--- .../ConfirmationControllerSpec.scala | 4 +- .../JrsExtensionConfirmationViewSpec.scala | 10 +-- .../helper/ConfirmationHeadingSpec.scala | 68 +++++++++++++++++++ 12 files changed, 147 insertions(+), 90 deletions(-) create mode 100644 app/views/helper/confirmationHeading.scala.html create mode 100644 test/views/helper/ConfirmationHeadingSpec.scala diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index b6bcbd745..862bc5dfb 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -20,6 +20,7 @@ @import pages.info.ConfirmationPage @import models.requests.DataRequest @import config.FrontendAppConfig +@import views.ViewUtils._ @this( govukLayout: templates.GovukLayoutWrapper, @@ -27,7 +28,7 @@ h2: components.h2, h3: components.h3, p: components.p, - confirmation: components.confirmation, + confirmation: helper.confirmationHeading, panelIndent: components.panelIndent, strong: components.strong, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, @@ -43,20 +44,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - @confirmation { - - @h1(Html(messages("confirmation.no.nic.pension.heading")), classes = Some("")) - -
    -

    - @messages("confirmation.no.nic.pension.p1") -
    - @messages("confirmation.extension.p2") -

    -

    £@cvb.furlough.total.formatted("%.2f")

    -
    - - } + @confirmation(claimPeriod, cvb.furlough.total) @p { @strong(Html(messages("confirmation.calculated.on"))) diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index 267cc66e0..80e29d4a4 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -29,7 +29,7 @@ p: components.p, panelIndent: components.panelIndent, strong: components.strong, - confirmation: components.confirmation, + confirmation: helper.confirmationHeading, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -43,16 +43,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - @confirmation { - - @h1(Html(messages("confirmation.no.nic.pension.heading")), classes = Some("")) - -
    -

    @messages("confirmation.no.nic.pension.p1")

    -

    £@cvb.furlough.total.formatted("%.2f")

    -
    - - } + @confirmation(claimPeriod, cvb.furlough.total) @p { @strong(Html(messages("confirmation.calculated.on"))) diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index acb6a6dbd..9e25f630e 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -27,7 +27,7 @@ h2: components.h2, h3: components.h3, p: components.p, -confirmation: components.confirmation, +confirmation: helper.confirmationHeading, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -41,20 +41,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.seventyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation { - -@h1(Html(messages("confirmation.seventyPercent.heading")), classes = Some("")) - -
    -

    - @messages("confirmation.seventyPercent.p1") -
    - @messages("confirmation.seventyPercent.p2", messages(s"month.${claimPeriod.start.getMonthValue}")) -

    -

    £@cvb.furlough.seventy.formatted("%.2f")

    -
    - -} +@confirmation(claimPeriod, cvb.furlough.seventy, 70)
    @p{ diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index b738d657e..6fc79ee47 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -27,7 +27,7 @@ h2: components.h2, h3: components.h3, p: components.p, -confirmation: components.confirmation, +confirmation: helper.confirmationHeading, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -41,20 +41,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation { - -@h1(Html(messages("confirmation.sixtyPercent.heading")), classes = Some("")) - -
    -

    - @messages("confirmation.sixtyPercent.p1") -
    - @messages("confirmation.sixtyPercent.p2", messages(s"month.${claimPeriod.start.getMonthValue}")) -

    -

    £@cvb.furlough.sixty.formatted("%.2f")

    -
    - -} +@confirmation(claimPeriod, cvb.furlough.sixty, 60)
    @p{ diff --git a/app/views/helper/confirmationHeading.scala.html b/app/views/helper/confirmationHeading.scala.html new file mode 100644 index 000000000..64ca1fa05 --- /dev/null +++ b/app/views/helper/confirmationHeading.scala.html @@ -0,0 +1,35 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@this( + confirmation: components.confirmation, + h1: components.h1 +) + +@(claimPeriod: Period, amount: BigDecimal, percentage: Int = 80)(implicit messages: Messages) + + +@confirmation { + + @h1(Html(messages("confirmation.no.nic.pension.heading")), classes = Some("")) + +
    +

    @messages("confirmation.heading.percent", percentage)

    +

    @messages("confirmation.heading.claimPeriod", dateToStringWithoutYear(claimPeriod.start), dateToString(claimPeriod.end))

    +

    £@amount.formatted("%.2f")

    +
    + +} diff --git a/conf/messages.cy b/conf/messages.cy index 4fa7d406d..ec15d10af 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -277,6 +277,7 @@ pensionContribution.error.required = Dewiswch ‘Iawn’ os ydych yn talu cyfran confirmation.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn confirmation.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.heading.eightyPercent = (Cyfradd yr Estyniad i’r Cynllun Cadw Swyddi yn sgil Coronafeirws: {0}% o gyflogau) confirmation.confirmation.p1 = Y swm a delir i’r cyflogai hwn sydd ar ffyrlo confirmation.confirmation.p2 = Cyfraniadau Yswiriant Gwladol y cyflogwr confirmation.confirmation.p3 = Isafswm cyfraniadau pensiwn y cyflogwr @@ -354,8 +355,6 @@ confirmation.sixtyPercent.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. confirmation.sixtyPercent.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. confirmation.sixtyPercent.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw -confirmation.extension.p2 = (Cyfradd yr Estyniad i’r Cynllun Cadw Swyddi yn sgil Coronafeirws: 80% o gyflogau) - claimPeriodStart.title = Beth yw dyddiad dechrau’r hawliad hwn? claimPeriodStart.heading = Beth yw dyddiad dechrau’r hawliad hwn? claimPeriodStart.p1 = O 1 Gorffennaf ymlaen, mae’n rhaid i hawliadau ddechrau a dod i ben yn ystod yr un mis calendr. diff --git a/conf/messages.en b/conf/messages.en index b15d23659..c85e5b0f0 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -267,8 +267,10 @@ pensionContribution.error.required = Select yes if you pay pension contributions # ConfirmationPage Messages # ---------------------------------------------------------- -confirmation.title = What you can claim for this employee -confirmation.heading = What you can claim for this employee +confirmation.title = Claim amount for this employee +confirmation.heading = Claim amount for this employee +confirmation.heading.percent = ({0}% of their wages) +confirmation.heading.claimPeriod = Claim period: {0} to {1} confirmation.confirmation.p1 = Amount paid to this furloughed employee confirmation.confirmation.p2 = Employer National Insurance contributions confirmation.confirmation.p3 = Employer minimum pension contributions @@ -316,8 +318,8 @@ confirmation.webchat = Webchat help (opens in a new tab). confirmation.no.nic.pension.insert.t1 = You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these -confirmation.no.nic.pension.title = What you can claim for this employee -confirmation.no.nic.pension.heading = What you can claim for this employee +confirmation.no.nic.pension.title = Claim amount for this employee +confirmation.no.nic.pension.heading = Claim amount for this employee confirmation.no.nic.pension.p1 = Furlough grant confirmation.no.nic.pension.nextSteps.li.1 = for your records confirmation.no.nic.pension.nextSteps.li.2 = Make a note of the amount you can claim for this employee and the claim period. @@ -329,8 +331,8 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Coronavirus Job Retention Scheme confirmation.no.nic.pension.breakdown.summary = Breakdown of calculations confirmation.no.nic.pension.disclaimer = The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. You cannot claim for more money than you are going to pay out under the scheme. -confirmation.seventyPercent.title = What you can claim for this employee -confirmation.seventyPercent.heading = What you can claim for this employee +confirmation.seventyPercent.title = Claim amount for this employee +confirmation.seventyPercent.heading = Claim amount for this employee confirmation.seventyPercent.p1 = Furlough grant confirmation.seventyPercent.p2 = ({0} rate: 70% of wages) confirmation.seventyPercent.inset.p1.1 = You must pay this employee @@ -338,8 +340,8 @@ confirmation.seventyPercent.inset.p1.2 = in addition to the furlough grant of £ confirmation.seventyPercent.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. confirmation.seventyPercent.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is -confirmation.sixtyPercent.title = What you can claim for this employee -confirmation.sixtyPercent.heading = What you can claim for this employee +confirmation.sixtyPercent.title = Claim amount for this employee +confirmation.sixtyPercent.heading = Claim amount for this employee confirmation.sixtyPercent.p1 = Furlough grant confirmation.sixtyPercent.p2 = ({0} rate: 60% of wages) confirmation.sixtyPercent.inset.p1.1 = You must pay this employee @@ -350,8 +352,6 @@ confirmation.sixtyPercent.eligibility = To be eligible for the grant you must pa confirmation.breakdown.heading = Breakdown of calculations confirmation.breakdown.p2 = You told us your employee gets paid a {0} -confirmation.extension.p2 = (JRS Extension rate: 80% of wages) - claimPeriodStart.title = What’s the start date of this claim? claimPeriodStart.heading = What’s the start date of this claim? claimPeriodStart.p1 = From 1 July, claims must start and end in the same calendar month. diff --git a/it/controllers/ConfirmationControllerISpec.scala b/it/controllers/ConfirmationControllerISpec.scala index 42463bd52..7e9e22777 100644 --- a/it/controllers/ConfirmationControllerISpec.scala +++ b/it/controllers/ConfirmationControllerISpec.scala @@ -135,7 +135,7 @@ class ConfirmationControllerISpec whenReady(res) { result => result should have( httpStatus(OK), - titleOf("What you can claim for this employee - Job Retention Scheme calculator - GOV.UK"), + titleOf("Claim amount for this employee - Job Retention Scheme calculator - GOV.UK"), contentExists(s"${outcome.setScale(2).toString()}", ".govuk-panel__title"), ) } @@ -154,7 +154,7 @@ class ConfirmationControllerISpec whenReady(res) { result => result should have( httpStatus(OK), - titleOf("What you can claim for this employee - Job Retention Scheme calculator - GOV.UK"), + titleOf("Claim amount for this employee - Job Retention Scheme calculator - GOV.UK"), contentExists(s"Total furlough grant for pay period = £") ) } @@ -170,7 +170,7 @@ class ConfirmationControllerISpec whenReady(res) { result => result should have( httpStatus(OK), - titleOf("What you can claim for this employee - Job Retention Scheme calculator - GOV.UK") + titleOf("Claim amount for this employee - Job Retention Scheme calculator - GOV.UK") ) } } @@ -185,7 +185,7 @@ class ConfirmationControllerISpec whenReady(res) { result => result should have( httpStatus(OK), - titleOf("What you can claim for this employee - Job Retention Scheme calculator - GOV.UK") + titleOf("Claim amount for this employee - Job Retention Scheme calculator - GOV.UK") ) } } @@ -200,7 +200,7 @@ class ConfirmationControllerISpec whenReady(res) { result => result should have( httpStatus(OK), - titleOf("What you can claim for this employee - Job Retention Scheme calculator - GOV.UK") + titleOf("Claim amount for this employee - Job Retention Scheme calculator - GOV.UK") ) } } diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 1a339d54c..ac0fd807a 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -22,9 +22,16 @@ import utils.ValueFormatter object JRSExtensionConfirmationMessages extends ValueFormatter { - object RegularType1 { + val heading = "Claim amount for this employee" - val heading = "What you can claim for this employee" + object ConfirmationBlock { + def p1(percent: Int) = s"($percent% of their wages)" + def p2(claimPeriod: Period)(implicit messages: Messages) = + s"Claim period: ${dateToStringWithoutYear(claimPeriod.start)} to ${dateToString(claimPeriod.end)}" + def claimAmount(amount: BigDecimal) = s"£${amount.formatted("%.2f")}" + } + + object RegularType1 { val dateAndCalculatorVersion = (todaysDate: String) => s"Calculated on: $todaysDate (Calculator Version v2)" @@ -67,8 +74,7 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { val h4ParagraphOne = "Take the pay in pay period:" - def calculatePayListMessages(messageNumber: Int, pay: BigDecimal, daysInPeriod: Int, numberOfDaysFurloughed: Int)( - implicit messages: Messages): String = + def calculatePayListMessages(messageNumber: Int, pay: BigDecimal, daysInPeriod: Int, numberOfDaysFurloughed: Int): String = messageNumber match { case 1 => s"Start with ${currencyFormatter(pay)} (from pay period)." case 2 => s"Divide by $daysInPeriod (number of days in the pay period)." @@ -80,8 +86,7 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { val h4FurloughGrant = "Furlough grant" - def furloughGrantListMessages(messageNumber: Int, pay: BigDecimal, generosityPercentage: BigDecimal)( - implicit messages: Messages): String = + def furloughGrantListMessages(messageNumber: Int, pay: BigDecimal, generosityPercentage: BigDecimal): String = messageNumber match { case 1 => s"Take ${currencyFormatter(pay)} (pay based on furlough days)." case 2 => s"Multiply by $generosityPercentage%" @@ -134,8 +139,6 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { object VariableExtensionType5 { - val heading = "What you can claim for this employee" - val dateAndCalculatorVersion = (todaysDate: String) => s"Calculated on: $todaysDate (Calculator Version v2)" val indent = "You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these" @@ -190,8 +193,7 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { val h4FurloughGrant = "Furlough grant" - def furloughGrantListMessages(messageNumber: Int, pay: BigDecimal, generosityPercentage: BigDecimal)( - implicit messages: Messages): String = + def furloughGrantListMessages(messageNumber: Int, pay: BigDecimal, generosityPercentage: BigDecimal): String = messageNumber match { case 1 => s"Take ${currencyFormatter(pay)} (pay based on furlough days)." case 2 => s"Multiply by $generosityPercentage%" diff --git a/test/controllers/ConfirmationControllerSpec.scala b/test/controllers/ConfirmationControllerSpec.scala index 9bfee3a44..3d90df82d 100644 --- a/test/controllers/ConfirmationControllerSpec.scala +++ b/test/controllers/ConfirmationControllerSpec.scala @@ -19,7 +19,7 @@ package controllers import assets.constants.ConfirmationConstants._ import base.{CoreTestDataBuilder, SpecBaseControllerSpecs} import config.CalculatorVersionConfiguration -import messages.JRSExtensionConfirmationMessages.VariableExtensionType5 +import messages.JRSExtensionConfirmationMessages._ import models.FurloughStatus.FurloughOngoing import models.NicCategory.Payable import models.PartTimeQuestion.PartTimeNo @@ -206,7 +206,7 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa )(dataRequest, messages, appConf).toString status(result) mustEqual OK - actual must include(VariableExtensionType5.heading) + actual must include(heading) } diff --git a/test/views/JrsExtensionConfirmationViewSpec.scala b/test/views/JrsExtensionConfirmationViewSpec.scala index 2bfde5f9a..b38de1499 100644 --- a/test/views/JrsExtensionConfirmationViewSpec.scala +++ b/test/views/JrsExtensionConfirmationViewSpec.scala @@ -19,7 +19,7 @@ package views import assets.messages.PhaseTwoReferencePayBreakdownHelperMessages import cats.scalatest.ValidatedValues import handlers.ConfirmationControllerRequestHandler -import messages.JRSExtensionConfirmationMessages.{RegularType1, VariableExtensionType5} +import messages.JRSExtensionConfirmationMessages._ import models.FurloughStatus.FurloughOngoing import models.PartTimeQuestion.PartTimeNo import models.PayMethod.Variable @@ -104,7 +104,7 @@ class JrsExtensionConfirmationViewSpec } val expectedContent = Seq( - RegularEmployeeTypeOneSelectors.h1 -> RegularType1.heading, + RegularEmployeeTypeOneSelectors.h1 -> heading, RegularEmployeeTypeOneSelectors.dateAndCalculatorVersion -> RegularType1.dateAndCalculatorVersion(dateToString(LocalDate.now())), RegularEmployeeTypeOneSelectors.indent -> RegularType1.indent, RegularEmployeeTypeOneSelectors.disclaimer -> RegularType1.disclaimerTopPage, @@ -150,7 +150,7 @@ class JrsExtensionConfirmationViewSpec "for a Regular Pay Pre-Covid Employee (Employee Type 1)" should { behave like normalPage(messageKeyPrefix) - behave like pageWithHeading(heading = VariableExtensionType5.heading) + behave like pageWithHeading(heading = heading) behave like pageWithExpectedMessages(expectedContent) "behave like a page with a StartAnotherCalculation button" must { @@ -241,7 +241,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec } val expectedContent = Seq( - VariableEmployeeTypeFiveSelectors.h1 -> VariableExtensionType5.heading, + VariableEmployeeTypeFiveSelectors.h1 -> heading, VariableEmployeeTypeFiveSelectors.dateAndCalculatorVersion -> VariableExtensionType5.dateAndCalculatorVersion( dateToString(LocalDate.now())), VariableEmployeeTypeFiveSelectors.indent -> VariableExtensionType5.indent, @@ -291,7 +291,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec "for a Variable Pay New Starter Employee (Employee Type 5)" should { behave like normalPage(messageKeyPrefix) - behave like pageWithHeading(heading = VariableExtensionType5.heading) + behave like pageWithHeading(heading = heading) behave like pageWithExpectedMessages(expectedContent) "behave like a page with a StartAnotherCalculation button" must { diff --git a/test/views/helper/ConfirmationHeadingSpec.scala b/test/views/helper/ConfirmationHeadingSpec.scala new file mode 100644 index 000000000..52d2feab7 --- /dev/null +++ b/test/views/helper/ConfirmationHeadingSpec.scala @@ -0,0 +1,68 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package views.helper + +import messages.JRSExtensionConfirmationMessages._ +import models._ +import views.BaseSelectors +import views.behaviours.ViewBehaviours +import views.html.helper.confirmationHeading + +import java.time.LocalDate + +class ConfirmationHeadingSpec extends ViewBehaviours { + + val headingHelper = app.injector.instanceOf[confirmationHeading] + + object Selectors extends BaseSelectors + + val claimPeriod = Period(LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 8)) + val claimAmount = 500 + + "headingHelper" must { + + "render the expected 80% heading when not passed a custom percentage" must { + + val html = headingHelper(claimPeriod, claimAmount) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.h1 -> heading, + Selectors.p(1) -> ConfirmationBlock.p1(80), + Selectors.p(2) -> ConfirmationBlock.p2(claimPeriod), + Selectors.p(3) -> ConfirmationBlock.claimAmount(claimAmount) + )) + } + + "render the supplied 70% heading when passed a custom percentage of 70%" must { + + val html = headingHelper(claimPeriod, claimAmount, 70) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.h1 -> heading, + Selectors.p(1) -> ConfirmationBlock.p1(70), + Selectors.p(2) -> ConfirmationBlock.p2(claimPeriod), + Selectors.p(3) -> ConfirmationBlock.claimAmount(claimAmount) + )) + } + + } + +} From 00daefce0e524082d8c89f67f5a21ade1d5462d5 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 10:43:37 +0100 Subject: [PATCH 05/14] [CVSRP-4673] Refactor to introduce a model for the FurloughGrantRate --- app/models/FurloughGrantRates.scala | 22 ++++ .../ConfirmationViewBreakdown.scala | 6 +- app/views/NewConfirmationView.scala.html | 113 ++++++++++++++++++ .../SeventyPercentConfirmationView.scala.html | 2 +- .../SixtyPercentConfirmationView.scala.html | 4 +- .../helper/confirmationHeading.scala.html | 4 +- .../helper/ConfirmationHeadingSpec.scala | 2 +- 7 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 app/models/FurloughGrantRates.scala create mode 100644 app/views/NewConfirmationView.scala.html diff --git a/app/models/FurloughGrantRates.scala b/app/models/FurloughGrantRates.scala new file mode 100644 index 000000000..ddb6e3643 --- /dev/null +++ b/app/models/FurloughGrantRates.scala @@ -0,0 +1,22 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package models + +sealed trait FurloughGrantRate { val value: Int } +case object SixtyPercent extends FurloughGrantRate { override val value: Int = 60 } +case object SeventyPercent extends FurloughGrantRate { override val value: Int = 70 } +case object EightyPercent extends FurloughGrantRate { override val value: Int = 80 } diff --git a/app/viewmodels/ConfirmationViewBreakdown.scala b/app/viewmodels/ConfirmationViewBreakdown.scala index 1979019e3..eb12b41ef 100644 --- a/app/viewmodels/ConfirmationViewBreakdown.scala +++ b/app/viewmodels/ConfirmationViewBreakdown.scala @@ -256,9 +256,9 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo .getOrElse(Seq()) } - def detailedBreakdownMessageKeysOct()(implicit messages: Messages, - dataRequest: DataRequest[_], - appConfig: FrontendAppConfig): Seq[String] = { + def detailedBreakdownMessageKeysSixtyPercent()(implicit messages: Messages, + dataRequest: DataRequest[_], + appConfig: FrontendAppConfig): Seq[String] = { val helper = new BeenOnStatutoryLeaveHelper() furlough.periodBreakdowns.headOption .map { diff --git a/app/views/NewConfirmationView.scala.html b/app/views/NewConfirmationView.scala.html new file mode 100644 index 000000000..61102d392 --- /dev/null +++ b/app/views/NewConfirmationView.scala.html @@ -0,0 +1,113 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@import java.time.LocalDate +@import org.apache.commons.lang3.StringUtils._ +@import viewmodels.ConfirmationViewBreakdownWithoutNicAndPension +@import pages.info.ConfirmationPage +@import models.requests.DataRequest +@import config.FrontendAppConfig + +@this( +govukLayout: templates.GovukLayoutWrapper, +h1: components.h1, +h2: components.h2, +h3: components.h3, +p: components.p, +confirmation: helper.confirmationHeading, +furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, +nicBreakdown: helper.phaseTwoDetailedNicBreakdown, +pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, +button: components.button, +details: components.details, +link: components.link, +appConfig: config.FrontendAppConfig +) + +@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) + +@govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { + +@confirmation(claimPeriod, cvb.furlough.sixty, SixtyPercent) + +
    + @p{ + @messages("confirmation.sixtyPercent.inset.p1.1") + £@cvb.furlough.sixtyDiff.formatted("%.2f") + @messages("confirmation.sixtyPercent.inset.p1.2", cvb.furlough.sixty.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) + } + @p(Html(messages("confirmation.sixtyPercent.inset.p2"))) +
    + +@p { +@messages("confirmation.calculated.on") +@dateToString(LocalDate.now()) +@Html(messages("confirmation.date.version", version)) +} + +@p(Html(messages("confirmation.disclaimer"))) + +@h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) + +
      +
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • +
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • +
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", + dateToStringWithoutYear(claimPeriod.start), + dateToStringWithoutYear(claimPeriod.end))
    • +
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • +
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, + "confirmation.no.nic.pension.nextSteps.li.4.2", true))) +
    • +
    + +@button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) + +@h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) + + + +@for(text <- cvb.detailedBreakdownMessageKeysSixtyPercent) { + @p(Html(text)) +} + +

    + @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") + @messages("phaseTwoDetailedBreakdown.p2.a") +

    + +@p(Html(messages("phaseTwoDetailedBreakdown.p3"))) + +@for(detailedBreakdown <- cvb.detailedBreakdowns) { + @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) +} +
    +
    + +

    + @messages("confirmation.sixtyPercent.eligibility") + £@cvb.furlough.sixtyDiff.formatted("%.2f.") +

    +

    @messages("confirmation.disclaimer")

    + +

    @messages("confirmation.print.this.page")

    + +@p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) + +@p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) +} + diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index 9e25f630e..ac677e3ba 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -41,7 +41,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.seventyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation(claimPeriod, cvb.furlough.seventy, 70) +@confirmation(claimPeriod, cvb.furlough.seventy, SeventyPercent)
    @p{ diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index 6fc79ee47..61102d392 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -41,7 +41,7 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation(claimPeriod, cvb.furlough.sixty, 60) +@confirmation(claimPeriod, cvb.furlough.sixty, SixtyPercent)
    @p{ @@ -80,7 +80,7 @@ -@for(text <- cvb.detailedBreakdownMessageKeysOct) { +@for(text <- cvb.detailedBreakdownMessageKeysSixtyPercent) { @p(Html(text)) } diff --git a/app/views/helper/confirmationHeading.scala.html b/app/views/helper/confirmationHeading.scala.html index 64ca1fa05..24d8d7250 100644 --- a/app/views/helper/confirmationHeading.scala.html +++ b/app/views/helper/confirmationHeading.scala.html @@ -19,7 +19,7 @@ h1: components.h1 ) -@(claimPeriod: Period, amount: BigDecimal, percentage: Int = 80)(implicit messages: Messages) +@(claimPeriod: Period, amount: BigDecimal, percentage: FurloughGrantRate = EightyPercent)(implicit messages: Messages) @confirmation { @@ -27,7 +27,7 @@ @h1(Html(messages("confirmation.no.nic.pension.heading")), classes = Some(""))
    -

    @messages("confirmation.heading.percent", percentage)

    +

    @messages("confirmation.heading.percent", percentage.value)

    @messages("confirmation.heading.claimPeriod", dateToStringWithoutYear(claimPeriod.start), dateToString(claimPeriod.end))

    £@amount.formatted("%.2f")

    diff --git a/test/views/helper/ConfirmationHeadingSpec.scala b/test/views/helper/ConfirmationHeadingSpec.scala index 52d2feab7..8a4074f4a 100644 --- a/test/views/helper/ConfirmationHeadingSpec.scala +++ b/test/views/helper/ConfirmationHeadingSpec.scala @@ -51,7 +51,7 @@ class ConfirmationHeadingSpec extends ViewBehaviours { "render the supplied 70% heading when passed a custom percentage of 70%" must { - val html = headingHelper(claimPeriod, claimAmount, 70) + val html = headingHelper(claimPeriod, claimAmount, SeventyPercent) implicit val doc = asDocument(dummyView(html)) behave like pageWithExpectedMessages( From 72008c597fc1118730c71a4dc65a0e226432b38d Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 12:53:24 +0100 Subject: [PATCH 06/14] [CVSRP-4673] Add helper for the AdditionalPaymentUpToEightyPercent --- app/models/CalculationResult.scala | 7 ++ app/models/FurloughGrantRates.scala | 19 +++- .../JrsExtensionConfirmationView.scala.html | 5 +- app/views/NewConfirmationView.scala.html | 20 ++--- ...NoNicAndPensionConfirmationView.scala.html | 5 +- .../SeventyPercentConfirmationView.scala.html | 18 ++-- .../SixtyPercentConfirmationView.scala.html | 18 ++-- ...itionalPaymentUpToEightyPercent.scala.html | 35 ++++++++ .../helper/confirmationHeading.scala.html | 4 +- conf/messages.cy | 20 ++--- conf/messages.en | 16 +--- .../JRSExtensionConfirmationMessages.scala | 9 +- ...ditionalPaymentUpToEightyPercentSpec.scala | 88 +++++++++++++++++++ .../helper/ConfirmationHeadingSpec.scala | 32 +++++-- 14 files changed, 218 insertions(+), 78 deletions(-) create mode 100644 app/views/helper/additionalPaymentUpToEightyPercent.scala.html create mode 100644 test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala diff --git a/app/models/CalculationResult.scala b/app/models/CalculationResult.scala index c09a7900a..4edbf6fdc 100644 --- a/app/models/CalculationResult.scala +++ b/app/models/CalculationResult.scala @@ -22,6 +22,13 @@ case class PhaseTwoFurloughCalculationResult(total: BigDecimal, periodBreakdowns def sixty = periodBreakdowns.map(_.sixty).sum def seventyDiff = total - seventy def sixtyDiff = total - sixty + def atRate(furloughGrantRate: FurloughGrantRate) = furloughGrantRate match { + case SixtyPercent => sixty + case SeventyPercent => seventy + case EightyPercent => total + } + + def diffAtRate(furloughGrantRate: FurloughGrantRate) = total - atRate(furloughGrantRate) } case class NicCalculationResult(total: BigDecimal, periodBreakdowns: Seq[NicBreakdown]) case class PhaseTwoNicCalculationResult(total: BigDecimal, periodBreakdowns: Seq[PhaseTwoNicBreakdown]) diff --git a/app/models/FurloughGrantRates.scala b/app/models/FurloughGrantRates.scala index ddb6e3643..cb2457e95 100644 --- a/app/models/FurloughGrantRates.scala +++ b/app/models/FurloughGrantRates.scala @@ -16,7 +16,18 @@ package models -sealed trait FurloughGrantRate { val value: Int } -case object SixtyPercent extends FurloughGrantRate { override val value: Int = 60 } -case object SeventyPercent extends FurloughGrantRate { override val value: Int = 70 } -case object EightyPercent extends FurloughGrantRate { override val value: Int = 80 } +sealed trait FurloughGrantRate { + val value: Int +} +case object SixtyPercent extends FurloughGrantRate { + override val value: Int = 60 + override def toString: String = "sixtyPercent" +} +case object SeventyPercent extends FurloughGrantRate { + override val value: Int = 70 + override def toString: String = "seventyPercent" +} +case object EightyPercent extends FurloughGrantRate { + override val value: Int = 80 + override def toString: String = "eightyPercent" +} diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index 862bc5dfb..809b4f52e 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -29,6 +29,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + additionalPayment: helper.additionalPaymentUpToEightyPercent, panelIndent: components.panelIndent, strong: components.strong, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, @@ -44,7 +45,9 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - @confirmation(claimPeriod, cvb.furlough.total) + @confirmation(claimPeriod, cvb.furlough) + + @additionalPayment(cvb.furlough, EightyPercent) @p { @strong(Html(messages("confirmation.calculated.on"))) diff --git a/app/views/NewConfirmationView.scala.html b/app/views/NewConfirmationView.scala.html index 61102d392..150375990 100644 --- a/app/views/NewConfirmationView.scala.html +++ b/app/views/NewConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, +additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -37,20 +38,13 @@ appConfig: config.FrontendAppConfig ) -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) +@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String, furloughRate: FurloughGrantRate)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) -@govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { +@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation(claimPeriod, cvb.furlough.sixty, SixtyPercent) + @confirmation(claimPeriod, cvb.furlough, furloughRate) -
    - @p{ - @messages("confirmation.sixtyPercent.inset.p1.1") - £@cvb.furlough.sixtyDiff.formatted("%.2f") - @messages("confirmation.sixtyPercent.inset.p1.2", cvb.furlough.sixty.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) - } - @p(Html(messages("confirmation.sixtyPercent.inset.p2"))) -
    + @additionalPayment(cvb.furlough, furloughRate) @p { @messages("confirmation.calculated.on") @@ -99,8 +93,8 @@

    - @messages("confirmation.sixtyPercent.eligibility") - £@cvb.furlough.sixtyDiff.formatted("%.2f.") + @messages("confirmation.additionalPayment.eligibility") + £@cvb.furlough.diffAtRate(furloughRate).formatted("%.2f.")

    @messages("confirmation.disclaimer")

    diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index 80e29d4a4..fbbd6de8e 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -30,6 +30,7 @@ panelIndent: components.panelIndent, strong: components.strong, confirmation: helper.confirmationHeading, + additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -43,7 +44,9 @@ @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - @confirmation(claimPeriod, cvb.furlough.total) + @confirmation(claimPeriod, cvb.furlough) + + @additionalPayment(cvb.furlough, EightyPercent) @p { @strong(Html(messages("confirmation.calculated.on"))) diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index ac677e3ba..571a8fc3a 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -39,18 +40,11 @@ @(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) -@govukLayout(pageTitle = Some(titleNoForm("confirmation.seventyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { +@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation(claimPeriod, cvb.furlough.seventy, SeventyPercent) + @confirmation(claimPeriod, cvb.furlough, SeventyPercent) -
    - @p{ - @messages("confirmation.seventyPercent.inset.p1.1") - £@cvb.furlough.seventyDiff.formatted("%.2f") - @messages("confirmation.seventyPercent.inset.p1.2", cvb.furlough.seventy.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) - } - @p(Html(messages("confirmation.seventyPercent.inset.p2"))) -
    + @additionalPayment(cvb.furlough, SeventyPercent) @p { @messages("confirmation.calculated.on") @@ -99,8 +93,8 @@

    - @messages("confirmation.seventyPercent.eligibility") - £@cvb.furlough.seventyDiff.formatted("%.2f.") + @messages("confirmation.additionalPayment.eligibility") + £@cvb.furlough.diffAtRate(SeventyPercent).formatted("%.2f.")

    @messages("confirmation.disclaimer")

    diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index 61102d392..c2d6e5b0e 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, @@ -39,18 +40,11 @@ @(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) -@govukLayout(pageTitle = Some(titleNoForm("confirmation.sixtyPercent.title")), showBackButton = false, thisPage = ConfirmationPage) { +@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { -@confirmation(claimPeriod, cvb.furlough.sixty, SixtyPercent) + @confirmation(claimPeriod, cvb.furlough, SixtyPercent) -
    - @p{ - @messages("confirmation.sixtyPercent.inset.p1.1") - £@cvb.furlough.sixtyDiff.formatted("%.2f") - @messages("confirmation.sixtyPercent.inset.p1.2", cvb.furlough.sixty.formatted("%.2f"), cvb.furlough.total.formatted("%.2f")) - } - @p(Html(messages("confirmation.sixtyPercent.inset.p2"))) -
    + @additionalPayment(cvb.furlough, SixtyPercent) @p { @messages("confirmation.calculated.on") @@ -99,8 +93,8 @@

    - @messages("confirmation.sixtyPercent.eligibility") - £@cvb.furlough.sixtyDiff.formatted("%.2f.") + @messages("confirmation.additionalPayment.eligibility") + £@cvb.furlough.diffAtRate(SixtyPercent).formatted("%.2f.")

    @messages("confirmation.disclaimer")

    diff --git a/app/views/helper/additionalPaymentUpToEightyPercent.scala.html b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html new file mode 100644 index 000000000..33410695a --- /dev/null +++ b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html @@ -0,0 +1,35 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@this( + inset: components.panelIndent, + p: components.p +) + +@(calculation: PhaseTwoFurloughCalculationResult, percentage: FurloughGrantRate = EightyPercent)(implicit messages: Messages) + +@if(percentage != EightyPercent) { + + @inset { + + @p { + @messages(s"confirmation.additionalPayment.inset.p1.1") + £@calculation.diffAtRate(percentage).formatted("%.2f") + @messages(s"confirmation.additionalPayment.inset.p1.2", calculation.atRate(percentage).formatted("%.2f"), calculation.total.formatted("%.2f")) + } + @p(Html(messages(s"confirmation.additionalPayment.inset.p2"))) + } +} diff --git a/app/views/helper/confirmationHeading.scala.html b/app/views/helper/confirmationHeading.scala.html index 24d8d7250..b739f4e0a 100644 --- a/app/views/helper/confirmationHeading.scala.html +++ b/app/views/helper/confirmationHeading.scala.html @@ -19,7 +19,7 @@ h1: components.h1 ) -@(claimPeriod: Period, amount: BigDecimal, percentage: FurloughGrantRate = EightyPercent)(implicit messages: Messages) +@(claimPeriod: Period, calculation: PhaseTwoFurloughCalculationResult, percentage: FurloughGrantRate = EightyPercent)(implicit messages: Messages) @confirmation { @@ -29,7 +29,7 @@

    @messages("confirmation.heading.percent", percentage.value)

    @messages("confirmation.heading.claimPeriod", dateToStringWithoutYear(claimPeriod.start), dateToString(claimPeriod.end))

    -

    £@amount.formatted("%.2f")

    +

    £@calculation.atRate(percentage).formatted("%.2f")

    } diff --git a/conf/messages.cy b/conf/messages.cy index ec15d10af..c01ce522c 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -277,7 +277,8 @@ pensionContribution.error.required = Dewiswch ‘Iawn’ os ydych yn talu cyfran confirmation.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn confirmation.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.heading.eightyPercent = (Cyfradd yr Estyniad i’r Cynllun Cadw Swyddi yn sgil Coronafeirws: {0}% o gyflogau) +confirmation.heading.percent = (Cyfradd yr Estyniad i’r Cynllun Cadw Swyddi yn sgil Coronafeirws: {0}% o gyflogau) +confirmation.heading.claimPeriod = Claim period: {0} to {1} confirmation.confirmation.p1 = Y swm a delir i’r cyflogai hwn sydd ar ffyrlo confirmation.confirmation.p2 = Cyfraniadau Yswiriant Gwladol y cyflogwr confirmation.confirmation.p3 = Isafswm cyfraniadau pensiwn y cyflogwr @@ -337,23 +338,16 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Cynllun Cadw Swyddi yn sgil Coron confirmation.no.nic.pension.breakdown.summary = Dadansoddiad o gyfrifiadau confirmation.no.nic.pension.disclaimer = Mae canlyniadau’r cyfrifiad yn dibynnu ar gywirdeb yr wybodaeth a nodwyd gennych, yr ydych yn gyfrifol amdani. Ni allwch hawlio am fwy o arian nag yr ydych yn mynd i’w dalu allan o dan y cynllun. -confirmation.seventyPercent.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.seventyPercent.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn +confirmation.additionalPayment.inset.p1.1 = Mae’n rhaid i chi dalu +confirmation.additionalPayment.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). +confirmation.additionalPayment.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. +confirmation.additionalPayment.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw + confirmation.seventyPercent.p1 = Grant ffyrlo confirmation.seventyPercent.p2 = (Cyfradd mis {0}: 70% o gyflogau) -confirmation.seventyPercent.inset.p1.1 = Mae’n rhaid i chi dalu -confirmation.seventyPercent.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). -confirmation.seventyPercent.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. -confirmation.seventyPercent.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw -confirmation.sixtyPercent.title = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn -confirmation.sixtyPercent.heading = Yr hyn y gallwch ei hawlio ar gyfer y cyflogai hwn confirmation.sixtyPercent.p1 = Grant ffyrlo confirmation.sixtyPercent.p2 = (Cyfradd mis {0}: 60% o gyflogau) -confirmation.sixtyPercent.inset.p1.1 = Mae’n rhaid i chi dalu -confirmation.sixtyPercent.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). -confirmation.sixtyPercent.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. -confirmation.sixtyPercent.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw claimPeriodStart.title = Beth yw dyddiad dechrau’r hawliad hwn? claimPeriodStart.heading = Beth yw dyddiad dechrau’r hawliad hwn? diff --git a/conf/messages.en b/conf/messages.en index c85e5b0f0..5e300b3ff 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -316,6 +316,10 @@ confirmation.nextSteps.li.4.2 = Job Retention Scheme online claim service (opens confirmation.startAgain = Start another calculation confirmation.webchat = Webchat help (opens in a new tab). +confirmation.additionalPayment.inset.p1.1 = You must pay this employee +confirmation.additionalPayment.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). +confirmation.additionalPayment.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. +confirmation.additionalPayment.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is confirmation.no.nic.pension.insert.t1 = You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these confirmation.no.nic.pension.title = Claim amount for this employee @@ -331,23 +335,11 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Coronavirus Job Retention Scheme confirmation.no.nic.pension.breakdown.summary = Breakdown of calculations confirmation.no.nic.pension.disclaimer = The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. You cannot claim for more money than you are going to pay out under the scheme. -confirmation.seventyPercent.title = Claim amount for this employee -confirmation.seventyPercent.heading = Claim amount for this employee confirmation.seventyPercent.p1 = Furlough grant confirmation.seventyPercent.p2 = ({0} rate: 70% of wages) -confirmation.seventyPercent.inset.p1.1 = You must pay this employee -confirmation.seventyPercent.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). -confirmation.seventyPercent.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. -confirmation.seventyPercent.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is -confirmation.sixtyPercent.title = Claim amount for this employee -confirmation.sixtyPercent.heading = Claim amount for this employee confirmation.sixtyPercent.p1 = Furlough grant confirmation.sixtyPercent.p2 = ({0} rate: 60% of wages) -confirmation.sixtyPercent.inset.p1.1 = You must pay this employee -confirmation.sixtyPercent.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). -confirmation.sixtyPercent.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. -confirmation.sixtyPercent.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is confirmation.breakdown.heading = Breakdown of calculations confirmation.breakdown.p2 = You told us your employee gets paid a {0} diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index ac0fd807a..309755d44 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -28,7 +28,14 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { def p1(percent: Int) = s"($percent% of their wages)" def p2(claimPeriod: Period)(implicit messages: Messages) = s"Claim period: ${dateToStringWithoutYear(claimPeriod.start)} to ${dateToString(claimPeriod.end)}" - def claimAmount(amount: BigDecimal) = s"£${amount.formatted("%.2f")}" + def claimAmount(amount: BigDecimal) = currencyFormatter(amount) + } + + object AdditionalPaymentBlock { + def p1(topup: BigDecimal, grant: BigDecimal) = + s"You must pay this employee ${currencyFormatter(topup)} in addition to the furlough grant of ${currencyFormatter(grant)}. This adds up to 80% of their usual wage (${currencyFormatter(topup + grant)})." + val p2 = + "To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to." } object RegularType1 { diff --git a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala new file mode 100644 index 000000000..d1be97deb --- /dev/null +++ b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala @@ -0,0 +1,88 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package views.helper + +import messages.JRSExtensionConfirmationMessages._ +import models._ +import views.BaseSelectors +import views.behaviours.ViewBehaviours +import views.html.helper.{additionalPaymentUpToEightyPercent, confirmationHeading} + +import java.time.LocalDate + +class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { + + val headingHelper = app.injector.instanceOf[additionalPaymentUpToEightyPercent] + + object Selectors extends BaseSelectors + + val calcResult = PhaseTwoFurloughCalculationResult( + 500, + Seq( + PhaseTwoFurloughBreakdown( + grant = Amount(500), + paymentWithPeriod = RegularPaymentWithPhaseTwoPeriod( + regularPay = Amount(500), + referencePay = Amount(500), + phaseTwoPeriod = PhaseTwoPeriod( + periodWithPaymentDate = FullPeriodWithPaymentDate( + period = FullPeriod(Period(LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 8))), + paymentDate = PaymentDate(LocalDate.of(2020, 12, 31)) + ), + actualHours = None, + usualHours = None + ) + ), + furloughCap = FullPeriodCap(2500) + ) + ) + ) + + "additionalPaymentUpToEightyPercent" must { + + "not render anything for EightyPercent" in { + + val html = headingHelper(calcResult, EightyPercent) + + html.body.trim mustBe "" + } + + "render the expected 70% top up content" must { + + val html = headingHelper(calcResult, SeventyPercent) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.seventyDiff, calcResult.seventy), + Selectors.p(2) -> AdditionalPaymentBlock.p2 + )) + } + + "render the expected 60% top up content" must { + + val html = headingHelper(calcResult, SixtyPercent) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.sixtyDiff, calcResult.sixty), + Selectors.p(2) -> AdditionalPaymentBlock.p2 + )) + } + } +} diff --git a/test/views/helper/ConfirmationHeadingSpec.scala b/test/views/helper/ConfirmationHeadingSpec.scala index 8a4074f4a..36368b33f 100644 --- a/test/views/helper/ConfirmationHeadingSpec.scala +++ b/test/views/helper/ConfirmationHeadingSpec.scala @@ -31,13 +31,33 @@ class ConfirmationHeadingSpec extends ViewBehaviours { object Selectors extends BaseSelectors val claimPeriod = Period(LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 8)) - val claimAmount = 500 + val calcResult = PhaseTwoFurloughCalculationResult( + 500, + Seq( + PhaseTwoFurloughBreakdown( + grant = Amount(500), + paymentWithPeriod = RegularPaymentWithPhaseTwoPeriod( + regularPay = Amount(500), + referencePay = Amount(500), + phaseTwoPeriod = PhaseTwoPeriod( + periodWithPaymentDate = FullPeriodWithPaymentDate( + period = FullPeriod(Period(LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 8))), + paymentDate = PaymentDate(LocalDate.of(2020, 12, 31)) + ), + actualHours = None, + usualHours = None + ) + ), + furloughCap = FullPeriodCap(2500) + ) + ) + ) "headingHelper" must { "render the expected 80% heading when not passed a custom percentage" must { - val html = headingHelper(claimPeriod, claimAmount) + val html = headingHelper(claimPeriod, calcResult) implicit val doc = asDocument(dummyView(html)) behave like pageWithExpectedMessages( @@ -45,13 +65,13 @@ class ConfirmationHeadingSpec extends ViewBehaviours { Selectors.h1 -> heading, Selectors.p(1) -> ConfirmationBlock.p1(80), Selectors.p(2) -> ConfirmationBlock.p2(claimPeriod), - Selectors.p(3) -> ConfirmationBlock.claimAmount(claimAmount) + Selectors.p(3) -> ConfirmationBlock.claimAmount(calcResult.total) )) } "render the supplied 70% heading when passed a custom percentage of 70%" must { - val html = headingHelper(claimPeriod, claimAmount, SeventyPercent) + val html = headingHelper(claimPeriod, calcResult, SeventyPercent) implicit val doc = asDocument(dummyView(html)) behave like pageWithExpectedMessages( @@ -59,10 +79,8 @@ class ConfirmationHeadingSpec extends ViewBehaviours { Selectors.h1 -> heading, Selectors.p(1) -> ConfirmationBlock.p1(70), Selectors.p(2) -> ConfirmationBlock.p2(claimPeriod), - Selectors.p(3) -> ConfirmationBlock.claimAmount(claimAmount) + Selectors.p(3) -> ConfirmationBlock.claimAmount(calcResult.seventy) )) } - } - } From fd70f733dcee17a7cfce225486f3afbebd763d9b Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 13:32:28 +0100 Subject: [PATCH 07/14] [CVSRP-4673] Move the still pay NIC and Pension to the Additional Payment block --- .../JrsExtensionConfirmationView.scala.html | 2 -- ...NoNicAndPensionConfirmationView.scala.html | 2 -- ...itionalPaymentUpToEightyPercent.scala.html | 19 ++++++++++++++++--- .../JRSExtensionConfirmationMessages.scala | 4 ++-- .../JrsExtensionConfirmationViewSpec.scala | 6 +++--- ...ditionalPaymentUpToEightyPercentSpec.scala | 16 +++++++++++----- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index 809b4f52e..a88e3ca30 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -55,8 +55,6 @@ @Html(messages("confirmation.date.version", version)) } - @panelIndent(Html(messages("confirmation.no.nic.pension.insert.t1"))) - @p(Html(messages("confirmation.disclaimer"))) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index fbbd6de8e..145835005 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -54,8 +54,6 @@ @Html(messages("confirmation.date.version", version)) } - @panelIndent(Html(messages("confirmation.no.nic.pension.insert.t1"))) - @p(Html(messages("confirmation.disclaimer"))) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/helper/additionalPaymentUpToEightyPercent.scala.html b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html index 33410695a..20d3851b9 100644 --- a/app/views/helper/additionalPaymentUpToEightyPercent.scala.html +++ b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html @@ -21,15 +21,28 @@ @(calculation: PhaseTwoFurloughCalculationResult, percentage: FurloughGrantRate = EightyPercent)(implicit messages: Messages) -@if(percentage != EightyPercent) { +@inset { - @inset { + @if(percentage == EightyPercent) { + + @p { + @messages("confirmation.no.nic.pension.insert.t1") + } + + } else { @p { @messages(s"confirmation.additionalPayment.inset.p1.1") £@calculation.diffAtRate(percentage).formatted("%.2f") @messages(s"confirmation.additionalPayment.inset.p1.2", calculation.atRate(percentage).formatted("%.2f"), calculation.total.formatted("%.2f")) } - @p(Html(messages(s"confirmation.additionalPayment.inset.p2"))) + + @p { + @messages(s"confirmation.additionalPayment.inset.p2") + } + + @p { + @messages("confirmation.no.nic.pension.insert.t1") + } } } diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 309755d44..777990eb2 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -36,14 +36,14 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { s"You must pay this employee ${currencyFormatter(topup)} in addition to the furlough grant of ${currencyFormatter(grant)}. This adds up to 80% of their usual wage (${currencyFormatter(topup + grant)})." val p2 = "To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to." + val stillPayNICandPension = + "You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these" } object RegularType1 { val dateAndCalculatorVersion = (todaysDate: String) => s"Calculated on: $todaysDate (Calculator Version v2)" - val indent = "You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these" - val disclaimerTopPage = { "The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. " + "You cannot claim for more money than you are going to pay out under the scheme." diff --git a/test/views/JrsExtensionConfirmationViewSpec.scala b/test/views/JrsExtensionConfirmationViewSpec.scala index b38de1499..1dcba0822 100644 --- a/test/views/JrsExtensionConfirmationViewSpec.scala +++ b/test/views/JrsExtensionConfirmationViewSpec.scala @@ -44,7 +44,7 @@ class JrsExtensionConfirmationViewSpec object RegularEmployeeTypeOneSelectors extends BaseSelectors { val nonGreenContentParagraphChild: Int => String = (i: Int) => s"#main-content > div > div > div > p:nth-child($i)" - val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(2) + val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(3) val disclaimer: String = nonGreenContentParagraphChild(4) val nextStepsNumberedList: Int => String = i => s"#main-content > div > div > div > ul.govuk-list.govuk-list--number > li:nth-child($i)" @@ -106,7 +106,7 @@ class JrsExtensionConfirmationViewSpec val expectedContent = Seq( RegularEmployeeTypeOneSelectors.h1 -> heading, RegularEmployeeTypeOneSelectors.dateAndCalculatorVersion -> RegularType1.dateAndCalculatorVersion(dateToString(LocalDate.now())), - RegularEmployeeTypeOneSelectors.indent -> RegularType1.indent, + RegularEmployeeTypeOneSelectors.indent -> AdditionalPaymentBlock.stillPayNICandPension, RegularEmployeeTypeOneSelectors.disclaimer -> RegularType1.disclaimerTopPage, RegularEmployeeTypeOneSelectors.h2(1) -> RegularType1.h2NextSteps, RegularEmployeeTypeOneSelectors.nextStepsNumberedList(1) -> nextStepsListMessage(1), @@ -187,7 +187,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec object VariableEmployeeTypeFiveSelectors extends BaseSelectors { val nonGreenContentParagraphChild: Int => String = (i: Int) => s"#main-content > div > div > div > p:nth-child($i)" - val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(2) + val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(3) val disclaimer: String = nonGreenContentParagraphChild(4) val nextStepsNumberedList: Int => String = i => s"#main-content > div > div > div > ul.govuk-list.govuk-list--number > li:nth-child($i)" diff --git a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala index d1be97deb..cd70d1c92 100644 --- a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala +++ b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala @@ -54,11 +54,15 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { "additionalPaymentUpToEightyPercent" must { - "not render anything for EightyPercent" in { + "Only render the Still Pay NIC and Pensions message" must { - val html = headingHelper(calcResult, EightyPercent) + val html = headingHelper(calcResult, EightyPercent) + implicit val doc = asDocument(dummyView(html)) - html.body.trim mustBe "" + behave like pageWithExpectedMessages( + Seq( + Selectors.p(1) -> AdditionalPaymentBlock.stillPayNICandPension + )) } "render the expected 70% top up content" must { @@ -69,7 +73,8 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.seventyDiff, calcResult.seventy), - Selectors.p(2) -> AdditionalPaymentBlock.p2 + Selectors.p(2) -> AdditionalPaymentBlock.p2, + Selectors.p(3) -> AdditionalPaymentBlock.stillPayNICandPension )) } @@ -81,7 +86,8 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.sixtyDiff, calcResult.sixty), - Selectors.p(2) -> AdditionalPaymentBlock.p2 + Selectors.p(2) -> AdditionalPaymentBlock.p2, + Selectors.p(3) -> AdditionalPaymentBlock.stillPayNICandPension )) } } From cb160fe101df4dcb4213d153c263ff59aaaf5f70 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 13:45:55 +0100 Subject: [PATCH 08/14] [CVSRP-4673] Create calculation date helper block --- .../JrsExtensionConfirmationView.scala.html | 9 +--- app/views/NewConfirmationView.scala.html | 9 +--- ...NoNicAndPensionConfirmationView.scala.html | 9 +--- .../SeventyPercentConfirmationView.scala.html | 9 +--- .../SixtyPercentConfirmationView.scala.html | 9 +--- app/views/helper/calculationDate.scala.html | 32 +++++++++++++ .../JRSExtensionConfirmationMessages.scala | 21 +++------ .../JrsExtensionConfirmationViewSpec.scala | 13 +++--- test/views/helper/CalculationDateSpec.scala | 46 +++++++++++++++++++ 9 files changed, 100 insertions(+), 57 deletions(-) create mode 100644 app/views/helper/calculationDate.scala.html create mode 100644 test/views/helper/CalculationDateSpec.scala diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index a88e3ca30..561e27a0f 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -29,6 +29,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, panelIndent: components.panelIndent, strong: components.strong, @@ -49,13 +50,7 @@ @additionalPayment(cvb.furlough, EightyPercent) - @p { - @strong(Html(messages("confirmation.calculated.on"))) - @dateToString(LocalDate.now()) - @Html(messages("confirmation.date.version", version)) - } - - @p(Html(messages("confirmation.disclaimer"))) + @calculationDate(version) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/NewConfirmationView.scala.html b/app/views/NewConfirmationView.scala.html index 150375990..ee58de529 100644 --- a/app/views/NewConfirmationView.scala.html +++ b/app/views/NewConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, @@ -46,13 +47,7 @@ @additionalPayment(cvb.furlough, furloughRate) -@p { -@messages("confirmation.calculated.on") -@dateToString(LocalDate.now()) -@Html(messages("confirmation.date.version", version)) -} - -@p(Html(messages("confirmation.disclaimer"))) + @calculationDate(version) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index 145835005..b19cd65f3 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -30,6 +30,7 @@ panelIndent: components.panelIndent, strong: components.strong, confirmation: helper.confirmationHeading, + calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, @@ -48,13 +49,7 @@ @additionalPayment(cvb.furlough, EightyPercent) - @p { - @strong(Html(messages("confirmation.calculated.on"))) - @dateToString(LocalDate.now()) - @Html(messages("confirmation.date.version", version)) - } - - @p(Html(messages("confirmation.disclaimer"))) + @calculationDate(version) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index 571a8fc3a..48d9fd1e2 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, @@ -46,13 +47,7 @@ @additionalPayment(cvb.furlough, SeventyPercent) -@p { -@messages("confirmation.calculated.on") -@dateToString(LocalDate.now()) -@Html(messages("confirmation.date.version", version)) -} - -@p(Html(messages("confirmation.disclaimer"))) + @calculationDate(version) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index c2d6e5b0e..7e084040f 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, @@ -46,13 +47,7 @@ @additionalPayment(cvb.furlough, SixtyPercent) -@p { -@messages("confirmation.calculated.on") -@dateToString(LocalDate.now()) -@Html(messages("confirmation.date.version", version)) -} - -@p(Html(messages("confirmation.disclaimer"))) + @calculationDate(version) @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) diff --git a/app/views/helper/calculationDate.scala.html b/app/views/helper/calculationDate.scala.html new file mode 100644 index 000000000..f93eb0be6 --- /dev/null +++ b/app/views/helper/calculationDate.scala.html @@ -0,0 +1,32 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@import java.time.LocalDate + +@this( + strong: components.strong, + p: components.p +) + +@(version: String)(implicit messages: Messages) + +@p { + @strong { @messages("confirmation.calculated.on") } + @dateToString(LocalDate.now()) + @Html(messages("confirmation.date.version", version)) +} + +@p(Html(messages("confirmation.disclaimer"))) diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 777990eb2..1463a92e4 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -40,14 +40,14 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { "You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these" } - object RegularType1 { + def dateAndCalculatorVersion(todaysDate: String, version: String) = s"Calculated on: $todaysDate (Calculator Version v$version)" - val dateAndCalculatorVersion = (todaysDate: String) => s"Calculated on: $todaysDate (Calculator Version v2)" + val disclaimerTopPage = { + "The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. " + + "You cannot claim for more money than you are going to pay out under the scheme." + } - val disclaimerTopPage = { - "The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. " + - "You cannot claim for more money than you are going to pay out under the scheme." - } + object RegularType1 { def nextStepsListMessages(messageNumber: Int, period: Period)(implicit messages: Messages): String = messageNumber match { @@ -146,15 +146,6 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { object VariableExtensionType5 { - val dateAndCalculatorVersion = (todaysDate: String) => s"Calculated on: $todaysDate (Calculator Version v2)" - - val indent = "You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these" - - val disclaimerTopPage = { - "The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. " + - "You cannot claim for more money than you are going to pay out under the scheme." - } - def nextStepsListMessages(messageNumber: Int, period: Period)(implicit messages: Messages): String = messageNumber match { case 1 => "Print or save a copy of this page for your records" diff --git a/test/views/JrsExtensionConfirmationViewSpec.scala b/test/views/JrsExtensionConfirmationViewSpec.scala index 1dcba0822..2d2da6c80 100644 --- a/test/views/JrsExtensionConfirmationViewSpec.scala +++ b/test/views/JrsExtensionConfirmationViewSpec.scala @@ -105,9 +105,9 @@ class JrsExtensionConfirmationViewSpec val expectedContent = Seq( RegularEmployeeTypeOneSelectors.h1 -> heading, - RegularEmployeeTypeOneSelectors.dateAndCalculatorVersion -> RegularType1.dateAndCalculatorVersion(dateToString(LocalDate.now())), + RegularEmployeeTypeOneSelectors.dateAndCalculatorVersion -> dateAndCalculatorVersion(dateToString(LocalDate.now()), "2"), RegularEmployeeTypeOneSelectors.indent -> AdditionalPaymentBlock.stillPayNICandPension, - RegularEmployeeTypeOneSelectors.disclaimer -> RegularType1.disclaimerTopPage, + RegularEmployeeTypeOneSelectors.disclaimer -> disclaimerTopPage, RegularEmployeeTypeOneSelectors.h2(1) -> RegularType1.h2NextSteps, RegularEmployeeTypeOneSelectors.nextStepsNumberedList(1) -> nextStepsListMessage(1), RegularEmployeeTypeOneSelectors.nextStepsNumberedList(2) -> nextStepsListMessage(2), @@ -241,11 +241,10 @@ class EmployeeType5JrsExtensionConfirmationViewSpec } val expectedContent = Seq( - VariableEmployeeTypeFiveSelectors.h1 -> heading, - VariableEmployeeTypeFiveSelectors.dateAndCalculatorVersion -> VariableExtensionType5.dateAndCalculatorVersion( - dateToString(LocalDate.now())), - VariableEmployeeTypeFiveSelectors.indent -> VariableExtensionType5.indent, - VariableEmployeeTypeFiveSelectors.disclaimer -> VariableExtensionType5.disclaimerTopPage, + VariableEmployeeTypeFiveSelectors.h1 -> heading, + VariableEmployeeTypeFiveSelectors.dateAndCalculatorVersion -> dateAndCalculatorVersion(dateToString(LocalDate.now()), "2"), + VariableEmployeeTypeFiveSelectors.indent -> AdditionalPaymentBlock.stillPayNICandPension, + VariableEmployeeTypeFiveSelectors.disclaimer -> disclaimerTopPage, VariableEmployeeTypeFiveSelectors.h2(1) -> VariableExtensionType5.h2NextSteps, VariableEmployeeTypeFiveSelectors.nextStepsNumberedList(1) -> nextStepsListMessage(1), VariableEmployeeTypeFiveSelectors.nextStepsNumberedList(2) -> nextStepsListMessage(2), diff --git a/test/views/helper/CalculationDateSpec.scala b/test/views/helper/CalculationDateSpec.scala new file mode 100644 index 000000000..e0b520a96 --- /dev/null +++ b/test/views/helper/CalculationDateSpec.scala @@ -0,0 +1,46 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package views.helper + +import messages.JRSExtensionConfirmationMessages._ +import models._ +import views.BaseSelectors +import views.behaviours.ViewBehaviours +import views.html.helper.{additionalPaymentUpToEightyPercent, calculationDate} + +import java.time.LocalDate + +class CalculationDateSpec extends ViewBehaviours { + + val headingHelper = app.injector.instanceOf[calculationDate] + + object Selectors extends BaseSelectors + + val version = "2.0" + + "calculationDate" must { + + val html = headingHelper(version) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.p(1) -> dateAndCalculatorVersion(dateToString(LocalDate.now()), version), + Selectors.p(2) -> disclaimerTopPage + )) + } +} From 3ed7daf53795d2e6fc4460510a6e2721e019659c Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 15:36:42 +0100 Subject: [PATCH 09/14] [CVSRP-4673] Added a next steps breakdown helper --- .../JrsExtensionConfirmationView.scala.html | 15 +----- app/views/NewConfirmationView.scala.html | 15 +----- ...NoNicAndPensionConfirmationView.scala.html | 15 +----- .../SeventyPercentConfirmationView.scala.html | 17 +------ .../SixtyPercentConfirmationView.scala.html | 21 ++------ app/views/components/bullets.scala.html | 10 +++- app/views/components/link.scala.html | 5 +- .../helper/confirmationNextSteps.scala.html | 39 +++++++++++++++ .../JRSExtensionConfirmationMessages.scala | 40 ++++++--------- .../JrsExtensionConfirmationViewSpec.scala | 14 +++--- .../helper/ConfirmationNextStepsSpec.scala | 50 +++++++++++++++++++ 11 files changed, 132 insertions(+), 109 deletions(-) create mode 100644 app/views/helper/confirmationNextSteps.scala.html create mode 100644 test/views/helper/ConfirmationNextStepsSpec.scala diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index 561e27a0f..0fe4598df 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -29,6 +29,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, panelIndent: components.panelIndent, @@ -52,19 +53,7 @@ @calculationDate(version) - @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) - -
      -
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", - dateToStringWithoutYear(claimPeriod.start), - dateToString(claimPeriod.end))
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • -
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, - "confirmation.no.nic.pension.nextSteps.li.4.2", true))) -
    • -
    + @nextSteps(claimPeriod) @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) diff --git a/app/views/NewConfirmationView.scala.html b/app/views/NewConfirmationView.scala.html index ee58de529..7859e567c 100644 --- a/app/views/NewConfirmationView.scala.html +++ b/app/views/NewConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, @@ -49,19 +50,7 @@ @calculationDate(version) -@h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) - -
      -
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", - dateToStringWithoutYear(claimPeriod.start), - dateToStringWithoutYear(claimPeriod.end))
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • -
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, - "confirmation.no.nic.pension.nextSteps.li.4.2", true))) -
    • -
    + @nextSteps(claimPeriod) @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index b19cd65f3..80d8c6ea6 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -30,6 +30,7 @@ panelIndent: components.panelIndent, strong: components.strong, confirmation: helper.confirmationHeading, + nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, @@ -51,19 +52,7 @@ @calculationDate(version) - @h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) - -
      -
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", - dateToStringWithoutYear(claimPeriod.start), - dateToStringWithoutYear(claimPeriod.end))
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • -
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, - "confirmation.no.nic.pension.nextSteps.li.4.2", true))) -
    • -
    + @nextSteps(claimPeriod) @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index 48d9fd1e2..ad5cc2345 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, @@ -49,26 +50,12 @@ @calculationDate(version) -@h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) - -
      -
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", - dateToStringWithoutYear(claimPeriod.start), - dateToStringWithoutYear(claimPeriod.end))
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • -
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, - "confirmation.no.nic.pension.nextSteps.li.4.2", true))) -
    • -
    + @nextSteps(claimPeriod) @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - @for(text <- cvb.detailedBreakdownMessageKeysSeventyPercent) { @p(Html(text)) } diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index 7e084040f..f3e9b461d 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -29,6 +29,7 @@ p: components.p, confirmation: helper.confirmationHeading, calculationDate: helper.calculationDate, + nextSteps: helper.confirmationNextSteps, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, nicBreakdown: helper.phaseTwoDetailedNicBreakdown, @@ -49,25 +50,11 @@ @calculationDate(version) -@h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) - -
      -
    • @messages("confirmation.print.this.page") @messages("confirmation.no.nic.pension.nextSteps.li.1")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.2")
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.3", - dateToStringWithoutYear(claimPeriod.start), - dateToStringWithoutYear(claimPeriod.end))
    • -
    • @messages("confirmation.no.nic.pension.nextSteps.li.4")
    • -
    • @Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, - "confirmation.no.nic.pension.nextSteps.li.4.2", true))) -
    • -
    - -@button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) - -@h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) + @nextSteps(claimPeriod) + @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) + @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) @for(text <- cvb.detailedBreakdownMessageKeysSixtyPercent) { @p(Html(text)) diff --git a/app/views/components/bullets.scala.html b/app/views/components/bullets.scala.html index ee38bd357..07893551f 100644 --- a/app/views/components/bullets.scala.html +++ b/app/views/components/bullets.scala.html @@ -18,8 +18,14 @@ @(content: Seq[Html], isWarning: Boolean = false, numberList: Boolean = false, classes: String = "govuk-list")(implicit messages: Messages) -
      + @if(numberList) { +
        @bullets
      + } else { +
        @bullets
      + } + +@bullets = { @content.map { bullet =>
    • @bullet
    • } -
    +} diff --git a/app/views/components/link.scala.html b/app/views/components/link.scala.html index 1b7587175..b75865ab0 100644 --- a/app/views/components/link.scala.html +++ b/app/views/components/link.scala.html @@ -20,7 +20,8 @@ link: String, messageKey: String, attrTarget: Boolean = false, - id: Option[String] = None)(implicit messages: Messages + id: Option[String] = None, + onClickAction: Option[String] = None)(implicit messages: Messages ) - s"id=$x") @if(attrTarget) { target="_blank" rel="noopener noreferrer" }>@messages(messageKey) + s"onClick=$x") @id.map(x => s"id=$x") @if(attrTarget) { target="_blank" rel="noopener noreferrer" }>@messages(messageKey) diff --git a/app/views/helper/confirmationNextSteps.scala.html b/app/views/helper/confirmationNextSteps.scala.html new file mode 100644 index 000000000..adad38337 --- /dev/null +++ b/app/views/helper/confirmationNextSteps.scala.html @@ -0,0 +1,39 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@import config.FrontendAppConfig +@import scala.collection.immutable + +@this( + bullets: components.bullets, + h2: components.h2, + link: components.link +) + +@(claimPeriod: Period)(implicit messages: Messages, appConfig: FrontendAppConfig) + +@h2(Html(messages("confirmation.nextSteps.heading")), classes = Some("govuk-heading-m")) + +@bullets(Seq( + HtmlFormat.fill(immutable.Seq( + link("#", "confirmation.print.this.page", onClickAction = Some("window.print();")), + Html(messages("confirmation.no.nic.pension.nextSteps.li.1")) + )), + Html(messages("confirmation.no.nic.pension.nextSteps.li.2")), + Html(messages("confirmation.no.nic.pension.nextSteps.li.3", dateToStringWithoutYear(claimPeriod.start), dateToString(claimPeriod.end))), + Html(messages("confirmation.no.nic.pension.nextSteps.li.4")), + Html(messages("confirmation.no.nic.pension.nextSteps.li.4.1", link(appConfig.jobRetentionScheme, "confirmation.no.nic.pension.nextSteps.li.4.2", true))) +), numberList = true) diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 1463a92e4..08aa18712 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -47,21 +47,22 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { "You cannot claim for more money than you are going to pay out under the scheme." } - object RegularType1 { + val h2NextSteps = "Next steps" + + def nextStepsListMessages(messageNumber: Int, period: Period)(implicit messages: Messages): String = + messageNumber match { + case 1 => "Print or save a copy of this page for your records" + case 2 => "Make a note of the amount you can claim for this employee and the claim period." + case 3 => + s"Use the calculator again for any other employees furloughed within this claim period ${dateToStringWithoutYear(period.start)} " + + s"to ${dateToString(period.`end`)} and make a note of the results." + case 4 => "Add all the results for each employee furloughed in this claim period together to get the total amount you can claim." + case 5 => "Make a claim through the Coronavirus Job Retention Scheme (opens in a new window or tab)." + case _ => s"This number $messageNumber is not valid. Are you sure there are that many bullets?" + } - def nextStepsListMessages(messageNumber: Int, period: Period)(implicit messages: Messages): String = - messageNumber match { - case 1 => "Print or save a copy of this page for your records" - case 2 => "Make a note of the amount you can claim for this employee and the claim period." - case 3 => - s"Use the calculator again for any other employees furloughed within this claim period ${dateToStringWithoutYear(period.start)} " + - s"to ${dateToString(period.`end`)} and make a note of the results." - case 4 => "Add all the results for each employee furloughed in this claim period together to get the total amount you can claim." - case 5 => "Make a claim through the Coronavirus Job Retention Scheme (opens in a new window or tab)." - case _ => s"This number $messageNumber is not valid. Are you sure there are that many bullets?" - } + object RegularType1 { - val h2NextSteps = "Next steps" val h2BreakdownOfCalculations = "Breakdown of calculations" val breakDownParagraphOne @@ -146,19 +147,6 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { object VariableExtensionType5 { - def nextStepsListMessages(messageNumber: Int, period: Period)(implicit messages: Messages): String = - messageNumber match { - case 1 => "Print or save a copy of this page for your records" - case 2 => "Make a note of the amount you can claim for this employee and the claim period." - case 3 => - s"Use the calculator again for any other employees furloughed within this claim period ${dateToStringWithoutYear(period.start)} " + - s"to ${dateToString(period.`end`)} and make a note of the results." - case 4 => "Add all the results for each employee furloughed in this claim period together to get the total amount you can claim." - case 5 => "Make a claim through the Coronavirus Job Retention Scheme (opens in a new window or tab)." - case _ => s"This number $messageNumber is not valid. Are you sure there are that many bullets?" - } - - val h2NextSteps = "Next steps" val h2BreakdownOfCalculations = "Breakdown of calculations" def breakdownP1(boundaryStart: String, boundaryEnd: String) = diff --git a/test/views/JrsExtensionConfirmationViewSpec.scala b/test/views/JrsExtensionConfirmationViewSpec.scala index 2d2da6c80..a8dde169b 100644 --- a/test/views/JrsExtensionConfirmationViewSpec.scala +++ b/test/views/JrsExtensionConfirmationViewSpec.scala @@ -47,7 +47,7 @@ class JrsExtensionConfirmationViewSpec val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(3) val disclaimer: String = nonGreenContentParagraphChild(4) val nextStepsNumberedList: Int => String = - i => s"#main-content > div > div > div > ul.govuk-list.govuk-list--number > li:nth-child($i)" + i => s"#main-content > div > div > div > ol.govuk-list.govuk-list--number > li:nth-child($i)" val calculatePayList: Int => String = i => s"#main-content > div > div > div > ol:nth-child(15) > li:nth-child($i)" val furloughGrantList: Int => String = i => s"#main-content > div > div > div > ol:nth-child(18) > li:nth-child($i)" val breakdownParagraphOne: String = nonGreenContentParagraphChild(9) @@ -94,8 +94,7 @@ class JrsExtensionConfirmationViewSpec loadResultData(userAnswers).value.asInstanceOf[ConfirmationDataResultWithoutNicAndPension].confirmationViewBreakdown } - val nextStepsListMessage: Int => String = - (bullet: Int) => RegularType1.nextStepsListMessages(bullet, decClaimPeriod) + val nextStepsListMessage: Int => String = (bullet: Int) => nextStepsListMessages(bullet, decClaimPeriod) val calculatePayListMessage: Int => String = { (bullet: Int) => RegularType1.calculatePayListMessages(bullet, 10000, 31, 31) } @@ -108,7 +107,7 @@ class JrsExtensionConfirmationViewSpec RegularEmployeeTypeOneSelectors.dateAndCalculatorVersion -> dateAndCalculatorVersion(dateToString(LocalDate.now()), "2"), RegularEmployeeTypeOneSelectors.indent -> AdditionalPaymentBlock.stillPayNICandPension, RegularEmployeeTypeOneSelectors.disclaimer -> disclaimerTopPage, - RegularEmployeeTypeOneSelectors.h2(1) -> RegularType1.h2NextSteps, + RegularEmployeeTypeOneSelectors.h2(1) -> h2NextSteps, RegularEmployeeTypeOneSelectors.nextStepsNumberedList(1) -> nextStepsListMessage(1), RegularEmployeeTypeOneSelectors.nextStepsNumberedList(2) -> nextStepsListMessage(2), RegularEmployeeTypeOneSelectors.nextStepsNumberedList(3) -> nextStepsListMessage(3), @@ -190,7 +189,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec val dateAndCalculatorVersion: String = nonGreenContentParagraphChild(3) val disclaimer: String = nonGreenContentParagraphChild(4) val nextStepsNumberedList: Int => String = - i => s"#main-content > div > div > div > ul.govuk-list.govuk-list--number > li:nth-child($i)" + i => s"#main-content > div > div > div > ol.govuk-list.govuk-list--number > li:nth-child($i)" val calculatePayList: Int => String = i => s"#main-content > div > div > div > ol:nth-child(15) > li:nth-child($i)" val furloughGrantList: Int => String = i => s"#main-content > div > div > div > ol:nth-child(18) > li:nth-child($i)" val breakdownParagraphOne: String = nonGreenContentParagraphChild(9) @@ -233,8 +232,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec val userAnswers: UserAnswers = nov2020Type5Journey() - val nextStepsListMessage: Int => String = - (bullet: Int) => VariableExtensionType5.nextStepsListMessages(bullet, novClaimPeriod) + val nextStepsListMessage: Int => String = (bullet: Int) => nextStepsListMessages(bullet, novClaimPeriod) val furloughGrantListMessage: Int => String = { (bullet: Int) => VariableExtensionType5.furloughGrantListMessages(bullet, 733.92, 80) @@ -245,7 +243,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec VariableEmployeeTypeFiveSelectors.dateAndCalculatorVersion -> dateAndCalculatorVersion(dateToString(LocalDate.now()), "2"), VariableEmployeeTypeFiveSelectors.indent -> AdditionalPaymentBlock.stillPayNICandPension, VariableEmployeeTypeFiveSelectors.disclaimer -> disclaimerTopPage, - VariableEmployeeTypeFiveSelectors.h2(1) -> VariableExtensionType5.h2NextSteps, + VariableEmployeeTypeFiveSelectors.h2(1) -> h2NextSteps, VariableEmployeeTypeFiveSelectors.nextStepsNumberedList(1) -> nextStepsListMessage(1), VariableEmployeeTypeFiveSelectors.nextStepsNumberedList(2) -> nextStepsListMessage(2), VariableEmployeeTypeFiveSelectors.nextStepsNumberedList(3) -> nextStepsListMessage(3), diff --git a/test/views/helper/ConfirmationNextStepsSpec.scala b/test/views/helper/ConfirmationNextStepsSpec.scala new file mode 100644 index 000000000..2c1955225 --- /dev/null +++ b/test/views/helper/ConfirmationNextStepsSpec.scala @@ -0,0 +1,50 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package views.helper + +import messages.JRSExtensionConfirmationMessages._ +import models._ +import views.BaseSelectors +import views.behaviours.ViewBehaviours +import views.html.helper.{additionalPaymentUpToEightyPercent, confirmationNextSteps} + +import java.time.LocalDate + +class ConfirmationNextStepsSpec extends ViewBehaviours { + + val nextSteps = app.injector.instanceOf[confirmationNextSteps] + + val claimPeriod = Period(LocalDate.of(2021, 1, 1), LocalDate.of(2021, 1, 8)) + + object Selectors extends BaseSelectors + + "confirmationNextSteps" must { + + val html = nextSteps(claimPeriod) + implicit val doc = asDocument(dummyView(html)) + + behave like pageWithExpectedMessages( + Seq( + Selectors.h2(1) -> h2NextSteps, + Selectors.numbered(1) -> nextStepsListMessages(1, claimPeriod), + Selectors.numbered(2) -> nextStepsListMessages(2, claimPeriod), + Selectors.numbered(3) -> nextStepsListMessages(3, claimPeriod), + Selectors.numbered(4) -> nextStepsListMessages(4, claimPeriod), + Selectors.numbered(5) -> nextStepsListMessages(5, claimPeriod) + )) + } +} From 3b2cc05fdc98eb5a9366a841a7f786cdfcf35e32 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:11:40 +0100 Subject: [PATCH 10/14] [CVSRP-4673] Refactor to remove the need for multiple helpers and instead pass the furlough rate through --- app/controllers/ConfirmationController.scala | 59 +++++++----- app/models/FurloughGrantRate.scala | 40 ++++++++ app/models/FurloughGrantRates.scala | 33 ------- app/models/PeriodBreakdown.scala | 25 +++-- .../ConfirmationViewBreakdown.scala | 71 ++------------- .../JrsExtensionConfirmationView.scala.html | 27 +++--- app/views/NewConfirmationView.scala.html | 91 ------------------- ...NoNicAndPensionConfirmationView.scala.html | 43 ++++----- app/views/PhaseTwoConfirmationView.scala.html | 6 +- .../SeventyPercentConfirmationView.scala.html | 39 +++----- .../SixtyPercentConfirmationView.scala.html | 35 +++---- app/views/helper/FurloughCapHelper.scala | 9 +- .../helper/confirmationFooter.scala.html | 46 ++++++++++ .../detailedFurloughBreakdown.scala.html | 4 +- ...aseTwoDetailedFurloughBreakdown.scala.html | 19 ++-- conf/messages.cy | 4 +- conf/messages.en | 8 +- .../ConfirmationControllerISpec.scala | 33 ------- .../ConfirmationControllerSpec.scala | 21 +++-- test/models/PeriodBreakdownSpec.scala | 2 +- .../JrsExtensionConfirmationViewSpec.scala | 10 +- .../ConfirmationType3EmployeeViewSpec.scala | 14 ++- .../ConfirmationType4EmployeeViewSpec.scala | 20 +++- .../ConfirmationType5EmployeeViewSpec.scala | 26 +++++- test/views/helper/FurloughCapHelperSpec.scala | 30 ++++-- 25 files changed, 331 insertions(+), 384 deletions(-) create mode 100644 app/models/FurloughGrantRate.scala delete mode 100644 app/models/FurloughGrantRates.scala delete mode 100644 app/views/NewConfirmationView.scala.html create mode 100644 app/views/helper/confirmationFooter.scala.html diff --git a/app/controllers/ConfirmationController.scala b/app/controllers/ConfirmationController.scala index dd56f17da..9f9dc80e3 100644 --- a/app/controllers/ConfirmationController.scala +++ b/app/controllers/ConfirmationController.scala @@ -20,7 +20,7 @@ import cats.data.Validated.{Invalid, Valid} import config.{CalculatorVersionConfiguration, FrontendAppConfig} import controllers.actions._ import handlers.{ConfirmationControllerRequestHandler, ErrorHandler} -import models.UserAnswers +import models.{EightyPercent, FurloughGrantRate, UserAnswers} import navigation.Navigator import play.api.i18n.MessagesApi import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -56,7 +56,7 @@ class ConfirmationController @Inject()( def onPageLoad: Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => /** Uncomment line to create integration test cases when going through journeys, either manually or via test packs. * Set the number of cases to the amount of cases that will be executed. */ -// printOutConfirmationTestCases(request.userAnswers, loadResultData(request.userAnswers), 6) + // printOutConfirmationTestCases(request.userAnswers, loadResultData(request.userAnswers), 6) loadResultData(request.userAnswers) match { case Valid(data: PhaseOneConfirmationDataResult) => @@ -65,27 +65,42 @@ class ConfirmationController @Inject()( case Valid(data: PhaseTwoConfirmationDataResult) => auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) Ok(phaseTwoView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) - case Valid(data: ConfirmationDataResultWithoutNicAndPension) => + case Valid(data: ConfirmationDataResultWithoutNicAndPension) => { + auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - data.metaData.claimPeriod.start.getYearMonth match { - case yearMonth if yearMonth == AUGUST.inYear(y2020) => - Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) - case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) || yearMonth == JULY.inYear(y2021) => - Ok(seventyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) - case yearMonth - if yearMonth == OCTOBER.inYear(y2020) || yearMonth == AUGUST.inYear(y2021) || yearMonth == SEPTEMBER.inYear(y2021) => - Ok(sixtyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) - case yearMonth if yearMonth.isBetweenInclusive(appConfig.extensionStartDate.getYearMonth, appConfig.schemeEndDate.getYearMonth) => - Ok( - extensionView( - data.confirmationViewBreakdown, - data.metaData.claimPeriod, - calculatorVersionConf, - employeeTypeService.isType5NewStarter() - )) - case _ => - Redirect(routes.ErrorController.somethingWentWrong()) - } + + val furloughRate = FurloughGrantRate.rateForYearMonth(data.metaData.claimPeriod.start.getYearMonth) + + Ok( + extensionView( + data.confirmationViewBreakdown, + data.metaData.claimPeriod, + calculatorVersionConf, + employeeTypeService.isType5NewStarter(), + furloughRate + )) + +// data.metaData.claimPeriod.start.getYearMonth match { +// case yearMonth if yearMonth == AUGUST.inYear(y2020) => +// Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf, false, EightyPercent)) +// case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) || yearMonth == JULY.inYear(y2021) => +// Ok(seventyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) +// case yearMonth +// if yearMonth == OCTOBER.inYear(y2020) || yearMonth == AUGUST.inYear(y2021) || yearMonth == SEPTEMBER.inYear(y2021) => +// Ok(sixtyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) +// case yearMonth if yearMonth.isBetweenInclusive(appConfig.extensionStartDate.getYearMonth, appConfig.schemeEndDate.getYearMonth) => +// Ok( +// extensionView( +// data.confirmationViewBreakdown, +// data.metaData.claimPeriod, +// calculatorVersionConf, +// employeeTypeService.isType5NewStarter(), +// furloughRate +// )) +// case _ => +// Redirect(routes.ErrorController.somethingWentWrong()) +// } + } case Invalid(e) => auditService.sendCalculationFailed(request.userAnswers) PagerDutyHelper.alert(CALCULATION_FAILED) diff --git a/app/models/FurloughGrantRate.scala b/app/models/FurloughGrantRate.scala new file mode 100644 index 000000000..e3f178b0d --- /dev/null +++ b/app/models/FurloughGrantRate.scala @@ -0,0 +1,40 @@ +/* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package models + +import java.time.YearMonth +import java.time.Month._ + +sealed trait FurloughGrantRate { + val value: Int +} +case object SixtyPercent extends FurloughGrantRate { override val value: Int = 60 } +case object SeventyPercent extends FurloughGrantRate { override val value: Int = 70 } +case object EightyPercent extends FurloughGrantRate { override val value: Int = 80 } + +object FurloughGrantRate { + + val yearMonthMap = Map[YearMonth, FurloughGrantRate]( + YearMonth.of(2020, SEPTEMBER) -> SeventyPercent, + YearMonth.of(2020, OCTOBER) -> SixtyPercent, + YearMonth.of(2021, JULY) -> SeventyPercent, + YearMonth.of(2021, AUGUST) -> SixtyPercent, + YearMonth.of(2021, SEPTEMBER) -> SixtyPercent + ).withDefaultValue(EightyPercent) + + def rateForYearMonth(yearMonth: YearMonth): FurloughGrantRate = yearMonthMap(yearMonth) +} diff --git a/app/models/FurloughGrantRates.scala b/app/models/FurloughGrantRates.scala deleted file mode 100644 index cb2457e95..000000000 --- a/app/models/FurloughGrantRates.scala +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package models - -sealed trait FurloughGrantRate { - val value: Int -} -case object SixtyPercent extends FurloughGrantRate { - override val value: Int = 60 - override def toString: String = "sixtyPercent" -} -case object SeventyPercent extends FurloughGrantRate { - override val value: Int = 70 - override def toString: String = "seventyPercent" -} -case object EightyPercent extends FurloughGrantRate { - override val value: Int = 80 - override def toString: String = "eightyPercent" -} diff --git a/app/models/PeriodBreakdown.scala b/app/models/PeriodBreakdown.scala index 400771247..a7b48c88f 100644 --- a/app/models/PeriodBreakdown.scala +++ b/app/models/PeriodBreakdown.scala @@ -109,12 +109,25 @@ sealed trait PhaseTwoPeriodBreakdown { final case class PhaseTwoFurloughBreakdown(grant: Amount, paymentWithPeriod: PaymentWithPhaseTwoPeriod, furloughCap: FurloughCap) extends PhaseTwoPeriodBreakdown { - def isCapped: Boolean = (paymentWithPeriod.referencePay.value * 0.8) > furloughCap.value - def calculatedFurlough: String = Amount(paymentWithPeriod.referencePay.value * 0.8).halfUp.value.formatted("%.2f") - def calculatedSeventy: String = Amount(paymentWithPeriod.referencePay.value * 0.7).halfUp.value.formatted("%.2f") - def calculatedSixty: String = Amount(paymentWithPeriod.referencePay.value * 0.6).halfUp.value.formatted("%.2f") - def seventy = Amount((grant.value / 80) * 70).halfUp.value - def sixty = Amount((grant.value / 80) * 60).halfUp.value + def isCapped: Boolean = (paymentWithPeriod.referencePay.value * 0.8) > furloughCap.value + def calculatedEighty: String = Amount(paymentWithPeriod.referencePay.value * 0.8).halfUp.value.formatted("%.2f") + def calculatedSeventy: String = Amount(paymentWithPeriod.referencePay.value * 0.7).halfUp.value.formatted("%.2f") + def calculatedSixty: String = Amount(paymentWithPeriod.referencePay.value * 0.6).halfUp.value.formatted("%.2f") + + def seventy = Amount((grant.value / 80) * 70).halfUp.value + def sixty = Amount((grant.value / 80) * 60).halfUp.value + + def grantAmount(furloughGrantRate: FurloughGrantRate): BigDecimal = furloughGrantRate match { + case SixtyPercent => sixty + case SeventyPercent => seventy + case EightyPercent => grant.value + } + + def calculatedFurlough(furloughGrantRate: FurloughGrantRate): String = furloughGrantRate match { + case SixtyPercent => calculatedSixty + case SeventyPercent => calculatedSeventy + case EightyPercent => calculatedEighty + } } final case class PhaseTwoNicBreakdown(grant: Amount, diff --git a/app/viewmodels/ConfirmationViewBreakdown.scala b/app/viewmodels/ConfirmationViewBreakdown.scala index eb12b41ef..cd94217c2 100644 --- a/app/viewmodels/ConfirmationViewBreakdown.scala +++ b/app/viewmodels/ConfirmationViewBreakdown.scala @@ -114,8 +114,7 @@ case class PhaseTwoConfirmationViewBreakdown(furlough: PhaseTwoFurloughCalculati ) } - def detailedBreakdownMessageKeys( - isNewStarterType5: Boolean)(implicit messages: Messages, dataRequest: DataRequest[_], appConfig: FrontendAppConfig): Seq[String] = { + def detailedBreakdownMessageKeys(implicit messages: Messages, dataRequest: DataRequest[_], appConfig: FrontendAppConfig): Seq[String] = { val helper = new BeenOnStatutoryLeaveHelper() furlough.periodBreakdowns.headOption .map { @@ -124,10 +123,6 @@ case class PhaseTwoConfirmationViewBreakdown(furlough: PhaseTwoFurloughCalculati Seq( messages("phaseTwoDetailedBreakdown.p1.regular") ) - case _: AveragePaymentWithPhaseTwoPeriod if isNewStarterType5 => - Seq( - messages("phaseTwoReferencePayBreakdown.extension.p1") - ) case _: AveragePaymentWithPhaseTwoPeriod => Seq( messages("phaseTwoDetailedBreakdown.p1.average", helper.boundaryStart(), helper.boundaryEnd()) @@ -186,7 +181,9 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo } def detailedBreakdownMessageKeys( + furloughRate: FurloughGrantRate, isNewStarterType5: Boolean)(implicit messages: Messages, dataRequest: DataRequest[_], appConfig: FrontendAppConfig): Seq[String] = { + val helper = new BeenOnStatutoryLeaveHelper() furlough.periodBreakdowns.headOption @@ -194,19 +191,19 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo _.paymentWithPeriod match { case _: RegularPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.p1.regular") + messages("phaseTwoDetailedBreakdown.p1.regular", furloughRate.value) ) - case avg: AveragePaymentWithPhaseTwoPeriod if isNewStarterType5 => + case _: AveragePaymentWithPhaseTwoPeriod if isNewStarterType5 => Seq( - messages("phaseTwoDetailedBreakdown.no.nic.p1.extension", helper.boundaryStart(), helper.boundaryEnd()) + messages("phaseTwoDetailedBreakdown.no.nic.p1.extension", helper.boundaryStart(), helper.boundaryEnd(), furloughRate.value) ) case _: AveragePaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.p1.average", helper.boundaryStart(), helper.boundaryEnd()) + messages("phaseTwoDetailedBreakdown.p1.average", helper.boundaryStart(), helper.boundaryEnd(), furloughRate.value) ) case _: CylbPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1"), + messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1", furloughRate.value), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2"), messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3", helper.boundaryEnd()) ) @@ -229,58 +226,6 @@ case class ConfirmationViewBreakdownWithoutNicAndPension(furlough: PhaseTwoFurlo type5bEmployeeResult = Some(messages("phaseTwoDetailedBreakdown.statLeave", start, end)) ) } else None - - def detailedBreakdownMessageKeysSeventyPercent()(implicit messages: Messages, - dataRequest: DataRequest[_], - appConfig: FrontendAppConfig): Seq[String] = { - val helper = new BeenOnStatutoryLeaveHelper() - furlough.periodBreakdowns.headOption - .map { - _.paymentWithPeriod match { - case _: RegularPaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.seventyPercent.p1.regular") - ) - case _: AveragePaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.seventyPercent.p1.average") - ) - case _: CylbPaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1"), - messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2"), - messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3", helper.boundaryEnd()) - ) - } - } - .getOrElse(Seq()) - } - - def detailedBreakdownMessageKeysSixtyPercent()(implicit messages: Messages, - dataRequest: DataRequest[_], - appConfig: FrontendAppConfig): Seq[String] = { - val helper = new BeenOnStatutoryLeaveHelper() - furlough.periodBreakdowns.headOption - .map { - _.paymentWithPeriod match { - case _: RegularPaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.sixtyPercent.p1.regular") - ) - case _: AveragePaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.sixtyPercent.p1.average") - ) - case _: CylbPaymentWithPhaseTwoPeriod => - Seq( - messages("phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1"), - messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2"), - messages("phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3", helper.boundaryEnd()) - ) - } - } - .getOrElse(Seq()) - } } sealed trait Metadata diff --git a/app/views/JrsExtensionConfirmationView.scala.html b/app/views/JrsExtensionConfirmationView.scala.html index 0fe4598df..7a936cc39 100644 --- a/app/views/JrsExtensionConfirmationView.scala.html +++ b/app/views/JrsExtensionConfirmationView.scala.html @@ -29,6 +29,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + footer: helper.confirmationFooter, nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, @@ -43,13 +44,19 @@ appConfig: config.FrontendAppConfig ) -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String, isNewStarterType5:Boolean)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) +@( + cvb: ConfirmationViewBreakdownWithoutNicAndPension, + claimPeriod: Period, + version: String, + isNewStarterType5: Boolean, + furloughRate: FurloughGrantRate +)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - @confirmation(claimPeriod, cvb.furlough) + @confirmation(claimPeriod, cvb.furlough, furloughRate) - @additionalPayment(cvb.furlough, EightyPercent) + @additionalPayment(cvb.furlough, furloughRate) @calculationDate(version) @@ -59,7 +66,7 @@ @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - @for(text <- cvb.detailedBreakdownMessageKeys(isNewStarterType5)) { + @for(text <- cvb.detailedBreakdownMessageKeys(furloughRate, isNewStarterType5)) { @p(Html(text)) } @@ -76,17 +83,9 @@ @for(detailedBreakdown <- cvb.detailedBreakdowns) { @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5, claimPeriod.start.getMonth, furloughRate) } -
    -
    -

    @messages("confirmation.no.nic.pension.disclaimer")

    - -

    @messages("confirmation.print.this.page")

    - - @p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) - - @p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) + @footer(cvb.furlough, furloughRate) } diff --git a/app/views/NewConfirmationView.scala.html b/app/views/NewConfirmationView.scala.html deleted file mode 100644 index 7859e567c..000000000 --- a/app/views/NewConfirmationView.scala.html +++ /dev/null @@ -1,91 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import java.time.LocalDate -@import org.apache.commons.lang3.StringUtils._ -@import viewmodels.ConfirmationViewBreakdownWithoutNicAndPension -@import pages.info.ConfirmationPage -@import models.requests.DataRequest -@import config.FrontendAppConfig - -@this( -govukLayout: templates.GovukLayoutWrapper, -h1: components.h1, -h2: components.h2, -h3: components.h3, -p: components.p, -confirmation: helper.confirmationHeading, - nextSteps: helper.confirmationNextSteps, - calculationDate: helper.calculationDate, -additionalPayment: helper.additionalPaymentUpToEightyPercent, -furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, -nicBreakdown: helper.phaseTwoDetailedNicBreakdown, -pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, -button: components.button, -details: components.details, -link: components.link, -appConfig: config.FrontendAppConfig -) - -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String, furloughRate: FurloughGrantRate)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) - -@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { - - @confirmation(claimPeriod, cvb.furlough, furloughRate) - - @additionalPayment(cvb.furlough, furloughRate) - - @calculationDate(version) - - @nextSteps(claimPeriod) - -@button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) - -@h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - - -@for(text <- cvb.detailedBreakdownMessageKeysSixtyPercent) { - @p(Html(text)) -} - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - -@p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - -@for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) -} -
    -
    - -

    - @messages("confirmation.additionalPayment.eligibility") - £@cvb.furlough.diffAtRate(furloughRate).formatted("%.2f.") -

    -

    @messages("confirmation.disclaimer")

    - -

    @messages("confirmation.print.this.page")

    - -@p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) - -@p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) -} - diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html index 80d8c6ea6..5ec5f48ee 100644 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ b/app/views/NoNicAndPensionConfirmationView.scala.html @@ -30,6 +30,7 @@ panelIndent: components.panelIndent, strong: components.strong, confirmation: helper.confirmationHeading, + footer: helper.confirmationFooter, nextSteps: helper.confirmationNextSteps, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, @@ -42,13 +43,19 @@ appConfig: config.FrontendAppConfig ) -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String, isNewStarterType5:Boolean = false)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) +@( + cvb: ConfirmationViewBreakdownWithoutNicAndPension, + claimPeriod: Period, + version: String, + isNewStarterType5:Boolean = false, + furloughRate: FurloughGrantRate +)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) @govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { @confirmation(claimPeriod, cvb.furlough) - @additionalPayment(cvb.furlough, EightyPercent) + @additionalPayment(cvb.furlough, furloughRate) @calculationDate(version) @@ -58,32 +65,22 @@ @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - - @for(text <- cvb.detailedBreakdownMessageKeys(isNewStarterType5)) { + @for(text <- cvb.detailedBreakdownMessageKeys(furloughRate, isNewStarterType5)) { @p(Html(text)) } -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    +

    + @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") + @messages("phaseTwoDetailedBreakdown.p2.a") +

    -@p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - -@for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5) -} -
    -
    + @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) -

    @messages("confirmation.no.nic.pension.disclaimer")

    - -

    @messages("confirmation.print.this.page")

    - -@p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) + @for(detailedBreakdown <- cvb.detailedBreakdowns) { + @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5, claimPeriod.start.getMonth, furloughRate) + } -@p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) + @footer(cvb.furlough, furloughRate) } diff --git a/app/views/PhaseTwoConfirmationView.scala.html b/app/views/PhaseTwoConfirmationView.scala.html index cb2f50d64..4ed90f4f7 100644 --- a/app/views/PhaseTwoConfirmationView.scala.html +++ b/app/views/PhaseTwoConfirmationView.scala.html @@ -36,7 +36,7 @@ appConfig: config.FrontendAppConfig ) -@(cvb: PhaseTwoConfirmationViewBreakdown, claimPeriod: Period, version: String, isNewStarterType5:Boolean = false)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) +@(cvb: PhaseTwoConfirmationViewBreakdown, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) @govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { @@ -94,7 +94,7 @@ @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) @h3(Messages("confirmation.breakdown.summary")) - @for(text <- cvb.detailedBreakdownMessageKeys(isNewStarterType5)) { + @for(text <- cvb.detailedBreakdownMessageKeys) { @p(Html(text)) } @@ -107,7 +107,7 @@ @for(detailedBreakdown <- cvb.detailedBreakdowns) { @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, false, claimPeriod.start.getMonth, EightyPercent) @nicBreakdown(detailedBreakdown.nic, detailedBreakdown.furlough.grant) @pensionBreakdown(detailedBreakdown.pension, detailedBreakdown.furlough.grant) } diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html index ad5cc2345..7b152dc70 100644 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ b/app/views/SeventyPercentConfirmationView.scala.html @@ -29,6 +29,7 @@ p: components.p, confirmation: helper.confirmationHeading, nextSteps: helper.confirmationNextSteps, + footer: helper.confirmationFooter, calculationDate: helper.calculationDate, additionalPayment: helper.additionalPaymentUpToEightyPercent, furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, @@ -52,38 +53,26 @@ @nextSteps(claimPeriod) -@button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) + @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) -@h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) + @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) -@for(text <- cvb.detailedBreakdownMessageKeysSeventyPercent) { - @p(Html(text)) -} - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - -@p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - -@for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) -} -
    -
    + @for(text <- cvb.detailedBreakdownMessageKeys(SeventyPercent, isNewStarterType5 = false)) { + @p(Html(text)) + }

    - @messages("confirmation.additionalPayment.eligibility") - £@cvb.furlough.diffAtRate(SeventyPercent).formatted("%.2f.") + @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") + @messages("phaseTwoDetailedBreakdown.p2.a")

    -

    @messages("confirmation.disclaimer")

    -

    @messages("confirmation.print.this.page")

    + @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) -@p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) + @for(detailedBreakdown <- cvb.detailedBreakdowns) { + @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) + } -@p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) + @footer(cvb.furlough, SeventyPercent) } diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html index f3e9b461d..3b23cf8df 100644 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ b/app/views/SixtyPercentConfirmationView.scala.html @@ -28,6 +28,7 @@ h3: components.h3, p: components.p, confirmation: helper.confirmationHeading, + footer: helper.confirmationFooter, calculationDate: helper.calculationDate, nextSteps: helper.confirmationNextSteps, additionalPayment: helper.additionalPaymentUpToEightyPercent, @@ -56,34 +57,22 @@ @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) -@for(text <- cvb.detailedBreakdownMessageKeysSixtyPercent) { - @p(Html(text)) -} - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - -@p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - -@for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) -} -
    -
    + @for(text <- cvb.detailedBreakdownMessageKeys(SixtyPercent, isNewStarterType5 = false)) { + @p(Html(text)) + }

    - @messages("confirmation.additionalPayment.eligibility") - £@cvb.furlough.diffAtRate(SixtyPercent).formatted("%.2f.") + @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") + @messages("phaseTwoDetailedBreakdown.p2.a")

    -

    @messages("confirmation.disclaimer")

    -

    @messages("confirmation.print.this.page")

    + @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) -@p(Html(link(appConfig.webchatHelpUrl, "confirmation.webchat", true))) + @for(detailedBreakdown <- cvb.detailedBreakdowns) { + @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) + @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) + } -@p(Html(link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", true))) + @footer(cvb.furlough, SixtyPercent) } diff --git a/app/views/helper/FurloughCapHelper.scala b/app/views/helper/FurloughCapHelper.scala index 894c5c716..7f12994d8 100644 --- a/app/views/helper/FurloughCapHelper.scala +++ b/app/views/helper/FurloughCapHelper.scala @@ -27,7 +27,14 @@ import services.Calculators._ class FurloughCapHelper @Inject()() { - def calculationFor(cap: FurloughCap)(implicit messages: Messages): String = + def calculationFor(cap: FurloughCap, furloughRate: FurloughGrantRate, month: Month)(implicit messages: Messages): String = + furloughRate match { + case SixtyPercent => calculationForSixtyPercent(cap, month) + case SeventyPercent => calculationForSeventyPercent(cap, month) + case EightyPercent => calculationForEighty(cap) + } + + def calculationForEighty(cap: FurloughCap)(implicit messages: Messages): String = cap match { case FullPeriodCap(value) => messages("furloughBreakdown.furloughCap.fullPeriodCap", value.formatted("%.2f")) diff --git a/app/views/helper/confirmationFooter.scala.html b/app/views/helper/confirmationFooter.scala.html new file mode 100644 index 000000000..3b5d0b3b1 --- /dev/null +++ b/app/views/helper/confirmationFooter.scala.html @@ -0,0 +1,46 @@ +@* + * Copyright 2021 HM Revenue & Customs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *@ + +@import config.FrontendAppConfig + +@this( + link: components.link, + p: components.p, + strong: components.strong +) + +@( + calculation: PhaseTwoFurloughCalculationResult, + furloughRate: FurloughGrantRate +)(implicit messages: Messages, appConfig: FrontendAppConfig) + +
    +
    + +@if(furloughRate != EightyPercent) { + @p { + @messages("confirmation.additionalPayment.eligibility") + @strong { £@calculation.diffAtRate(furloughRate).formatted("%.2f.") } + } +} + +@p { @messages("confirmation.disclaimer") } + +@p { @link("#", "confirmation.print.this.page", onClickAction = Some("window.print();")) } + +@p { @link(appConfig.webchatHelpUrl, "confirmation.webchat", attrTarget = true) } + +@p { @link(routes.FeedbackSurveyController.startSurvey(), "confirmation.feedbackSurvey.label", attrTarget = true) } diff --git a/app/views/helper/detailedFurloughBreakdown.scala.html b/app/views/helper/detailedFurloughBreakdown.scala.html index c99055f60..93a7879d2 100644 --- a/app/views/helper/detailedFurloughBreakdown.scala.html +++ b/app/views/helper/detailedFurloughBreakdown.scala.html @@ -35,8 +35,8 @@ @if(breakdown.isCapped) { @p(Html(messages("furloughBreakdown.furloughCap.p1", breakdown.calculatedFurlough))) - @p(Html(messages("furloughBreakdown.furloughCap.p2", helper.calculationFor(breakdown.furloughCap)))) - @p(Html(messages("furloughBreakdown.furloughCap.p3", helper.calculationFor(breakdown.furloughCap)))) + @p(Html(messages("furloughBreakdown.furloughCap.p2", helper.calculationForEighty(breakdown.furloughCap)))) + @p(Html(messages("furloughBreakdown.furloughCap.p3", helper.calculationForEighty(breakdown.furloughCap)))) }
    diff --git a/app/views/helper/phaseTwoDetailedFurloughBreakdown.scala.html b/app/views/helper/phaseTwoDetailedFurloughBreakdown.scala.html index 90f4e9fbf..ae234e44a 100644 --- a/app/views/helper/phaseTwoDetailedFurloughBreakdown.scala.html +++ b/app/views/helper/phaseTwoDetailedFurloughBreakdown.scala.html @@ -15,6 +15,7 @@ *@ @import views.helper.FurloughCapHelper +@import java.time.Month @this( h4: components.h4, @@ -24,7 +25,13 @@ appConfig: config.FrontendAppConfig ) -@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, isNewStarterType5:Boolean)(implicit messages: Messages) +@( + breakdown: PhaseTwoFurloughBreakdown, + period: Periods, + isNewStarterType5:Boolean, + month: Month, + furloughRate: FurloughGrantRate +)(implicit messages: Messages) @referencePayBreakdown(breakdown.paymentWithPeriod, period, isNewStarterType5) @@ -36,15 +43,15 @@ } else {
  • @messages("phaseTwoFurloughBreakdown.l1", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
  • } -
  • @messages("phaseTwoFurloughBreakdown.l2")
  • +
  • @messages("phaseTwoFurloughBreakdown.l2", furloughRate.value)
  • @if(breakdown.isCapped) { - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedFurlough))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationFor(breakdown.furloughCap)))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationFor(breakdown.furloughCap)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedFurlough(furloughRate)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationFor(breakdown.furloughCap, furloughRate, month)))) + @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationFor(breakdown.furloughCap, furloughRate, month)))) }
    - @messages("phaseTwoFurloughBreakdown.total", breakdown.grant.value.formatted("%.2f")) + @messages("phaseTwoFurloughBreakdown.total", breakdown.grantAmount(furloughRate).formatted("%.2f"))
    diff --git a/conf/messages.cy b/conf/messages.cy index c01ce522c..e095890d8 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -736,7 +736,7 @@ phaseTwoDetailedBreakdown.sixtyPercent.p1.average = Rhoesoch wybod i ni fod y cy # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 # ---------------------------------------------------------- -phaseTwoDetailedBreakdown.no.nic.p1.extension = Gwnaethoch roi gwybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro ac nad oedd ar eich cyflogres cyn 19 Mawrth 2020. Rydym wedi cyfrifo’i enillion dyddiol cyfartalog drwy rannu cyfanswm ei gyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2020 (neu’r dyddiad y dechreuodd ei gyflogaeth, p’un bynnag sydd hwyraf) a’r diwrnod cyn iddo gael ei roi ar ffyrlo am y tro cyntaf ar neu ar ôl 1 Tachwedd 2020. Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo a’r oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn cyfateb i 80% o hyn. +phaseTwoDetailedBreakdown.no.nic.p1.extension = Gwnaethoch roi gwybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro ac nad oedd ar eich cyflogres cyn 19 Mawrth 2020. Rydym wedi cyfrifo’i enillion dyddiol cyfartalog drwy rannu cyfanswm ei gyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2020 (neu’r dyddiad y dechreuodd ei gyflogaeth, p’un bynnag sydd hwyraf) a’r diwrnod cyn iddo gael ei roi ar ffyrlo am y tro cyntaf ar neu ar ôl 1 Tachwedd 2020. Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo a’r oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn cyfateb i {2}% o hyn. # ---------------------------------------------------------- @@ -815,7 +815,7 @@ phaseTwoReferencePayBreakdown.cylb.higherOf.result = Cyfanswm cyflog yn seiliedi phaseTwoFurloughBreakdown.h4 = Grant ffyrlo phaseTwoFurloughBreakdown.l1 = Cymerwch £{0} (cyflog yn seiliedig ar ddiwrnodau ffyrlo). phaseTwoFurloughBreakdown.l1.partTime = Cymerwch £{0} (cyflog yn seiliedig ar yr oriau a weithiwyd yn ystod y cyfnod cyflog hwn). -phaseTwoFurloughBreakdown.l2 = Lluoswch â 80%. +phaseTwoFurloughBreakdown.l2 = Lluoswch â {0}%. phaseTwoFurloughBreakdown.seventyPercent.l2 = Lluoswch â 70% (cyfradd mis {0}). phaseTwoFurloughBreakdown.sixtyPercent.l2 = Lluoswch â 60% (cyfradd mis {0}). phaseTwoFurloughBreakdown.total = Cyfanswm y grant ffyrlo ar gyfer y cyfnod cyflog = £{0} diff --git a/conf/messages.en b/conf/messages.en index 5e300b3ff..22df5201b 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -731,7 +731,7 @@ phaseTwoDetailedBreakdown.p1.cylb.1 = You told us your employee gets paid a vari phaseTwoDetailedBreakdown.p1.cylb.2 = Method 1: we’ve taken the amounts they were paid for equivalent pay periods in the previous tax year and applied this to the number of furlough days and furlough hours in each pay period. phaseTwoDetailedBreakdown.p1.cylb.3 = Method 2: we’ve worked out their average daily earnings in the last tax year, by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020 if later). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. -phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 80% of this. +phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is {0}% of this. phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 70% of this. phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 60% of this. @@ -745,7 +745,7 @@ phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3 = Method 2: we’ve worked ou # Variable Pay, Employee Type 4 - Worked Less Than Full Year Pre Covid (Averages the pay) - Messages for Pre-Sept, Sept, & Oct # ---------------------------------------------------------- -phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. +phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is {2}% of this. phaseTwoDetailedBreakdown.seventyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. phaseTwoDetailedBreakdown.sixtyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. @@ -753,7 +753,7 @@ phaseTwoDetailedBreakdown.sixtyPercent.p1.average = You told us your employee ge # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 # ---------------------------------------------------------- -phaseTwoDetailedBreakdown.no.nic.p1.extension = You told us your employee gets paid a variable amount each time and was not on your payroll before 19 March 2020. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then, we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. +phaseTwoDetailedBreakdown.no.nic.p1.extension = You told us your employee gets paid a variable amount each time and was not on your payroll before 19 March 2020. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then, we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is {2}% of this. # Shared Breakdown Section Messages # ---------------------------------------------------------- @@ -829,7 +829,7 @@ phaseTwoReferencePayBreakdown.cylb.higherOf.result = Total pay based on hours wo phaseTwoFurloughBreakdown.h4 = Furlough grant phaseTwoFurloughBreakdown.l1 = Take £{0} (pay based on furlough days). phaseTwoFurloughBreakdown.l1.partTime = Take £{0} (pay based on hours worked in this pay period). -phaseTwoFurloughBreakdown.l2 = Multiply by 80% +phaseTwoFurloughBreakdown.l2 = Multiply by {0}% phaseTwoFurloughBreakdown.seventyPercent.l2 = Multiply by 70% ({0} rate). phaseTwoFurloughBreakdown.sixtyPercent.l2 = Multiply by 60% ({0} rate). phaseTwoFurloughBreakdown.total = Total furlough grant for pay period = £{0} diff --git a/it/controllers/ConfirmationControllerISpec.scala b/it/controllers/ConfirmationControllerISpec.scala index 7e9e22777..8f1c23393 100644 --- a/it/controllers/ConfirmationControllerISpec.scala +++ b/it/controllers/ConfirmationControllerISpec.scala @@ -224,39 +224,6 @@ class ConfirmationControllerISpec ) } } - - s"claim period is after ${appConfig.schemeEndDate}" in { - - println(dateToStringFmt(appConfig.schemeEndDate)) - - val userAnswers = emptyUserAnswers - .withFurloughStatus(FurloughStatus.FurloughEnded) - .withFurloughEndDate("2021-05-31") - .withPaymentFrequency(FourWeekly) - .withClaimPeriodStart(dateToStringFmt(appConfig.schemeEndDate.plusMonths(1))) - .withLastYear(List()) - .withPayPeriodsList(PayPeriodsList.Yes) - .withPayMethod(PayMethod.Regular) - .withPartTimeQuestion(PartTimeQuestion.PartTimeNo) - .withRegularPayAmount(3300) - .withFurloughStartDate("2021-05-01") - .withClaimPeriodEnd("2021-05-31") - .withRegularLengthEmployed(RegularLengthEmployed.Yes) - .withPayDate(List("2021-04-30", "2021-05-28", "2021-06-25")) - .withUsualHours(List()) - .withPartTimeHours(List()) - - setAnswers(userAnswers) - - val res = getRequest("/confirmation")("sessionId" -> userAnswers.id, "X-Session-ID" -> userAnswers.id) - - whenReady(res) { result => - result should have( - httpStatus(SEE_OTHER), - redirectLocation("/job-retention-scheme-calculator/error") - ) - } - } } } } diff --git a/test/controllers/ConfirmationControllerSpec.scala b/test/controllers/ConfirmationControllerSpec.scala index 3d90df82d..e7b7eab7c 100644 --- a/test/controllers/ConfirmationControllerSpec.scala +++ b/test/controllers/ConfirmationControllerSpec.scala @@ -202,7 +202,8 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa cvb = breakdown, claimPeriod = period(start = claimStartDate, end = claimEndDate), version = calculatorVersionConf, - isNewStarterType5 = false + isNewStarterType5 = false, + EightyPercent )(dataRequest, messages, appConf).toString status(result) mustEqual OK @@ -260,10 +261,12 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa val result: Future[Result] = controller.onPageLoad()(request) val actual: String = contentAsString(result) - val expected: String = seventyPercentView( + val expected: String = extensionView( cvb = breakdown, claimPeriod = period(start = claimStartDate, end = claimEndDate), - version = calculatorVersionConf + version = calculatorVersionConf, + isNewStarterType5 = false, + SeventyPercent )(dataRequest, messages, appConf).toString status(result) mustEqual OK @@ -320,10 +323,12 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa val result: Future[Result] = controller.onPageLoad()(request) val actual: String = contentAsString(result) - val expected: String = sixtyPercentView( + val expected: String = extensionView( cvb = breakdown, claimPeriod = period(start = claimStartDate, end = claimEndDate), - version = calculatorVersionConf + version = calculatorVersionConf, + isNewStarterType5 = false, + SixtyPercent )(dataRequest, messages, appConf).toString status(result) mustEqual OK @@ -380,10 +385,12 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa val result: Future[Result] = controller.onPageLoad()(request) val actual: String = contentAsString(result) - val expected: String = sixtyPercentView( + val expected: String = extensionView( cvb = breakdown, claimPeriod = period(start = claimStartDate, end = claimEndDate), - version = calculatorVersionConf + version = calculatorVersionConf, + isNewStarterType5 = false, + SixtyPercent )(dataRequest, messages, appConf).toString status(result) mustEqual OK diff --git a/test/models/PeriodBreakdownSpec.scala b/test/models/PeriodBreakdownSpec.scala index 28ea0c6fa..bbf76c722 100644 --- a/test/models/PeriodBreakdownSpec.scala +++ b/test/models/PeriodBreakdownSpec.scala @@ -53,7 +53,7 @@ class PeriodBreakdownSpec extends SpecBaseControllerSpecs with MustMatchers with val breakdown = PhaseTwoFurloughBreakdown(grant, payment, furloughCap) - breakdown.calculatedFurlough mustBe "1069.86" + breakdown.calculatedEighty mustBe "1069.86" } } diff --git a/test/views/JrsExtensionConfirmationViewSpec.scala b/test/views/JrsExtensionConfirmationViewSpec.scala index a8dde169b..73bcb1703 100644 --- a/test/views/JrsExtensionConfirmationViewSpec.scala +++ b/test/views/JrsExtensionConfirmationViewSpec.scala @@ -25,7 +25,7 @@ import models.PartTimeQuestion.PartTimeNo import models.PayMethod.Variable import models.PaymentFrequency.Monthly import models.requests.DataRequest -import models.{EmployeeStarted, Period, UserAnswers} +import models.{EightyPercent, EmployeeStarted, Period, UserAnswers} import org.jsoup.nodes.Document import play.twirl.api.HtmlFormat import utils.LocalDateHelpers.apr6th2020 @@ -140,7 +140,7 @@ class JrsExtensionConfirmationViewSpec implicit val request: DataRequest[_] = fakeDataRequest(userAnswers) def applyView(): HtmlFormat.Appendable = - view(cvb = noNicAndPensionBreakdown, claimPeriod = decClaimPeriod, version = "2", isNewStarterType5 = false) + view(cvb = noNicAndPensionBreakdown, claimPeriod = decClaimPeriod, version = "2", isNewStarterType5 = false, EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -162,7 +162,7 @@ class JrsExtensionConfirmationViewSpec "behave like a page with correct links" must { "have a PrintOrSave link - brings up window.print() when clicked" in { - doc.select(RegularEmployeeTypeOneSelectors.printLink).attr("onClick") mustBe "window.print()" + doc.select(RegularEmployeeTypeOneSelectors.printLink).attr("onClick") mustBe "window.print();" } "have a Webchat link - opens a webchat/contact details page" in { @@ -281,7 +281,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec implicit val request: DataRequest[_] = fakeDataRequest(userAnswers) def applyView(): HtmlFormat.Appendable = - view(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = true) + view(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = true, EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -301,7 +301,7 @@ class EmployeeType5JrsExtensionConfirmationViewSpec "behave like a page with correct links" must { "have a PrintOrSave link - brings up window.print() when clicked" in { - doc.select(VariableEmployeeTypeFiveSelectors.printLink).attr("onClick") mustBe "window.print()" + doc.select(VariableEmployeeTypeFiveSelectors.printLink).attr("onClick") mustBe "window.print();" } "have a Webchat link - opens a webchat/contact details page" in { diff --git a/test/views/confirmation/ConfirmationType3EmployeeViewSpec.scala b/test/views/confirmation/ConfirmationType3EmployeeViewSpec.scala index 9e5dfa07f..96655a485 100644 --- a/test/views/confirmation/ConfirmationType3EmployeeViewSpec.scala +++ b/test/views/confirmation/ConfirmationType3EmployeeViewSpec.scala @@ -25,7 +25,7 @@ import models.PartTimeQuestion.PartTimeNo import models.PayMethod.Variable import models.PaymentFrequency.Monthly import models.requests.DataRequest -import models.{EmployeeStarted, Period, UserAnswers} +import models.{EightyPercent, EmployeeStarted, Period, UserAnswers} import org.jsoup.nodes.Document import play.twirl.api.HtmlFormat import utils.LocalDateHelpers._ @@ -77,7 +77,11 @@ class ConfirmationType3EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = false) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = false, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -98,7 +102,11 @@ class ConfirmationType3EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = false) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = false, + EightyPercent) implicit val doc: Document = asDocument(applyView()) diff --git a/test/views/confirmation/ConfirmationType4EmployeeViewSpec.scala b/test/views/confirmation/ConfirmationType4EmployeeViewSpec.scala index 7ef474ed2..147c88378 100644 --- a/test/views/confirmation/ConfirmationType4EmployeeViewSpec.scala +++ b/test/views/confirmation/ConfirmationType4EmployeeViewSpec.scala @@ -26,7 +26,7 @@ import models.PartTimeQuestion.PartTimeNo import models.PayMethod.Variable import models.PaymentFrequency.Monthly import models.requests.DataRequest -import models.{EmployeeStarted, Period, UserAnswers} +import models.{EightyPercent, EmployeeStarted, Period, UserAnswers} import org.jsoup.nodes.Document import play.twirl.api.HtmlFormat import utils.LocalDateHelpers._ @@ -77,7 +77,11 @@ class ConfirmationType4EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = false) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = false, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -96,7 +100,11 @@ class ConfirmationType4EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = false) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = false, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -118,7 +126,11 @@ class ConfirmationType4EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = false) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = false, + EightyPercent) implicit val doc: Document = asDocument(applyView()) diff --git a/test/views/confirmation/ConfirmationType5EmployeeViewSpec.scala b/test/views/confirmation/ConfirmationType5EmployeeViewSpec.scala index efd727d7f..ca23308e4 100644 --- a/test/views/confirmation/ConfirmationType5EmployeeViewSpec.scala +++ b/test/views/confirmation/ConfirmationType5EmployeeViewSpec.scala @@ -26,7 +26,7 @@ import models.PartTimeQuestion.PartTimeNo import models.PayMethod.Variable import models.PaymentFrequency.Monthly import models.requests.DataRequest -import models.{EmployeeStarted, Period, UserAnswers} +import models.{EightyPercent, EmployeeStarted, Period, UserAnswers} import org.jsoup.nodes.Document import play.twirl.api.HtmlFormat import utils.LocalDateHelpers.apr6th2020 @@ -106,7 +106,11 @@ class ConfirmationType5EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = true) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = true, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -127,7 +131,11 @@ class ConfirmationType5EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = novClaimPeriod, version = "2", isNewStarterType5 = true) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = novClaimPeriod, + version = "2", + isNewStarterType5 = true, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -148,7 +156,11 @@ class ConfirmationType5EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = mayClaimPeriod, version = "2", isNewStarterType5 = true) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = mayClaimPeriod, + version = "2", + isNewStarterType5 = true, + EightyPercent) implicit val doc: Document = asDocument(applyView()) @@ -169,7 +181,11 @@ class ConfirmationType5EmployeeViewSpec } def applyView(): HtmlFormat.Appendable = - extConfirmationView(cvb = noNicAndPensionBreakdown, claimPeriod = mayClaimPeriod, version = "2", isNewStarterType5 = true) + extConfirmationView(cvb = noNicAndPensionBreakdown, + claimPeriod = mayClaimPeriod, + version = "2", + isNewStarterType5 = true, + EightyPercent) implicit val doc: Document = asDocument(applyView()) doc.toString.contains(statLeaveOnly(None, dateToString(LocalDate.parse("2021-05-01")))) mustBe true diff --git a/test/views/helper/FurloughCapHelperSpec.scala b/test/views/helper/FurloughCapHelperSpec.scala index ca70ac75b..20a3af746 100644 --- a/test/views/helper/FurloughCapHelperSpec.scala +++ b/test/views/helper/FurloughCapHelperSpec.scala @@ -22,6 +22,8 @@ import play.api.i18n.Messages import play.api.test.Helpers import views.helper.FurloughCapHelper +import java.time.Month + class FurloughCapHelperSpec extends SpecBase { val instance = new FurloughCapHelper() @@ -54,49 +56,61 @@ class FurloughCapHelperSpec extends SpecBase { "calculationFor" must { "return a templated message for FullPeriodCap" in { - instance.calculationFor(FullPeriodCap(100.00)) mustBe "100.00" + instance.calculationFor(FullPeriodCap(100.00), EightyPercent, Month.NOVEMBER) mustBe "100.00" } "return a templated message for FullPeriodCapWithPartTime" in { - instance.calculationFor(FullPeriodCapWithPartTime(100.00, 200.00, 20.00, 10.00)) mustBe "200.00|20.00|10.00|100.00" + instance + .calculationFor(FullPeriodCapWithPartTime(100.00, 200.00, 20.00, 10.00), EightyPercent, Month.NOVEMBER) mustBe "200.00|20.00|10.00|100.00" } "return a templated message for PeriodSpansMonthCap" in { val cap = PeriodSpansMonthCap(2621.15, 17, 3, 80.65, 15, 4, 83.34) - instance.calculationFor(cap) mustBe "17|March|80.65|15|April|83.34|2621.15" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "17|March|80.65|15|April|83.34|2621.15" } "return a templated message for PeriodSpansMonthCapWithPartTime" in { val cap = PeriodSpansMonthCapWithPartTime(2621.15, 17, 3, 80.65, 15, 4, 83.34, 0.00, 0.00, 0.00) - instance.calculationFor(cap) mustBe "17|March|80.65|15|April|83.34|0.00|0.00|2621.15" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "17|March|80.65|15|April|83.34|0.00|0.00|2621.15" } "round the values for PeriodSpansMonthCap" in { val cap = PeriodSpansMonthCap(2621.150, 17, 3, 80.650, 15, 4, 83.340) - instance.calculationFor(cap) mustBe "17|March|80.65|15|April|83.34|2621.15" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "17|March|80.65|15|April|83.34|2621.15" } "return a templated message for PartialPeriodCap" in { val cap = PartialPeriodCap(1774.30, 22, 3, 80.65) - instance.calculationFor(cap) mustBe "22|March|80.65|1774.30" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "22|March|80.65|1774.30" } "return a templated message for PartialPeriodCapWithPartTime" in { val cap = PartialPeriodCapWithPartTime(1774.30, 22, 3, 80.65, 0.00, 0.00, 0.00) - instance.calculationFor(cap) mustBe "22|March|80.65|0.00|0.00|1774.30" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "22|March|80.65|0.00|0.00|1774.30" } "round the values for PartialPeriodCap" in { val cap = PartialPeriodCap(1774.3, 22, 3, 80.650) - instance.calculationFor(cap) mustBe "22|March|80.65|1774.30" + instance.calculationFor(cap, EightyPercent, Month.NOVEMBER) mustBe "22|March|80.65|1774.30" + } + + "return the correct values for 70% rate" in { + val cap = PartialPeriodCap(1774.3, 22, 3, 80.650) + + instance.calculationFor(cap, SeventyPercent, Month.JULY) mustBe "22|March|70.57|1552.51" } + "return the correct values for 60% rate" in { + val cap = PartialPeriodCap(1774.3, 22, 3, 80.650) + + instance.calculationFor(cap, SixtyPercent, Month.AUGUST) mustBe "22|March|60.49|1330.73" + } } } From c4c8f0391e7e9a1d934c5758924b3c9e30dc6df9 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:22:19 +0100 Subject: [PATCH 11/14] [CVSRP-4673] Remove unused views --- app/controllers/ConfirmationController.scala | 34 +------- ...NoNicAndPensionConfirmationView.scala.html | 86 ------------------- .../SeventyPercentConfirmationView.scala.html | 78 ----------------- .../SixtyPercentConfirmationView.scala.html | 78 ----------------- ...FurloughBreakdownSeventyPercent.scala.html | 51 ----------- ...edFurloughBreakdownSixtyPercent.scala.html | 51 ----------- .../ConfirmationControllerSpec.scala | 16 ++-- 7 files changed, 7 insertions(+), 387 deletions(-) delete mode 100644 app/views/NoNicAndPensionConfirmationView.scala.html delete mode 100644 app/views/SeventyPercentConfirmationView.scala.html delete mode 100644 app/views/SixtyPercentConfirmationView.scala.html delete mode 100644 app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html delete mode 100644 app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html diff --git a/app/controllers/ConfirmationController.scala b/app/controllers/ConfirmationController.scala index 9f9dc80e3..90dc04cd9 100644 --- a/app/controllers/ConfirmationController.scala +++ b/app/controllers/ConfirmationController.scala @@ -20,7 +20,7 @@ import cats.data.Validated.{Invalid, Valid} import config.{CalculatorVersionConfiguration, FrontendAppConfig} import controllers.actions._ import handlers.{ConfirmationControllerRequestHandler, ErrorHandler} -import models.{EightyPercent, FurloughGrantRate, UserAnswers} +import models.{FurloughGrantRate, UserAnswers} import navigation.Navigator import play.api.i18n.MessagesApi import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -30,8 +30,6 @@ import utils.{PagerDutyHelper, YearMonthHelper} import viewmodels.{ConfirmationDataResultWithoutNicAndPension, PhaseOneConfirmationDataResult, PhaseTwoConfirmationDataResult} import views.html._ -import java.time.Month._ -import java.time.YearMonth import javax.inject.Inject import scala.concurrent.ExecutionContext @@ -44,9 +42,6 @@ class ConfirmationController @Inject()( employeeTypeService: EmployeeTypeService, viewWithDetailedBreakdowns: ConfirmationViewWithDetailedBreakdowns, phaseTwoView: PhaseTwoConfirmationView, - noNicAndPensionView: NoNicAndPensionConfirmationView, - seventyPercentConfirmationView: SeventyPercentConfirmationView, - sixtyPercentConfirmationView: SixtyPercentConfirmationView, extensionView: JrsExtensionConfirmationView, auditService: AuditService, val navigator: Navigator)(implicit val errorHandler: ErrorHandler, ec: ExecutionContext, appConfig: FrontendAppConfig) @@ -66,40 +61,15 @@ class ConfirmationController @Inject()( auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) Ok(phaseTwoView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) case Valid(data: ConfirmationDataResultWithoutNicAndPension) => { - auditService.sendCalculationPerformed(request.userAnswers, data.confirmationViewBreakdown) - - val furloughRate = FurloughGrantRate.rateForYearMonth(data.metaData.claimPeriod.start.getYearMonth) - Ok( extensionView( data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf, employeeTypeService.isType5NewStarter(), - furloughRate + FurloughGrantRate.rateForYearMonth(data.metaData.claimPeriod.start.getYearMonth) )) - -// data.metaData.claimPeriod.start.getYearMonth match { -// case yearMonth if yearMonth == AUGUST.inYear(y2020) => -// Ok(noNicAndPensionView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf, false, EightyPercent)) -// case yearMonth if yearMonth == SEPTEMBER.inYear(y2020) || yearMonth == JULY.inYear(y2021) => -// Ok(seventyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) -// case yearMonth -// if yearMonth == OCTOBER.inYear(y2020) || yearMonth == AUGUST.inYear(y2021) || yearMonth == SEPTEMBER.inYear(y2021) => -// Ok(sixtyPercentConfirmationView(data.confirmationViewBreakdown, data.metaData.claimPeriod, calculatorVersionConf)) -// case yearMonth if yearMonth.isBetweenInclusive(appConfig.extensionStartDate.getYearMonth, appConfig.schemeEndDate.getYearMonth) => -// Ok( -// extensionView( -// data.confirmationViewBreakdown, -// data.metaData.claimPeriod, -// calculatorVersionConf, -// employeeTypeService.isType5NewStarter(), -// furloughRate -// )) -// case _ => -// Redirect(routes.ErrorController.somethingWentWrong()) -// } } case Invalid(e) => auditService.sendCalculationFailed(request.userAnswers) diff --git a/app/views/NoNicAndPensionConfirmationView.scala.html b/app/views/NoNicAndPensionConfirmationView.scala.html deleted file mode 100644 index 5ec5f48ee..000000000 --- a/app/views/NoNicAndPensionConfirmationView.scala.html +++ /dev/null @@ -1,86 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import java.time.LocalDate -@import org.apache.commons.lang3.StringUtils._ -@import viewmodels.ConfirmationViewBreakdownWithoutNicAndPension -@import pages.info.ConfirmationPage -@import models.requests.DataRequest -@import config.FrontendAppConfig - -@this( - govukLayout: templates.GovukLayoutWrapper, - h1: components.h1, - h2: components.h2, - h3: components.h3, - p: components.p, - panelIndent: components.panelIndent, - strong: components.strong, - confirmation: helper.confirmationHeading, - footer: helper.confirmationFooter, - nextSteps: helper.confirmationNextSteps, - calculationDate: helper.calculationDate, - additionalPayment: helper.additionalPaymentUpToEightyPercent, - furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdown, - nicBreakdown: helper.phaseTwoDetailedNicBreakdown, - pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, - button: components.button, - details: components.details, - link: components.link, - appConfig: config.FrontendAppConfig -) - -@( - cvb: ConfirmationViewBreakdownWithoutNicAndPension, - claimPeriod: Period, - version: String, - isNewStarterType5:Boolean = false, - furloughRate: FurloughGrantRate -)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) - -@govukLayout(pageTitle = Some(titleNoForm("confirmation.no.nic.pension.title")), showBackButton = false, thisPage = ConfirmationPage) { - - @confirmation(claimPeriod, cvb.furlough) - - @additionalPayment(cvb.furlough, furloughRate) - - @calculationDate(version) - - @nextSteps(claimPeriod) - - @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) - - @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - @for(text <- cvb.detailedBreakdownMessageKeys(furloughRate, isNewStarterType5)) { - @p(Html(text)) - } - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - - @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - - @for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, isNewStarterType5, claimPeriod.start.getMonth, furloughRate) - } - - @footer(cvb.furlough, furloughRate) -} - diff --git a/app/views/SeventyPercentConfirmationView.scala.html b/app/views/SeventyPercentConfirmationView.scala.html deleted file mode 100644 index 7b152dc70..000000000 --- a/app/views/SeventyPercentConfirmationView.scala.html +++ /dev/null @@ -1,78 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import java.time.LocalDate -@import org.apache.commons.lang3.StringUtils._ -@import viewmodels.ConfirmationViewBreakdownWithoutNicAndPension -@import pages.info.ConfirmationPage -@import models.requests.DataRequest -@import config.FrontendAppConfig - -@this( -govukLayout: templates.GovukLayoutWrapper, -h1: components.h1, -h2: components.h2, -h3: components.h3, -p: components.p, -confirmation: helper.confirmationHeading, - nextSteps: helper.confirmationNextSteps, - footer: helper.confirmationFooter, - calculationDate: helper.calculationDate, - additionalPayment: helper.additionalPaymentUpToEightyPercent, -furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSeventyPercent, -nicBreakdown: helper.phaseTwoDetailedNicBreakdown, -pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, -button: components.button, -details: components.details, -link: components.link, -appConfig: config.FrontendAppConfig -) - -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) - -@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { - - @confirmation(claimPeriod, cvb.furlough, SeventyPercent) - - @additionalPayment(cvb.furlough, SeventyPercent) - - @calculationDate(version) - - @nextSteps(claimPeriod) - - @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) - - @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - @for(text <- cvb.detailedBreakdownMessageKeys(SeventyPercent, isNewStarterType5 = false)) { - @p(Html(text)) - } - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - - @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - - @for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) - } - - @footer(cvb.furlough, SeventyPercent) -} - diff --git a/app/views/SixtyPercentConfirmationView.scala.html b/app/views/SixtyPercentConfirmationView.scala.html deleted file mode 100644 index 3b23cf8df..000000000 --- a/app/views/SixtyPercentConfirmationView.scala.html +++ /dev/null @@ -1,78 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import java.time.LocalDate -@import org.apache.commons.lang3.StringUtils._ -@import viewmodels.ConfirmationViewBreakdownWithoutNicAndPension -@import pages.info.ConfirmationPage -@import models.requests.DataRequest -@import config.FrontendAppConfig - -@this( -govukLayout: templates.GovukLayoutWrapper, -h1: components.h1, -h2: components.h2, -h3: components.h3, -p: components.p, -confirmation: helper.confirmationHeading, - footer: helper.confirmationFooter, - calculationDate: helper.calculationDate, - nextSteps: helper.confirmationNextSteps, - additionalPayment: helper.additionalPaymentUpToEightyPercent, -furloughBreakdown: helper.phaseTwoDetailedFurloughBreakdownSixtyPercent, -nicBreakdown: helper.phaseTwoDetailedNicBreakdown, -pensionBreakdown: helper.phaseTwoDetailedPensionBreakdown, -button: components.button, -details: components.details, -link: components.link, -appConfig: config.FrontendAppConfig -) - -@(cvb: ConfirmationViewBreakdownWithoutNicAndPension, claimPeriod: Period, version: String)(implicit request: DataRequest[_], messages: Messages, appConfig: FrontendAppConfig) - -@govukLayout(pageTitle = Some(titleNoForm("confirmation.title")), showBackButton = false, thisPage = ConfirmationPage) { - - @confirmation(claimPeriod, cvb.furlough, SixtyPercent) - - @additionalPayment(cvb.furlough, SixtyPercent) - - @calculationDate(version) - - @nextSteps(claimPeriod) - - @button(messages("confirmation.startAgain"), href = Some(routes.ClaimPeriodQuestionController.onPageLoad()), classes = Some("govuk-button")) - - @h2(Html(messages("confirmation.no.nic.pension.breakdown.summary")), classes = Some("govuk-heading-m")) - - @for(text <- cvb.detailedBreakdownMessageKeys(SixtyPercent, isNewStarterType5 = false)) { - @p(Html(text)) - } - -

    - @messages("phaseTwoDetailedBreakdown.no.nic.pension.p2") - @messages("phaseTwoDetailedBreakdown.p2.a") -

    - - @p(Html(messages("phaseTwoDetailedBreakdown.p3"))) - - @for(detailedBreakdown <- cvb.detailedBreakdowns) { - @h3(Messages("phaseTwoDetailedBreakdown.h3", detailedBreakdown.payPeriodStart, detailedBreakdown.payPeriodEnd)) - @furloughBreakdown(detailedBreakdown.furlough, detailedBreakdown.period, claimPeriod.start.getMonth) - } - - @footer(cvb.furlough, SixtyPercent) -} - diff --git a/app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html b/app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html deleted file mode 100644 index 2180406e5..000000000 --- a/app/views/helper/phaseTwoDetailedFurloughBreakdownSeventyPercent.scala.html +++ /dev/null @@ -1,51 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import views.helper.FurloughCapHelper -@import java.time.Month - -@this( - h4: components.h4, - p: components.p, - helper: FurloughCapHelper, - referencePayBreakdown: phaseTwoReferencePayBreakdown, - appConfig: config.FrontendAppConfig -) - -@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, month: Month, isNewStarterType5:Boolean = false)(implicit messages: Messages) - - @referencePayBreakdown(breakdown.paymentWithPeriod, period, isNewStarterType5) - - @h4(messages("phaseTwoFurloughBreakdown.h4")) - -
      - @if(breakdown.paymentWithPeriod.phaseTwoPeriod.isPartTime) { -
    1. @messages("phaseTwoFurloughBreakdown.l1.partTime", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
    2. - } else { -
    3. @messages("phaseTwoFurloughBreakdown.l1", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
    4. - } -
    5. @messages("phaseTwoFurloughBreakdown.seventyPercent.l2", messages(s"month.${month.getValue}"))
    6. -
    - - @if(breakdown.isCapped) { - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedSeventy))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForSeventyPercent(breakdown.furloughCap, month)))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForSeventyPercent(breakdown.furloughCap, month)))) - } - -
    - @messages("phaseTwoFurloughBreakdown.total", breakdown.seventy.formatted("%.2f")) -
    diff --git a/app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html b/app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html deleted file mode 100644 index 3f167d13d..000000000 --- a/app/views/helper/phaseTwoDetailedFurloughBreakdownSixtyPercent.scala.html +++ /dev/null @@ -1,51 +0,0 @@ -@* - * Copyright 2021 HM Revenue & Customs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *@ - -@import views.helper.FurloughCapHelper -@import java.time.Month - -@this( - h4: components.h4, - p: components.p, - helper: FurloughCapHelper, - referencePayBreakdown: phaseTwoReferencePayBreakdown, - appConfig: config.FrontendAppConfig -) - -@(breakdown: PhaseTwoFurloughBreakdown, period: Periods, month: Month, isNewStarterType5:Boolean = false)(implicit messages: Messages) - - @referencePayBreakdown(breakdown.paymentWithPeriod, period, isNewStarterType5) - - @h4(messages("phaseTwoFurloughBreakdown.h4")) - -
      - @if(breakdown.paymentWithPeriod.phaseTwoPeriod.isPartTime) { -
    1. @messages("phaseTwoFurloughBreakdown.l1.partTime", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
    2. - } else { -
    3. @messages("phaseTwoFurloughBreakdown.l1", breakdown.paymentWithPeriod.referencePay.value.formatted("%.2f"))
    4. - } -
    5. @messages("phaseTwoFurloughBreakdown.sixtyPercent.l2", messages(s"month.${month.getValue}"))
    6. -
    - - @if(breakdown.isCapped) { - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p1", breakdown.calculatedSixty))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p2", helper.calculationForSixtyPercent(breakdown.furloughCap, month)))) - @p(Html(messages("phaseTwoFurloughBreakdown.furloughCap.p3", helper.calculationForSixtyPercent(breakdown.furloughCap, month)))) - } - -
    - @messages("phaseTwoFurloughBreakdown.total", breakdown.sixty.formatted("%.2f")) -
    diff --git a/test/controllers/ConfirmationControllerSpec.scala b/test/controllers/ConfirmationControllerSpec.scala index e7b7eab7c..cf27139d0 100644 --- a/test/controllers/ConfirmationControllerSpec.scala +++ b/test/controllers/ConfirmationControllerSpec.scala @@ -43,14 +43,11 @@ import scala.concurrent.Future class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDataBuilder { - val view = app.injector.instanceOf[ConfirmationViewWithDetailedBreakdowns] - val noNicView = app.injector.instanceOf[NoNicAndPensionConfirmationView] - val phaseTwoView = app.injector.instanceOf[PhaseTwoConfirmationView] - val seventyPercentView = app.injector.instanceOf[SeventyPercentConfirmationView] - val sixtyPercentView = app.injector.instanceOf[SixtyPercentConfirmationView] - val extensionView = app.injector.instanceOf[JrsExtensionConfirmationView] - val audit = app.injector.instanceOf[AuditService] - val service = app.injector.instanceOf[EmployeeTypeService] + val view = app.injector.instanceOf[ConfirmationViewWithDetailedBreakdowns] + val phaseTwoView = app.injector.instanceOf[PhaseTwoConfirmationView] + val extensionView = app.injector.instanceOf[JrsExtensionConfirmationView] + val audit = app.injector.instanceOf[AuditService] + val service = app.injector.instanceOf[EmployeeTypeService] val controller = new ConfirmationController( messagesApi = messagesApi, @@ -61,9 +58,6 @@ class ConfirmationControllerSpec extends SpecBaseControllerSpecs with CoreTestDa employeeTypeService = service, viewWithDetailedBreakdowns = view, phaseTwoView = phaseTwoView, - noNicAndPensionView = noNicView, - seventyPercentConfirmationView = seventyPercentView, - sixtyPercentConfirmationView = sixtyPercentView, extensionView = extensionView, auditService = audit, navigator = navigator From 5583f9730365fbf558f9b6e04e87a2564cf38bf0 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:41:18 +0100 Subject: [PATCH 12/14] [CVSRP-4673] Remove unused messages and correct welsh --- .../ConfirmationViewBreakdown.scala | 4 ++-- conf/messages.cy | 20 +++---------------- conf/messages.en | 15 -------------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/app/viewmodels/ConfirmationViewBreakdown.scala b/app/viewmodels/ConfirmationViewBreakdown.scala index cd94217c2..60b208052 100644 --- a/app/viewmodels/ConfirmationViewBreakdown.scala +++ b/app/viewmodels/ConfirmationViewBreakdown.scala @@ -121,11 +121,11 @@ case class PhaseTwoConfirmationViewBreakdown(furlough: PhaseTwoFurloughCalculati _.paymentWithPeriod match { case _: RegularPaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.p1.regular") + messages("phaseTwoDetailedBreakdown.p1.regular", EightyPercent.value) ) case _: AveragePaymentWithPhaseTwoPeriod => Seq( - messages("phaseTwoDetailedBreakdown.p1.average", helper.boundaryStart(), helper.boundaryEnd()) + messages("phaseTwoDetailedBreakdown.p1.average", helper.boundaryStart(), helper.boundaryEnd(), EightyPercent.value) ) case _: CylbPaymentWithPhaseTwoPeriod => Seq( diff --git a/conf/messages.cy b/conf/messages.cy index e095890d8..bcca67013 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -343,12 +343,6 @@ confirmation.additionalPayment.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £ confirmation.additionalPayment.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. confirmation.additionalPayment.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw -confirmation.seventyPercent.p1 = Grant ffyrlo -confirmation.seventyPercent.p2 = (Cyfradd mis {0}: 70% o gyflogau) - -confirmation.sixtyPercent.p1 = Grant ffyrlo -confirmation.sixtyPercent.p2 = (Cyfradd mis {0}: 60% o gyflogau) - claimPeriodStart.title = Beth yw dyddiad dechrau’r hawliad hwn? claimPeriodStart.heading = Beth yw dyddiad dechrau’r hawliad hwn? claimPeriodStart.p1 = O 1 Gorffennaf ymlaen, mae’n rhaid i hawliadau ddechrau a dod i ben yn ystod yr un mis calendr. @@ -726,12 +720,8 @@ partTimeNormalHours.p1 = Dyma nifer yr oriau y byddai wedi disgwyl i’r cyfloga partTimeNormalHours.p2 = Dewch o hyd i ragor o wybodaeth am sut i {0} partTimeNormalHours.link = gyfrifo oriau arferol ac oriau ffyrlo eich cyflogai (yn agor ffenestr neu dab newydd). -phaseTwoDetailedBreakdown.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 80% o hyn. -phaseTwoDetailedBreakdown.seventyPercent.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.sixtyPercent.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. -phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.seventyPercent.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.sixtyPercent.p1.average = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am lai na 12 mis. Rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm y cyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn 60% o hyn. +phaseTwoDetailedBreakdown.p1.regular = Rhoesoch wybod i ni fod y cyflogai hwn yn cael cyflog rheolaidd bob tro. Rydym wedi cyfrifo ei enillion dyddiol ac wedi’u lluosi â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. Mae’r grant ffyrlo yn {0}% o hyn. +phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is {2}% of this. # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 # ---------------------------------------------------------- @@ -743,9 +733,7 @@ phaseTwoDetailedBreakdown.no.nic.p1.extension = Gwnaethoch roi gwybod i ni fod e phaseTwoDetailedBreakdown.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 80% o hyn. phaseTwoDetailedBreakdown.p1.cylb.2 = Dull 1: rydym wedi defnyddio’r dull ‘edrych yn ôl ar y calendr’ i ystyried y symiau a dalwyd i’r cyflogai yn ystod cyfnodau cyflog cyfatebol. Yna, gwnaethom ddefnyddio hyn wrth ystyried nifer y diwrnodau ffyrlo ym mhob cyfnod cyflog. phaseTwoDetailedBreakdown.p1.cylb.3 = Dull 2: rydym wedi cyfrifo ei enillion dyddiol cyfartalog yn ystod y flwyddyn dreth ddiwethaf, drwy rannu cyfanswm ei gyflog â nifer y diwrnodau calendr rhwng 6 Ebrill 2019 a’r diwrnod cyn y ffyrlo (neu 5 Ebrill 2020 os yw hynny’n hwyrach). Yna, rydym wedi lluosi hynny â nifer y diwrnodau ffyrlo ac oriau ffyrlo ym mhob cyfnod cyflog. -phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 80% o hyn. -phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 70% o hyn. -phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn 60% o hyn. +phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = Rhoesoch wybod i ni fod eich cyflogai yn cael cyflog amrywiol bob tro a’i fod wedi gweithio i chi am fwy na 12 mis. Mae’r cyflogai wedi gweithio yn ystod y cyfnod hawlio. Mae 2 ddull y gallwn eu defnyddio i gyfrifo cyflog. Rydym wedi defnyddio’r un a roddodd y ffigur uchaf. Mae’r grant ffyrlo yn {0}% o hyn. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.2 = Dull 1: rydym wedi ystyried y symiau a dalwyd iddo ar gyfer cyfnodau cyflog cyfatebol yn y flwyddyn dreth flaenorol, ac wedi defnyddio’r rhain wrth ystyried nifer y diwrnodau ffyrlo a’r oriau ffyrlo ym mhob cyfnod cyflog. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3 = Dull 2: we’ve worked out their average daily earnings in the last tax year, by dividing their total pay by the number of calendar days between 6 April 2019 and {0}. Then we’ve multiplied that by the number of furlough days in each pay period. phaseTwoDetailedBreakdown.p2 = Mae yna uchafswm y gallwch ei hawlio am grant ffyrlo a chyfraniadau Yswiriant Gwladol y cyflogwr. Os yw hyn yn effeithio ar eich hawliad, rydym wedi addasu’r cyfrifiadau. @@ -816,8 +804,6 @@ phaseTwoFurloughBreakdown.h4 = Grant ffyrlo phaseTwoFurloughBreakdown.l1 = Cymerwch £{0} (cyflog yn seiliedig ar ddiwrnodau ffyrlo). phaseTwoFurloughBreakdown.l1.partTime = Cymerwch £{0} (cyflog yn seiliedig ar yr oriau a weithiwyd yn ystod y cyfnod cyflog hwn). phaseTwoFurloughBreakdown.l2 = Lluoswch â {0}%. -phaseTwoFurloughBreakdown.seventyPercent.l2 = Lluoswch â 70% (cyfradd mis {0}). -phaseTwoFurloughBreakdown.sixtyPercent.l2 = Lluoswch â 60% (cyfradd mis {0}). phaseTwoFurloughBreakdown.total = Cyfanswm y grant ffyrlo ar gyfer y cyfnod cyflog = £{0} phaseTwoFurloughBreakdown.furloughCap.p1 = Grant ffyrlo wedi’i gyfrifo = £{0} phaseTwoFurloughBreakdown.furloughCap.p2 = Mae’r grant ffyrlo amcangyfrifedig yn fwy na’r grant ffyrlo uchaf ar gyfer y cyfnod cyflog hwn. Oherwydd hyn, mae’n rhaid i chi ddefnyddio’r grant ffyrlo uchaf, sef £{0}. diff --git a/conf/messages.en b/conf/messages.en index 22df5201b..672a88dc2 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -335,12 +335,6 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Coronavirus Job Retention Scheme confirmation.no.nic.pension.breakdown.summary = Breakdown of calculations confirmation.no.nic.pension.disclaimer = The results of the calculation rely on the accuracy of the information you entered, for which you are responsible. You cannot claim for more money than you are going to pay out under the scheme. -confirmation.seventyPercent.p1 = Furlough grant -confirmation.seventyPercent.p2 = ({0} rate: 70% of wages) - -confirmation.sixtyPercent.p1 = Furlough grant -confirmation.sixtyPercent.p2 = ({0} rate: 60% of wages) - confirmation.breakdown.heading = Breakdown of calculations confirmation.breakdown.p2 = You told us your employee gets paid a {0} @@ -722,8 +716,6 @@ partTimeNormalHours.link = work out your employee’s usual hours and furloughed # Regular Pay, Employee Type 1 & 2 - Pre-Covid & Normal Pay Period before 30th October 2020 - Messages # ---------------------------------------------------------- phaseTwoDetailedBreakdown.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 80% of this. -phaseTwoDetailedBreakdown.seventyPercent.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.sixtyPercent.p1.regular = You told us this employee gets paid a regular amount each time. We’ve worked out their daily earnings and multiplied by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. # Variable Pay, Employee Type 3 - Worked a Full Year Pre Covid - Messages for Pre-Sept, Sept, & Oct. JrsExtension uses default 80% version of messages # ---------------------------------------------------------- @@ -732,8 +724,6 @@ phaseTwoDetailedBreakdown.p1.cylb.2 = Method 1: we’ve taken the amounts they w phaseTwoDetailedBreakdown.p1.cylb.3 = Method 2: we’ve worked out their average daily earnings in the last tax year, by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020 if later). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is {0}% of this. -phaseTwoDetailedBreakdown.seventyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.sixtyPercent.no.nic.pension.p1.cylb.1 = You told us your employee gets paid a variable amount each time and has worked for you for more than 12 months. There are 2 methods we can use to work out pay. We’ve used the one that gave the higher figure. The furlough grant is 60% of this. phaseTwoDetailedBreakdown.statLeave.method2 = You told us this employee was on statutory leave between {0} and {1}. Because of this, for Method 2 we have to remove the number of days they were on statutory leave, and the amount they were paid for these periods from the calculation. phaseTwoDetailedBreakdown.statLeave = You told us this employee was on statutory leave between {0} and {1}. Because of this, we have to remove the number of days they were on statutory leave, and the amount they were paid for these periods from the calculation. @@ -746,9 +736,6 @@ phaseTwoDetailedBreakdown.no.nic.pension.p1.cylb.3 = Method 2: we’ve worked ou # ---------------------------------------------------------- phaseTwoDetailedBreakdown.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between {0} and {1}. Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is {2}% of this. -phaseTwoDetailedBreakdown.seventyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 70% of this. -phaseTwoDetailedBreakdown.sixtyPercent.p1.average = You told us your employee gets paid a variable amount each time and has worked for you for less than 12 months. We’ve worked out their average daily earnings by dividing their total pay by the number of calendar days between 6 April 2019 and the day before furlough (or 5 April 2020, whichever is earlier). Then we’ve multiplied that by the number of furlough days and furlough hours in each pay period. The furlough grant is 60% of this. - # Variable Pay, Employee Type 5 - Eligible for CJRS Extension claims only - Messages for Post-1st of November 2020 # ---------------------------------------------------------- @@ -830,8 +817,6 @@ phaseTwoFurloughBreakdown.h4 = Furlough grant phaseTwoFurloughBreakdown.l1 = Take £{0} (pay based on furlough days). phaseTwoFurloughBreakdown.l1.partTime = Take £{0} (pay based on hours worked in this pay period). phaseTwoFurloughBreakdown.l2 = Multiply by {0}% -phaseTwoFurloughBreakdown.seventyPercent.l2 = Multiply by 70% ({0} rate). -phaseTwoFurloughBreakdown.sixtyPercent.l2 = Multiply by 60% ({0} rate). phaseTwoFurloughBreakdown.total = Total furlough grant for pay period = £{0} phaseTwoFurloughBreakdown.furloughCap.p1 = Calculated furlough grant = £{0} phaseTwoFurloughBreakdown.furloughCap.p2 = The calculated furlough grant is more than the maximum furlough grant for this pay period. Because of this, you must use the maximum furlough grant, which is {0} From ef5030e166bd06239cface8513ec93c15651c385 Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Thu, 15 Apr 2021 10:11:06 +0100 Subject: [PATCH 13/14] [CVSRP-4673] Refactor the calculation to use the rate passed in rather than hardcoded methods --- app/models/CalculationResult.scala | 13 ++---------- app/models/FurloughGrantRate.scala | 1 + app/models/PeriodBreakdown.scala | 20 +++++-------------- ...itionalPaymentUpToEightyPercent.scala.html | 8 +------- conf/messages.cy | 3 +-- conf/messages.en | 4 +--- .../JRSExtensionConfirmationMessages.scala | 4 ++-- test/models/PeriodBreakdownSpec.scala | 2 +- ...ditionalPaymentUpToEightyPercentSpec.scala | 10 ++++------ .../helper/ConfirmationHeadingSpec.scala | 2 +- 10 files changed, 19 insertions(+), 48 deletions(-) diff --git a/app/models/CalculationResult.scala b/app/models/CalculationResult.scala index 4edbf6fdc..d29d5cc46 100644 --- a/app/models/CalculationResult.scala +++ b/app/models/CalculationResult.scala @@ -18,17 +18,8 @@ package models case class FurloughCalculationResult(total: BigDecimal, periodBreakdowns: Seq[FurloughBreakdown]) case class PhaseTwoFurloughCalculationResult(total: BigDecimal, periodBreakdowns: Seq[PhaseTwoFurloughBreakdown]) { - def seventy = periodBreakdowns.map(_.seventy).sum - def sixty = periodBreakdowns.map(_.sixty).sum - def seventyDiff = total - seventy - def sixtyDiff = total - sixty - def atRate(furloughGrantRate: FurloughGrantRate) = furloughGrantRate match { - case SixtyPercent => sixty - case SeventyPercent => seventy - case EightyPercent => total - } - - def diffAtRate(furloughGrantRate: FurloughGrantRate) = total - atRate(furloughGrantRate) + def atRate(furloughGrantRate: FurloughGrantRate): BigDecimal = periodBreakdowns.map(_.grantAmount(furloughGrantRate)).sum + def diffAtRate(furloughGrantRate: FurloughGrantRate): BigDecimal = total - atRate(furloughGrantRate) } case class NicCalculationResult(total: BigDecimal, periodBreakdowns: Seq[NicBreakdown]) case class PhaseTwoNicCalculationResult(total: BigDecimal, periodBreakdowns: Seq[PhaseTwoNicBreakdown]) diff --git a/app/models/FurloughGrantRate.scala b/app/models/FurloughGrantRate.scala index e3f178b0d..05be82dd0 100644 --- a/app/models/FurloughGrantRate.scala +++ b/app/models/FurloughGrantRate.scala @@ -21,6 +21,7 @@ import java.time.Month._ sealed trait FurloughGrantRate { val value: Int + def asPercentage: BigDecimal = BigDecimal(value) / 100 } case object SixtyPercent extends FurloughGrantRate { override val value: Int = 60 } case object SeventyPercent extends FurloughGrantRate { override val value: Int = 70 } diff --git a/app/models/PeriodBreakdown.scala b/app/models/PeriodBreakdown.scala index a7b48c88f..206ee4f58 100644 --- a/app/models/PeriodBreakdown.scala +++ b/app/models/PeriodBreakdown.scala @@ -109,25 +109,15 @@ sealed trait PhaseTwoPeriodBreakdown { final case class PhaseTwoFurloughBreakdown(grant: Amount, paymentWithPeriod: PaymentWithPhaseTwoPeriod, furloughCap: FurloughCap) extends PhaseTwoPeriodBreakdown { - def isCapped: Boolean = (paymentWithPeriod.referencePay.value * 0.8) > furloughCap.value - def calculatedEighty: String = Amount(paymentWithPeriod.referencePay.value * 0.8).halfUp.value.formatted("%.2f") - def calculatedSeventy: String = Amount(paymentWithPeriod.referencePay.value * 0.7).halfUp.value.formatted("%.2f") - def calculatedSixty: String = Amount(paymentWithPeriod.referencePay.value * 0.6).halfUp.value.formatted("%.2f") - - def seventy = Amount((grant.value / 80) * 70).halfUp.value - def sixty = Amount((grant.value / 80) * 60).halfUp.value + def isCapped: Boolean = (paymentWithPeriod.referencePay.value * 0.8) > furloughCap.value def grantAmount(furloughGrantRate: FurloughGrantRate): BigDecimal = furloughGrantRate match { - case SixtyPercent => sixty - case SeventyPercent => seventy - case EightyPercent => grant.value + case EightyPercent => grant.value + case rate => Amount((grant.value / 80) * rate.value).halfUp.value } - def calculatedFurlough(furloughGrantRate: FurloughGrantRate): String = furloughGrantRate match { - case SixtyPercent => calculatedSixty - case SeventyPercent => calculatedSeventy - case EightyPercent => calculatedEighty - } + def calculatedFurlough(furloughGrantRate: FurloughGrantRate): String = + Amount(paymentWithPeriod.referencePay.value * furloughGrantRate.asPercentage).halfUp.value.formatted("%.2f") } final case class PhaseTwoNicBreakdown(grant: Amount, diff --git a/app/views/helper/additionalPaymentUpToEightyPercent.scala.html b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html index 20d3851b9..75fbca6fd 100644 --- a/app/views/helper/additionalPaymentUpToEightyPercent.scala.html +++ b/app/views/helper/additionalPaymentUpToEightyPercent.scala.html @@ -32,13 +32,7 @@ } else { @p { - @messages(s"confirmation.additionalPayment.inset.p1.1") - £@calculation.diffAtRate(percentage).formatted("%.2f") - @messages(s"confirmation.additionalPayment.inset.p1.2", calculation.atRate(percentage).formatted("%.2f"), calculation.total.formatted("%.2f")) - } - - @p { - @messages(s"confirmation.additionalPayment.inset.p2") + @messages(s"confirmation.additionalPayment.inset.p1", s"£${calculation.diffAtRate(percentage).formatted("%.2f")}") } @p { diff --git a/conf/messages.cy b/conf/messages.cy index bcca67013..4213f0575 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -338,8 +338,7 @@ confirmation.no.nic.pension.nextSteps.li.4.2 = Cynllun Cadw Swyddi yn sgil Coron confirmation.no.nic.pension.breakdown.summary = Dadansoddiad o gyfrifiadau confirmation.no.nic.pension.disclaimer = Mae canlyniadau’r cyfrifiad yn dibynnu ar gywirdeb yr wybodaeth a nodwyd gennych, yr ydych yn gyfrifol amdani. Ni allwch hawlio am fwy o arian nag yr ydych yn mynd i’w dalu allan o dan y cynllun. -confirmation.additionalPayment.inset.p1.1 = Mae’n rhaid i chi dalu -confirmation.additionalPayment.inset.p1.2 = yn ychwanegol at y grant ffyrlo o £{0}. Mae hyn yn cynrychioli 80% o’i gyflog arferol (£{1}). +confirmation.additionalPayment.inset.p1 = You must pay this employee an additional £{0} to be eligible for this grant. This is because employees must be paid at least 80% of their wages. confirmation.additionalPayment.inset.p2 = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu o leiaf 80% o’u cyflog arferol i’ch cyflogeion am y cyfnod y maent ar ffyrlo. Gallwch ddewis talu mwy na hyn, ond does dim rhaid i chi wneud hynny. confirmation.additionalPayment.eligibility = Er mwyn bod yn gymwys ar gyfer y grant, mae’n rhaid i chi dalu 80% o gyflog cyflogeion sydd ar ffyrlo am y cyfnod y maent ar ffyrlo (hyd at uchafswm o £2,500 y mis). Y swm y mae’n rhaid i chi ei dalu i’r cyflogai hwn yn ogystal â’r grant yw diff --git a/conf/messages.en b/conf/messages.en index 672a88dc2..f36c5c1b6 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -316,9 +316,7 @@ confirmation.nextSteps.li.4.2 = Job Retention Scheme online claim service (opens confirmation.startAgain = Start another calculation confirmation.webchat = Webchat help (opens in a new tab). -confirmation.additionalPayment.inset.p1.1 = You must pay this employee -confirmation.additionalPayment.inset.p1.2 = in addition to the furlough grant of £{0}. This adds up to 80% of their usual wage (£{1}). -confirmation.additionalPayment.inset.p2 = To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to. +confirmation.additionalPayment.inset.p1 = You must pay this employee an additional {0} to be eligible for this grant. This is because employees must be paid at least 80% of their wages. confirmation.additionalPayment.eligibility = To be eligible for the grant you must pay furloughed employees 80% of their wages for the time they are furloughed (up to a cap of £2,500 per month). The amount you must pay this employee in addition to the grant is confirmation.no.nic.pension.insert.t1 = You cannot claim for employer National Insurance and pension contributions, but the employer must still pay these diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 08aa18712..5a62a9099 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -32,8 +32,8 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { } object AdditionalPaymentBlock { - def p1(topup: BigDecimal, grant: BigDecimal) = - s"You must pay this employee ${currencyFormatter(topup)} in addition to the furlough grant of ${currencyFormatter(grant)}. This adds up to 80% of their usual wage (${currencyFormatter(topup + grant)})." + def p1(topup: BigDecimal) = + s"You must pay this employee an additional £$topup to be eligible for this grant. This is because employees must be paid at least 80% of their wages." val p2 = "To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to." val stillPayNICandPension = diff --git a/test/models/PeriodBreakdownSpec.scala b/test/models/PeriodBreakdownSpec.scala index bbf76c722..1f2b79f89 100644 --- a/test/models/PeriodBreakdownSpec.scala +++ b/test/models/PeriodBreakdownSpec.scala @@ -53,7 +53,7 @@ class PeriodBreakdownSpec extends SpecBaseControllerSpecs with MustMatchers with val breakdown = PhaseTwoFurloughBreakdown(grant, payment, furloughCap) - breakdown.calculatedEighty mustBe "1069.86" + breakdown.calculatedFurlough(EightyPercent) mustBe "1069.86" } } diff --git a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala index cd70d1c92..8cdaf9faa 100644 --- a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala +++ b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala @@ -72,9 +72,8 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( - Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.seventyDiff, calcResult.seventy), - Selectors.p(2) -> AdditionalPaymentBlock.p2, - Selectors.p(3) -> AdditionalPaymentBlock.stillPayNICandPension + Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.diffAtRate(SeventyPercent)), + Selectors.p(2) -> AdditionalPaymentBlock.stillPayNICandPension )) } @@ -85,9 +84,8 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( - Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.sixtyDiff, calcResult.sixty), - Selectors.p(2) -> AdditionalPaymentBlock.p2, - Selectors.p(3) -> AdditionalPaymentBlock.stillPayNICandPension + Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.diffAtRate(SixtyPercent)), + Selectors.p(2) -> AdditionalPaymentBlock.stillPayNICandPension )) } } diff --git a/test/views/helper/ConfirmationHeadingSpec.scala b/test/views/helper/ConfirmationHeadingSpec.scala index 36368b33f..d7830815f 100644 --- a/test/views/helper/ConfirmationHeadingSpec.scala +++ b/test/views/helper/ConfirmationHeadingSpec.scala @@ -79,7 +79,7 @@ class ConfirmationHeadingSpec extends ViewBehaviours { Selectors.h1 -> heading, Selectors.p(1) -> ConfirmationBlock.p1(70), Selectors.p(2) -> ConfirmationBlock.p2(claimPeriod), - Selectors.p(3) -> ConfirmationBlock.claimAmount(calcResult.seventy) + Selectors.p(3) -> ConfirmationBlock.claimAmount(calcResult.atRate(SeventyPercent)) )) } } From ce4581b31560df36527f8429df93f3525f34a35e Mon Sep 17 00:00:00 2001 From: MJCallahanPage <16954819+MJCallahanPage@users.noreply.github.com> Date: Thu, 15 Apr 2021 14:17:32 +0100 Subject: [PATCH 14/14] [CVSRP-4673] Add numeric to test instead of using method to test it --- test/assets/messages/JRSExtensionConfirmationMessages.scala | 2 +- .../views/helper/AdditionalPaymentUpToEightyPercentSpec.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/assets/messages/JRSExtensionConfirmationMessages.scala b/test/assets/messages/JRSExtensionConfirmationMessages.scala index 5a62a9099..78a239ba4 100644 --- a/test/assets/messages/JRSExtensionConfirmationMessages.scala +++ b/test/assets/messages/JRSExtensionConfirmationMessages.scala @@ -33,7 +33,7 @@ object JRSExtensionConfirmationMessages extends ValueFormatter { object AdditionalPaymentBlock { def p1(topup: BigDecimal) = - s"You must pay this employee an additional £$topup to be eligible for this grant. This is because employees must be paid at least 80% of their wages." + s"You must pay this employee an additional ${currencyFormatter(topup)} to be eligible for this grant. This is because employees must be paid at least 80% of their wages." val p2 = "To be eligible for the grant you must pay employees at least 80% of their wages for the time they are furloughed. You can choose to pay more than this but do not have to." val stillPayNICandPension = diff --git a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala index 8cdaf9faa..2c2ecb220 100644 --- a/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala +++ b/test/views/helper/AdditionalPaymentUpToEightyPercentSpec.scala @@ -72,7 +72,7 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( - Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.diffAtRate(SeventyPercent)), + Selectors.p(1) -> AdditionalPaymentBlock.p1(62.5), // 500 - ((500 / 80) * 70) Selectors.p(2) -> AdditionalPaymentBlock.stillPayNICandPension )) } @@ -84,7 +84,7 @@ class AdditionalPaymentUpToEightyPercentSpec extends ViewBehaviours { behave like pageWithExpectedMessages( Seq( - Selectors.p(1) -> AdditionalPaymentBlock.p1(calcResult.diffAtRate(SixtyPercent)), + Selectors.p(1) -> AdditionalPaymentBlock.p1(125), // 500 - ((500 / 80) * 60) Selectors.p(2) -> AdditionalPaymentBlock.stillPayNICandPension )) }