Skip to content

Commit

Permalink
SASS-10418 Removing new values from rentals, just leaving them in ren…
Browse files Browse the repository at this point in the history
…t-a-room
  • Loading branch information
StuartJamesProctor committed Feb 18, 2025
1 parent 1433bfa commit 6695fc3
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 54 deletions.
2 changes: 1 addition & 1 deletion app/models/RentARoomAdjustmentsStoreAnswers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package models

import models.request.{BalancingCharge, UnusedLossesBroughtForward, WhenYouReportedTheLoss}
import models.request.{WhenYouReportedTheLoss, BalancingCharge, UnusedLossesBroughtForward}
import play.api.libs.json.{OFormat, Json}

final case class RentARoomAdjustmentsStoreAnswers(
Expand Down
11 changes: 1 addition & 10 deletions app/models/repository/Merger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,7 @@ object Merger {
fromDownstreamAdjustment.businessPremisesRenovationAllowanceBalancingCharges
),
residentialFinanceCost = residentialFinanceCost,
unusedResidentialFinanceCost = Some(residentialFinanceCostCarriedForward),
unusedLossesBroughtForward = UnusedLossesBroughtForward(
unusedLossesBroughtForwardYesOrNo = extractedMaybe
.map(_.unusedLossesBroughtForwardYesNo)
.getOrElse((
fromDownstreamAdjustment.lossBroughtForward.isDefined
)),
unusedLossesBroughtForwardAmount = fromDownstreamAdjustment.lossBroughtForward
),
whenYouReportedTheLoss = extractedMaybe.flatMap(_.whenYouReportedTheLoss)
unusedResidentialFinanceCost = Some(residentialFinanceCostCarriedForward)
)
)
case _ => None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object CreateUKPropertyPeriodicSubmissionRequest {
fromPropertyRentalsIncome(taxYear, periodicSubmissionMaybe, e)
case e @ RentalsAndRaRIncome(_, _, _, _, _, _, _, _) =>
fromRentalsAndRaRIncome(taxYear, periodicSubmissionMaybe, e)
case e @ PropertyRentalAdjustments(_, _, _, _, _, _, _, _) =>
case e @ PropertyRentalAdjustments(_, _, _, _, _, _) =>
fromPropertyRentalAdjustments(taxYear, periodicSubmissionMaybe, e).asRight[ServiceError]
case e @ RentalsAndRaRAbout(_, _, _, _, _) => fromRentalsAndRaRAbout(taxYear, periodicSubmissionMaybe, e)

Expand Down
12 changes: 5 additions & 7 deletions app/models/request/PropertyRentalAdjustments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ final case class PropertyRentalAdjustments(
propertyIncomeAllowance: Option[BigDecimal],
renovationAllowanceBalancingCharge: RenovationAllowanceBalancingCharge,
residentialFinanceCost: BigDecimal,
unusedResidentialFinanceCost: Option[BigDecimal],
unusedLossesBroughtForward: UnusedLossesBroughtForward,
whenYouReportedTheLoss: Option[WhenYouReportedTheLoss]
unusedResidentialFinanceCost: Option[BigDecimal]
)

object PropertyRentalAdjustments {
Expand All @@ -51,9 +49,9 @@ object RenovationAllowanceBalancingCharge {
}

final case class UnusedLossesBroughtForward(
unusedLossesBroughtForwardYesOrNo: Boolean,
unusedLossesBroughtForwardAmount: Option[BigDecimal]
)
unusedLossesBroughtForwardYesOrNo: Boolean,
unusedLossesBroughtForwardAmount: Option[BigDecimal]
)

object UnusedLossesBroughtForward {
implicit val format: OFormat[UnusedLossesBroughtForward] = Json.format
Expand All @@ -75,4 +73,4 @@ object WhenYouReportedTheLoss extends Enumerable.Implicits {

implicit val enumerable: Enumerable[WhenYouReportedTheLoss] =
Enumerable(values.map(v => v.toString -> v): _*)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object UpdateUKPropertyPeriodicSubmissionRequest {
case e @ RentARoomExpenses(_, _, _, _, _, _) => fromRaRExpenses(periodicSubmissionMaybe, e)
case e @ PropertyRentalsIncome(_, _, _, _, _, _, _, _, _) => fromPropertyRentalsIncome(periodicSubmissionMaybe, e)
case e @ RentalsAndRaRIncome(_, _, _, _, _, _, _, _) => fromRentalsAndRaRIncome(periodicSubmissionMaybe, e)
case e @ PropertyRentalAdjustments(_, _, _, _, _, _, _, _) =>
case e @ PropertyRentalAdjustments(_, _, _, _, _, _) =>
fromPropertyRentalAdjustments(periodicSubmissionMaybe, e).asRight[ServiceError]
case e @ RentalsAndRaRAbout(_, _, _, _, _) => fromRentalsAndRaRAbout(periodicSubmissionMaybe, e)
case _ =>
Expand Down
2 changes: 1 addition & 1 deletion app/models/request/ukrentaroom/RaRAdjustments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package models.request.ukrentaroom

import models.request.{WhenYouReportedTheLoss, BalancingCharge, UnusedLossesBroughtForward}
import models.request.{BalancingCharge, UnusedLossesBroughtForward, WhenYouReportedTheLoss}
import play.api.libs.json.{OFormat, Json}

final case class RaRAdjustments(
Expand Down
5 changes: 1 addition & 4 deletions app/models/responses/AdjustmentStoreAnswers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@

package models.responses

import models.request.WhenYouReportedTheLoss
import play.api.libs.json.{OFormat, Json}

case class AdjustmentStoreAnswers(
balancingChargeYesNo: Boolean,
renovationAllowanceBalancingChargeYesNo: Boolean,
unusedLossesBroughtForwardYesNo: Boolean,
whenYouReportedTheLoss: Option[WhenYouReportedTheLoss]
renovationAllowanceBalancingChargeYesNo: Boolean
)

object AdjustmentStoreAnswers {
Expand Down
4 changes: 1 addition & 3 deletions app/services/PropertyService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,7 @@ class PropertyService @Inject() (

val adjustmentStoreAnswers = AdjustmentStoreAnswers(
propertyRentalAdjustment.balancingCharge.balancingChargeYesNo,
propertyRentalAdjustment.renovationAllowanceBalancingCharge.renovationAllowanceBalancingChargeYesNo,
propertyRentalAdjustment.unusedLossesBroughtForward.unusedLossesBroughtForwardYesOrNo,
propertyRentalAdjustment.whenYouReportedTheLoss
propertyRentalAdjustment.renovationAllowanceBalancingCharge.renovationAllowanceBalancingChargeYesNo
)
for {
maybePeriodicSubmission <- getCurrentPeriodicSubmission(
Expand Down
14 changes: 2 additions & 12 deletions test/controllers/JourneyAnswersControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,7 @@ class JourneyAnswersControllerSpec
renovationAllowanceBalancingChargeAmount = Some(92)
),
BigDecimal(56.78),
Some(BigDecimal(78.89)),
UnusedLossesBroughtForward(
unusedLossesBroughtForwardYesOrNo = true,
unusedLossesBroughtForwardAmount = Some(BigDecimal(37.92))
),
Some(WhenYouReportedTheLoss.y2018to2019),
Some(BigDecimal(78.89))
)
)

Expand Down Expand Up @@ -1232,12 +1227,7 @@ class JourneyAnswersControllerSpec
renovationAllowanceBalancingChargeAmount = Some(92)
),
BigDecimal(56.78),
Some(BigDecimal(78.89)),
UnusedLossesBroughtForward(
unusedLossesBroughtForwardYesOrNo = true,
unusedLossesBroughtForwardAmount = Some(BigDecimal(12.56))
),
Some(WhenYouReportedTheLoss.y2018to2019),
Some(BigDecimal(78.89))
)
)

Expand Down
4 changes: 1 addition & 3 deletions test/models/PropertyAnnualSubmissionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,7 @@ class PropertyAnnualSubmissionSpec extends UnitTest {
Some(35.79)
),
13.57,
Some(91.35),
UnusedLossesBroughtForward(true, Some(32.47)),
Some(WhenYouReportedTheLoss.y2018to2019)
Some(91.35)
)

val firstLevelDiff = diff(
Expand Down
10 changes: 2 additions & 8 deletions test/models/repository/MergerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ class MergerSpec extends UnitTest {

val balancingChargeYesNo = true
val renovationAllowanceBalancingChargeYesNo = false
val unusedLossesBroughtForwardYesOrNo = true
val adjustmentStoreAnswers: Option[AdjustmentStoreAnswers] =
Some(AdjustmentStoreAnswers(balancingChargeYesNo, renovationAllowanceBalancingChargeYesNo, unusedLossesBroughtForwardYesOrNo, Some(whenReportedTheLoss)))
Some(AdjustmentStoreAnswers(balancingChargeYesNo, renovationAllowanceBalancingChargeYesNo))
val propertyRentalAdjustments: Option[PropertyRentalAdjustments] =
adjustmentStoreAnswers.merge(ukOtherAdjustmentsAndExpensesMaybe)
propertyRentalAdjustments shouldBe Some(
Expand All @@ -166,12 +165,7 @@ class MergerSpec extends UnitTest {
Some(businessPremisesRenovationAllowanceBalancingCharges)
),
residentialFinanceCost,
Some(residentialFinanceCostCarriedForward),
UnusedLossesBroughtForward(
unusedLossesBroughtForwardYesOrNo,
Some(unusedLossesBroughtForward)
),
whenYouReportedTheLoss = Some(whenReportedTheLoss)
Some(residentialFinanceCostCarriedForward)
)
)
}
Expand Down
4 changes: 1 addition & 3 deletions test/services/PropertyServiceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,7 @@ class PropertyServiceSpec
renovationAllowanceBalancingChargeAmount = Some(92)
),
BigDecimal(56.78),
Some(BigDecimal(78.89)),
UnusedLossesBroughtForward(true, Some(12.56)),
Some(WhenYouReportedTheLoss.y2018to2019)
Some(BigDecimal(78.89))
)

"return a success with no content when the request is valid and data is persisted" in {
Expand Down

0 comments on commit 6695fc3

Please # to comment.