diff --git a/app/uk/gov/hmrc/apisubscriptionfields/connector/PushPullNotificationServiceConnector.scala b/app/uk/gov/hmrc/apisubscriptionfields/connector/PushPullNotificationServiceConnector.scala index 64788f0..fbb0926 100644 --- a/app/uk/gov/hmrc/apisubscriptionfields/connector/PushPullNotificationServiceConnector.scala +++ b/app/uk/gov/hmrc/apisubscriptionfields/connector/PushPullNotificationServiceConnector.scala @@ -20,9 +20,11 @@ import javax.inject.{Inject, Singleton} import scala.concurrent.{ExecutionContext, Future} import scala.util.control.NonFatal +import play.api.libs.json.Json import uk.gov.hmrc.apiplatform.modules.common.domain.models.ClientId import uk.gov.hmrc.http.HttpReads.Implicits._ -import uk.gov.hmrc.http.{HeaderCarrier, HttpClient} +import uk.gov.hmrc.http.client.HttpClientV2 +import uk.gov.hmrc.http.{HeaderCarrier, StringContextOps} import uk.gov.hmrc.play.http.metrics.common._ import uk.gov.hmrc.apisubscriptionfields.config.ApplicationConfig @@ -30,7 +32,7 @@ import uk.gov.hmrc.apisubscriptionfields.model.Types.FieldValue import uk.gov.hmrc.apisubscriptionfields.model._ @Singleton -class PushPullNotificationServiceConnector @Inject() (http: HttpClient, appConfig: ApplicationConfig, val apiMetrics: ApiMetrics)(implicit ec: ExecutionContext) +class PushPullNotificationServiceConnector @Inject() (http: HttpClientV2, appConfig: ApplicationConfig, val apiMetrics: ApiMetrics)(implicit ec: ExecutionContext) extends RecordMetrics { import uk.gov.hmrc.apisubscriptionfields.connector.JsonFormatters._ @@ -42,7 +44,9 @@ class PushPullNotificationServiceConnector @Inject() (http: HttpClient, appConfi val payload = CreateBoxRequest(boxName, clientId) http - .PUT[CreateBoxRequest, CreateBoxResponse](s"$externalServiceUri/box", payload) + .put(url"$externalServiceUri/box") + .withBody(Json.toJson(payload)) + .execute[CreateBoxResponse] .map(_.boxId) .recover { case NonFatal(e) => throw new RuntimeException(s"Unexpected response from $externalServiceUri: ${e.getMessage}") @@ -53,7 +57,9 @@ class PushPullNotificationServiceConnector @Inject() (http: HttpClient, appConfi val payload = UpdateSubscriberRequest(SubscriberRequest(callbackUrl, "API_PUSH_SUBSCRIBER")) http - .PUT[UpdateSubscriberRequest, UpdateSubscriberResponse](s"$externalServiceUri/box/${boxId.value.toString}/subscriber", payload) + .put(url"$externalServiceUri/box/${boxId.value.toString}/subscriber") + .withBody(Json.toJson(payload)) + .execute[UpdateSubscriberResponse] .map(_ => ()) .recover { case NonFatal(e) => throw new RuntimeException(s"Unexpected response from $externalServiceUri: ${e.getMessage}") @@ -63,7 +69,9 @@ class PushPullNotificationServiceConnector @Inject() (http: HttpClient, appConfi def updateCallBackUrl(clientId: ClientId, boxId: BoxId, callbackUrl: FieldValue)(implicit hc: HeaderCarrier): Future[Either[String, Unit]] = { val payload = UpdateCallBackUrlRequest(clientId, callbackUrl) http - .PUT[UpdateCallBackUrlRequest, UpdateCallBackUrlResponse](s"$externalServiceUri/box/${boxId.value.toString}/callback", payload) + .put(url"$externalServiceUri/box/${boxId.value.toString}/callback") + .withBody(Json.toJson(payload)) + .execute[UpdateCallBackUrlResponse] .map(response => if (response.successful) Right(()) diff --git a/build.sbt b/build.sbt index 3b3a1fc..d6af92f 100644 --- a/build.sbt +++ b/build.sbt @@ -43,8 +43,7 @@ lazy val acceptance = (project in file("acceptance")) .settings( name := "acceptance-tests", Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-eT"), - DefaultBuildSettings.itSettings(), - addTestReportOption(Test, "acceptance-reports") + DefaultBuildSettings.itSettings() ) commands ++= Seq( diff --git a/conf/application.conf b/conf/application.conf index 5a4d6db..a7cd111 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -25,7 +25,7 @@ play.http.errorHandler = "uk.gov.hmrc.play.bootstrap.backend.http.JsonErrorHandl # ~~~~ # Additional play modules can be added here play.modules.enabled += "uk.gov.hmrc.mongo.play.PlayMongoModule" -play.modules.enabled += "uk.gov.hmrc.play.bootstrap.HttpClientModule" +play.modules.enabled += "uk.gov.hmrc.play.bootstrap.HttpClientV2Module" play.modules.enabled += "uk.gov.hmrc.play.http.metrics.Module" diff --git a/conf/logback.xml b/conf/logback.xml index 7cf8b1f..1c5f667 100644 --- a/conf/logback.xml +++ b/conf/logback.xml @@ -13,19 +13,6 @@ - - - %date{ISO8601} level=[%level] logger=[%logger] thread=[%thread] rid=[not-available] user=[not-available] message=[%message] %replace(exception=[%xException]){'^exception=\[\]$',''}%n - - - - - logs/access.log - - %message%n - - - logs/connector.log @@ -33,14 +20,6 @@ - - - - - - - - diff --git a/project/build.properties b/project/build.properties index e8a1e24..04267b1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.9.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 9718b18..c1976fa 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefac resolvers += Resolver.url("HMRC-open-artefacts-ivy2", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns) resolvers += Resolver.typesafeRepo("releases") -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.20.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0") addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "2.5.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0")