diff --git a/app/uk/gov/hmrc/merchandiseinbaggage/controllers/RetrieveDeclarationController.scala b/app/uk/gov/hmrc/merchandiseinbaggage/controllers/RetrieveDeclarationController.scala index 661ca5f8..58e024ca 100644 --- a/app/uk/gov/hmrc/merchandiseinbaggage/controllers/RetrieveDeclarationController.scala +++ b/app/uk/gov/hmrc/merchandiseinbaggage/controllers/RetrieveDeclarationController.scala @@ -17,10 +17,11 @@ package uk.gov.hmrc.merchandiseinbaggage.controllers import cats.implicits._ -import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} +import play.api.mvc.{Action, AnyContent, Call, MessagesControllerComponents} import uk.gov.hmrc.http.HeaderCarrier import uk.gov.hmrc.merchandiseinbaggage.config.AppConfig import uk.gov.hmrc.merchandiseinbaggage.connectors.MibConnector +import uk.gov.hmrc.merchandiseinbaggage.controllers.routes.{ImportExportChoiceController, NewOrExistingController} import uk.gov.hmrc.merchandiseinbaggage.forms.RetrieveDeclarationForm.form import uk.gov.hmrc.merchandiseinbaggage.model.core.RetrieveDeclaration import uk.gov.hmrc.merchandiseinbaggage.navigation._ @@ -42,9 +43,12 @@ class RetrieveDeclarationController @Inject() ( )(implicit appConfig: AppConfig, val ec: ExecutionContext) extends DeclarationJourneyUpdateController { + private def backLink(isAssistedDigital: Boolean): Call = + if (isAssistedDigital) ImportExportChoiceController.onPageLoad else NewOrExistingController.onPageLoad + override val onPageLoad: Action[AnyContent] = actionProvider.journeyAction { implicit request => val preFilledForm = request.declarationJourney.maybeRetrieveDeclaration.fold(form)(form.fill) - Ok(view(preFilledForm, routes.NewOrExistingController.onPageLoad, request.declarationJourney.declarationType)) + Ok(view(preFilledForm, backLink(request.isAssistedDigital), request.declarationJourney.declarationType)) } override val onSubmit: Action[AnyContent] = actionProvider.journeyAction.async { implicit request => @@ -53,7 +57,7 @@ class RetrieveDeclarationController @Inject() ( .fold( formWithErrors => BadRequest( - view(formWithErrors, routes.NewOrExistingController.onPageLoad, request.declarationJourney.declarationType) + view(formWithErrors, backLink(request.isAssistedDigital), request.declarationJourney.declarationType) ).asFuture, retrieveDeclaration => processRequest(retrieveDeclaration) ) diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 9db6cb5e..0fce806b 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -6,11 +6,11 @@ object AppDependencies { private val compile: Seq[ModuleID] = Seq( "uk.gov.hmrc" %% "bootstrap-frontend-play-30" % bootstrapVersion, - "uk.gov.hmrc" %% "play-frontend-hmrc-play-30" % "11.5.0", + "uk.gov.hmrc" %% "play-frontend-hmrc-play-30" % "11.7.0", "uk.gov.hmrc.mongo" %% "hmrc-mongo-play-30" % "2.3.0", "com.beachape" %% "enumeratum-play" % "1.8.2", "org.webjars.npm" % "accessible-autocomplete" % "3.0.0", - "com.softwaremill.quicklens" %% "quicklens" % "1.9.9", + "com.softwaremill.quicklens" %% "quicklens" % "1.9.10", "org.typelevel" %% "cats-core" % "2.12.0", "io.github.samueleresca" %% "pekko-quartz-scheduler" % "1.2.2-pekko-1.0.x" )