diff --git a/app/controllers/verify/InactiveSchemeWarningController.scala b/app/controllers/verify/InactiveSchemeWarningController.scala new file mode 100644 index 00000000..36429ad0 --- /dev/null +++ b/app/controllers/verify/InactiveSchemeWarningController.scala @@ -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. + */ + +package controllers.verify + +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.verify.InactiveSchemeWarningView + +import javax.inject.Inject + +class InactiveSchemeWarningController @Inject() ( + override val messagesApi: MessagesApi, + identify: IdentifierAction, + getData: DataRetrievalAction, + requireData: DataRequiredAction, + val controllerComponents: MessagesControllerComponents, + view: InactiveSchemeWarningView +) extends FrontendBaseController + with I18nSupport { + + def onPageLoad: Action[AnyContent] = (identify andThen getData andThen requireData) { implicit request => + Ok(view()) + } +} diff --git a/app/views/components/Link.scala.html b/app/views/components/Link.scala.html index 6d884fbc..61aee122 100644 --- a/app/views/components/Link.scala.html +++ b/app/views/components/Link.scala.html @@ -27,7 +27,8 @@ prefixTextKey: String = emptyString, suffixTextKey: String = emptyString, extraClasses: String = emptyString, - bold: Boolean = false + bold: Boolean = false, + linkId: String = emptyString )(implicit messages: Messages) @defining { @@ -35,9 +36,9 @@ @{Html(messages(prefixTextKey))} } @if(hasFullStop) { - @{Html(messages(linkTextKey))}. + @{Html(messages(linkTextKey))}. } else { - @{Html(messages(linkTextKey))} + @{Html(messages(linkTextKey))} } @if(suffixTextKey.nonEmpty) { diff --git a/app/views/verify/InactiveSchemeWarningView.scala.html b/app/views/verify/InactiveSchemeWarningView.scala.html new file mode 100644 index 00000000..5de2cea9 --- /dev/null +++ b/app/views/verify/InactiveSchemeWarningView.scala.html @@ -0,0 +1,46 @@ +@* + * 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, + heading: H1, + paragraph: Paragraph, + warning: WarningInsetText, + govukButton: GovukButton, + link: Link + ) + +@()(implicit request: Request[_], messages: Messages) + + @layout(pageTitle = titleNoForm(messages("verify.inactiveSchemeWarning.title"))) { + + @heading(messages("verify.inactiveSchemeWarning.heading")) + + @paragraph(messages("verify.inactiveSchemeWarning.p1")) + @paragraph(messages("verify.inactiveSchemeWarning.p2")) + + @warning(messages("verify.inactiveSchemeWarning.warningText")) + +
+ @govukButton( + ButtonViewModel(messages("site.continue")).asLink("#").withAttribute("id" -> "continue-button") + ) + @link(linkTextKey = "verify.inactiveSchemeWarning.cancel", linkUrl = "#", linkId = "cancel-link") +
+ +} diff --git a/conf/app.routes b/conf/app.routes index 0e5c8b90..710e4825 100644 --- a/conf/app.routes +++ b/conf/app.routes @@ -392,3 +392,5 @@ GET /verify/no-new-subcontractors-to-verify controllers.verify.Verify POST /verify/no-new-subcontractors-to-verify controllers.verify.VerifyYourSubcontractorsYesNoController.onSubmit GET /verify/problem-with-verification-warning controllers.verify.VerifyDepartmentalErrorController.onPageLoad() + +GET /verify/inactive-scheme-warning controllers.verify.InactiveSchemeWarningController.onPageLoad() diff --git a/conf/messages.en b/conf/messages.en index 5f0c3512..500db768 100644 --- a/conf/messages.en +++ b/conf/messages.en @@ -870,3 +870,10 @@ verify.verifyDepartmentalError.contactHMRC.p1 = for more h verify.verifyDepartmentalError.contactHMRC.p1.link = Contact HMRC by phone verify.verifyDepartmentalError.manageSubcontractors.p1 = Back to verify.verifyDepartmentalError.manageSubcontractors.p1.link = Manage your subcontractors + +verify.inactiveSchemeWarning.title = Your scheme is not active +verify.inactiveSchemeWarning.heading = Your scheme is not active +verify.inactiveSchemeWarning.p1 = Your scheme was recently made inactive. +verify.inactiveSchemeWarning.p2 = You must contact HMRC by phone to reactivate your scheme before you can pay any more subcontractors. +verify.inactiveSchemeWarning.warningText = Any verification request that you send while your scheme is inactive will fail when you try to submit it. +verify.inactiveSchemeWarning.cancel = Cancel request diff --git a/test/controllers/verify/InactiveSchemeWarningControllerSpec.scala b/test/controllers/verify/InactiveSchemeWarningControllerSpec.scala new file mode 100644 index 00000000..aa7bb4b8 --- /dev/null +++ b/test/controllers/verify/InactiveSchemeWarningControllerSpec.scala @@ -0,0 +1,44 @@ +/* + * 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.verify + +import base.SpecBase +import play.api.test.FakeRequest +import play.api.test.Helpers.* +import views.html.verify.InactiveSchemeWarningView + +class InactiveSchemeWarningControllerSpec extends SpecBase { + + "InactiveSchemeWarning Controller" - { + + "must return OK and the correct view for a GET" in { + + val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)).build() + + running(application) { + val request = FakeRequest(GET, controllers.verify.routes.InactiveSchemeWarningController.onPageLoad().url) + + val result = route(application, request).value + + val view = application.injector.instanceOf[InactiveSchemeWarningView] + + status(result) mustEqual OK + contentAsString(result) mustEqual view()(request, messages(application)).toString + } + } + } +} diff --git a/test/views/verify/InactiveSchemeWarningViewSpec.scala b/test/views/verify/InactiveSchemeWarningViewSpec.scala new file mode 100644 index 00000000..70d06b26 --- /dev/null +++ b/test/views/verify/InactiveSchemeWarningViewSpec.scala @@ -0,0 +1,96 @@ +/* + * 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.verify + +import config.FrontendAppConfig +import org.jsoup.Jsoup +import org.scalatest.matchers.must.Matchers +import org.scalatest.wordspec.AnyWordSpec +import org.scalatestplus.play.guice.GuiceOneAppPerSuite +import play.api.i18n.{Lang, Messages, MessagesApi, MessagesImpl} +import play.api.mvc.Request +import play.api.test.FakeRequest +import views.html.verify.InactiveSchemeWarningView + +class InactiveSchemeWarningViewSpec extends AnyWordSpec with Matchers with GuiceOneAppPerSuite { + + implicit val request: Request[_] = + FakeRequest() + + implicit val messages: Messages = + MessagesImpl( + Lang.defaultLang, + app.injector.instanceOf[MessagesApi] + ) + + implicit val appConfig: FrontendAppConfig = + app.injector.instanceOf[FrontendAppConfig] + + private val view: InactiveSchemeWarningView = + app.injector.instanceOf[InactiveSchemeWarningView] + + "InactiveSchemeWarningView" should { + + "render the page with correct title, heading, paragraphs, warning text and button group links" in { + + val html = + view()( + request, + messages + ) + + val doc = Jsoup.parse(html.toString()) + + doc.select("title").text() must include( + messages("verify.inactiveSchemeWarning.title") + ) + + doc.select("h1").size() mustBe 1 + doc.select("h1").text() mustBe + messages("verify.inactiveSchemeWarning.heading") + + val bodyParagraphs = doc.select("p.govuk-body") + + bodyParagraphs.get(0).text() mustBe + messages("verify.inactiveSchemeWarning.p1") + + bodyParagraphs.get(1).text() mustBe + messages("verify.inactiveSchemeWarning.p2") + + val warningEl = doc.select(".govuk-inset-text, .govuk-warning-text") + warningEl.size() mustBe 1 + warningEl.text() must include( + messages("verify.inactiveSchemeWarning.warningText") + ) + + val buttonGroup = doc.select("div.govuk-button-group") + buttonGroup.size() mustBe 1 + + val continueButton = buttonGroup.select("a.govuk-button") + continueButton.size() mustBe 1 + continueButton.text() mustBe + messages("site.continue") + continueButton.attr("href") mustBe "#" + + val cancelLink = buttonGroup.select("a.govuk-link") + cancelLink.size() mustBe 1 + cancelLink.text() mustBe + messages("verify.inactiveSchemeWarning.cancel") + cancelLink.attr("href") mustBe "#" + } + } +} diff --git a/test/views/verify/ReverifyExistingSubcontractorsYesNoViewSpec.scala b/test/views/verify/ReverifyExistingSubcontractorsYesNoViewSpec.scala index 63558770..566e740b 100644 --- a/test/views/verify/ReverifyExistingSubcontractorsYesNoViewSpec.scala +++ b/test/views/verify/ReverifyExistingSubcontractorsYesNoViewSpec.scala @@ -28,7 +28,7 @@ import play.api.mvc.Request import play.api.test.FakeRequest import views.html.verify.ReverifyExistingSubcontractorsYesNoView -class ReverifyExistingSubcontractorsViewYesNoSpec extends AnyWordSpec with Matchers with GuiceOneAppPerSuite { +class ReverifyExistingSubcontractorsYesNoViewSpec extends AnyWordSpec with Matchers with GuiceOneAppPerSuite { "ReverifyExistingSubcontractorsYesNoView" should {