Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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())
}
}
40 changes: 40 additions & 0 deletions app/views/contractordetails/ContractorDetailsView.scala.html
Original file line number Diff line number Diff line change
@@ -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")),
))
}
}
3 changes: 3 additions & 0 deletions conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -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()
5 changes: 5 additions & 0 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
64 changes: 64 additions & 0 deletions test/views/contractordetails/ContractorDetailsViewSpec.scala
Original file line number Diff line number Diff line change
@@ -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)
}
}