Skip to content

Commit

Permalink
[AC][OPS-13205] add ITSA origin to SA (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyHWChung authored Jan 15, 2025
1 parent f59c93a commit b0746ad
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 35 deletions.
84 changes: 50 additions & 34 deletions app/testOnly/controllers/StartJourneyController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,23 @@ import scala.concurrent.{ExecutionContext, Future}

@Singleton
class StartJourneyController @Inject() (
as: Actions,
appConfig: AppConfig,
essttpStubConnector: EssttpStubConnector,
mcc: MessagesControllerComponents,
testOnlyStartPage: TestOnlyStartPage,
journeyConnector: JourneyConnector,
loginService: AuthLoginApiService,
taxRegimePage: TaxRegimePage,
iAmBtaPage: IAmBtaPage,
iAmPtaPage: IAmPtaPage,
iAmEpayePage: IAmEPAYEPage,
iAmVatPage: IAmVatPage,
iAmVatPenaltiesPage: IAmVatPenaltiesPage,
iAmGovUkPage: IAmGovUkPage,
iAmMobilePage: IAmMobilePage,
requestSupport: RequestSupport
as: Actions,
appConfig: AppConfig,
essttpStubConnector: EssttpStubConnector,
mcc: MessagesControllerComponents,
testOnlyStartPage: TestOnlyStartPage,
journeyConnector: JourneyConnector,
loginService: AuthLoginApiService,
taxRegimePage: TaxRegimePage,
iAmBtaPage: IAmBtaPage,
iAmPtaPage: IAmPtaPage,
iAmEpayePage: IAmEPAYEPage,
iAmVatPage: IAmVatPage,
iAmVatPenaltiesPage: IAmVatPenaltiesPage,
iAmGovUkPage: IAmGovUkPage,
iAmMobilePage: IAmMobilePage,
iAmItsaViewAndChangePage: IAmItsaViewAndChangePage,
requestSupport: RequestSupport
)(implicit ec: ExecutionContext)
extends FrontendController(mcc)
with Logging {
Expand Down Expand Up @@ -137,24 +138,25 @@ class StartJourneyController @Inject() (
maybeTestUser = TestUser.makeTestUser(startJourneyForm)
session <- maybeTestUser.map(testUser => loginService.logIn(testUser)).getOrElse(Future.successful(Session.emptyCookie))
redirectTo: Call = startJourneyForm.origin match {
case Origins.Epaye.Bta => testOnlyRoutes.StartJourneyController.showBtaEpayePage
case Origins.Epaye.EpayeService => testOnlyRoutes.StartJourneyController.showEpayePage
case Origins.Epaye.GovUk => testOnlyRoutes.StartJourneyController.showGovukEpayePage
case Origins.Epaye.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedEpayeJourney
case Origins.Vat.Bta => testOnlyRoutes.StartJourneyController.showBtaVatPage
case Origins.Vat.VatService => testOnlyRoutes.StartJourneyController.showVatPage
case Origins.Vat.GovUk => testOnlyRoutes.StartJourneyController.showGovukVatPage
case Origins.Vat.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedVatJourney
case Origins.Vat.VatPenalties => testOnlyRoutes.StartJourneyController.showVatPenaltiesPage
case Origins.Sa.Bta => testOnlyRoutes.StartJourneyController.showBtaSaPage
case Origins.Sa.Pta => testOnlyRoutes.StartJourneyController.showPtaSaPage
case Origins.Sa.Mobile => testOnlyRoutes.StartJourneyController.showMobileSaPage
case Origins.Sa.GovUk => testOnlyRoutes.StartJourneyController.showGovukSaPage
case Origins.Sa.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedSaJourney
case Origins.Simp.Pta => testOnlyRoutes.StartJourneyController.showPtaSimpPage
case Origins.Simp.Mobile => testOnlyRoutes.StartJourneyController.showMobileSimpPage
case Origins.Simp.GovUk => testOnlyRoutes.StartJourneyController.showGovukSimpPage
case Origins.Simp.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedSimpJourney
case Origins.Epaye.Bta => testOnlyRoutes.StartJourneyController.showBtaEpayePage
case Origins.Epaye.EpayeService => testOnlyRoutes.StartJourneyController.showEpayePage
case Origins.Epaye.GovUk => testOnlyRoutes.StartJourneyController.showGovukEpayePage
case Origins.Epaye.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedEpayeJourney
case Origins.Vat.Bta => testOnlyRoutes.StartJourneyController.showBtaVatPage
case Origins.Vat.VatService => testOnlyRoutes.StartJourneyController.showVatPage
case Origins.Vat.GovUk => testOnlyRoutes.StartJourneyController.showGovukVatPage
case Origins.Vat.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedVatJourney
case Origins.Vat.VatPenalties => testOnlyRoutes.StartJourneyController.showVatPenaltiesPage
case Origins.Sa.Bta => testOnlyRoutes.StartJourneyController.showBtaSaPage
case Origins.Sa.Pta => testOnlyRoutes.StartJourneyController.showPtaSaPage
case Origins.Sa.Mobile => testOnlyRoutes.StartJourneyController.showMobileSaPage
case Origins.Sa.GovUk => testOnlyRoutes.StartJourneyController.showGovukSaPage
case Origins.Sa.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedSaJourney
case Origins.Sa.ItsaViewAndChange => testOnlyRoutes.StartJourneyController.showItsaViewAndChangePage
case Origins.Simp.Pta => testOnlyRoutes.StartJourneyController.showPtaSimpPage
case Origins.Simp.Mobile => testOnlyRoutes.StartJourneyController.showMobileSimpPage
case Origins.Simp.GovUk => testOnlyRoutes.StartJourneyController.showGovukSimpPage
case Origins.Simp.DetachedUrl => _root_.controllers.routes.StartJourneyController.startDetachedSimpJourney
}
} yield Redirect(redirectTo).withSession(session)
}
Expand Down Expand Up @@ -232,6 +234,11 @@ class StartJourneyController @Inject() (
withSessionId(Future.successful(Ok(iAmVatPenaltiesPage())))
}

/** Pretends being an ITSA View & Change page */
val showItsaViewAndChangePage: Action[AnyContent] = as.default.async { implicit request =>
withSessionId(Future.successful(Ok(iAmItsaViewAndChangePage(testOnlyRoutes.StartJourneyController.startJourneySaItsaViewAndChange.url))))
}

/**
* Pretends for testing purposes that journey started from Bta
*/
Expand Down Expand Up @@ -310,6 +317,15 @@ class StartJourneyController @Inject() (
}
}

