-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 => | ||
if (awrsFeatureSwitches.enrolmentJourney().enabled) { | ||
Future.successful(Ok(template())) | ||
} else { | ||
Future.successful(NotFound) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please fix indentation so it's easier to read :') |
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> | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
} | ||
|
||
} | ||
|
||
} |
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)" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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 removeimplicit ar
and replace with _ie:
{ _ => ...code }