Skip to content

Commit

Permalink
No-Jira Changes to adjsuted/threshold income and messages (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelAAbbott authored Nov 13, 2024
1 parent 7509080 commit 578044d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 47 deletions.
56 changes: 24 additions & 32 deletions app/services/CalculationResultService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -295,31 +295,31 @@ class CalculationResultService @Inject() (

val totalIncome: Int = userAnswers.get(TotalIncomePage(period)).map(_.toInt).getOrElse(0)

val income: Option[Income] =
if (period == Period._2016)
None
else if (userAnswers.get(ThresholdIncomePage(period)).contains(ThresholdIncome.Yes))
userAnswers.get(KnowAdjustedAmountPage(period)) match {
case Some(true) =>
Some(AboveThreshold(userAnswers.get(AdjustedIncomePage(period)).getOrElse(BigInt(0)).toInt))
case Some(false) =>
Some(AboveThreshold(adjustedIncomeCalculation(userAnswers, period).toInt))
case _ => None
val adjustedIncomeAmount: Option[BigInt] = {
def getAdjustedIncomeValue =
userAnswers.get(AdjustedIncomePage(period)) match {
case a @ Some(_) => a
case None => Some(adjustedIncomeCalculation(userAnswers, period))
}

if (userAnswers.get(ThresholdIncomePage(period)).contains(ThresholdIncome.Yes))
getAdjustedIncomeValue
else if (userAnswers.get(ThresholdIncomePage(period)).contains(ThresholdIncome.IDoNotKnow))
userAnswers.get(models.AboveThreshold(period)) match {
case Some(true) =>
userAnswers.get(KnowAdjustedAmountPage(period)) match {
case Some(true) =>
Some(AboveThreshold(userAnswers.get(AdjustedIncomePage(period)).getOrElse(BigInt(0)).toInt))
case Some(false) =>
Some(AboveThreshold(adjustedIncomeCalculation(userAnswers, period).toInt))
case _ => None
}
case Some(false) => Some(BelowThreshold)
case Some(true) => getAdjustedIncomeValue
case _ => None
}
else None
}

val income: Option[Income] = period match {
case Period._2016 => None
case _ =>
adjustedIncomeAmount match {
case Some(amount) => Some(AboveThreshold(amount.toInt))
case None => Some(BelowThreshold)
}
else
Some(BelowThreshold)
}

val chargePaidByMember: Int =
userAnswers.get(HowMuchAAChargeYouPaidPage(period, SchemeIndex(0))).map(_.toInt).getOrElse(0)
Expand Down Expand Up @@ -392,7 +392,7 @@ class CalculationResultService @Inject() (
userAnswers.get(LumpSumDeathBenefitsValuePage(period)).map(_.toInt),
userAnswers.get(models.AboveThreshold(period)),
userAnswers.get(TaxReliefPage(period)).map(_.toInt),
userAnswers.get(AdjustedIncomePage(period)).map(_.toInt),
adjustedIncomeAmount.map(_.toInt),
userAnswers.get(HowMuchTaxReliefPensionPage(period)).map(_.toInt),
userAnswers.get(HowMuchContributionPensionSchemePage(period)).map(_.toInt),
userAnswers.get(AmountClaimedOnOverseasPensionPage(period)).map(_.toInt),
Expand Down Expand Up @@ -999,21 +999,13 @@ class CalculationResultService @Inject() (
): String =
period match {
case Period._2016 => "notApplicable"
case _ =>
incomeSubJourney.thresholdIncomeAmount.getOrElse(None) match {
case Some(thresholdIncome) => "£" + thresholdIncome.toString
case _ => "notApplicable"
}
case _ => incomeSubJourney.thresholdIncomeAmount.map(_.toString).getOrElse("notApplicable")
}

private def adjustedIncomeMessage(period: Period, incomeSubJourney: IncomeSubJourney): String =
period match {
case Period._2016 => "notApplicable"
case _ =>
incomeSubJourney.adjustedIncomeAmount.getOrElse(None) match {
case Some(adjustedIncome) => adjustedIncome.toString
case _ => "notApplicable"
}
case _ => incomeSubJourney.adjustedIncomeAmount.map(_.toString).getOrElse("notApplicable")
}

private def taxYearIncomeSubJourney(taxYears: List[TaxYear2016To2023], period: Period): IncomeSubJourney =
Expand Down
8 changes: 4 additions & 4 deletions conf/messages.cy
Original file line number Diff line number Diff line change
Expand Up @@ -1538,13 +1538,13 @@ maybePIAUnchangedOrDecreased.heading1 = cy: Pension input amount changes
maybePIAUnchangedOrDecreased.message1 = cy: Your pension input amount (PIA) is the amount that your pension has increased in a pension input period (PIP), which is usually a year.
maybePIAUnchangedOrDecreased.message2 = cy: As a result of the Public Service Pensions remedy, your pension input amounts (PIA) may have changed.
maybePIAUnchangedOrDecreased.message3 = cy: If your pension scheme administrator sends you the original figures, you will find both the original and revised figures on your pension savings statement.
maybePIAUnchangedOrDecreased.heading2 = cy: Have any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.heading2 = cy: Have any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.yes = cy: Yes
maybePIAUnchangedOrDecreased.no = cy: No
maybePIAUnchangedOrDecreased.idk = cy: Do not know
maybePIAUnchangedOrDecreased.checkYourAnswersLabel = cy: Have any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.error.required = cy: Select yes if any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.change.hidden = cy: if any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.checkYourAnswersLabel = cy: Have any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.error.required = cy: Select yes if any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.change.hidden = cy: if any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022

pIAAboveAnnualAllowanceIn2023.title = cy: Did you have a pension input amount above £40000?
pIAAboveAnnualAllowanceIn2023.caption = Lwfans blynyddol
Expand Down
8 changes: 4 additions & 4 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -1538,13 +1538,13 @@ maybePIAUnchangedOrDecreased.heading1 = Pension input amount changes
maybePIAUnchangedOrDecreased.message1 = Your pension input amount (PIA) is the amount that your pension has increased in a pension input period (PIP), which is usually a year.
maybePIAUnchangedOrDecreased.message2 = As a result of the Public Service Pensions remedy, your pension input amounts (PIA) may have changed.
maybePIAUnchangedOrDecreased.message3 = If your pension scheme administrator sends you the original figures, you will find both the original and revised figures on your pension savings statement.
maybePIAUnchangedOrDecreased.heading2 = Have any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.heading2 = Have any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.yes = Yes
maybePIAUnchangedOrDecreased.no = No
maybePIAUnchangedOrDecreased.idk = Do not know
maybePIAUnchangedOrDecreased.checkYourAnswersLabel = Have any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.error.required = Select yes if any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.change.hidden = if any of your pension input amounts remained unchanged or decreased for the tax years ending 5 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.checkYourAnswersLabel = Have any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022?
maybePIAUnchangedOrDecreased.error.required = Select yes if any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022
maybePIAUnchangedOrDecreased.change.hidden = if any of your pension input amounts remained unchanged or decreased for the tax years ending 6 April 2016 to 5 April 2022

pIAAboveAnnualAllowanceIn2023.title = Did you have a pension input amount above £40000?
pIAAboveAnnualAllowanceIn2023.caption = Annual allowance
Expand Down
14 changes: 7 additions & 7 deletions test/services/CalculationResultServiceSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(96148),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -2739,7 +2739,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(166148),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -2875,7 +2875,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(177748),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -2986,7 +2986,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(177748),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -3124,7 +3124,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(209548),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -3825,7 +3825,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
Some(777),
Some(true),
Some(888),
None,
Some(243148),
Some(1111),
Some(1212),
Some(1414),
Expand Down Expand Up @@ -4540,7 +4540,7 @@ class CalculationResultServiceSpec extends SpecBase with MockitoSugar {
_2021,
11,
"calculationReviewIndividualAA.annualResults.adjustedIncome",
"notApplicable"
"£96,148"
)

}
Expand Down

0 comments on commit 578044d

Please sign in to comment.