From b51ce7c75c2ce93e308d1774c6994bf6bca9d012 Mon Sep 17 00:00:00 2001 From: Arun Kumar Madesh <56151567+arunkumar461@users.noreply.github.com> Date: Tue, 21 May 2024 10:38:35 +0100 Subject: [PATCH] SASS-8272: DES clean up and fix 1938 API (#49) Fix API 1938, Clean up DES API connectors and references and upgrade dependencies --- app/config/AppConfig.scala | 4 -- app/connectors/DESConnector.scala | 45 ------------ .../DataExchangeServiceConnector.scala | 55 --------------- .../IntegrationFrameworkConnector.scala | 8 +-- app/services/DESService.scala | 38 ---------- conf/application.conf | 8 --- .../DataExchangeServiceConnectorISpec.scala | 67 ------------------ project/AppDependencies.scala | 4 +- project/plugins.sbt | 4 +- test/connectors/DESConnectorSpec.scala | 70 ------------------- test/services/DESServiceSpec.scala | 52 -------------- test/services/StateBenefitsServiceSpec.scala | 4 +- test/support/mocks/MockDESService.scala | 39 ----------- .../MockDataExchangeServiceConnector.scala | 40 ----------- test/support/stubs/AppConfigStub.scala | 3 - 15 files changed, 8 insertions(+), 433 deletions(-) delete mode 100644 app/connectors/DESConnector.scala delete mode 100644 app/connectors/DataExchangeServiceConnector.scala delete mode 100644 app/services/DESService.scala delete mode 100644 it/test/connectors/DataExchangeServiceConnectorISpec.scala delete mode 100644 test/connectors/DESConnectorSpec.scala delete mode 100644 test/services/DESServiceSpec.scala delete mode 100644 test/support/mocks/MockDESService.scala delete mode 100644 test/support/mocks/MockDataExchangeServiceConnector.scala diff --git a/app/config/AppConfig.scala b/app/config/AppConfig.scala index ddff7c5..5308d51 100644 --- a/app/config/AppConfig.scala +++ b/app/config/AppConfig.scala @@ -38,8 +38,4 @@ class AppConfig @Inject()(servicesConfig: ServicesConfig) { lazy val useEncryption: Boolean = servicesConfig.getBoolean("useEncryption") def authorisationTokenFor(apiVersion: String): String = servicesConfig.getString(authorisationTokenKey + s".$apiVersion") - - lazy val desBaseUrl: String = servicesConfig.baseUrl(serviceName = "des") - lazy val desEnvironment: String = servicesConfig.getString(key = "microservice.services.des.environment") - lazy val desAuthorisationToken: String = servicesConfig.getString(key = "microservice.services.des.authorisation-token") } diff --git a/app/connectors/DESConnector.scala b/app/connectors/DESConnector.scala deleted file mode 100644 index f401ead..0000000 --- a/app/connectors/DESConnector.scala +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -package connectors - -import com.typesafe.config.ConfigFactory -import config.AppConfig -import uk.gov.hmrc.http.HeaderCarrier.Config -import uk.gov.hmrc.http.{Authorization, HeaderCarrier} -import utils.HeaderCarrierSyntax.HeaderCarrierOps - -import java.net.URL - -trait DESConnector { - - protected val appConfig: AppConfig - protected[connectors] lazy val baseUrl: String = appConfig.desBaseUrl - - protected val headerCarrierConfig: Config = HeaderCarrier.Config.fromConfig(ConfigFactory.load()) - - private[connectors] def desHeaderCarrier(url: URL)(implicit hc: HeaderCarrier): HeaderCarrier = { - val isInternalHost = headerCarrierConfig.internalHostPatterns.exists(_.pattern.matcher(url.getHost).matches()) - - val hcWithAuth = hc.copy(authorization = Some(Authorization(s"Bearer ${appConfig.desAuthorisationToken}"))) - - if (isInternalHost) { - hcWithAuth.withExtraHeaders("Environment" -> appConfig.desEnvironment) - } else { - hcWithAuth.withExtraHeaders(("Environment" -> appConfig.desEnvironment) +: hcWithAuth.toExplicitHeaders: _*) - } - } -} diff --git a/app/connectors/DataExchangeServiceConnector.scala b/app/connectors/DataExchangeServiceConnector.scala deleted file mode 100644 index 0a69b5d..0000000 --- a/app/connectors/DataExchangeServiceConnector.scala +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ - -package connectors - -import config.AppConfig -import connectors.errors.ApiError -import connectors.responses.DeleteStateBenefitDetailOverrideResponse -import services.PagerDutyLoggerService -import uk.gov.hmrc.http.{HeaderCarrier, HttpClient} - -import java.net.URL -import java.util.UUID -import javax.inject.Inject -import scala.concurrent.{ExecutionContext, Future} - -class DataExchangeServiceConnector @Inject()(httpClient: HttpClient, - pagerDutyLoggerService: PagerDutyLoggerService, - appConf: AppConfig) - (implicit ec: ExecutionContext) extends DESConnector { - - override protected[connectors] val appConfig: AppConfig = appConf - - def deleteStateBenefitDetailOverride(taxYear: Int, nino: String, benefitId: UUID) - (implicit hc: HeaderCarrier): Future[Either[ApiError, Unit]] = { - val url = new URL(s"$baseUrl/income-tax/income/state-benefits/$nino/${toTaxYearParam(taxYear)}/$benefitId") - val eventualResponse = callDeleteStateBenefitDetailOverride(url)(desHeaderCarrier(url)) - - eventualResponse.map { apiResponse: DeleteStateBenefitDetailOverrideResponse => - if (apiResponse.result.isLeft) pagerDutyLoggerService.pagerDutyLog(apiResponse.httpResponse, apiResponse.getClass.getSimpleName) - apiResponse.result - } - } - - private def callDeleteStateBenefitDetailOverride(url: URL)(implicit hc: HeaderCarrier): Future[DeleteStateBenefitDetailOverrideResponse] = { - httpClient.DELETE[DeleteStateBenefitDetailOverrideResponse](url) - } - - private def toTaxYearParam(taxYear: Int): String = { - s"${taxYear - 1}-${taxYear.toString takeRight 2}" - } -} diff --git a/app/connectors/IntegrationFrameworkConnector.scala b/app/connectors/IntegrationFrameworkConnector.scala index ddc55e4..81a9390 100644 --- a/app/connectors/IntegrationFrameworkConnector.scala +++ b/app/connectors/IntegrationFrameworkConnector.scala @@ -52,8 +52,8 @@ class IntegrationFrameworkConnector @Inject()(httpClient: HttpClient, def getAllStateBenefitsData(taxYear: Int, nino: String) (implicit hc: HeaderCarrier): Future[Either[ApiError, Option[AllStateBenefitsData]]] = { - val (url, apiVersion) = if (shouldUse2324(taxYear)) { - (new URL(s"$baseUrl/income-tax/income/state-benefits/23-24/$nino"), getApi2324Version) + val (url, apiVersion) = if (isAfter2324Api(taxYear)) { + (new URL(s"$baseUrl/income-tax/income/state-benefits/${asTys(taxYear)}/$nino"), getApi2324Version) } else { (new URL(s"$baseUrl/income-tax/income/state-benefits/$nino/${toTaxYearParam(taxYear)}"), getApiVersion) } @@ -209,10 +209,6 @@ class IntegrationFrameworkConnector @Inject()(httpClient: HttpClient, s"${taxYear - 1}-${taxYear.toString takeRight 2}" } - private def shouldUse2324(taxYear: Int): Boolean = { - taxYear == 2024 - } - private def isAfter2324Api(taxYear: Int): Boolean = { taxYear >= 2024 } diff --git a/app/services/DESService.scala b/app/services/DESService.scala deleted file mode 100644 index 80f73df..0000000 --- a/app/services/DESService.scala +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package services - -import connectors.DataExchangeServiceConnector -import models.errors.ApiServiceError -import models.mongo.StateBenefitsUserData -import uk.gov.hmrc.http.HeaderCarrier - -import javax.inject.{Inject, Singleton} -import scala.concurrent.{ExecutionContext, Future} - -@Singleton -class DESService @Inject()(connector: DataExchangeServiceConnector) - (implicit ec: ExecutionContext) { - - def removeCustomerOverride(stateBenefitsUserData: StateBenefitsUserData) - (implicit hc: HeaderCarrier): Future[Either[ApiServiceError, Unit]] = { - connector.deleteStateBenefitDetailOverride(stateBenefitsUserData.taxYear, stateBenefitsUserData.nino, stateBenefitsUserData.claim.get.benefitId.get).map { - case Left(error) => Left(ApiServiceError(error.status.toString)) - case Right(_) => Right(()) - } - } -} diff --git a/conf/application.conf b/conf/application.conf index f179149..1383ea6 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -74,14 +74,6 @@ microservice { port = 8500 } - des { - host = "localhost" - environment = "test" - authorisation-token = "secret" - port = 9303 - #This is the port for the income-tax-submission-stub - } - integration-framework { host = "localhost" environment = "test" diff --git a/it/test/connectors/DataExchangeServiceConnectorISpec.scala b/it/test/connectors/DataExchangeServiceConnectorISpec.scala deleted file mode 100644 index c06444f..0000000 --- a/it/test/connectors/DataExchangeServiceConnectorISpec.scala +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -package connectors - -import connectors.errors.{ApiError, SingleErrorBody} -import org.scalamock.scalatest.MockFactory -import play.api.http.Status.{INTERNAL_SERVER_ERROR, NO_CONTENT} -import play.api.libs.json.Json -import services.PagerDutyLoggerService -import support.ConnectorIntegrationTest -import support.providers.TaxYearProvider -import uk.gov.hmrc.http.{HeaderCarrier, HttpResponse, SessionId} - -import java.util.UUID -import scala.concurrent.ExecutionContext.Implicits.global - -class DataExchangeServiceConnectorISpec extends ConnectorIntegrationTest - with MockFactory - with TaxYearProvider { - - private val benefitId = UUID.randomUUID() - private val nino = "some-nino" - private val hc: HeaderCarrier = HeaderCarrier(sessionId = Some(SessionId("sessionIdValue"))) - - private val pagerDutyLoggerService = mock[PagerDutyLoggerService] - - private val underTest = new DataExchangeServiceConnector(httpClient, pagerDutyLoggerService, appConfigStub) - - private def toTaxYearParameter(taxYear: Int): String = { - s"${taxYear - 1}-${taxYear.toString takeRight 2}" - } - - ".deleteStateBenefitDetailOverride" should { - "return correct response when correct data is passed" in { - val httpResponse = HttpResponse(NO_CONTENT, "") - - stubDeleteHttpClientCall(s"/income-tax/income/state-benefits/$nino/${toTaxYearParameter(taxYear)}/$benefitId", httpResponse) - - await(underTest.deleteStateBenefitDetailOverride(taxYear, nino, benefitId)(hc)) shouldBe Right(()) - } - - "return error and perform a pagerDutyLog when Left is returned" in { - val httpResponse = HttpResponse(INTERNAL_SERVER_ERROR, Json.toJson(SingleErrorBody("some-code", "some-reason")).toString()) - - (pagerDutyLoggerService.pagerDutyLog _).expects(*, "DeleteStateBenefitDetailOverrideResponse") - - stubDeleteHttpClientCall(s"/income-tax/income/state-benefits/$nino/${toTaxYearParameter(taxYear)}/$benefitId", httpResponse) - - await(underTest.deleteStateBenefitDetailOverride(taxYear, nino, benefitId)(hc)) shouldBe - Left(ApiError(INTERNAL_SERVER_ERROR, SingleErrorBody("some-code", "some-reason"))) - } - } -} diff --git a/project/AppDependencies.scala b/project/AppDependencies.scala index 68647ec..eb4f203 100644 --- a/project/AppDependencies.scala +++ b/project/AppDependencies.scala @@ -18,8 +18,8 @@ import sbt.* object AppDependencies { - private val bootstrapBackendPlay30Version = "8.5.0" - private val hmrcMongoPlay30Version = "1.7.0" + private val bootstrapBackendPlay30Version = "8.6.0" + private val hmrcMongoPlay30Version = "1.9.0" val compile: Seq[ModuleID] = Seq( "uk.gov.hmrc" %% "bootstrap-backend-play-30" % bootstrapBackendPlay30Version, diff --git a/project/plugins.sbt b/project/plugins.sbt index 4b0f686..c4f8962 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -22,8 +22,8 @@ ThisBuild / libraryDependencySchemes ++= Seq( "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always ) -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.20.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.21.0") addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.2") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.3") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") diff --git a/test/connectors/DESConnectorSpec.scala b/test/connectors/DESConnectorSpec.scala deleted file mode 100644 index 54c0855..0000000 --- a/test/connectors/DESConnectorSpec.scala +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -package connectors - -import config.AppConfig -import org.scalamock.scalatest.MockFactory -import support.UnitTest -import support.providers.AppConfigStubProvider -import support.stubs.AppConfigStub -import uk.gov.hmrc.http.HeaderNames.{authorisation, xRequestChain, xSessionId} -import uk.gov.hmrc.http.{Authorization, HeaderCarrier, SessionId} - -import java.net.URL - -class DESConnectorSpec extends UnitTest - with MockFactory - with AppConfigStubProvider { - - private val underTest = new DESConnector { - override protected val appConfig: AppConfig = appConfigStub - } - - ".baseUrl" should { - "return the app config value" in { - val underTest = new DESConnector { - override protected val appConfig: AppConfig = new AppConfigStub().config("not-test") - } - - underTest.baseUrl shouldBe appConfigStub.desBaseUrl - } - } - - ".desHeaderCarrier" should { - "return correct HeaderCarrier when internal host" in { - val internalHost = new URL("http://localhost") - - val result = underTest.desHeaderCarrier(internalHost)(HeaderCarrier()) - - result.authorization shouldBe Some(Authorization(s"Bearer ${appConfigStub.desAuthorisationToken}")) - result.extraHeaders shouldBe Seq("Environment" -> appConfigStub.desEnvironment) - } - - "return correct HeaderCarrier when external host" in { - val externalHost = new URL("http://127.0.0.1") - val hc = HeaderCarrier(sessionId = Some(SessionId("sessionIdHeaderValue"))) - - val result = underTest.desHeaderCarrier(externalHost)(hc) - - result.extraHeaders.size shouldBe 4 - result.extraHeaders.contains(xSessionId -> "sessionIdHeaderValue") shouldBe true - result.extraHeaders.contains(authorisation -> s"Bearer ${appConfigStub.desAuthorisationToken}") shouldBe true - result.extraHeaders.contains("Environment" -> appConfigStub.desEnvironment) shouldBe true - result.extraHeaders.exists(x => x._1.equalsIgnoreCase(xRequestChain)) shouldBe true - } - } -} diff --git a/test/services/DESServiceSpec.scala b/test/services/DESServiceSpec.scala deleted file mode 100644 index 6a7fb51..0000000 --- a/test/services/DESServiceSpec.scala +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -package services - -import connectors.errors.{ApiError, SingleErrorBody} -import models.errors.ApiServiceError -import play.api.http.Status.INTERNAL_SERVER_ERROR -import support.UnitTest -import support.builders.mongo.StateBenefitsUserDataBuilder.aStateBenefitsUserData -import support.mocks.MockDataExchangeServiceConnector -import uk.gov.hmrc.http.HeaderCarrier - -import scala.concurrent.ExecutionContext.Implicits.global - -class DESServiceSpec extends UnitTest - with MockDataExchangeServiceConnector { - - private implicit val headerCarrier: HeaderCarrier = HeaderCarrier() - - private val apiError = ApiError(INTERNAL_SERVER_ERROR, SingleErrorBody.parsingError) - - private val underTest = new DESService(mockDataExchangeServiceConnector) - - ".removeCustomerOverride" should { - val userData = aStateBenefitsUserData - "return error when connector.deleteStateBenefitDetailOverride(...) fails" in { - mockDeleteStateBenefitDetailOverride(userData.taxYear, userData.nino, userData.claim.get.benefitId.get, Left(apiError)) - - await(underTest.removeCustomerOverride(userData)) shouldBe Left(ApiServiceError(apiError.status.toString)) - } - - "succeed when connector.deleteStateBenefitDetailOverride(...) succeeds" in { - mockDeleteStateBenefitDetailOverride(userData.taxYear, userData.nino, userData.claim.get.benefitId.get, Right(())) - - await(underTest.removeCustomerOverride(userData)) shouldBe Right(()) - } - } -} diff --git a/test/services/StateBenefitsServiceSpec.scala b/test/services/StateBenefitsServiceSpec.scala index d783e59..8e09320 100644 --- a/test/services/StateBenefitsServiceSpec.scala +++ b/test/services/StateBenefitsServiceSpec.scala @@ -24,7 +24,7 @@ import support.builders.IncomeTaxUserDataBuilder.anIncomeTaxUserData import support.builders.api.AllStateBenefitsDataBuilder.anAllStateBenefitsData import support.builders.mongo.ClaimCYAModelBuilder.aClaimCYAModel import support.builders.mongo.StateBenefitsUserDataBuilder.aStateBenefitsUserData -import support.mocks.{MockDESService, MockIntegrationFrameworkService, MockStateBenefitsUserDataRepository, MockSubmissionService} +import support.mocks.{MockIntegrationFrameworkService, MockStateBenefitsUserDataRepository, MockSubmissionService} import uk.gov.hmrc.http.HeaderCarrier import scala.concurrent.ExecutionContext.Implicits.global @@ -288,7 +288,7 @@ class StateBenefitsServiceSpec await(underTest.removeClaim(userData.nino, userData.sessionDataId.get)) shouldBe Left(DataNotUpdatedError) } - "desService.removeOrIgnoreClaim(...) fails" in { + "removeOrIgnoreClaim(...) fails" in { mockFind(userData.nino, userData.sessionDataId.get, Right(userData)) mockRemoveCustomerOverride(userData, Left(ApiServiceError("some-error"))) diff --git a/test/support/mocks/MockDESService.scala b/test/support/mocks/MockDESService.scala deleted file mode 100644 index 98edc1b..0000000 --- a/test/support/mocks/MockDESService.scala +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -package support.mocks - -import models.errors.ApiServiceError -import models.mongo.StateBenefitsUserData -import org.scalamock.handlers._ -import org.scalamock.scalatest.MockFactory -import services.DESService -import uk.gov.hmrc.http.HeaderCarrier - -import scala.concurrent.Future - -trait MockDESService extends MockFactory { - - protected val mockDESService: DESService = mock[DESService] - - def mockRemoveCustomerOverride(userData: StateBenefitsUserData, - result: Either[ApiServiceError, Unit] - ): CallHandler2[StateBenefitsUserData, HeaderCarrier, Future[Either[ApiServiceError, Unit]]] = { - (mockDESService.removeCustomerOverride(_: StateBenefitsUserData)(_: HeaderCarrier)) - .expects(userData, *) - .returning(Future.successful(result)) - } -} diff --git a/test/support/mocks/MockDataExchangeServiceConnector.scala b/test/support/mocks/MockDataExchangeServiceConnector.scala deleted file mode 100644 index 4fcfe68..0000000 --- a/test/support/mocks/MockDataExchangeServiceConnector.scala +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ - -package support.mocks - -import connectors.DataExchangeServiceConnector -import connectors.errors.ApiError -import org.scalamock.handlers.CallHandler4 -import org.scalamock.scalatest.MockFactory -import uk.gov.hmrc.http.HeaderCarrier - -import java.util.UUID -import scala.concurrent.Future - -trait MockDataExchangeServiceConnector extends MockFactory { - - protected val mockDataExchangeServiceConnector: DataExchangeServiceConnector = mock[DataExchangeServiceConnector] - - def mockDeleteStateBenefitDetailOverride(taxYear: Int, - nino: String, - benefitId: UUID, - result: Either[ApiError, Unit]): CallHandler4[Int, String, UUID, HeaderCarrier, Future[Either[ApiError, Unit]]] = { - (mockDataExchangeServiceConnector.deleteStateBenefitDetailOverride(_: Int, _: String, _: UUID)(_: HeaderCarrier)) - .expects(taxYear, nino, benefitId, *) - .returning(Future.successful(result)) - } -} diff --git a/test/support/stubs/AppConfigStub.scala b/test/support/stubs/AppConfigStub.scala index 2b4013f..d4323c1 100644 --- a/test/support/stubs/AppConfigStub.scala +++ b/test/support/stubs/AppConfigStub.scala @@ -37,8 +37,5 @@ class AppConfigStub extends MockFactory { override def authorisationTokenFor(apiVersion: String): String = authorisationToken + s".$apiVersion" - override lazy val desBaseUrl: String = s"http://localhost:$wireMockPort" - override lazy val desAuthorisationToken: String = "authorisation-token" - override lazy val desEnvironment: String = "environment" } }