From d383b56640cbb0162907e1f9fdd11cec244f65da Mon Sep 17 00:00:00 2001
From: willjshark <90686675+willjshark@users.noreply.github.com>
Date: Wed, 4 Sep 2024 15:56:08 +0100
Subject: [PATCH] Rentals & RaR - Adjustments: PIA - Create 'Your Property
Income Allowance claim' page
---
...djustmentsCheckYourAnswersController.scala | 2 +-
.../PropertyIncomeAllowanceController.scala | 20 ++++-----
...pertyPeriodSessionRecoveryExtensions.scala | 2 +-
app/navigation/Navigator.scala | 8 ++--
.../PropertyIncomeAllowancePage.scala | 6 +--
.../PropertyIncomeAllowanceSummary.scala | 8 ++--
.../PropertyIncomeAllowanceView.scala.html | 6 +--
conf/app.routes | 13 ++++--
conf/messages.cy | 20 ++++-----
conf/messages.en | 18 ++++----
...ropertyIncomeAllowanceControllerSpec.scala | 45 +++++++++++++------
...yPeriodSessionRecoveryExtensionsSpec.scala | 2 +-
test/navigation/NavigatorSpec.scala | 8 ++--
13 files changed, 91 insertions(+), 67 deletions(-)
diff --git a/app/controllers/adjustments/AdjustmentsCheckYourAnswersController.scala b/app/controllers/adjustments/AdjustmentsCheckYourAnswersController.scala
index 4809bdee..114d8f68 100644
--- a/app/controllers/adjustments/AdjustmentsCheckYourAnswersController.scala
+++ b/app/controllers/adjustments/AdjustmentsCheckYourAnswersController.scala
@@ -52,7 +52,7 @@ class AdjustmentsCheckYourAnswersController @Inject()(
rows = Seq(
PrivateUseAdjustmentSummary.row(taxYear, request.userAnswers),
BalancingChargeSummary.row(taxYear, request.userAnswers),
- PropertyIncomeAllowanceSummary.row(taxYear, request.userAnswers),
+ PropertyIncomeAllowanceSummary.row(taxYear, request.userAnswers, Rentals),
RenovationAllowanceBalancingChargeSummary.row(taxYear, request.userAnswers, Rentals),
ResidentialFinanceCostSummary.row(taxYear, request.userAnswers, Rentals),
UnusedResidentialFinanceCostSummary.row(taxYear, request.userAnswers)
diff --git a/app/controllers/adjustments/PropertyIncomeAllowanceController.scala b/app/controllers/adjustments/PropertyIncomeAllowanceController.scala
index e308f337..2238bfb1 100644
--- a/app/controllers/adjustments/PropertyIncomeAllowanceController.scala
+++ b/app/controllers/adjustments/PropertyIncomeAllowanceController.scala
@@ -19,7 +19,7 @@ package controllers.adjustments
import controllers.actions._
import forms.adjustments.PropertyIncomeAllowanceFormProvider
import models.TotalIncomeUtils.{incomeAndBalancingChargeCombined, maxAllowedPIA}
-import models.{Mode, Rentals}
+import models.{Mode, PropertyType, Rentals}
import navigation.Navigator
import pages.adjustments.PropertyIncomeAllowancePage
import play.api.i18n.{I18nSupport, MessagesApi}
@@ -44,20 +44,20 @@ class PropertyIncomeAllowanceController @Inject() (
)(implicit ec: ExecutionContext)
extends FrontendBaseController with I18nSupport {
- def onPageLoad(taxYear: Int, mode: Mode): Action[AnyContent] = (identify andThen getData andThen requireData) {
+ def onPageLoad(taxYear: Int, mode: Mode, propertyType: PropertyType): Action[AnyContent] = (identify andThen getData andThen requireData) {
implicit request =>
- val combinedAmount = incomeAndBalancingChargeCombined(request.userAnswers, Rentals)
+ val combinedAmount = incomeAndBalancingChargeCombined(request.userAnswers, propertyType)
val form = formProvider(request.user.isAgentMessageKey, combinedAmount)
- val preparedForm = request.userAnswers.get(PropertyIncomeAllowancePage) match {
+ val preparedForm = request.userAnswers.get(PropertyIncomeAllowancePage(propertyType)) match {
case None => form
case Some(value) => form.fill(value)
}
- Ok(view(preparedForm, mode, taxYear, request.user.isAgentMessageKey, maxAllowedPIA(combinedAmount)))
+ Ok(view(preparedForm, mode, taxYear, request.user.isAgentMessageKey, maxAllowedPIA(combinedAmount), propertyType))
}
- def onSubmit(taxYear: Int, mode: Mode): Action[AnyContent] = (identify andThen getData andThen requireData).async {
+ def onSubmit(taxYear: Int, mode: Mode, propertyType: PropertyType): Action[AnyContent] = (identify andThen getData andThen requireData).async {
implicit request =>
- val combinedAllowance = incomeAndBalancingChargeCombined(request.userAnswers, Rentals)
+ val combinedAllowance = incomeAndBalancingChargeCombined(request.userAnswers, propertyType)
val form = formProvider(request.user.isAgentMessageKey, combinedAllowance)
form
.bindFromRequest()
@@ -65,15 +65,15 @@ class PropertyIncomeAllowanceController @Inject() (
formWithErrors =>
Future.successful(
BadRequest(
- view(formWithErrors, mode, taxYear, request.user.isAgentMessageKey, maxAllowedPIA(combinedAllowance))
+ view(formWithErrors, mode, taxYear, request.user.isAgentMessageKey, maxAllowedPIA(combinedAllowance), propertyType)
)
),
value =>
for {
- updatedAnswers <- Future.fromTry(request.userAnswers.set(PropertyIncomeAllowancePage, value))
+ updatedAnswers <- Future.fromTry(request.userAnswers.set(PropertyIncomeAllowancePage(propertyType), value))
_ <- sessionRepository.set(updatedAnswers)
} yield Redirect(
- navigator.nextPage(PropertyIncomeAllowancePage, taxYear, mode, request.userAnswers, updatedAnswers)
+ navigator.nextPage(PropertyIncomeAllowancePage(propertyType), taxYear, mode, request.userAnswers, updatedAnswers)
)
)
}
diff --git a/app/controllers/session/PropertyPeriodSessionRecoveryExtensions.scala b/app/controllers/session/PropertyPeriodSessionRecoveryExtensions.scala
index 33c1da7c..58542ed1 100644
--- a/app/controllers/session/PropertyPeriodSessionRecoveryExtensions.scala
+++ b/app/controllers/session/PropertyPeriodSessionRecoveryExtensions.scala
@@ -107,7 +107,7 @@ object PropertyPeriodSessionRecoveryExtensions {
for {
ua1 <- userAnswers.set(BalancingChargePage, adjustments.balancingCharge)
ua2 <- ua1.set(PrivateUseAdjustmentPage, adjustments.privateUseAdjustment)
- ua3 <- ua2.set(PropertyIncomeAllowancePage, adjustments.propertyIncomeAllowance)
+ ua3 <- ua2.set(PropertyIncomeAllowancePage(Rentals), adjustments.propertyIncomeAllowance)
ua4 <- ua3.set(RenovationAllowanceBalancingChargePage(Rentals), adjustments.renovationAllowanceBalancingCharge)
ua5 <- ua4.set(ResidentialFinanceCostPage(Rentals), adjustments.residentialFinanceCost)
ua6 <- ua5.set(UnusedResidentialFinanceCostPage, adjustments.unusedResidentialFinanceCost)
diff --git a/app/navigation/Navigator.scala b/app/navigation/Navigator.scala
index 45871007..bc571653 100644
--- a/app/navigation/Navigator.scala
+++ b/app/navigation/Navigator.scala
@@ -156,8 +156,8 @@ class Navigator @Inject() () {
//
case PrivateUseAdjustmentPage => taxYear => _ => _ => BalancingChargeController.onPageLoad(taxYear, NormalMode)
- case BalancingChargePage => taxYear => _ => _ => PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode)
- case PropertyIncomeAllowancePage =>
+ case BalancingChargePage => taxYear => _ => _ => PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode, Rentals)
+ case PropertyIncomeAllowancePage(Rentals) =>
taxYear => _ => _ => RenovationAllowanceBalancingChargeController.onPageLoad(taxYear, NormalMode, Rentals)
case RenovationAllowanceBalancingChargePage(Rentals) =>
taxYear => _ => _ => ResidentialFinanceCostController.onPageLoad(taxYear, NormalMode, Rentals)
@@ -480,7 +480,7 @@ class Navigator @Inject() () {
controllers.rentalsandrentaroom.expenses.routes.RentalsAndRaRExpensesCheckYourAnswersController
.onPageLoad(taxYear)
// Adjustments
- case PrivateUseAdjustmentPage | PropertyIncomeAllowancePage | RenovationAllowanceBalancingChargePage(Rentals) |
+ case PrivateUseAdjustmentPage | PropertyIncomeAllowancePage(Rentals) | RenovationAllowanceBalancingChargePage(Rentals) |
ResidentialFinanceCostPage(Rentals) | UnusedResidentialFinanceCostPage =>
taxYear => _ => _ => AdjustmentsCheckYourAnswersController.onPageLoad(taxYear)
case BalancingChargePage =>
@@ -821,7 +821,7 @@ class Navigator @Inject() () {
if current.balancingChargeYesNo == previous.balancingChargeYesNo &&
current.balancingChargeAmount == previous.balancingChargeAmount =>
AdjustmentsCheckYourAnswersController.onPageLoad(taxYear)
- case _ => PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode)
+ case _ => PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode, Rentals)
}
private def totalIncomeNavigationNormalMode(taxYear: Int, userAnswers: UserAnswers): Call =
diff --git a/app/pages/adjustments/PropertyIncomeAllowancePage.scala b/app/pages/adjustments/PropertyIncomeAllowancePage.scala
index 5e2ff547..e1a3676b 100644
--- a/app/pages/adjustments/PropertyIncomeAllowancePage.scala
+++ b/app/pages/adjustments/PropertyIncomeAllowancePage.scala
@@ -16,14 +16,14 @@
package pages.adjustments
-import models.Rentals
+import models.{PropertyType, Rentals}
import pages.PageConstants.adjustmentsPath
import pages.QuestionPage
import play.api.libs.json.JsPath
-case object PropertyIncomeAllowancePage extends QuestionPage[BigDecimal] {
+case class PropertyIncomeAllowancePage(propertyType: PropertyType) extends QuestionPage[BigDecimal] {
- override def path: JsPath = JsPath \ adjustmentsPath(Rentals) \ toString
+ override def path: JsPath = JsPath \ adjustmentsPath(propertyType) \ toString
override def toString: String = "propertyIncomeAllowance"
}
diff --git a/app/viewmodels/checkAnswers/adjustments/PropertyIncomeAllowanceSummary.scala b/app/viewmodels/checkAnswers/adjustments/PropertyIncomeAllowanceSummary.scala
index 092e19f9..ff40fbfe 100644
--- a/app/viewmodels/checkAnswers/adjustments/PropertyIncomeAllowanceSummary.scala
+++ b/app/viewmodels/checkAnswers/adjustments/PropertyIncomeAllowanceSummary.scala
@@ -17,7 +17,7 @@
package viewmodels.checkAnswers.adjustments
import controllers.adjustments.routes
-import models.{CheckMode, UserAnswers}
+import models.{CheckMode, PropertyType, UserAnswers}
import pages.adjustments.PropertyIncomeAllowancePage
import play.api.i18n.Messages
import uk.gov.hmrc.govukfrontend.views.viewmodels.summarylist.SummaryListRow
@@ -27,15 +27,15 @@ import viewmodels.implicits._
object PropertyIncomeAllowanceSummary {
- def row(taxYear: Int, answers: UserAnswers)(implicit messages: Messages): Option[SummaryListRow] =
- answers.get(PropertyIncomeAllowancePage).map {
+ def row(taxYear: Int, answers: UserAnswers, propertyType: PropertyType)(implicit messages: Messages): Option[SummaryListRow] =
+ answers.get(PropertyIncomeAllowancePage(propertyType)).map {
answer =>
SummaryListRowViewModel(
key = KeyViewModel("propertyIncomeAllowance.checkYourAnswersLabel").withCssClass(keyCssClass),
value = ValueViewModel(bigDecimalCurrency(answer)).withCssClass(valueCssClass),
actions = Seq(
- ActionItemViewModel("site.change", routes.PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode).url)
+ ActionItemViewModel("site.change", routes.PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode, propertyType).url)
.withVisuallyHiddenText(messages("propertyIncomeAllowance.change.hidden"))
)
)
diff --git a/app/views/adjustments/PropertyIncomeAllowanceView.scala.html b/app/views/adjustments/PropertyIncomeAllowanceView.scala.html
index 5b7cc9ee..7c214d4c 100644
--- a/app/views/adjustments/PropertyIncomeAllowanceView.scala.html
+++ b/app/views/adjustments/PropertyIncomeAllowanceView.scala.html
@@ -26,20 +26,20 @@
govukButton: GovukButton
)
-@(form: Form[_], mode: Mode, taxYear: Int, individualOrAgent: String, maxPIA: BigDecimal)(implicit request: Request[_], messages: Messages)
+@(form: Form[_], mode: Mode, taxYear: Int, individualOrAgent: String, maxPIA: BigDecimal, propertyType: PropertyType)(implicit request: Request[_], messages: Messages)
@layout(pageTitle = title(form, messages(s"propertyIncomeAllowance.title.$individualOrAgent"))) {
@messages(s"propertyIncomeAllowance.heading.$individualOrAgent")
- @formHelper(action = routes.PropertyIncomeAllowanceController.onSubmit(taxYear, mode), Symbol("autoComplete") -> "off") {
+ @formHelper(action = routes.PropertyIncomeAllowanceController.onSubmit(taxYear, mode, propertyType), Symbol("autoComplete") -> "off") {
@if(form.errors.nonEmpty) {
@govukErrorSummary(ErrorSummaryViewModel(form))
}
@messages(s"propertyIncomeAllowance.details.content1.$individualOrAgent", maxPIA)
- @messages(s"propertyIncomeAllowance.details.content2.$individualOrAgent")
+ @messages(s"propertyIncomeAllowance.details.content2.$individualOrAgent", maxPIA)
@messages("propertyIncomeAllowance.details.content3")
@messages("propertyIncomeAllowance.details.content3.link.text")
diff --git a/conf/app.routes b/conf/app.routes
index 92ec220a..cd4b1e38 100644
--- a/conf/app.routes
+++ b/conf/app.routes
@@ -135,10 +135,10 @@ POST /:taxYear/rentals/adjustments/balancing-charge
GET /:taxYear/rentals/adjustments/change-balancing-charge controllers.adjustments.BalancingChargeController.onPageLoad(taxYear: Int, mode: Mode = CheckMode)
POST /:taxYear/rentals/adjustments/change-balancing-charge controllers.adjustments.BalancingChargeController.onSubmit(taxYear: Int, mode: Mode = CheckMode)
-GET /:taxYear/rentals/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = NormalMode)
-POST /:taxYear/rentals/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = NormalMode)
-GET /:taxYear/rentals/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = CheckMode)
-POST /:taxYear/rentals/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = CheckMode)
+GET /:taxYear/rentals/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = Rentals)
+POST /:taxYear/rentals/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = Rentals)
+GET /:taxYear/rentals/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = Rentals)
+POST /:taxYear/rentals/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = Rentals)
GET /:taxYear/rentals/adjustments/renovation-allowance-balancing-charge controllers.adjustments.RenovationAllowanceBalancingChargeController.onPageLoad(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = Rentals)
POST /:taxYear/rentals/adjustments/renovation-allowance-balancing-charge controllers.adjustments.RenovationAllowanceBalancingChargeController.onSubmit(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = Rentals)
@@ -729,3 +729,8 @@ POST /:taxYear/rentals-rent-a-room/adjustments/residential-finance-cost
GET /:taxYear/rentals-rent-a-room/adjustments/change-residential-finance-cost controllers.adjustments.ResidentialFinanceCostController.onPageLoad(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = RentalsRentARoom)
POST /:taxYear/rentals-rent-a-room/adjustments/change-residential-finance-cost controllers.adjustments.ResidentialFinanceCostController.onSubmit(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = RentalsRentARoom)
+GET /:taxYear/rentals-rent-a-room/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = RentalsRentARoom)
+POST /:taxYear/rentals-rent-a-room/adjustments/property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = NormalMode, propertyType: PropertyType = RentalsRentARoom)
+GET /:taxYear/rentals-rent-a-room/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onPageLoad(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = RentalsRentARoom)
+POST /:taxYear/rentals-rent-a-room/adjustments/change-property-income-allowance controllers.adjustments.PropertyIncomeAllowanceController.onSubmit(taxYear: Int, mode: Mode = CheckMode, propertyType: PropertyType = RentalsRentARoom)
+
diff --git a/conf/messages.cy b/conf/messages.cy
index 5e7431e1..3d181008 100644
--- a/conf/messages.cy
+++ b/conf/messages.cy
@@ -391,16 +391,16 @@ unusedResidentialFinanceCost.input.legend = Faint o gostau preswyl sydd heb eu d
unusedResidentialFinanceCost.checkYourAnswersLabel = Costau ariannol preswyl sydd heb eu defnyddio a ddygwyd ymlaen
unusedResidentialFinanceCost.change.hidden = Costau ariannol preswyl sydd heb eu defnyddio a ddygwyd ymlaen
-propertyIncomeAllowance.title.individual = Faint o Lwfans Incwm o Eiddo (PIA) hoffech hawlio?
-propertyIncomeAllowance.title.agent = Faint o Lwfans Incwm o Eiddo (PIA) hoffai eich cleient hawlio?
-propertyIncomeAllowance.heading.individual = Faint o Lwfans Incwm o Eiddo (PIA) hoffech hawlio?
-propertyIncomeAllowance.heading.agent = Faint o Lwfans Incwm o Eiddo (PIA) hoffai eich cleient hawlio?
-propertyIncomeAllowance.input.heading.individual = Nodwch eich cyfran chi o’r PIA ar gyfer yr eiddo hwn
-propertyIncomeAllowance.input.heading.agent = Nodwch gyfran eich cleient o’r PIA ar gyfer yr eiddo hwn
-propertyIncomeAllowance.details.content1.individual = Gallwch hawlio hyd at o lwfans incwm o eiddo ar draws eich holl eiddo. Os ydych yn berchen ar eiddo ar y cyd â rhywun arall, gall y ddau ohonoch hawlio’r lwfans.
-propertyIncomeAllowance.details.content1.agent = Gall eich cleient hawlio’r holl lwfans incwm o eiddo hyd at (Income plus balancing charge) ar draws pob un o’i eiddo. Os yw’n berchen ar eiddo ar y cyd â rhywun arall, gall y ddau ohonynt hawlio’r lwfans o (Income plus balancing charge).
-propertyIncomeAllowance.details.content2.individual = Os bydd angen i chi dalu tâl mantoli, mae’n rhaid i chi ychwanegu’r ffigur hwn at y swm rydych yn ei hawlio ar gyfer lwfans incwm o eiddo. Ni all y ffigur at ei gilydd fynd y tu hwnt.
-propertyIncomeAllowance.details.content2.agent = Os oes angen iddo dalu tâl mantoli, mae’n rhaid i chi ychwanegu’r ffigur hwn at y swm rydych yn ei hawlio ar gyfer lwfans incwm o eiddo. Ni all y ffigur at ei gilydd fynd y tu hwnt i gyfanswm o (Income plus balancing charge).
+propertyIncomeAllowance.title.individual = *Missing Welsh*
+propertyIncomeAllowance.title.agent = *Missing Welsh*
+propertyIncomeAllowance.heading.individual = *Missing Welsh*
+propertyIncomeAllowance.heading.agent = *Missing Welsh*
+propertyIncomeAllowance.input.heading.individual = *Missing Welsh*
+propertyIncomeAllowance.input.heading.agent = *Missing Welsh*
+propertyIncomeAllowance.details.content1.individual = *Missing Welsh*
+propertyIncomeAllowance.details.content1.agent = *Missing Welsh*
+propertyIncomeAllowance.details.content2.individual = *Missing Welsh*
+propertyIncomeAllowance.details.content2.agent = *Missing Welsh*
propertyIncomeAllowance.details.content3 = Darllenwch ragor am
propertyIncomeAllowance.details.content3.link.text = lwfans incwm o eiddo, ar GOV.UK (yn agor tab newydd)
diff --git a/conf/messages.en b/conf/messages.en
index 308d3a1f..73773cf8 100644
--- a/conf/messages.en
+++ b/conf/messages.en
@@ -520,16 +520,16 @@ unusedResidentialFinanceCost.error.twoDecimalPlaces.agent = Amount can only incl
unusedResidentialFinanceCost.error.outOfRange = Enter an amount between £{0} and £{1}
unusedResidentialFinanceCost.change.hidden = Unused residential financial costs carried forward
-propertyIncomeAllowance.title.individual = How much Property Income Allowance (PIA) do you want to claim?
-propertyIncomeAllowance.title.agent = How much Property Income Allowance (PIA) does your client want to claim?
-propertyIncomeAllowance.heading.individual = How much Property Income Allowance (PIA) do you want to claim?
-propertyIncomeAllowance.heading.agent = How much Property Income Allowance (PIA) does your client want to claim?
-propertyIncomeAllowance.input.heading.individual = Enter your share of PIA for this property
-propertyIncomeAllowance.input.heading.agent = Enter your client’s share of PIA for this property
+propertyIncomeAllowance.title.individual = Your Property Income Allowance claim
+propertyIncomeAllowance.title.agent = Your client’s Property Income Allowance claim
+propertyIncomeAllowance.heading.individual = Your Property Income Allowance claim
+propertyIncomeAllowance.heading.agent = Your client’s Property Income Allowance claim
+propertyIncomeAllowance.input.heading.individual = How much Property Income Allowance do you want to claim?
+propertyIncomeAllowance.input.heading.agent = How much Property Income Allowance does your client want to claim?
propertyIncomeAllowance.details.content1.individual = You can claim up to £{0} property income allowance across all of your properties. If you own a property with someone else you can each claim the allowance.
-propertyIncomeAllowance.details.content1.agent = Your client can claim up to £{0} (Income plus balancing charge) all property income allowance across all of their properties. If they own a property with someone else they can each claim the (Income plus balancing charge) allowance.
-propertyIncomeAllowance.details.content2.individual = If you have to pay a balancing charge you must add this figure to the amount that you are claiming for property income allowance. The combined figure must not exceed.
-propertyIncomeAllowance.details.content2.agent = If they have to pay a balancing charge you must add this figure to the amount that you are claiming for property income allowance. The combined figure must not exceed (Income plus balancing charge) all.
+propertyIncomeAllowance.details.content1.agent = Your client can claim up to £{0} property income allowance across all of their properties. If they own a property with someone else they can each claim the allowance.
+propertyIncomeAllowance.details.content2.individual = If you have to pay a balancing charge you must add this figure to the amount that you are claiming for property income allowance. The combined figure must not exceed £{0}.
+propertyIncomeAllowance.details.content2.agent = If they have to pay a balancing charge you must add this figure to the amount that you are claiming for property income allowance. The combined figure must not exceed £{0}.
propertyIncomeAllowance.details.content3 = Read more about
propertyIncomeAllowance.details.content3.link.text = property income allowance at GOV.UK (opens in a new tab)
propertyIncomeAllowance.details.content3.link.href = https://www.gov.uk/guidance/tax-free-allowances-on-property-and-trading-income#property
diff --git a/test/controllers/adjustments/PropertyIncomeAllowanceControllerSpec.scala b/test/controllers/adjustments/PropertyIncomeAllowanceControllerSpec.scala
index 8844c9b5..2f6ace36 100644
--- a/test/controllers/adjustments/PropertyIncomeAllowanceControllerSpec.scala
+++ b/test/controllers/adjustments/PropertyIncomeAllowanceControllerSpec.scala
@@ -18,7 +18,7 @@ package controllers.adjustments
import base.SpecBase
import forms.adjustments.PropertyIncomeAllowanceFormProvider
-import models.{NormalMode, UserAnswers}
+import models.{NormalMode, Rentals, RentalsRentARoom, UserAnswers}
import navigation.{FakeNavigator, Navigator}
import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.when
@@ -44,7 +44,8 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
val validAnswer: BigDecimal = BigDecimal(0)
- lazy val propertyIncomeAllowanceRoute: String = routes.PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode).url
+ lazy val rentalsRoute: String = routes.PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode, Rentals).url
+ lazy val rentalsRaRRoute: String = routes.PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode, RentalsRentARoom).url
"PropertyIncomeAllowance Controller" - {
@@ -53,32 +54,50 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
val application = applicationBuilder(userAnswers = Some(emptyUserAnswers), isAgent = false).build()
running(application) {
- val request = FakeRequest(GET, propertyIncomeAllowanceRoute)
+ val request = FakeRequest(GET, rentalsRoute)
val result = route(application, request).value
val view = application.injector.instanceOf[PropertyIncomeAllowanceView]
status(result) mustEqual OK
- contentAsString(result) mustEqual view(form, NormalMode, taxYear, isAgentMessageKey, 0)(request, messages(application)).toString
+ contentAsString(result) mustEqual view(form, NormalMode, taxYear, isAgentMessageKey, 0, Rentals)(request, messages(application)).toString
}
}
- "must populate the view correctly on a GET when the question has previously been answered" in {
+ "Rentals only journey must populate the view correctly on a GET when the question has previously been answered" in {
- val userAnswers = UserAnswers(userAnswersId).set(PropertyIncomeAllowancePage, validAnswer).success.value
+ val userAnswers = UserAnswers(userAnswersId).set(PropertyIncomeAllowancePage(Rentals), validAnswer).success.value
val application = applicationBuilder(userAnswers = Some(userAnswers),isAgent = false).build()
running(application) {
- val request = FakeRequest(GET, propertyIncomeAllowanceRoute)
+ val request = FakeRequest(GET, rentalsRoute)
val view = application.injector.instanceOf[PropertyIncomeAllowanceView]
val result = route(application, request).value
status(result) mustEqual OK
- contentAsString(result) mustEqual view(form.fill(validAnswer), NormalMode, taxYear, isAgentMessageKey, 0)(request, messages(application)).toString
+ contentAsString(result) mustEqual view(form.fill(validAnswer), NormalMode, taxYear, isAgentMessageKey, 0, Rentals)(request, messages(application)).toString
+ }
+ }
+
+ "Rentals RaR journey must populate the view correctly on a GET when the question has previously been answered" in {
+
+ val userAnswers = UserAnswers(userAnswersId).set(PropertyIncomeAllowancePage(RentalsRentARoom), validAnswer).success.value
+
+ val application = applicationBuilder(userAnswers = Some(userAnswers), isAgent = false).build()
+
+ running(application) {
+ val request = FakeRequest(GET, rentalsRaRRoute)
+
+ val view = application.injector.instanceOf[PropertyIncomeAllowanceView]
+
+ val result = route(application, request).value
+
+ status(result) mustEqual OK
+ contentAsString(result) mustEqual view(form.fill(validAnswer), NormalMode, taxYear, isAgentMessageKey, 0, RentalsRentARoom)(request, messages(application)).toString
}
}
@@ -98,7 +117,7 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
running(application) {
val request =
- FakeRequest(POST, propertyIncomeAllowanceRoute)
+ FakeRequest(POST, rentalsRoute)
.withFormUrlEncodedBody(("propertyIncomeAllowance", validAnswer.toString))
val result = route(application, request).value
@@ -114,7 +133,7 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
running(application) {
val request =
- FakeRequest(POST, propertyIncomeAllowanceRoute)
+ FakeRequest(POST, rentalsRoute)
.withFormUrlEncodedBody(("propertyIncomeAllowance", "invalid value"))
val boundForm = form.bind(Map("propertyIncomeAllowance" -> "invalid value"))
@@ -124,7 +143,7 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
val result = route(application, request).value
status(result) mustEqual BAD_REQUEST
- contentAsString(result) mustEqual view(boundForm, NormalMode, taxYear, isAgentMessageKey, 0)(request, messages(application)).toString
+ contentAsString(result) mustEqual view(boundForm, NormalMode, taxYear, isAgentMessageKey, 0, Rentals)(request, messages(application)).toString
}
}
@@ -133,7 +152,7 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
val application = applicationBuilder(userAnswers = None, isAgent = false).build()
running(application) {
- val request = FakeRequest(GET, propertyIncomeAllowanceRoute)
+ val request = FakeRequest(GET, rentalsRoute)
val result = route(application, request).value
@@ -148,7 +167,7 @@ class PropertyIncomeAllowanceControllerSpec extends SpecBase with MockitoSugar {
running(application) {
val request =
- FakeRequest(POST, propertyIncomeAllowanceRoute)
+ FakeRequest(POST, rentalsRoute)
.withFormUrlEncodedBody(("propertyIncomeAllowance", validAnswer.toString))
val result = route(application, request).value
diff --git a/test/controllers/session/PropertyPeriodSessionRecoveryExtensionsSpec.scala b/test/controllers/session/PropertyPeriodSessionRecoveryExtensionsSpec.scala
index 6b96579c..727efe08 100644
--- a/test/controllers/session/PropertyPeriodSessionRecoveryExtensionsSpec.scala
+++ b/test/controllers/session/PropertyPeriodSessionRecoveryExtensionsSpec.scala
@@ -213,7 +213,7 @@ class PropertyPeriodSessionRecoveryExtensionsSpec extends SpecBase with MockitoS
updated.get(OtherAllowablePropertyExpensesPage(Rentals)).get mustBe 3
updated.get(PrivateUseAdjustmentPage).get mustBe PrivateUseAdjustment(2)
updated.get(BalancingChargePage).get mustBe BalancingCharge(true, Some(3))
- updated.get(PropertyIncomeAllowancePage).get mustBe 4
+ updated.get(PropertyIncomeAllowancePage(Rentals)).get mustBe 4
updated.get(ReversePremiumsReceivedPage(Rentals)).get mustBe ReversePremiumsReceived(true, Some(45))
updated.get(RenovationAllowanceBalancingChargePage(Rentals)).get mustBe RenovationAllowanceBalancingCharge(true, Some(23))
updated.get(ResidentialFinanceCostPage(Rentals)).get mustBe 2
diff --git a/test/navigation/NavigatorSpec.scala b/test/navigation/NavigatorSpec.scala
index e5c7e3e2..21569580 100644
--- a/test/navigation/NavigatorSpec.scala
+++ b/test/navigation/NavigatorSpec.scala
@@ -594,12 +594,12 @@ class NavigatorSpec extends SpecBase {
NormalMode,
UserAnswers("test"),
UserAnswers("test")
- ) mustBe PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode)
+ ) mustBe PropertyIncomeAllowanceController.onPageLoad(taxYear, NormalMode, Rentals)
}
"must go from PropertyIncomeAllowancePage to RenovationAllowanceBalancingChargePage" in {
navigator.nextPage(
- PropertyIncomeAllowancePage,
+ PropertyIncomeAllowancePage(Rentals),
taxYear,
NormalMode,
UserAnswers("test"),
@@ -1381,12 +1381,12 @@ class NavigatorSpec extends SpecBase {
CheckMode,
previousUserAnswers,
userAnswers
- ) mustBe PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode)
+ ) mustBe PropertyIncomeAllowanceController.onPageLoad(taxYear, CheckMode, Rentals)
}
"must go from PropertyIncomeAllowancePage to AdjustmentsCheckYourAnswersPage" in {
navigator.nextPage(
- PropertyIncomeAllowancePage,
+ PropertyIncomeAllowancePage(Rentals),
taxYear,
CheckMode,
UserAnswers("test"),