diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersController.scala b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersController.scala new file mode 100644 index 000000000..eae0208c9 --- /dev/null +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersController.scala @@ -0,0 +1,23 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.controllers + +import javax.inject.Inject +import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} +import uk.gov.hmrc.merchandiseinbaggagefrontend.config.AppConfig +import uk.gov.hmrc.merchandiseinbaggagefrontend.views.html.CheckYourAnswersPage +import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController + +import scala.concurrent.ExecutionContext + +class CheckYourAnswersController @Inject()(mcc: MessagesControllerComponents, page: CheckYourAnswersPage) + (implicit val ec: ExecutionContext, appConfig: AppConfig) + extends FrontendController(mcc) { + + val onPageLoad: Action[AnyContent] = Action { implicit request => + Ok(page()) + } +} diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyController.scala b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyController.scala new file mode 100644 index 000000000..b28ee68bd --- /dev/null +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyController.scala @@ -0,0 +1,79 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.controllers + +import javax.inject.Inject +import play.api.mvc.{Action, AnyContent, Call, MessagesControllerComponents} +import uk.gov.hmrc.merchandiseinbaggagefrontend.config.AppConfig +import uk.gov.hmrc.merchandiseinbaggagefrontend.views.html.SkeletonPage +import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController + +import scala.concurrent.ExecutionContext + +/** + * Controller serving skeleton pages + * + * It is envisaged this controller will be re-factored away action-by-action as we build out the journey + */ +class SkeletonJourneyController @Inject()(mcc: MessagesControllerComponents, page: SkeletonPage) + (implicit val ec: ExecutionContext, appConfig: AppConfig) + extends FrontendController(mcc) { + + val start: Action[AnyContent] = + displaySkeletonPage("start.title", routes.SkeletonJourneyController.importExport()) + + val importExport: Action[AnyContent] = + displaySkeletonPage("importExport.title", routes.SkeletonJourneyController.multipleCountriesEuCheck()) + + val multipleCountriesEuCheck: Action[AnyContent] = + displaySkeletonPage("multipleCountriesEuCheck.title", routes.SkeletonJourneyController.goodsExcise()) + + val goodsExcise: Action[AnyContent] = + displaySkeletonPage("goodsExcise.title", routes.SkeletonJourneyController.valueWeightOfGoods()) + + val valueWeightOfGoods: Action[AnyContent] = + displaySkeletonPage("valueWeightOfGoods.title", routes.SkeletonJourneyController.goodsType()) + + val goodsType: Action[AnyContent] = + displaySkeletonPage("goodsType.title", routes.SkeletonJourneyController.goodsCategory()) + + val goodsCategory: Action[AnyContent] = + displaySkeletonPage("goodsCategory.title", routes.SkeletonJourneyController.goodsDetailsWhere()) + + val goodsDetailsWhere: Action[AnyContent] = + displaySkeletonPage("goodsDetailsWhere.title", routes.SkeletonJourneyController.goodsDetailsCost()) + + val goodsDetailsCost: Action[AnyContent] = + displaySkeletonPage("goodsDetailsCost.title", routes.SkeletonJourneyController.goodsReview()) + + val goodsReview: Action[AnyContent] = + displaySkeletonPage("goodsReview.title", routes.SkeletonJourneyController.calculation()) + + val calculation: Action[AnyContent] = + displaySkeletonPage("calculation.title", routes.SkeletonJourneyController.traderAgent()) + + val traderAgent: Action[AnyContent] = + displaySkeletonPage("traderAgent.title", routes.SkeletonJourneyController.traderDetails()) + + val traderDetails: Action[AnyContent] = + displaySkeletonPage("traderDetails.title", routes.SkeletonJourneyController.traderAddress()) + + val traderAddress: Action[AnyContent] = + displaySkeletonPage("traderAddress.title", routes.SkeletonJourneyController.traderAddressList()) + + val traderAddressList: Action[AnyContent] = + displaySkeletonPage("traderAddressList.title", routes.SkeletonJourneyController.traderEori()) + + val traderEori: Action[AnyContent] = + displaySkeletonPage("traderEori.title", routes.SkeletonJourneyController.traderJourney()) + + val traderJourney: Action[AnyContent] = + displaySkeletonPage("traderJourney.title", routes.CheckYourAnswersController.onPageLoad()) + + private def displaySkeletonPage(titleMessageKey: String, next: Call) = Action { implicit request => + Ok(page(titleMessageKey, next)) + } +} diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/CheckYourAnswersPage.scala.html b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/CheckYourAnswersPage.scala.html new file mode 100644 index 000000000..0c08b345b --- /dev/null +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/CheckYourAnswersPage.scala.html @@ -0,0 +1,14 @@ +@* + * Copyright 2020 HM Revenue & Customs + * + *@ + +@import uk.gov.hmrc.merchandiseinbaggagefrontend.config.AppConfig + +@this(layout: Layout) + +@()(implicit request: Request[_], messages: Messages, appConfig: AppConfig) + +@layout(pageTitle = Some(messages("checkYourAnswers.title"))) { +

@messages("checkYourAnswers.title")

+} diff --git a/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/SkeletonPage.scala.html b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/SkeletonPage.scala.html new file mode 100644 index 000000000..f660e2b11 --- /dev/null +++ b/app/uk/gov/hmrc/merchandiseinbaggagefrontend/views/SkeletonPage.scala.html @@ -0,0 +1,17 @@ +@* + * Copyright 2020 HM Revenue & Customs + * + *@ + +@import play.api.mvc.Call +@import uk.gov.hmrc.merchandiseinbaggagefrontend.config.AppConfig + +@this(layout: Layout, val button: components.button) + +@(titleMessageKey: String, next: Call)(implicit request: Request[_], messages: Messages, appConfig: AppConfig) + +@layout(pageTitle = Some(messages(titleMessageKey))) { +

@messages(titleMessageKey)

+ + @button(messages("next.button"), href = Some(next.url), classes = Some("govuk-button")) +} diff --git a/build.sbt b/build.sbt index f77dd3bdb..babe01668 100644 --- a/build.sbt +++ b/build.sbt @@ -9,6 +9,7 @@ val silencerVersion = "1.7.0" lazy val microservice = Project(appName, file(".")) .enablePlugins(play.sbt.PlayScala, SbtAutoBuildPlugin, SbtGitVersioning, SbtDistributablesPlugin, SbtArtifactory) + .disablePlugins(JUnitXmlReportPlugin) .settings( majorVersion := 0, scalaVersion := "2.12.11", diff --git a/conf/app.routes b/conf/app.routes index d1cc24bbb..af18f6485 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -1,9 +1,29 @@ # microservice specific routes --> /govuk-frontend govuk.Routes --> /hmrc-frontend hmrcfrontend.Routes +-> /govuk-frontend govuk.Routes +-> /hmrc-frontend hmrcfrontend.Routes -GET /assets/*file controllers.Assets.versioned(path = "/public", file: Asset) +GET /assets/*file controllers.Assets.versioned(path = "/public", file: Asset) -GET /payment uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.PaymentController.onPageLoad -GET /process-payment uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.PaymentController.onSubmit() +GET /payment uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.PaymentController.onPageLoad +GET /process-payment uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.PaymentController.onSubmit() + +GET /start uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.start +GET /import-export uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.importExport +GET /multiple-countries-eu-check uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.multipleCountriesEuCheck +GET /goods-excise uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsExcise +GET /value-weight-of-goods uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.valueWeightOfGoods +GET /goods-type uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsType +GET /goods-category uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsCategory +GET /goods-details-where uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsDetailsWhere +GET /goods-details-cost uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsDetailsCost +GET /goods-review uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.goodsReview +GET /calculation uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.calculation +GET /trader-agent uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderAgent +GET /trader-details uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderDetails +GET /trader-address uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderAddress +GET /trader-address-list uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderAddressList +GET /trader-eori uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderEori +GET /trader-journey uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.SkeletonJourneyController.traderJourney + +GET /check-your-answers uk.gov.hmrc.merchandiseinbaggagefrontend.controllers.CheckYourAnswersController.onPageLoad diff --git a/conf/messages b/conf/messages index 34a402a8b..31c18340f 100644 --- a/conf/messages +++ b/conf/messages @@ -11,4 +11,24 @@ footer.termsConditions.url = /help/terms-and-conditions footer.govukHelp.text = Help using GOV.UK footer.govukHelp.url = https://www.gov.uk/help -payment.button = Pay now \ No newline at end of file +payment.button = Pay now +next.button = Next + +start.title = Declaring merchandise in your baggage +importExport.title = What do you need to declare? +multipleCountriesEuCheck.title = Where are the goods coming from? +goodsExcise.title = Are you bringing in excise or restricted goods? +valueWeightOfGoods.title = Is the total value of the goods over £873 or 1000kg? +goodsType.title = Enter the detail of each individual item +goodsCategory.title = Which rate of VAT do the goods fit into? +goodsDetailsWhere.title = In which country did you purchase the goods? +goodsDetailsCost.title = How much did you pay for the goods? +goodsReview.title = Review your goods +calculation.title = Tax due on these goods +traderAgent.title = Are you a customs agent? +traderDetails.title = What is the name of carrying the goods? +traderAddress.title = What is your address? +traderAddressList.title = Select your address +traderEori.title = What is your EORI number? +traderJourney.title = What your journey details? +checkYourAnswers.title = Check your answers before making your declaration diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersControllerSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersControllerSpec.scala new file mode 100644 index 000000000..466ba6d76 --- /dev/null +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/CheckYourAnswersControllerSpec.scala @@ -0,0 +1,23 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.controllers + +import play.api.test.Helpers._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.BaseSpecWithApplication + +class CheckYourAnswersControllerSpec extends BaseSpecWithApplication { + private lazy val controller = app.injector.instanceOf[CheckYourAnswersController] + + "onPageLoad" should { + "render the page" in { + val getRequest = buildGet(routes.CheckYourAnswersController.onPageLoad().url) + + val eventualResponse = controller.onPageLoad(getRequest) + status(eventualResponse) mustBe 200 + contentAsString(eventualResponse) must include("Check your answers before making your declaration") + } + } +} diff --git a/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyControllerSpec.scala b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyControllerSpec.scala new file mode 100644 index 000000000..4d47752e3 --- /dev/null +++ b/test/uk/gov/hmrc/merchandiseinbaggagefrontend/controllers/SkeletonJourneyControllerSpec.scala @@ -0,0 +1,177 @@ +/* + * Copyright 2020 HM Revenue & Customs + * + */ + +package uk.gov.hmrc.merchandiseinbaggagefrontend.controllers + +import play.api.mvc.{Call, Result} +import play.api.test.Helpers._ +import uk.gov.hmrc.merchandiseinbaggagefrontend.BaseSpecWithApplication + +import scala.concurrent.Future + +class SkeletonJourneyControllerSpec extends BaseSpecWithApplication { + private lazy val controller = app.injector.instanceOf[SkeletonJourneyController] + + "start" should { + "render the page" in { + val title = "Declaring merchandise in your baggage" + val getRequest = buildGet(routes.SkeletonJourneyController.start().url) + + ensure(controller.start(getRequest), title, routes.SkeletonJourneyController.importExport()) + } + } + + "importExport" should { + "render the page" in { + val title = "What do you need to declare?" + val getRequest = buildGet(routes.SkeletonJourneyController.importExport().url) + + ensure(controller.importExport(getRequest), title, routes.SkeletonJourneyController.multipleCountriesEuCheck()) + } + } + + "multipleCountriesEuCheck" should { + "render the page" in { + val title = "Where are the goods coming from?" + val getRequest = buildGet(routes.SkeletonJourneyController.multipleCountriesEuCheck().url) + + ensure(controller.multipleCountriesEuCheck(getRequest), title, routes.SkeletonJourneyController.goodsExcise()) + } + } + + "goodsExcise" should { + "render the page" in { + val title = "Are you bringing in excise or restricted goods?" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsExcise().url) + + ensure(controller.goodsExcise(getRequest), title, routes.SkeletonJourneyController.valueWeightOfGoods()) + } + } + + "valueWeightOfGoods" should { + "render the page" in { + val title = "Is the total value of the goods over £873 or 1000kg?" + val getRequest = buildGet(routes.SkeletonJourneyController.valueWeightOfGoods().url) + + ensure(controller.valueWeightOfGoods(getRequest), title, routes.SkeletonJourneyController.goodsType()) + } + } + + "goodsType" should { + "render the page" in { + val title = "Enter the detail of each individual item" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsType().url) + + ensure(controller.goodsType(getRequest), title, routes.SkeletonJourneyController.goodsCategory()) + } + } + + "goodsCategory" should { + "render the page" in { + val title = "Which rate of VAT do the goods fit into?" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsCategory().url) + + ensure(controller.goodsCategory(getRequest), title, routes.SkeletonJourneyController.goodsDetailsWhere()) + } + } + + "goodsDetailsWhere" should { + "render the page" in { + val title = "In which country did you purchase the goods?" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsDetailsWhere().url) + + ensure(controller.goodsDetailsWhere(getRequest), title, routes.SkeletonJourneyController.goodsDetailsCost()) + } + } + + "goodsDetailsCost" should { + "render the page" in { + val title = "How much did you pay for the goods?" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsDetailsCost().url) + + ensure(controller.goodsDetailsCost(getRequest), title, routes.SkeletonJourneyController.goodsReview()) + } + } + + "goodsReview" should { + "render the page" in { + val title = "Review your goods" + val getRequest = buildGet(routes.SkeletonJourneyController.goodsReview().url) + + ensure(controller.goodsReview(getRequest), title, routes.SkeletonJourneyController.calculation()) + } + } + + "calculation" should { + "render the page" in { + val title = "Tax due on these goods" + val getRequest = buildGet(routes.SkeletonJourneyController.calculation().url) + + ensure(controller.calculation(getRequest), title, routes.SkeletonJourneyController.traderAgent()) + } + } + + "traderAgent" should { + "render the page" in { + val title = "Are you a customs agent?" + val getRequest = buildGet(routes.SkeletonJourneyController.traderAgent().url) + + ensure(controller.traderAgent(getRequest), title, routes.SkeletonJourneyController.traderDetails()) + } + } + + "traderDetails" should { + "render the page" in { + val title = "What is the name of carrying the goods?" + val getRequest = buildGet(routes.SkeletonJourneyController.traderDetails().url) + + ensure(controller.traderDetails(getRequest), title, routes.SkeletonJourneyController.traderAddress()) + } + } + + "traderAddress" should { + "render the page" in { + val title = "What is your address?" + val getRequest = buildGet(routes.SkeletonJourneyController.traderAddress().url) + + ensure(controller.traderAddress(getRequest), title, routes.SkeletonJourneyController.traderAddressList()) + } + } + + "traderAddressList" should { + "render the page" in { + val title = "Select your address" + val getRequest = buildGet(routes.SkeletonJourneyController.traderAddressList().url) + + ensure(controller.traderAddressList(getRequest), title, routes.SkeletonJourneyController.traderEori()) + } + } + + "traderEori" should { + "render the page" in { + val title = "What is your EORI number?" + val getRequest = buildGet(routes.SkeletonJourneyController.traderEori().url) + + ensure(controller.traderEori(getRequest), title, routes.SkeletonJourneyController.traderJourney()) + } + } + + "traderJourney" should { + "render the page" in { + val title = "What your journey details?" + val getRequest = buildGet(routes.SkeletonJourneyController.traderJourney().url) + + ensure(controller.traderJourney(getRequest), title, routes.CheckYourAnswersController.onPageLoad()) + } + } + + private def ensure(eventualResponse: Future[Result], title: String, call: Call) = { + val content = contentAsString(eventualResponse) + + status(eventualResponse) mustBe 200 + content must include(title) + content must include(call.url) + } +}