diff --git a/app/controllers/LandingController.scala b/app/controllers/LandingController.scala index 4a0824f0..d67c1dd8 100644 --- a/app/controllers/LandingController.scala +++ b/app/controllers/LandingController.scala @@ -16,7 +16,7 @@ package controllers -import controllers.actions.IdentifierAction +import controllers.actions.{AllowListFilterAction, IdentifierAction} import play.api.Logging import play.api.i18n.I18nSupport import play.api.mvc.{Action, AnyContent, MessagesControllerComponents} @@ -28,18 +28,20 @@ import scala.concurrent.ExecutionContext class LandingController @Inject() (nddService: NationalDirectDebitService, val controllerComponents: MessagesControllerComponents, - identify: IdentifierAction + identify: IdentifierAction, + allowListFilter: AllowListFilterAction )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport with Logging { - def onPageLoad(): Action[AnyContent] = identify.async { implicit request => - nddService.retrieveAllDirectDebits(request.userId) map { - case rdsResponse if rdsResponse.directDebitCount == 0 => + def onPageLoad(): Action[AnyContent] = (identify andThen allowListFilter).async { implicit request => + nddService.retrieveAllDirectDebits(request.userId).map { rdsResponse => + if (rdsResponse.directDebitCount == 0) { Redirect(routes.SetupDirectDebitPaymentController.onPageLoad()) - case response => + } else { Redirect(routes.YourDirectDebitInstructionsController.onPageLoad()) + } } } } diff --git a/app/controllers/SetupDirectDebitPaymentController.scala b/app/controllers/SetupDirectDebitPaymentController.scala index 377aa5a9..d61a710f 100644 --- a/app/controllers/SetupDirectDebitPaymentController.scala +++ b/app/controllers/SetupDirectDebitPaymentController.scala @@ -34,12 +34,13 @@ class SetupDirectDebitPaymentController @Inject() ( nddService: NationalDirectDebitService, val controllerComponents: MessagesControllerComponents, view: SetupDirectDebitPaymentView, - lockService: LockService + lockService: LockService, + allowListFilter: AllowListFilterAction )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport { - def onPageLoad(): Action[AnyContent] = (identify andThen getData).async { implicit request => + def onPageLoad(): Action[AnyContent] = (identify andThen allowListFilter andThen getData).async { implicit request => lockService.isUserLocked(request.userId) flatMap { _.lockStatus match case NotLocked => diff --git a/app/controllers/YourBankDetailsController.scala b/app/controllers/YourBankDetailsController.scala index 7894af90..addd21db 100644 --- a/app/controllers/YourBankDetailsController.scala +++ b/app/controllers/YourBankDetailsController.scala @@ -76,7 +76,7 @@ class YourBankDetailsController @Inject() ( personalOrBusinessOpt match { case None => - logger.warn(s"Missing PersonalOrBusinessAccountPage for user: $credId") + logger.warn(s"Missing PersonalOrBusinessAccountPage for user") Future.successful(Redirect(routes.SystemErrorController.onPageLoad())) case Some(accountType) => diff --git a/app/controllers/YourDirectDebitInstructionsController.scala b/app/controllers/YourDirectDebitInstructionsController.scala index 8ba8cad1..5fee115e 100644 --- a/app/controllers/YourDirectDebitInstructionsController.scala +++ b/app/controllers/YourDirectDebitInstructionsController.scala @@ -40,12 +40,13 @@ class YourDirectDebitInstructionsController @Inject() ( appConfig: FrontendAppConfig, nddService: NationalDirectDebitService, paginationService: PaginationService, - sessionRepository: SessionRepository + sessionRepository: SessionRepository, + allowListFilter: AllowListFilterAction )(implicit ec: ExecutionContext) extends FrontendBaseController with I18nSupport { - def onPageLoad: Action[AnyContent] = (identify andThen getData).async { implicit request => + def onPageLoad: Action[AnyContent] = (identify andThen allowListFilter andThen getData).async { implicit request => val userAnswers = request.userAnswers.getOrElse(UserAnswers(request.userId)) val currentPage = request.getQueryString("page").flatMap(_.toIntOption).getOrElse(1) diff --git a/app/controllers/actions/AllowListFilterAction.scala b/app/controllers/actions/AllowListFilterAction.scala new file mode 100644 index 00000000..81705dab --- /dev/null +++ b/app/controllers/actions/AllowListFilterAction.scala @@ -0,0 +1,47 @@ +/* + * 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.actions + +import models.requests.IdentifierRequest +import play.api.mvc.{ActionFilter, Result} +import play.api.{Configuration, Logging} +import play.api.mvc.Results.SeeOther +import splitter.connectors.AllowListConnector +import uk.gov.hmrc.http.HeaderCarrier + +import javax.inject.Inject +import scala.concurrent.{ExecutionContext, Future} +import scala.util.control.NonFatal + +class AllowListFilterAction @Inject() (connector: AllowListConnector, configuration: Configuration)(implicit val executionContext: ExecutionContext) + extends ActionFilter[IdentifierRequest] + with Logging { + + private val legacyStartUrl = configuration.get[String]("microservice.services.ndds-legacy.path") + + override protected def filter[A](request: IdentifierRequest[A]): Future[Option[Result]] = + implicit val hc: HeaderCarrier = HeaderCarrier() + connector + .check(request.userId) + .map: + case true => None + case false => Some(SeeOther(legacyStartUrl)) + .recover: + case NonFatal(e) => + logger.error("Error when checking for user id ", e) + Some(SeeOther(legacyStartUrl)) +} diff --git a/app/services/NationalDirectDebitService.scala b/app/services/NationalDirectDebitService.scala index 906967ae..1993c173 100644 --- a/app/services/NationalDirectDebitService.scala +++ b/app/services/NationalDirectDebitService.scala @@ -144,7 +144,7 @@ class NationalDirectDebitService @Inject() (nddConnector: NationalDirectDebitCon userAnswers .get(YourBankDetailsPage) .map(_.auddisStatus) - .getOrElse(throw new Exception("YourBankDetailsPage details missing from user answers")) + .getOrElse(throw new Exception("Missing information from user answers")) ) } } diff --git a/app/splitter/controllers/SplitterController.scala b/app/splitter/controllers/SplitterController.scala index e551c0fb..8ddbaf79 100644 --- a/app/splitter/controllers/SplitterController.scala +++ b/app/splitter/controllers/SplitterController.scala @@ -16,7 +16,6 @@ package splitter.controllers -import controllers.actions.IdentifierAction import play.api.mvc.* import play.api.{Configuration, Logging} import splitter.connectors.AllowListConnector diff --git a/conf/application.conf b/conf/application.conf index b8d124e5..7ea9dc2f 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -144,7 +144,7 @@ features { maxNumberPPsAllowed = 99 enableLockService = false existingDirectDebit = true - allowListChecksEnabled = false + allowListChecksEnabled = true } mac { diff --git a/test/controllers/LandingControllerSpec.scala b/test/controllers/LandingControllerSpec.scala index bf3f6abc..52acef86 100644 --- a/test/controllers/LandingControllerSpec.scala +++ b/test/controllers/LandingControllerSpec.scala @@ -22,45 +22,56 @@ import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.when import org.scalatestplus.mockito.MockitoSugar.mock import play.api.inject.bind +import play.api.inject.guice.GuiceApplicationBuilder import play.api.test.FakeRequest import play.api.test.Helpers.* import services.NationalDirectDebitService +import splitter.connectors.AllowListConnector +import splitter.controllers.{FakeIdentityIdentifierAction, IdentityIdentifierAction} +import uk.gov.hmrc.http.HeaderCarrier import scala.concurrent.Future class LandingControllerSpec extends SpecBase { - "Landing Controller" - { + class FakeAllowListConnector(result: Exception | Boolean) extends AllowListConnector: + override def check(userId: String)(using HeaderCarrier): Future[Boolean] = + result match + case res: Boolean => Future.successful(res) + case res: Exception => Future.failed(res) + + private def legacyUrl = "/national-direct-debits" + "Landing Controller" - { val mockService = mock[NationalDirectDebitService] "must return REDIRECT and the correct view for a GET with no existing debits" in { - val application = applicationBuilder(userAnswers = None) .overrides( - bind[NationalDirectDebitService].toInstance(mockService) + bind[NationalDirectDebitService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() running(application) { - when(mockService.retrieveAllDirectDebits(any())(any(), any())) .thenReturn(Future.successful(NddResponse(0, Seq()))) val request = FakeRequest(GET, routes.LandingController.onPageLoad().url) - val result = route(application, request).value status(result) mustEqual SEE_OTHER - redirectLocation(result).value must startWith(controllers.routes.SetupDirectDebitPaymentController.onPageLoad().url) + redirectLocation(result).value mustBe controllers.routes.SetupDirectDebitPaymentController.onPageLoad().url } } "must return REDIRECT and the correct view for a GET with existing debits" in { - val application = applicationBuilder(userAnswers = None) .overrides( - bind[NationalDirectDebitService].toInstance(mockService) + bind[NationalDirectDebitService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -70,30 +81,48 @@ class LandingControllerSpec extends SpecBase { .thenReturn(Future.successful(NddResponse(2, Seq()))) val request = FakeRequest(GET, routes.LandingController.onPageLoad().url) - val result = route(application, request).value status(result) mustEqual SEE_OTHER - redirectLocation(result).value must startWith(controllers.routes.YourDirectDebitInstructionsController.onPageLoad().url) + redirectLocation(result).value mustBe controllers.routes.YourDirectDebitInstructionsController.onPageLoad().url } } "must return REDIRECT and the correct view for an unauthenticated user" in { - val application = applicationBuilder(userAnswers = None) .overrides( - bind[NationalDirectDebitService].toInstance(mockService) + bind[NationalDirectDebitService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() running(application) { val request = FakeRequest(GET, routes.LandingController.onPageLoad().url) + val result = route(application, request).value + + status(result) mustEqual SEE_OTHER + redirectLocation(result).value mustBe controllers.routes.YourDirectDebitInstructionsController.onPageLoad().url + } + } + "must return REDIRECT to legacy url when check is false" in { + val application = applicationBuilder(userAnswers = None) + .overrides( + bind[NationalDirectDebitService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(false)) + ) + .build() + + running(application) { + val request = FakeRequest(GET, routes.LandingController.onPageLoad().url) val result = route(application, request).value status(result) mustEqual SEE_OTHER - redirectLocation(result).value must startWith(controllers.routes.YourDirectDebitInstructionsController.onPageLoad().url) + redirectLocation(result).value mustBe legacyUrl } } + } } diff --git a/test/controllers/SetupDirectDebitPaymentControllerSpec.scala b/test/controllers/SetupDirectDebitPaymentControllerSpec.scala index e3e59cff..d8ff0a09 100644 --- a/test/controllers/SetupDirectDebitPaymentControllerSpec.scala +++ b/test/controllers/SetupDirectDebitPaymentControllerSpec.scala @@ -27,6 +27,8 @@ import play.api.mvc.Call import play.api.test.FakeRequest import play.api.test.Helpers.* import services.{LockService, NationalDirectDebitService} +import splitter.connectors.{AllowListConnector, FakeAllowListConnector} +import splitter.controllers.{FakeIdentityIdentifierAction, IdentityIdentifierAction} import views.html.SetupDirectDebitPaymentView import java.time.Instant @@ -35,7 +37,6 @@ import scala.concurrent.Future class SetupDirectDebitPaymentControllerSpec extends SpecBase { "SetupDirectDebitPayment Controller" - { - val mockService = mock[LockService] val returnedDate = "2025-06-28T15:30:30Z" @@ -60,7 +61,9 @@ class SetupDirectDebitPaymentControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[NationalDirectDebitService].toInstance(mockRDSDatacacheService), - bind[LockService].toInstance(mockService) + bind[LockService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -89,7 +92,9 @@ class SetupDirectDebitPaymentControllerSpec extends SpecBase { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( bind[NationalDirectDebitService].toInstance(mockRDSDatacacheService), - bind[LockService].toInstance(mockService) + bind[LockService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -118,7 +123,9 @@ class SetupDirectDebitPaymentControllerSpec extends SpecBase { "must return See Other and redirect for a GET if the user is locked but not verified" in { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[LockService].toInstance(mockService) + bind[LockService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -139,7 +146,9 @@ class SetupDirectDebitPaymentControllerSpec extends SpecBase { "must return See Other and redirect for a GET if the user is locked and verified" in { val application = applicationBuilder(userAnswers = Some(emptyUserAnswers)) .overrides( - bind[LockService].toInstance(mockService) + bind[LockService].toInstance(mockService), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() diff --git a/test/controllers/YourDirectDebitInstructionsControllerSpec.scala b/test/controllers/YourDirectDebitInstructionsControllerSpec.scala index f2871f42..ec8382a1 100644 --- a/test/controllers/YourDirectDebitInstructionsControllerSpec.scala +++ b/test/controllers/YourDirectDebitInstructionsControllerSpec.scala @@ -30,6 +30,9 @@ import play.api.test.Helpers.* import queries.{DirectDebitReferenceQuery, ExistingDirectDebitIdentifierQuery, PaymentPlansCountQuery} import repositories.SessionRepository import services.{NationalDirectDebitService, PaginationResult, PaginationService} +import splitter.connectors.{AllowListConnector, FakeAllowListConnector} +import splitter.controllers.{FakeIdentityIdentifierAction, IdentityIdentifierAction} +import uk.gov.hmrc.http.HeaderCarrier import viewmodels.govuk.PaginationFluency.* import java.time.LocalDateTime @@ -38,9 +41,7 @@ import scala.concurrent.Future class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers with MockitoSugar { "YourDirectDebitInstructionsController" - { - "onPageLoad" - { - "must return OK and the correct view for a GET with no page parameter" in { val testData = createTestNddResponse(5) val mockNddService = mock[NationalDirectDebitService] @@ -58,7 +59,9 @@ class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers w .overrides( bind[NationalDirectDebitService].toInstance(mockNddService), bind[PaginationService].toInstance(mockPaginationService), - bind[SessionRepository].toInstance(mockSessionRepository) + bind[SessionRepository].toInstance(mockSessionRepository), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -88,7 +91,9 @@ class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers w .overrides( bind[NationalDirectDebitService].toInstance(mockNddService), bind[PaginationService].toInstance(mockPaginationService), - bind[SessionRepository].toInstance(mockSessionRepository) + bind[SessionRepository].toInstance(mockSessionRepository), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -118,7 +123,9 @@ class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers w .overrides( bind[NationalDirectDebitService].toInstance(mockNddService), bind[PaginationService].toInstance(mockPaginationService), - bind[SessionRepository].toInstance(mockSessionRepository) + bind[SessionRepository].toInstance(mockSessionRepository), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -148,7 +155,9 @@ class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers w .overrides( bind[NationalDirectDebitService].toInstance(mockNddService), bind[PaginationService].toInstance(mockPaginationService), - bind[SessionRepository].toInstance(mockSessionRepository) + bind[SessionRepository].toInstance(mockSessionRepository), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() @@ -202,7 +211,9 @@ class YourDirectDebitInstructionsControllerSpec extends SpecBase with Matchers w .overrides( bind[NationalDirectDebitService].toInstance(mockNddService), bind[PaginationService].toInstance(mockPaginationService), - bind[SessionRepository].toInstance(mockSessionRepository) + bind[SessionRepository].toInstance(mockSessionRepository), + bind[IdentityIdentifierAction].to[FakeIdentityIdentifierAction], + bind[AllowListConnector].toInstance(FakeAllowListConnector(true)) ) .build() diff --git a/test/controllers/actions/AllowListFilterActionSpec.scala b/test/controllers/actions/AllowListFilterActionSpec.scala new file mode 100644 index 00000000..0be96f78 --- /dev/null +++ b/test/controllers/actions/AllowListFilterActionSpec.scala @@ -0,0 +1,76 @@ +/* + * 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.actions + +import base.SpecBase +import models.requests.IdentifierRequest +import play.api.Configuration +import play.api.mvc.Results +import play.api.test.Helpers.* +import play.api.test.{FakeRequest, Helpers} +import splitter.connectors.FakeAllowListConnector + +import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.{ExecutionContext, Future} + +class AllowListFilterActionSpec extends SpecBase { + + val fakeLegacyPath = "/test-url" + + "IdentityIdentifierAction" - { + "will redirect to when allow list checks are false" in { + val filter = AllowListFilterAction( + FakeAllowListConnector(false), + Configuration("microservice.services.ndds-legacy.path" -> fakeLegacyPath) + ) + + val request = IdentifierRequest(FakeRequest().withBody(""), "") + val result = filter.invokeBlock(request, _ => Future.successful(Results.Ok("from block"))) + + status(result) mustBe SEE_OTHER + redirectLocation(result) mustBe Some(fakeLegacyPath) + } + + "will redirect to when allow list checks fail" in { + val filter = AllowListFilterAction( + FakeAllowListConnector(new Exception("bang")), + Configuration("microservice.services.ndds-legacy.path" -> fakeLegacyPath) + ) + + val request = IdentifierRequest(FakeRequest().withBody(""), "") + val result = filter.invokeBlock(request, _ => Future.successful(Results.Ok("from block"))) + + status(result) mustBe SEE_OTHER + redirectLocation(result) mustBe Some(fakeLegacyPath) + } + + "No redirect when the check return true" in { + val filter = AllowListFilterAction( + FakeAllowListConnector(true), + Configuration("microservice.services.ndds-legacy.path" -> fakeLegacyPath) + ) + + val request = IdentifierRequest(FakeRequest().withBody(""), "") + val result = filter.invokeBlock(request, _ => Future.successful(Results.Ok("from block"))) + + status(result) mustBe OK + redirectLocation(result) mustBe None + contentAsString(result) mustEqual "from block" + } + + } +} diff --git a/test/services/NationalDirectDebitServiceSpec.scala b/test/services/NationalDirectDebitServiceSpec.scala index 61129889..6d222861 100644 --- a/test/services/NationalDirectDebitServiceSpec.scala +++ b/test/services/NationalDirectDebitServiceSpec.scala @@ -277,7 +277,7 @@ class NationalDirectDebitServiceSpec extends SpecBase with MockitoSugar with Dir "fail when auddis status is not in user answers" in { val result = intercept[Exception](service.getFutureWorkingDays(emptyUserAnswers, "123").futureValue) - result.getMessage must include("YourBankDetailsPage details missing from user answers") + result.getMessage must include("Missing information from user answers") } "must successfully return the Earliest Payment Date when direct debit is exists" in { diff --git a/test/splitter/connectors/FakeAllowListConnector.scala b/test/splitter/connectors/FakeAllowListConnector.scala new file mode 100644 index 00000000..8458ee1d --- /dev/null +++ b/test/splitter/connectors/FakeAllowListConnector.scala @@ -0,0 +1,27 @@ +/* + * 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 splitter.connectors + +import uk.gov.hmrc.http.HeaderCarrier + +import scala.concurrent.Future + +class FakeAllowListConnector(result: Exception | Boolean) extends AllowListConnector: + override def check(userId: String)(using HeaderCarrier): Future[Boolean] = + result match + case res: Boolean => Future.successful(res) + case res: Exception => Future.failed(res) diff --git a/test/splitter/controllers/SplitterControllerSpec.scala b/test/splitter/controllers/SplitterControllerSpec.scala index f07794f8..cf474948 100644 --- a/test/splitter/controllers/SplitterControllerSpec.scala +++ b/test/splitter/controllers/SplitterControllerSpec.scala @@ -16,27 +16,18 @@ package splitter.controllers +import org.scalatest.OptionValues import org.scalatest.freespec.AnyFreeSpec import org.scalatest.matchers.must.Matchers -import org.scalatest.OptionValues import play.api.http.Status import play.api.inject.bind import play.api.inject.guice.GuiceApplicationBuilder import play.api.test.FakeRequest import play.api.test.Helpers.* -import splitter.connectors.AllowListConnector -import uk.gov.hmrc.http.HeaderCarrier - -import scala.concurrent.Future +import splitter.connectors.{AllowListConnector, FakeAllowListConnector} class SplitterControllerSpec extends AnyFreeSpec, Matchers, OptionValues { - class FakeAllowListConnector(result: Exception | Boolean) extends AllowListConnector: - override def check(userId: String)(using HeaderCarrier): Future[Boolean] = - result match - case res: Boolean => Future.successful(res) - case res: Exception => Future.failed(res) - def withConnector(connectorResponse: Boolean | Exception)(builder: GuiceApplicationBuilder): GuiceApplicationBuilder = builder .overrides(