Skip to content
Merged
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
40 changes: 40 additions & 0 deletions app/controllers/verify/InactiveSchemeWarningController.scala
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.
*/

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())
}
}
7 changes: 4 additions & 3 deletions app/views/components/Link.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@
prefixTextKey: String = emptyString,
suffixTextKey: String = emptyString,
extraClasses: String = emptyString,
bold: Boolean = false
bold: Boolean = false,
linkId: String = emptyString
)(implicit messages: Messages)

@defining {
@if(prefixTextKey.nonEmpty) {
@{Html(messages(prefixTextKey))}
}
@if(hasFullStop) {
<a href="@linkUrl" class="govuk-link @if(bold){govuk-!-font-weight-bold}" @if(isNewTab){rel="noreferrer noopener" target="_blank"}>@{Html(messages(linkTextKey))}</a>.
<a href="@linkUrl" class="govuk-link @if(bold){govuk-!-font-weight-bold}" @if(linkId.nonEmpty){id="@linkId"} @if(isNewTab){rel="noreferrer noopener" target="_blank"}>@{Html(messages(linkTextKey))}</a>.
} else {
<a href="@linkUrl" class="govuk-link @if(bold){govuk-!-font-weight-bold}" @if(isNewTab){rel="noreferrer noopener" target="_blank"}>@{Html(messages(linkTextKey))}</a>
<a href="@linkUrl" class="govuk-link @if(bold){govuk-!-font-weight-bold}" @if(linkId.nonEmpty){id="@linkId"} @if(isNewTab){rel="noreferrer noopener" target="_blank"}>@{Html(messages(linkTextKey))}</a>
}

@if(suffixTextKey.nonEmpty) {
Expand Down
46 changes: 46 additions & 0 deletions app/views/verify/InactiveSchemeWarningView.scala.html
Original file line number Diff line number Diff line change
@@ -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"))

<div class="govuk-button-group">
@govukButton(
ButtonViewModel(messages("site.continue")).asLink("#").withAttribute("id" -> "continue-button")
)
@link(linkTextKey = "verify.inactiveSchemeWarning.cancel", linkUrl = "#", linkId = "cancel-link")
</div>

}
2 changes: 2 additions & 0 deletions conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 7 additions & 0 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 44 additions & 0 deletions test/controllers/verify/InactiveSchemeWarningControllerSpec.scala
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
96 changes: 96 additions & 0 deletions test/views/verify/InactiveSchemeWarningViewSpec.scala
Original file line number Diff line number Diff line change
@@ -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 "#"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down