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
35 changes: 35 additions & 0 deletions app/controllers/SuspendPaymentPlanController.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2025 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

import javax.inject.Inject
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.SuspendPaymentPlanView

class SuspendPaymentPlanController @Inject() (
override val messagesApi: MessagesApi,
val controllerComponents: MessagesControllerComponents,
view: SuspendPaymentPlanView
) extends FrontendBaseController
with I18nSupport {

def onPageLoad: Action[AnyContent] = Action { implicit request =>
Ok(view())
}
}
2 changes: 1 addition & 1 deletion app/views/PaymentPlanDetailsView.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
visuallyHiddenText = Some(messages("Cancel"))
) else null,
if (showActions && planType == PaymentPlanType.BudgetPaymentPlan.toString) ActionItem(
href = "#",
href = routes.SuspendPaymentPlanController.onPageLoad().url,
content = messages("paymentPlanDetails.details.suspend"),
visuallyHiddenText = Some(messages("Suspend"))
) else null
Expand Down
52 changes: 52 additions & 0 deletions app/views/SuspendPaymentPlanView.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@*
* Copyright 2025 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,
paragraph: Paragraph,
paragraphWithLink: ParagraphMessageWithLink,
govukButton: GovukButton
)

@()(implicit request: Request[_], messages: Messages)

@layout(pageTitle = titleNoFormManagePlan(messages("suspendPaymentPlan.title")), backLink = Some(routes.PaymentPlanDetailsController.onPageLoad().url)) {

<h1 class="govuk-heading-xl">@messages("suspendPaymentPlan.heading")</h1>
@paragraph("suspendPaymentPlan.p1")
@paragraph("suspendPaymentPlan.p2")
<ul class="govuk-list govuk-list--bullet">
<li>@messages("suspendPaymentPlan.l1")</li>
<li>@messages("suspendPaymentPlan.l2")</li>
<li>@messages("suspendPaymentPlan.l3")</li>
<li>@messages("suspendPaymentPlan.l4")</li>
</ul>
@paragraph("suspendPaymentPlan.p3")

@govukButton(Button(
href = Some(routes.JourneyRecoveryController.onPageLoad().url),
isStartButton = false,
content = Text(messages("suspendPaymentPlan.continue")),
attributes = Map("id" -> "continue-button")
))

@paragraphWithLink(
linkMessage = messages("suspendPaymentPlan.cancel.link"),
linkUrl = routes.PaymentPlanDetailsController.onPageLoad().url,
)
}
3 changes: 3 additions & 0 deletions app/views/ViewUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ object ViewUtils {
def titleNoForm(title: String, section: Option[String] = None)(implicit messages: Messages): String =
s"${messages(title)} - ${section.fold("")(messages(_) + " - ")}${messages("service.name")} - ${messages("site.govuk")}"

def titleNoFormManagePlan(title: String, section: Option[String] = None)(implicit messages: Messages): String =
s"${messages(title)} - ${section.fold("")(messages(_) + " - ")}${messages("service.manage")} - ${messages("site.govuk")}"

def errorPrefix(form: Form[?])(implicit messages: Messages): String = {
if (form.hasErrors || form.hasGlobalErrors) messages("error.title.prefix") else ""
}
Expand Down
2 changes: 2 additions & 0 deletions conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,5 @@ GET /cancel-payment-plan controllers.CancelPaymen
POST /cancel-payment-plan controllers.CancelPaymentPlanController.onSubmit()

GET /payment-plan-cancelled controllers.PaymentPlanCancelledController.onPageLoad()

GET /suspending-this-payment-plan controllers.SuspendPaymentPlanController.onPageLoad()
12 changes: 12 additions & 0 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -537,3 +537,15 @@ duplicateWarning.error.required = Select one option
duplicateWarning.change.hidden = DuplicateWarning
duplicateWarning.yes= Yes
duplicateWarning.no= No

suspendPaymentPlan.title = Suspending this payment plan
suspendPaymentPlan.heading = Suspending this payment plan
suspendPaymentPlan.p1 = You can suspend this payment plan if you need to pause payments.
suspendPaymentPlan.p2 = When you suspend a payment plan:
suspendPaymentPlan.l1 = no payments will be taken during the suspension period
suspendPaymentPlan.l2 = you can remove the suspension at any time
suspendPaymentPlan.l3 = interest may continue to accrue on your outstanding balance
suspendPaymentPlan.l4 = your payment plan will resume automatically after the suspension ends
suspendPaymentPlan.p3 = Payments due within the next 3 working days cannot be suspended.
suspendPaymentPlan.continue = Continue
suspendPaymentPlan.cancel.link = Cancel and return to payment plan
44 changes: 44 additions & 0 deletions test/controllers/SuspendPaymentPlanControllerSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2025 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

import base.SpecBase
import play.api.test.FakeRequest
import play.api.test.Helpers.*
import views.html.SuspendPaymentPlanView

class SuspendPaymentPlanControllerSpec extends SpecBase {

"SuspendPaymentPlan 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, routes.SuspendPaymentPlanController.onPageLoad().url)

val result = route(application, request).value

val view = application.injector.instanceOf[SuspendPaymentPlanView]

status(result) mustEqual OK
contentAsString(result) mustEqual view()(request, messages(application)).toString
}
}
}
}