diff --git a/app/controllers/contractordetails/ContractorDetailsController.scala b/app/controllers/contractordetails/ContractorDetailsController.scala new file mode 100644 index 00000000..a5442b1c --- /dev/null +++ b/app/controllers/contractordetails/ContractorDetailsController.scala @@ -0,0 +1,42 @@ +/* + * Copyright 2026 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. + */ + +package controllers.contractordetails + +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 views.html.contractordetails.ContractorDetailsView + +import javax.inject.Inject + +class ContractorDetailsController @Inject() ( + override val messagesApi: MessagesApi, + identify: IdentifierAction, + val controllerComponents: MessagesControllerComponents, + view: ContractorDetailsView +) extends FrontendBaseController + with I18nSupport { + + def onPageLoad: Action[AnyContent] = identify { implicit request => + Ok(view()) + } + + def onSubmit: Action[AnyContent] = identify { implicit request => + Redirect(routes.ContractorDetailsController.onPageLoad()) + } +} diff --git a/app/views/contractordetails/ContractorDetailsView.scala.html b/app/views/contractordetails/ContractorDetailsView.scala.html new file mode 100644 index 00000000..16c8beb7 --- /dev/null +++ b/app/views/contractordetails/ContractorDetailsView.scala.html @@ -0,0 +1,40 @@ +@* + * Copyright 2026 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 views.html.components._ + +@this( + layout: templates.Layout, + govukButton: GovukButton, + formHelper: FormWithCSRF, + h1: H1, + paragraph: Paragraph +) + +@()(implicit request: Request[_], messages: Messages) + +@layout(pageTitle = titleNoForm(messages("contractorDetails.title")), showSignOut = false) { + @formHelper(action = controllers.contractordetails.routes.ContractorDetailsController.onSubmit(), Symbol("autoComplete") -> "off") { + + @h1(messages("contractorDetails.heading")) + @paragraph(messages("contractorDetails.p1")) + @paragraph(messages("contractorDetails.p2")) + + @govukButton(Button( + content = Text(messages("site.continue")), + )) + } +} diff --git a/conf/app.routes b/conf/app.routes index fcd90f4d..083fa1d2 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -173,3 +173,6 @@ POST /amend-monthly-return/what-do-you-want-to-amend-nil GET /manage-cis-return/amend-monthly-return/confirm-amendment controllers.amend.ConfirmAmendmentController.onPageLoad() POST /manage-cis-return/amend-monthly-return/confirm-amendment controllers.amend.ConfirmAmendmentController.onSubmit() + +GET /contractor-details controllers.contractordetails.ContractorDetailsController.onPageLoad() +POST /contractor-details controllers.contractordetails.ContractorDetailsController.onSubmit() diff --git a/conf/messages.en b/conf/messages.en index 5be0caa9..93dbd7dc 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -551,3 +551,8 @@ whatDoYouWantToAmendNil.heading = What do you want to amend? whatDoYouWantToAmendNil.amendNilReturn = I want to amend this nil return whatDoYouWantToAmendNil.addPaymentOrSubcontractorDetails = I want to add payment or subcontractor details on this return whatDoYouWantToAmendNil.error.required = Select the type of amendment you want to make + +contractorDetails.title = Contractor details +contractorDetails.heading = Contractor details +contractorDetails.p1 = Use this service to confirm or change the contractor's email or scheme name associated with this account. +contractorDetails.p2 = You will need the contractor Unique Tax Reference (UTR) to do this. diff --git a/test/controllers/contractordetails/ContractorDetailsControllerSpec.scala b/test/controllers/contractordetails/ContractorDetailsControllerSpec.scala new file mode 100644 index 00000000..2768ae07 --- /dev/null +++ b/test/controllers/contractordetails/ContractorDetailsControllerSpec.scala @@ -0,0 +1,45 @@ +/* + * Copyright 2026 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. + */ + +package controllers.contractordetails + +import base.SpecBase +import play.api.test.FakeRequest +import play.api.test.Helpers.* +import views.html.contractordetails.ContractorDetailsView + +class ContractorDetailsControllerSpec extends SpecBase { + + "ContractorDetails Controller" - { + + "must return OK and the correct view for a GET" in { + + val application = applicationBuilder().build() + + running(application) { + val request = + FakeRequest(GET, controllers.contractordetails.routes.ContractorDetailsController.onPageLoad().url) + + val result = route(application, request).value + + val view = application.injector.instanceOf[ContractorDetailsView] + + status(result) mustEqual OK + contentAsString(result) mustEqual view()(request, messages(application)).toString + } + } + } +} diff --git a/test/views/contractordetails/ContractorDetailsViewSpec.scala b/test/views/contractordetails/ContractorDetailsViewSpec.scala new file mode 100644 index 00000000..3e10b56b --- /dev/null +++ b/test/views/contractordetails/ContractorDetailsViewSpec.scala @@ -0,0 +1,64 @@ +/* + * Copyright 2026 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. + */ + +package views.contractordetails + +import base.SpecBase +import org.jsoup.Jsoup +import org.jsoup.nodes.Document +import play.api.Application +import play.api.i18n.Messages +import play.api.test.FakeRequest +import play.twirl.api.HtmlFormat +import views.html.contractordetails.ContractorDetailsView + +class ContractorDetailsViewSpec extends SpecBase { + + "ContractorDetailsView" - { + + "should display the correct title" in new Setup { + doc.title must include(messages("contractorDetails.title")) + } + + "should display the correct heading" in new Setup { + doc.select("h1").text must include(messages("contractorDetails.heading")) + } + + "should display paragraph 1" in new Setup { + doc.select("p").text() must include(messages("contractorDetails.p1")) + } + + "should display paragraph 2" in new Setup { + doc.select("p").text() must include(messages("contractorDetails.p2")) + } + + "should display the Continue button" in new Setup { + doc.select("button").text() must include(messages("site.continue")) + } + } + + trait Setup { + val app: Application = applicationBuilder().build() + val view: ContractorDetailsView = app.injector.instanceOf[ContractorDetailsView] + implicit val request: play.api.mvc.Request[_] = FakeRequest() + implicit val messages: Messages = play.api.i18n.MessagesImpl( + play.api.i18n.Lang.defaultLang, + app.injector.instanceOf[play.api.i18n.MessagesApi] + ) + val html: HtmlFormat.Appendable = view() + val doc: Document = Jsoup.parse(html.body) + } +}