From b9eac0a6007361afc766a074d8f98a5eeb24b68b Mon Sep 17 00:00:00 2001 From: tbg2003 <72973046+tbg2003@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:57:08 +0000 Subject: [PATCH] SASS-10526: Implements navigation functionality for 'Structures and building allowance' journey --- ...StructureBuildingAllowanceController.scala | 5 +- .../ForeignSbaCompleteController.scala | 42 +++++++------- ...reignSbaRemoveConfirmationController.scala | 4 +- ...ureBuildingAllowanceClaimsController.scala | 8 +-- ...tureBuildingQualifyingDateController.scala | 2 +- ...esBuildingAllowanceAddressController.scala | 7 +-- ...reBuildingAllowanceClaimFormProvider.scala | 2 +- app/navigation/ForeignPropertyNavigator.scala | 56 +++++++++++++++++++ .../foreign/ForeignPropertySummaryPage.scala | 39 ++++++++++++- ...oreignStructureBuildingAllowancePage.scala | 1 + ...uctureBuildingAllowanceClaimsSummary.scala | 8 +-- ...ructureBuildingQualifyingDateSummary.scala | 5 +- ...mStructureBuildingAllowanceView.scala.html | 6 +- .../ForeignSbaCheckYourAnswersView.scala.html | 4 +- ...tureBuildingAllowanceClaimsView.scala.html | 4 +- ...nStructureBuildingAllowanceView.scala.html | 7 +-- ...ctureBuildingQualifyingDateView.scala.html | 31 ++++------ conf/foreign.routes | 2 +- conf/messages.cy | 18 ++++-- conf/messages.en | 40 +++++++------ ...ctureBuildingAllowanceControllerSpec.scala | 2 + .../ForeignSbaCompleteControllerSpec.scala | 8 +-- ...uildingAllowanceClaimsControllerSpec.scala | 5 +- ...ildingAllowanceAddressControllerSpec.scala | 4 +- 24 files changed, 203 insertions(+), 107 deletions(-) diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala index 3b294d0f..b0c93965 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignAddClaimStructureBuildingAllowanceController.scala @@ -20,7 +20,7 @@ import controllers.actions._ import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendBaseController -import pages.foreign.structurebuildingallowance.ForeignStructureBuildingAllowancePage +import pages.foreign.structurebuildingallowance.{ForeignStructureBuildingAllowanceGroup, ForeignStructureBuildingAllowancePage} import views.html.foreign.structurebuildingallowance.ForeignStructureBuildingAllowanceView import javax.inject.Inject @@ -38,6 +38,7 @@ class ForeignAddClaimStructureBuildingAllowanceController @Inject()( def onPageLoad(taxYear: Int, countryCode: String): Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => - Ok(view(ForeignStructureBuildingAllowancePage(taxYear, countryCode, request.user.isAgentMessageKey))) + val nextIndex = request.userAnswers.get(ForeignStructureBuildingAllowanceGroup(countryCode)).map(_.length).getOrElse(0) + Ok(view(ForeignStructureBuildingAllowancePage(taxYear, countryCode, nextIndex, request.user.isAgentMessageKey))) } } diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala index 63c704f7..c53bbd2c 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaCompleteController.scala @@ -18,10 +18,11 @@ package controllers.foreign.structuresbuildingallowance import controllers.ControllerUtils.statusForPage import controllers.actions.{DataRequiredAction, DataRetrievalAction, IdentifierAction} +import controllers.exceptions.InternalErrorFailure import forms.foreign.structurebuildingallowance.ForeignSbaCompleteFormProvider -import models.JourneyPath.ForeignStructureBuildingAllowance -import navigation.ForeignPropertyNavigator +import models.JourneyPath.ForeignPropertyAllowances import models.{JourneyContext, NormalMode} +import navigation.ForeignPropertyNavigator import pages.foreign.structurebuildingallowance.ForeignSbaCompletePage import play.api.data.Form import play.api.i18n.{I18nSupport, MessagesApi} @@ -76,28 +77,29 @@ class ForeignSbaCompleteController @Inject()( taxYear = taxYear, mtditid = request.user.mtditid, nino = request.user.nino, - journeyPath = ForeignStructureBuildingAllowance + journeyPath = ForeignPropertyAllowances ), status = statusForPage(value), request.user - ) - } yield status.fold( - _ => - //TODO: When we implement navigation story, update the route to show message from backend or error - Redirect(controllers.routes.SummaryController.show(taxYear) - ), - _ => - Redirect( - foreignPropertyNavigator - .nextPage( - ForeignSbaCompletePage(countryCode), - taxYear, - NormalMode, - request.userAnswers, - updatedAnswers + ).flatMap { + case Right(_) => + Future.successful(Redirect( + foreignPropertyNavigator + .nextPage( + ForeignSbaCompletePage(countryCode), + taxYear, + NormalMode, + request.userAnswers, + updatedAnswers + ) + )) + case Left(_) => + Future.failed( + InternalErrorFailure(s"Failed to save the status for SBA section in tax year: $taxYear") ) - ) - ) + } + } yield status ) } } + diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala index d4c92b00..7377c441 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignSbaRemoveConfirmationController.scala @@ -20,7 +20,7 @@ import controllers.actions._ import forms.foreign.structurebuildingallowance.ForeignSbaRemoveConfirmationFormProvider import models.{Mode, UserAnswers} import navigation.ForeignPropertyNavigator -import pages.foreign.structurebuildingallowance.{ForeignSbaRemoveConfirmationPage, ForeignStructureBuildingAllowanceClaimPage} +import pages.foreign.structurebuildingallowance.{ForeignSbaRemoveConfirmationPage, ForeignStructureBuildingAllowanceClaimPage, ForeignStructureBuildingAllowanceWithIndex} import play.api.i18n.{I18nSupport, Messages, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} import repositories.SessionRepository @@ -73,7 +73,7 @@ class ForeignSbaRemoveConfirmationController @Inject() ( updatedAnswers <- Future.fromTry { if (value) { - updatedAnswers.remove(ForeignStructureBuildingAllowanceClaimPage(countryCode, index)) + updatedAnswers.remove(ForeignStructureBuildingAllowanceWithIndex(index, countryCode)) } else { Success(updatedAnswers) } diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala index df24bc40..d684ee4f 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingAllowanceClaimsController.scala @@ -23,8 +23,7 @@ import forms.ForeignStructureBuildingAllowanceClaimsFormProvider import models.backend.PropertyDetails import models.requests.DataRequest import models.{AccountingMethod, AuditPropertyType, JourneyContext, JourneyName, JourneyPath, NormalMode, SectionName, UserAnswers} -import org.apache.pekko.actor.FSM.Normal -import pages.foreign.structurebuildingallowance.{ForeignSbaInfo, ForeignStructureBuildingAllowanceClaimsPage, ForeignStructureBuildingAllowanceGroup, SaveForeignSba} +import pages.foreign.structurebuildingallowance.{ForeignSbaInfo, ForeignStructureBuildingAllowanceClaimsPage, ForeignStructureBuildingAllowanceGroup} import play.api.data.Form import play.api.i18n.Lang.logger import play.api.i18n.{I18nSupport, Messages, MessagesApi} @@ -61,7 +60,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( val form: Form[Boolean] = formProvider() val list: SummaryList = summaryList(taxYear, request.userAnswers, countryCode) - Ok(view(form, list, taxYear, countryCode)) + Ok(view(form, list, taxYear, countryCode, request.user.isAgentMessageKey)) } private def summaryList(taxYear: Int, userAnswers: UserAnswers, countryCode: String)(implicit @@ -81,7 +80,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( form .bindFromRequest() .fold( - formWithErrors => Future.successful(BadRequest(view(formWithErrors, list, taxYear, countryCode))), + formWithErrors => Future.successful(BadRequest(view(formWithErrors, list, taxYear, countryCode, request.user.isAgentMessageKey))), value => handleValidForm(value, taxYear, request, countryCode) ) } @@ -178,6 +177,7 @@ class ForeignStructureBuildingAllowanceClaimsController @Inject() ( Future.failed(InternalErrorFailure("Foreign Structure and Building Allowance not found in userAnswers")) } +// TODO - revise audit model/method for Foreign Property private def auditSBAClaims( taxYear: Int, request: DataRequest[AnyContent], diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala index 2f13ee79..589da709 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructureBuildingQualifyingDateController.scala @@ -73,7 +73,7 @@ class ForeignStructureBuildingQualifyingDateController @Inject()( _ <- sessionRepository.set(updatedAnswers) } yield Redirect( foreignNavigator.nextPage( - ForeignStructureBuildingAllowanceClaimPage(countryCode, index), + ForeignStructureBuildingQualifyingDatePage(countryCode, index), taxYear, mode, request.userAnswers, diff --git a/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala b/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala index 6f0ec5cc..cf5333b0 100644 --- a/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala +++ b/app/controllers/foreign/structuresbuildingallowance/ForeignStructuresBuildingAllowanceAddressController.scala @@ -19,7 +19,7 @@ package controllers.foreign.structuresbuildingallowance import controllers.actions._ import forms.foreign.structurebuildingallowance.ForeignStructuresBuildingAllowanceAddressFormProvider import models.Mode -import navigation.Navigator +import navigation.ForeignPropertyNavigator import pages.foreign.structurebuildingallowance.ForeignStructuresBuildingAllowanceAddressPage import play.api.i18n.{I18nSupport, MessagesApi} import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future} class ForeignStructuresBuildingAllowanceAddressController @Inject() ( override val messagesApi: MessagesApi, sessionRepository: SessionRepository, - navigator: Navigator, + foreignNavigator: ForeignPropertyNavigator, identify: IdentifierAction, getData: DataRetrievalAction, requireData: DataRequiredAction, @@ -70,11 +70,10 @@ class ForeignStructuresBuildingAllowanceAddressController @Inject() ( ) _ <- sessionRepository.set(updatedAnswers) } yield Redirect( - navigator.sbaNextPage( + foreignNavigator.nextPage( ForeignStructuresBuildingAllowanceAddressPage(index, countryCode), taxYear, mode, - index, request.userAnswers, updatedAnswers ) diff --git a/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala b/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala index bec37051..311e9b00 100644 --- a/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala +++ b/app/forms/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimFormProvider.scala @@ -30,7 +30,7 @@ class ForeignStructureBuildingAllowanceClaimFormProvider @Inject() extends Mappi Form( "foreignStructureBuildingAllowanceClaim" -> currency( s"foreignStructureBuildingAllowanceClaim.error.required.$individualOrAgent", - s"foreignStructureBuildingAllowanceClaim.error.twoDecimalPlaces.${individualOrAgent}", + s"foreignStructureBuildingAllowanceClaim.error.twoDecimalPlaces.$individualOrAgent", "foreignStructureBuildingAllowanceClaim.error.nonNumeric") .verifying(inRange(BigDecimal(minimum), BigDecimal(maximum), "foreignStructureBuildingAllowanceClaim.error.outOfRange")) ) diff --git a/app/navigation/ForeignPropertyNavigator.scala b/app/navigation/ForeignPropertyNavigator.scala index d2b7e95a..a140d0f5 100644 --- a/app/navigation/ForeignPropertyNavigator.scala +++ b/app/navigation/ForeignPropertyNavigator.scala @@ -21,12 +21,14 @@ import controllers.foreign.allowances.routes._ import controllers.foreign.expenses.routes._ import controllers.foreign.income.routes._ import controllers.foreign.routes._ +import controllers.foreign.structuresbuildingallowance.routes._ import controllers.routes.{IndexController, SummaryController} import models.ForeignTotalIncome.{LessThanOneThousand, OneThousandAndMore} import models._ import pages.Page import pages.foreign._ import pages.foreign.allowances._ +import pages.foreign.structurebuildingallowance._ import pages.foreign.expenses._ import pages.foreign.income._ import play.api.mvc.Call @@ -94,6 +96,7 @@ class ForeignPropertyNavigator { taxYear => _ => userAnswers => consolidatedExpensesNavigation(taxYear, userAnswers, countryCode) case ForeignExpensesSectionCompletePage(_) => taxYear => _ => _ => SummaryController.show(taxYear) + //Allowances case ForeignZeroEmissionCarAllowancePage(countryCode) => taxYear => _ => _ => ForeignZeroEmissionGoodsVehiclesController.onPageLoad(taxYear, countryCode, NormalMode) @@ -103,9 +106,40 @@ class ForeignPropertyNavigator { taxYear => _ => _ => ForeignOtherCapitalAllowancesController.onPageLoad(taxYear, countryCode, NormalMode) case ForeignOtherCapitalAllowancesPage(countryCode) => // TODO route to CYA page once created taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) + // Allowances // Structure Building Allowance + case ForeignClaimStructureBuildingAllowancePage(countryCode) => + taxYear => _ => userAnswers => foreignSbaNavigation(taxYear, userAnswers, countryCode) + case ForeignStructureBuildingQualifyingDatePage(countryCode, index) => + taxYear => _ => _ => ForeignStructureBuildingQualifyingAmountController.onPageLoad(taxYear, countryCode, index, NormalMode) + case ForeignStructureBuildingQualifyingAmountPage(countryCode, index) => + taxYear => _ => _ => ForeignStructureBuildingAllowanceClaimController.onPageLoad(taxYear, countryCode, index, NormalMode) + case ForeignStructureBuildingAllowanceClaimPage(countryCode, index) => + taxYear => _ => _ => ForeignStructuresBuildingAllowanceAddressController.onPageLoad(taxYear, index, countryCode, NormalMode) + case ForeignStructuresBuildingAllowanceAddressPage(index, countryCode) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignSbaRemoveConfirmationPage(countryCode) => + taxYear => _ => userAnswers => foreignSbaRemoveConfirmationNavigationNormalMode(taxYear, userAnswers, countryCode) + case ForeignSbaCompletePage(_) => + taxYear => _ => _ => SummaryController.show(taxYear) + + case _ => _ => _ => _ => controllers.routes.IndexController.onPageLoad } + private def foreignSbaRemoveConfirmationNavigationNormalMode( + taxYear: Int, + userAnswers: UserAnswers, + countryCode: String + ): Call = ( + userAnswers.get(ForeignSbaRemoveConfirmationPage(countryCode)), + userAnswers.get(ForeignStructureBuildingAllowanceGroup(countryCode)) + ) match { + case (Some(true), Some(sbaForm)) if sbaForm.isEmpty => + ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode) + case (_, Some(sbaForm)) if sbaForm.nonEmpty => ForeignStructureBuildingAllowanceClaimsController.onPageLoad(taxYear, countryCode) + case (_, _) => SummaryController.show(taxYear) + } + private def consolidatedExpensesNavigation(taxYear: Int, userAnswers: UserAnswers, countryCode: String): Call = userAnswers.get(ConsolidatedOrIndividualExpensesPage(countryCode)) match { case Some(ConsolidatedOrIndividualExpenses(true, _)) => @@ -184,6 +218,17 @@ class ForeignPropertyNavigator { taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) case ForeignOtherCapitalAllowancesPage(countryCode) => taxYear => _ => _ => ForeignAllowancesCheckYourAnswersController.onPageLoad(taxYear, countryCode) + // Allowances // Structure Building Allowance + case ForeignStructureBuildingQualifyingDatePage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructureBuildingQualifyingAmountPage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructureBuildingAllowanceClaimPage(countryCode, index) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + case ForeignStructuresBuildingAllowanceAddressPage(index, countryCode) => + taxYear => _ => _ => ForeignSbaCheckYourAnswersController.onPageLoad(taxYear,countryCode, index) + + case _ => _ => _ => _ => controllers.routes.IndexController.onPageLoad } @@ -309,4 +354,15 @@ class ForeignPropertyNavigator { case _ => ForeignTaxCheckYourAnswersController.onSubmit(taxYear, countryCode) } + + private def foreignSbaNavigation( + taxYear: Int, + userAnswers: UserAnswers, + countryCode: String + ): Call = + userAnswers.get(ForeignClaimStructureBuildingAllowancePage(countryCode)) match { + case Some(true) => ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode) + // TODO - redirect to CYA for No Journey + case _ => SummaryController.show(taxYear) + } } diff --git a/app/pages/foreign/ForeignPropertySummaryPage.scala b/app/pages/foreign/ForeignPropertySummaryPage.scala index d3ae006d..a39c0d89 100644 --- a/app/pages/foreign/ForeignPropertySummaryPage.scala +++ b/app/pages/foreign/ForeignPropertySummaryPage.scala @@ -16,11 +16,12 @@ package pages.foreign -import models.{CheckMode, NormalMode, UserAnswers} +import models.{NormalMode, UserAnswers} import pages.foreign.allowances.ForeignAllowancesCompletePage import pages.foreign.expenses.ForeignExpensesSectionCompletePage import pages.foreign.income.ForeignIncomeSectionCompletePage -import pages.foreign.structurebuildingallowance.ForeignSbaCompletePage +import pages.foreign.structurebuildingallowance.{ForeignClaimStructureBuildingAllowancePage, ForeignSbaCompletePage, ForeignStructureBuildingAllowanceGroup} +import play.api.mvc.Call import viewmodels.summary.{TaskListItem, TaskListTag} case class ForeignPropertySummaryPage( @@ -150,7 +151,7 @@ object ForeignPropertySummaryPage { ), TaskListItem( "summary.structuresAndBuildingAllowance", - controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, CheckMode), + getSbaRouteDestination(taxYear, countryCode, userAnswers, taskListTagForSba), taskListTagForSba, s"foreign_structure_and_building_allowance_$countryCode" ) @@ -159,4 +160,36 @@ object ForeignPropertySummaryPage { case None => taskList } } + + private def getSbaRouteDestination( + taxYear: Int, + countryCode: String, + userAnswers: Option[UserAnswers], + taskListTag: TaskListTag.TaskListTag + ): Call = { + taskListTag match { + case TaskListTag.InProgress | TaskListTag.Completed => + val answers = userAnswers.get + ( + answers.get(ForeignClaimStructureBuildingAllowancePage(countryCode)), + answers.get(ForeignStructureBuildingAllowanceGroup(countryCode)) + ) + match { + case (Some(true), Some(sbaForm)) if sbaForm.nonEmpty => + controllers.foreign.structuresbuildingallowance.routes + .ForeignStructureBuildingAllowanceClaimsController.onPageLoad(taxYear, countryCode) + + case (Some(false), _) => + controllers.foreign.structuresbuildingallowance.routes + // TODO - Redirect to CYA for No Journey + .ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + + case (_, _) => + controllers.foreign.structuresbuildingallowance.routes + .ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + } + case _ => + controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode, NormalMode) + } + } } diff --git a/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala b/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala index 94c3a5eb..abd7a94f 100644 --- a/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala +++ b/app/pages/foreign/structurebuildingallowance/ForeignStructureBuildingAllowancePage.scala @@ -19,5 +19,6 @@ package pages.foreign.structurebuildingallowance case class ForeignStructureBuildingAllowancePage( taxYear: Int, countryCode: String, + nextIndex: Int, individualOrAgent: String ) diff --git a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala index c1085f88..89dc57b0 100644 --- a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala +++ b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsSummary.scala @@ -17,7 +17,7 @@ package viewmodels.checkAnswers.foreign.structurebuildingallowance import controllers.foreign.structuresbuildingallowance.routes -import models.{CheckMode, ForeignSbaOnIndex, UserAnswers} +import models.{ForeignSbaOnIndex, UserAnswers} import play.api.i18n.Messages import play.twirl.api.HtmlFormat import uk.gov.hmrc.govukfrontend.views.Aliases.HtmlContent @@ -44,9 +44,8 @@ object ForeignStructureBuildingAllowanceClaimsSummary { actions = Seq( ActionItemViewModel( "site.change", - // TODO - change to CYA page load - routes.ForeignStructureBuildingAllowanceClaimController - .onPageLoad(taxYear, countryCode, index, CheckMode) + routes.ForeignSbaCheckYourAnswersController + .onPageLoad(taxYear, countryCode, index) .url ).withVisuallyHiddenText(messages("foreignStructureBuildingAllowanceClaims.change.hidden")), @@ -57,6 +56,5 @@ object ForeignStructureBuildingAllowanceClaimsSummary { ), actionsCss = "w-25" ) - }.orElse(Option.empty[SummaryListRow]) } diff --git a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala index 70b05c45..481ed2a2 100644 --- a/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala +++ b/app/viewmodels/checkAnswers/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateSummary.scala @@ -16,6 +16,7 @@ package viewmodels.checkAnswers.foreign.structurebuildingallowance +import controllers.foreign.structuresbuildingallowance.routes import models.{CheckMode, UserAnswers} import pages.foreign.structurebuildingallowance.ForeignStructureBuildingQualifyingDatePage import play.api.i18n.Messages @@ -40,7 +41,9 @@ object ForeignStructureBuildingQualifyingDateSummary { actions = Seq( ActionItemViewModel( "site.change", - controllers.foreign.structuresbuildingallowance.routes.ForeignStructureBuildingQualifyingDateController.onPageLoad(taxYear, countryCode, index, CheckMode).url + routes.ForeignStructureBuildingQualifyingDateController + .onPageLoad(taxYear, countryCode, index, CheckMode) + .url ) .withVisuallyHiddenText(messages("foreignStructureBuildingQualifyingDate.change.hidden")) ) diff --git a/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html b/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html index 681f488b..cda0cf17 100644 --- a/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html +++ b/app/views/foreign/structurebuildingallowance/ForeignClaimStructureBuildingAllowanceView.scala.html @@ -27,7 +27,7 @@ @(form: Form[_], taxYear: Int, countryCode: String, mode: Mode, individualOrAgent: String)(implicit request: Request[_], messages: Messages) - @layout(pageTitle = title(form, messages("foreignClaimStructureBuildingAllowance.title"))) { + @layout(pageTitle = title(form, messages(s"foreignClaimStructureBuildingAllowance.title.$individualOrAgent"))) { @formHelper(action = controllers.foreign.structuresbuildingallowance.routes.ForeignClaimStructureBuildingAllowanceController.onSubmit(taxYear, countryCode, mode), Symbol("autoComplete") -> "off") { @@ -38,8 +38,8 @@
@messages("foreignClaimStructureBuildingAllowance.details.content")
-@messages(s"foreignClaimStructureBuildingAllowance.details.p1")
+@messages(s"foreignClaimStructureBuildingAllowance.details.content.$individualOrAgent")
+@messages(s"foreignClaimStructureBuildingAllowance.details.p1.$individualOrAgent")
@govukButton( ButtonViewModel(messages("site.saveAndContinue")) - .asLink(routes.ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(taxYear, countryCode).url) + .asLink(routes.ForeignStructureBuildingAllowanceClaimsController.onPageLoad(taxYear, countryCode).url) .withId("continue") )
@@ -44,7 +44,5 @@@messages("foreignStructureBuildingAllowance.para1")
+@messages(s"foreignStructureBuildingAllowance.para1.${page.individualOrAgent}")
@govukButton( ButtonViewModel(messages("foreignStructureBuildingAllowance.button")) - .asLink(routes.ForeignAddClaimStructureBuildingAllowanceController.onPageLoad(page.taxYear, page.countryCode).url) + .asLink(routes.ForeignStructureBuildingQualifyingDateController.onPageLoad(page.taxYear, page.countryCode, page.nextIndex, NormalMode).url) .withId("continue") )
diff --git a/app/views/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateView.scala.html b/app/views/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateView.scala.html index 11f67d91..d7145110 100644 --- a/app/views/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateView.scala.html +++ b/app/views/foreign/structurebuildingallowance/ForeignStructureBuildingQualifyingDateView.scala.html @@ -38,25 +38,18 @@@messages(s"foreignStructureBuildingQualifyingDate.details.content1.$individualOrAgent")
-@messages("foreignStructureBuildingQualifyingDate.details.content2.link.intro") - - @messages("foreignStructureBuildingQualifyingDate.details.content2.link.text") - -
-@messages(s"foreignStructureBuildingQualifyingDate.details.content1.$individualOrAgent")
+@messages("foreignStructureBuildingQualifyingDate.details.content2.link.intro") + + @messages("foreignStructureBuildingQualifyingDate.details.content2.link.text") + +
+ @govukDateInput( DateViewModel( diff --git a/conf/foreign.routes b/conf/foreign.routes index c985ec9e..b1be2eb8 100644 --- a/conf/foreign.routes +++ b/conf/foreign.routes @@ -221,7 +221,7 @@ POST /:taxYear/foreign-property/structures-buildings-allowance/:countryCod GET /:taxYear/foreign-property/structures-buildings-allowance/:countryCode/:index/check-your-answers controllers.foreign.structuresbuildingallowance.ForeignSbaCheckYourAnswersController.onPageLoad(taxYear: Int, countryCode: String, index: Int) -############################ foreign property adjustments ################################### +############################ Adjustments ################################### GET /:taxYear/foreign-property/adjustments/:countryCode/start controllers.foreign.adjustments.ForeignAdjustmentsStartController.onPageLoad(taxYear: Int, countryCode: String, isPIA: Boolean) diff --git a/conf/messages.cy b/conf/messages.cy index f6043a0f..7a195371 100644 --- a/conf/messages.cy +++ b/conf/messages.cy @@ -2389,18 +2389,21 @@ foreignOtherCapitalAllowances.change.hidden = *Missing Welsh* foreignStructureBuildingAllowance.title.individual = *Missing Welsh* foreignStructureBuildingAllowance.title.agent = *Missing Welsh* foreignStructureBuildingAllowance.heading = *Missing Welsh* -foreignStructureBuildingAllowance.para1 = *Missing Welsh* +foreignStructureBuildingAllowance.para1.individual = *Missing Welsh* +foreignStructureBuildingAllowance.para1.agent = *Missing Welsh* foreignStructureBuildingAllowance.button = *Missing Welsh* foreignStructureBuildingAllowanceAddress.hint = *Missing Welsh* -foreignClaimStructureBuildingAllowance.title = *Missing Welsh* +foreignClaimStructureBuildingAllowance.title.individual = *Missing Welsh* foreignClaimStructureBuildingAllowance.title.agent = *Missing Welsh* foreignClaimStructureBuildingAllowance.heading = *Missing Welsh* foreignClaimStructureBuildingAllowance.legend.individual = *Missing Welsh* foreignClaimStructureBuildingAllowance.legend.agent = *Missing Welsh* foreignClaimStructureBuildingAllowance.details.summary = *Missing Welsh* -foreignClaimStructureBuildingAllowance.details.content = *Missing Welsh* -foreignClaimStructureBuildingAllowance.details.p1 = *Missing Welsh* +foreignClaimStructureBuildingAllowance.details.content.individual = *Missing Welsh* +foreignClaimStructureBuildingAllowance.details.content.agent = *Missing Welsh* +foreignClaimStructureBuildingAllowance.details.p1.individual = *Missing Welsh* +foreignClaimStructureBuildingAllowance.details.p1.agent = *Missing Welsh* foreignClaimStructureBuildingAllowance.details.l1 = *Missing Welsh* foreignClaimStructureBuildingAllowance.details.l2 = *Missing Welsh* foreignClaimStructureBuildingAllowance.details.l3 = *Missing Welsh* @@ -2411,11 +2414,13 @@ foreignClaimStructureBuildingAllowance.details.content.link.href = *Missing Wels foreignClaimStructureBuildingAllowance.details.content.link.text = *Missing Welsh* foreignClaimStructureBuildingAllowance.yes = *Missing Welsh* foreignClaimStructureBuildingAllowance.no = *Missing Welsh* -foreignClaimStructureBuildingAllowance.checkYourAnswersLabel = *Missing Welsh* +foreignClaimStructureBuildingAllowance.checkYourAnswersLabel.individual = *Missing Welsh* +foreignClaimStructureBuildingAllowance.checkYourAnswersLabel.agent = *Missing Welsh* foreignClaimStructureBuildingAllowance.error.required.agent = *Missing Welsh* foreignClaimStructureBuildingAllowance.error.required.individual = *Missing Welsh* foreignClaimStructureBuildingAllowance.change.hidden = *Missing Welsh* + foreignStructureBuildingAllowanceClaim.title = *Missing Welsh* foreignStructureBuildingAllowanceClaim.heading.individual = *Missing Welsh* foreignStructureBuildingAllowanceClaim.heading.agent = *Missing Welsh* @@ -2487,7 +2492,8 @@ foreignSbaRemoveConfirmation.error.required = *Missing Welsh* foreignSbaRemoveConfirmation.change.hidden = *Missing Welsh* foreignStructureBuildingAllowanceClaims.title = *Missing Welsh* -foreignStructureBuildingAllowanceClaims.heading = *Missing Welsh* +foreignStructureBuildingAllowanceClaims.heading.individual = *Missing Welsh* +foreignStructureBuildingAllowanceClaims.heading.agent = *Missing Welsh* foreignStructureBuildingAllowanceClaims.legend = *Missing Welsh* foreignStructureBuildingAllowanceClaims.error.required = *Missing Welsh* foreignStructureBuildingAllowanceClaims.change.hidden = *Missing Welsh* diff --git a/conf/messages.en b/conf/messages.en index 85b5b8f3..21ee0d6d 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -2415,14 +2415,16 @@ foreignOtherCapitalAllowances.error.outOfRange = Enter an amount between £{0} a foreignOtherCapitalAllowances.change.hidden = Other capital allowances -foreignClaimStructureBuildingAllowance.title = Do you want to claim structures and buildings allowance? +foreignClaimStructureBuildingAllowance.title.individual = Do you want to claim structures and buildings allowance? foreignClaimStructureBuildingAllowance.title.agent = Does your client want to claim structures and buildings allowance? foreignClaimStructureBuildingAllowance.heading = Structures and buildings allowance foreignClaimStructureBuildingAllowance.legend.individual = Do you want to claim structures and buildings allowance? foreignClaimStructureBuildingAllowance.legend.agent = Does your client want to claim structures and buildings allowance? foreignClaimStructureBuildingAllowance.details.summary = Understanding structures and buildings allowance -foreignClaimStructureBuildingAllowance.details.content = If you’ve paid some or all of the costs towards the purchase, construction or renovation of your property (or structure), then you may be able to claim the structures and buildings allowance tax relief on what you’ve spent. -foreignClaimStructureBuildingAllowance.details.p1 = You can only claim on construction costs, which include: +foreignClaimStructureBuildingAllowance.details.content.individual = If you''ve paid some or all of the costs towards the purchase, construction or renovation of your non-residential property (or structure), then you may be able to claim the structures and buildings allowance tax relief on what you''ve spent. +foreignClaimStructureBuildingAllowance.details.content.agent = If your client paid some or all of the costs towards the purchase, construction or renovation of their non-residential property (or structure), then they may be able to claim the structures and buildings allowance tax relief on what they''ve spent. +foreignClaimStructureBuildingAllowance.details.p1.individual = You can only claim on construction costs, which include: +foreignClaimStructureBuildingAllowance.details.p1.agent = They can only claim on construction costs, which include: foreignClaimStructureBuildingAllowance.details.l1 = fees for design foreignClaimStructureBuildingAllowance.details.l2 = preparing the site for construction foreignClaimStructureBuildingAllowance.details.l3 = construction works @@ -2433,16 +2435,17 @@ foreignClaimStructureBuildingAllowance.details.content.link.href = https://www.g foreignClaimStructureBuildingAllowance.details.content.link.text = capital allowances for buildings and structures at GOV.UK (opens in new tab) foreignClaimStructureBuildingAllowance.yes = Yes foreignClaimStructureBuildingAllowance.no = No -foreignClaimStructureBuildingAllowance.checkYourAnswersLabel = Do you want to claim structures and buildings allowance? +foreignClaimStructureBuildingAllowance.checkYourAnswersLabel.individual = Do you want to claim structures and buildings allowance? +foreignClaimStructureBuildingAllowance.checkYourAnswersLabel.agent = Does your client want to claim structures and buildings allowance? foreignClaimStructureBuildingAllowance.error.required.agent = Select yes if your client wants to claim structures building allowance foreignClaimStructureBuildingAllowance.error.required.individual = Select yes if you want to claim structures building allowance foreignClaimStructureBuildingAllowance.change.hidden = Structures Buildings Allowance foreignStructureBuildingAllowanceClaim.title = How much is your structures and buildings allowance claim? foreignStructureBuildingAllowanceClaim.heading.individual = How much is your structures and buildings allowance claim? -foreignStructureBuildingAllowanceClaim.heading.agent = How much is your client’s structures and buildings allowance claim? -foreignStructureBuildingAllowanceClaim.legend.individual = Enter the amount that you’ve calculated for your allowance. -foreignStructureBuildingAllowanceClaim.legend.agent = Enter the amount that you’ve calculated for your client’s allowance. +foreignStructureBuildingAllowanceClaim.heading.agent = How much is your client''s structures and buildings allowance claim? +foreignStructureBuildingAllowanceClaim.legend.individual = Enter the amount that you''ve calculated for your allowance. +foreignStructureBuildingAllowanceClaim.legend.agent = Enter the amount that you''ve calculated for your client''s allowance. foreignStructureBuildingAllowanceClaim.checkYourAnswersLabel = Claim value foreignStructureBuildingAllowanceClaim.error.nonNumeric = The structures and buildings allowance claim value can only include pounds and pence, for example £600 or £600.20 foreignStructureBuildingAllowanceClaim.error.required.individual = Enter the amount for the structures and buildings allowance claim value @@ -2456,9 +2459,9 @@ foreignStructureBuildingAllowanceClaim.change.hidden = Structures and Buildings foreignStructureBuildingAllowance.title.individual = Structures Buildings Allowance foreignStructureBuildingAllowance.title.agent = Structures Buildings Allowance foreignStructureBuildingAllowance.heading = Structures and buildings allowance claims -foreignStructureBuildingAllowance.para1 = Tell HMRC if you’ve paid some, or all, of the costs towards the purchase, construction or renovation of a building. You may be able to claim tax relief. +foreignStructureBuildingAllowance.para1.individual = Tell HMRC if you''ve paid some, or all, of the costs towards the purchase, construction or renovation of a building. You may be able to claim tax relief. +foreignStructureBuildingAllowance.para1.agent = Tell HMRC if your client paid some, or all, of the costs towards the purchase, construction or renovation of a building. You may be be able to claim tax relief. foreignStructureBuildingAllowance.button = Add a claim -foreignStructureBuildingAllowanceAddress.hint = You can only add one address per claim foreignStructureBuildingQualifyingAmount.title = Structures and buildings allowance qualifying amount @@ -2470,9 +2473,9 @@ foreignStructureBuildingQualifyingAmount.details.l1 = the date the structure fir foreignStructureBuildingQualifyingAmount.details.l2 = the date on which the qualifying expenditure is incurred foreignStructureBuildingQualifyingAmount.input.legend = What is the total qualifying amount? -foreignStructureBuildingQualifyingAmount.error.nonNumeric = Enter the total qualifying amount for enhanced structures and buildings allowance -foreignStructureBuildingQualifyingAmount.error.required = Enter the total qualifying amount for enhanced structures and buildings allowance -foreignStructureBuildingQualifyingAmount.error.twoDecimalPlaces = The total qualifying amount for enhanced structures and buildings allowance can only include pounds and pence, for example £600 or £600.20 +foreignStructureBuildingQualifyingAmount.error.nonNumeric = The structures and buildings allowance claim can only include pounds and pence, for example £600 or £600.20 +foreignStructureBuildingQualifyingAmount.error.required = Enter the total qualifying amount for structures and buildings allowance +foreignStructureBuildingQualifyingAmount.error.twoDecimalPlaces = The total qualifying amount for structures and buildings allowance can only include pounds and pence, for example £600 or £600.20 foreignStructureBuildingQualifyingAmount.error.outOfRange = Enter an amount between £{0} and £{1} foreignStructureBuildingQualifyingAmount.change.hidden = Qualifying amount @@ -2488,16 +2491,16 @@ foreignStructuresBuildingAllowanceAddress.error.postcode.required = Enter a full foreignStructuresBuildingAllowanceAddress.checkYourAnswersLabel = Structure and building allowance address foreignStructuresBuildingAllowanceAddress.error.duplicate = The address for this claim has already been added -foreignStructureBuildingQualifyingDate.title = Qualifying date -foreignStructureBuildingQualifyingDate.heading = Qualifying date +foreignStructureBuildingQualifyingDate.title = Structures and buildings allowance qualifying date +foreignStructureBuildingQualifyingDate.heading = Structures and buildings allowance qualifying date foreignStructureBuildingQualifyingDate.legend = What is the qualifying date? foreignStructureBuildingQualifyingDate.hint = For example, 29 10 2018 foreignStructureBuildingQualifyingDate.details.heading = Understanding structures and buildings allowance qualifying date foreignStructureBuildingQualifyingDate.details.content1.individual = Start your claim from whichever date is later: -foreignStructureBuildingQualifyingDate.details.content1.agent = Start your client’s claim from whichever date is later: +foreignStructureBuildingQualifyingDate.details.content1.agent = Start your client''s claim from whichever date is later: foreignStructureBuildingQualifyingDate.details.l1.individual = the date when you started using the structure for a qualifying activity foreignStructureBuildingQualifyingDate.details.l1.agent = the date when your client started using the structure for a qualifying activity -foreignStructureBuildingQualifyingDate.details.l2.individual = the date that you’re due to pay for the structure or construction +foreignStructureBuildingQualifyingDate.details.l2.individual = the date that you''re due to pay for the structure or construction foreignStructureBuildingQualifyingDate.details.l2.agent = the date that your client is due to pay for the structure or construction foreignStructureBuildingQualifyingDate.details.content2.link.intro = Read more about foreignStructureBuildingQualifyingDate.details.content2.link.text = the structures and building allowance at GOV.UK (opens in new tab) @@ -2518,14 +2521,15 @@ foreignSbaRemoveConfirmation.error.required = Select yes if you want to remove t foreignSbaRemoveConfirmation.change.hidden = Remove Structures Buildings Allowance Claim foreignStructureBuildingAllowanceClaims.title = Your structures and buildings allowance claims -foreignStructureBuildingAllowanceClaims.heading = Your structures and buildings allowance claims +foreignStructureBuildingAllowanceClaims.heading.individual = Your structures and buildings allowance claims +foreignStructureBuildingAllowanceClaims.heading.agent = Your client''s structures and buildings allowance claims foreignStructureBuildingAllowanceClaims.legend = Do you want to add another claim? foreignStructureBuildingAllowanceClaims.error.required = Select yes if you want to add another claim foreignStructureBuildingAllowanceClaims.change.hidden = Structures and Buildings Allowance Claim foreignAdjustmentsStart.title = Adjustments for your property in {0} foreignAdjustmentsStart.heading = Adjustments for your property in {0} -foreignAdjustmentsStart.details.content = In this section we’re going to ask you about the following adjustments: +foreignAdjustmentsStart.details.content = In this section we''re going to ask you about the following adjustments: foreignAdjustmentsStart.details.content.l1 = private use adjustment foreignAdjustmentsStart.details.content.l2 = balancing charge foreignAdjustmentsStart.details.content.l3 = residential property finance costs diff --git a/test/controllers/foreign/structurebuildingallowance/ForeignAddClaimStructureBuildingAllowanceControllerSpec.scala b/test/controllers/foreign/structurebuildingallowance/ForeignAddClaimStructureBuildingAllowanceControllerSpec.scala index 3a11d093..93c5b8f8 100644 --- a/test/controllers/foreign/structurebuildingallowance/ForeignAddClaimStructureBuildingAllowanceControllerSpec.scala +++ b/test/controllers/foreign/structurebuildingallowance/ForeignAddClaimStructureBuildingAllowanceControllerSpec.scala @@ -29,6 +29,7 @@ class ForeignAddClaimStructureBuildingAllowanceControllerSpec extends SpecBase { val taxYear = 2024 val isAgent = true + val nextIndex = 0 val countryCode = "AUS" s"must return OK and the correct view for a GET" in { @@ -59,6 +60,7 @@ class ForeignAddClaimStructureBuildingAllowanceControllerSpec extends SpecBase { ForeignStructureBuildingAllowancePage( taxYear = taxYear, countryCode = countryCode, + nextIndex = nextIndex, individualOrAgent = "agent" ) )( diff --git a/test/controllers/foreign/structurebuildingallowance/ForeignSbaCompleteControllerSpec.scala b/test/controllers/foreign/structurebuildingallowance/ForeignSbaCompleteControllerSpec.scala index fb7589c6..d4098eaa 100644 --- a/test/controllers/foreign/structurebuildingallowance/ForeignSbaCompleteControllerSpec.scala +++ b/test/controllers/foreign/structurebuildingallowance/ForeignSbaCompleteControllerSpec.scala @@ -19,9 +19,9 @@ package controllers.foreign.structurebuildingallowance import base.SpecBase import controllers.routes import forms.foreign.structurebuildingallowance.ForeignSbaCompleteFormProvider -import models.JourneyPath.ForeignStructureBuildingAllowance +import models.JourneyPath.ForeignPropertyAllowances import models.{JourneyContext, NormalMode, User, UserAnswers} -import navigation.{FakeNavigator, Navigator} +import navigation.{FakeForeignPropertyNavigator, ForeignPropertyNavigator} import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when @@ -107,7 +107,7 @@ class ForeignSbaCompleteControllerSpec extends SpecBase with MockitoSugar { when( mockJourneyAnswersService.setStatus( ArgumentMatchers.eq( - JourneyContext(taxYear, mtditid = "mtditid", nino = "nino", journeyPath = ForeignStructureBuildingAllowance) + JourneyContext(taxYear, mtditid = "mtditid", nino = "nino", journeyPath = ForeignPropertyAllowances) ), ArgumentMatchers.eq("completed"), ArgumentMatchers.eq(user) @@ -117,7 +117,7 @@ class ForeignSbaCompleteControllerSpec extends SpecBase with MockitoSugar { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers), isAgent = false) .overrides( - bind[Navigator].toInstance(new FakeNavigator(onwardRoute)), + bind[ForeignPropertyNavigator].toInstance(new FakeForeignPropertyNavigator(onwardRoute)), bind[SessionRepository].toInstance(mockSessionRepository), bind[JourneyAnswersService].toInstance(mockJourneyAnswersService) ) diff --git a/test/controllers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsControllerSpec.scala b/test/controllers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsControllerSpec.scala index bb7961de..b837ff00 100644 --- a/test/controllers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsControllerSpec.scala +++ b/test/controllers/foreign/structurebuildingallowance/ForeignStructureBuildingAllowanceClaimsControllerSpec.scala @@ -42,6 +42,7 @@ class ForeignStructureBuildingAllowanceClaimsControllerSpec extends SpecBase wit def onwardRoute = Call("GET", "/foo") val formProvider = new ForeignStructureBuildingAllowanceClaimsFormProvider() + private val isAgentMessageKey = "individual" val form = formProvider() val taxYear = 2024 val countryCode = "AUS" @@ -64,7 +65,7 @@ class ForeignStructureBuildingAllowanceClaimsControllerSpec extends SpecBase wit val view = application.injector.instanceOf[ForeignStructureBuildingAllowanceClaimsView] status(result) mustEqual OK - contentAsString(result) mustEqual view(form, list, taxYear, countryCode)( + contentAsString(result) mustEqual view(form, list, taxYear, countryCode, isAgentMessageKey)( request, messages(application) ).toString @@ -106,7 +107,7 @@ class ForeignStructureBuildingAllowanceClaimsControllerSpec extends SpecBase wit val result = route(application, request).value status(result) mustEqual BAD_REQUEST - contentAsString(result) mustEqual view(boundForm, list, taxYear, countryCode)( + contentAsString(result) mustEqual view(boundForm, list, taxYear, countryCode, isAgentMessageKey)( request, messages(application) ).toString diff --git a/test/controllers/foreign/structurebuildingallowance/ForeignStructuresBuildingAllowanceAddressControllerSpec.scala b/test/controllers/foreign/structurebuildingallowance/ForeignStructuresBuildingAllowanceAddressControllerSpec.scala index d6288e0b..950730dd 100644 --- a/test/controllers/foreign/structurebuildingallowance/ForeignStructuresBuildingAllowanceAddressControllerSpec.scala +++ b/test/controllers/foreign/structurebuildingallowance/ForeignStructuresBuildingAllowanceAddressControllerSpec.scala @@ -21,7 +21,7 @@ import controllers.foreign.structuresbuildingallowance.routes.ForeignStructuresB import controllers.routes import forms.foreign.structurebuildingallowance.ForeignStructuresBuildingAllowanceAddressFormProvider import models.{ForeignStructuresBuildingAllowanceAddress, NormalMode, UserAnswers} -import navigation.{FakeNavigator, Navigator} +import navigation.{FakeForeignPropertyNavigator, ForeignPropertyNavigator} import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar @@ -109,7 +109,7 @@ class ForeignStructuresBuildingAllowanceAddressControllerSpec extends SpecBase w val application = applicationBuilder(userAnswers = Some(emptyUserAnswers), isAgent = false) .overrides( - bind[Navigator].toInstance(new FakeNavigator(onwardRoute)), + bind[ForeignPropertyNavigator].toInstance(new FakeForeignPropertyNavigator(onwardRoute)), bind[SessionRepository].toInstance(mockSessionRepository) ) .build()