Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successful Enrolment Page added #355

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
58 changes: 58 additions & 0 deletions app/controllers/SuccessfulEnrolmentController.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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 config.ApplicationConfig
import play.api.mvc._
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController
import uk.gov.hmrc.play.bootstrap.auth.DefaultAuthConnector
import utils.{AWRSFeatureSwitches, AccountUtils}
import controllers.auth.AwrsController
import services.DeEnrolService
import audit.Auditable

import javax.inject.Inject
import scala.concurrent.{ExecutionContext, Future}

class SuccessfulEnrolmentController @Inject()(mcc: MessagesControllerComponents,
implicit val applicationConfig: ApplicationConfig,
val deEnrolService: DeEnrolService,
val authConnector: DefaultAuthConnector,
val auditable: Auditable,
val awrsFeatureSwitches: AWRSFeatureSwitches,
val accountUtils: AccountUtils,
template: views.html.awrs_successful_enrolment
) extends FrontendController(mcc) with AwrsController {

implicit val ec: ExecutionContext = mcc.executionContext
val signInUrl: String = applicationConfig.signIn




def showSuccessfulEnrolmentPage() : Action[AnyContent] = Action.async { implicit request =>
btaAuthorisedAction { implicit ar =>
Copy link
Contributor

@Byasar3 Byasar3 Feb 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ar is not used, so remove implicit ar and replace with _

ie:
{ _ => ...code }

if (awrsFeatureSwitches.enrolmentJourney().enabled) {
Future.successful(Ok(template()))
} else {
Future.successful(NotFound)
}
}
}



}
39 changes: 39 additions & 0 deletions app/views/awrs_successful_enrolment.scala.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please fix indentation so it's easier to read :')
unfortunately without premium intellij we have to do it manually :(

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@*
* Copyright 2023 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 config.ApplicationConfig
@import play.twirl.api.HtmlFormat
@import views.html.layout

@this(awrsMain: main)

@()(implicit request: Request[AnyRef], messages: Messages, applicationConfig: ApplicationConfig)

@awrsMain(title = messages("awrs.successful_enrolment.title", messages("awrs.successful_enrolment.title"))) {
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">@Messages("awrs.successful_enrolment.title")
</h1>
</div>
<h2 class="govuk-body govuk-!-font-weight-bold">@messages("awrs.successful_enrolment.heading")</h2>
<p class="govuk-body" id="paragraph-1">@messages("awrs.successful_enrolment.p1")</p>
<p class="govuk-body" id="paragraph-2" >More detailed information can be found in the <a href="https://www.gov.uk/guidance/the-alcohol-wholesaler-registration-scheme-awrs" target="_blank">AWRS guidance (opens in a new tab)</a></p>
<br>
<br>
<a [email protected] role="button" class="govuk-button" data-module="govuk-button">
@messages("awrs.successful_enrolment.btn")
</a>
<br>
}
3 changes: 2 additions & 1 deletion conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,5 @@ GET /registered-postcode controllers.AwrsRegi
POST /registered-postcode controllers.AwrsRegisteredPostcodeController.saveAndContinue



# DL-14749
GET /successful-enrolment controllers.SuccessfulEnrolmentController.showSuccessfulEnrolmentPage
19 changes: 18 additions & 1 deletion conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -971,4 +971,21 @@ awrs.register_postcode.title = Enter the postcode you registered with Alcohol Wh
awrs.register_postcode.heading = Enter the postcode you registered with Alcohol Wholesaler Registration Scheme (AWRS)
awrs.register_postcode.error.empty = Enter your postcode
awrs.register_postcode.error.invalid_postcode = Enter a valid UK postcode, like AA1 1AA
awrs.register_postcode.hint = For example, SW1A 2AA
awrs.register_postcode.hint = For example, SW1A 2AA


awrs.deleted_urn_kickout.title = Get Help with your AWRS registration
awrs.deleted_urn_kickout.heading = We were unable to locate your details linked with the Unique Reference Number (URN) you entered.
awrs.deleted_urn_kickout.p1 = Contact HMRC
awrs.deleted_urn_kickout.p2 = Phone: 020 7946 0101
awrs.deleted_urn_kickout.p3 = Textphone: 020 7946 0102
awrs.deleted_urn_kickout.p4 = Monday to Friday, 9am to 5pm (except public holidays)
awrs.deleted_urn_kickout.p5 = Welsh language = 020 7946 0103
awrs.deleted_urn_kickout.p6 = Monday to Friday, 8:30am to 5pm


awrs.successful_enrolment.title = You have added your AWRS to your business tax account
awrs.successful_enrolment.heading = What happens next
awrs.successful_enrolment.p1 = You can now view and manage your AWRS registration in your business tax account.
awrs.successful_enrolment.p2 = More detailed information can be found in the AWRS guidance (opens in a new tab)
awrs.successful_enrolment.btn = View your business tax account
59 changes: 59 additions & 0 deletions test/controllers/SuccessfulEnrolmentControllerTest.scala
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add tests to make sure the hyper link and button are going to the correct places.

if design also required a back button(see jira ticket) then add testing for backlink too.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* 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 builders.SessionBuilder
import play.api.mvc.AnyContentAsEmpty
import play.api.test.FakeRequest
import play.api.test.Helpers._
import services.ServicesUnitTestFixture
import utils.AwrsUnitTestTraits
import views.html.awrs_successful_enrolment

class SuccessfulEnrolmentControllerTest extends AwrsUnitTestTraits
with ServicesUnitTestFixture {
val request: FakeRequest[AnyContentAsEmpty.type] = FakeRequest()
val template: awrs_successful_enrolment = app.injector.instanceOf[views.html.awrs_successful_enrolment]
val testSuccessfulEnrolmentController: SuccessfulEnrolmentController = new SuccessfulEnrolmentController(
mockMCC,
mockAppConfig,
mockDeEnrolService,
mockAuthConnector,
mockAuditable,
mockAwrsFeatureSwitches,
mockAccountUtils,
template
)

"SuccessfulEnrolmentController" must {

"show the Successful Enrolment page when enrolmentJourney is enable" in {
setAuthMocks()
setupEnrollmentJourneyFeatureSwitchMock(true)
val res = testSuccessfulEnrolmentController.showSuccessfulEnrolmentPage().apply(SessionBuilder.buildRequestWithSession(userId))
status(res) mustBe 200
}
"return 404 the Kickout page when enrolmentJourney is disabled" in {
setAuthMocks()
setupEnrollmentJourneyFeatureSwitchMock(false)
val res = testSuccessfulEnrolmentController.showSuccessfulEnrolmentPage().apply(SessionBuilder.buildRequestWithSession(userId))
status(res) mustBe 404
}

}

}
33 changes: 33 additions & 0 deletions test/views/SuccessfulEnrolmentTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2024 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

import play.twirl.api.HtmlFormat
import views.html.awrs_successful_enrolment

class SuccessfulEnrolmentTest extends ViewTestFixture {

val view: awrs_successful_enrolment =
app.injector.instanceOf[views.html.awrs_successful_enrolment]
override val htmlContent: HtmlFormat.Appendable = view.apply()(fakeRequest, messages, mockAppConfig)
"successful_enrolment page" should {
"render the correct content" in {
heading mustBe "You have added your AWRS to your business tax account"
bodyText mustBe "You can now view and manage your AWRS registration in your business tax account. More detailed information can be found in the AWRS guidance (opens in a new tab)"
}
}
}