val startJourneySaItsaViewAndChange: Action[AnyContent] = as.default.async { implicit request =>
withSessionId {
journeyConnector.Sa.startJourneyItsaViewAndChange(SjRequest.Sa.Simple(
returnUrl = ReturnUrl(routes.StartJourneyController.showMobileSaPage.url + "?return-page"),
backUrl = BackUrl(routes.StartJourneyController.showMobileSaPage.url + "?starting-page")
)).map(sjResponse => Redirect(sjResponse.nextUrl.value))
}
}

val startJourneySimpPta: Action[AnyContent] = as.default.async { implicit request =>
withSessionId {
journeyConnector.Simp.startJourneyPta(SjRequest.Simp.Simple(
Expand Down
43 changes: 43 additions & 0 deletions app/testOnly/views/IAmItsaViewAndChangePage.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@*
* Copyright 2023 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*@

@import controllers.routes
@import essttp.rootmodel.TaxRegime
@import play.api.mvc.Request
@import uk.gov.hmrc.govukfrontend.views.html.components._

@this(
testOnlyLayout: TestOnlyLayout,
govukButton: GovukButton
)
@(journeyStartUrl: String)(implicit request: Request[_])

@title = @{
"I am ITSA View & Change Page"
}


@testOnlyLayout(pageTitle = Some(title)) {

<h1 class="govuk-heading-xl">@title</h1>
<p class="govuk-body">Set up a Self Assessment payment plan if you cannot pay in full</p>

@govukButton(Button(
href = Some(journeyStartUrl),
content = Text("Start now")
))

}
5 changes: 5 additions & 0 deletions app/testOnly/views/TestOnlyStartPage.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,11 @@
content = Text("Mobile service"),
value = Some(Origins.Sa.Mobile.entryName),
checked = form.data.exists(_._2 === Origins.Sa.Mobile.entryName)
),
RadioItem(
content = Text("ITSA View & Change"),
value = Some(Origins.Sa.ItsaViewAndChange.entryName),
checked = form.data.exists(_._2 === Origins.Sa.ItsaViewAndChange.entryName)
)
),
classes = "govuk-radios--small"
Expand Down
2 changes: 2 additions & 0 deletions conf/testOnlyDoNotUseInAppConf.routes
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ GET /set-up-a-payment-plan/test-only/vat-penalties testOnly

GET /set-up-a-payment-plan/test-only/pta-sa testOnly.controllers.StartJourneyController.showPtaSaPage
GET /set-up-a-payment-plan/test-only/mobile-sa testOnly.controllers.StartJourneyController.showMobileSaPage
GET /set-up-a-payment-plan/test-only/itsa-sa testOnly.controllers.StartJourneyController.showItsaViewAndChangePage

GET /set-up-a-payment-plan/test-only/pta-simp testOnly.controllers.StartJourneyController.showPtaSimpPage
GET /set-up-a-payment-plan/test-only/mobile-simp testOnly.controllers.StartJourneyController.showMobileSimpPage
Expand All @@ -63,6 +64,7 @@ GET /set-up-a-payment-plan/test-only/start-journey-vat-penalties testOnly
GET /set-up-a-payment-plan/test-only/start-journey-sa-bta testOnly.controllers.StartJourneyController.startJourneySaBta
GET /set-up-a-payment-plan/test-only/start-journey-sa-pta testOnly.controllers.StartJourneyController.startJourneySaPta
GET /set-up-a-payment-plan/test-only/start-journey-sa-mobile testOnly.controllers.StartJourneyController.startJourneySaMobile
GET /set-up-a-payment-plan/test-only/start-journey-sa-itsa testOnly.controllers.StartJourneyController.startJourneySaItsaViewAndChange

GET /set-up-a-payment-plan/test-only/start-journey-simp-pta testOnly.controllers.StartJourneyController.startJourneySimpPta
GET /set-up-a-payment-plan/test-only/start-journey-simp-mobile testOnly.controllers.StartJourneyController.startJourneySimpMobile
Expand Down
2 changes: 1 addition & 1 deletion project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object AppDependencies {
"uk.gov.hmrc" %% "play-conditional-form-mapping-play-30" % "3.2.0",
"com.beachape" %% "enumeratum-play" % "1.8.1",
"org.typelevel" %% "cats-core" % "2.12.0",
"uk.gov.hmrc" %% "essttp-backend-cor-journey" % "1.174.0",
"uk.gov.hmrc" %% "essttp-backend-cor-journey" % "1.175.0",
"uk.gov.hmrc" %% "domain-play-30" % "10.0.0"
// format: ON
)
Expand Down

0 comments on commit b0746ad

Please sign in to comment.