Skip to content

Commit 85499c0

Browse files
authored
DL-17946: HIP logs clean up
1 parent 9bd2a28 commit 85499c0

File tree

4 files changed

+3
-20
lines changed

4 files changed

+3
-20
lines changed

app/connectors/HipConnector.scala

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616

1717
package connectors
1818

19-
import play.api.Logging
2019
import play.api.libs.json.{JsValue, Json, Writes}
2120
import uk.gov.hmrc.http.client.HttpClientV2
2221
import uk.gov.hmrc.http.{HeaderCarrier, HttpReads, HttpResponse, StringContextOps}
23-
import uk.gov.hmrc.play.audit.http.connector.AuditConnector
2422
import uk.gov.hmrc.play.bootstrap.config.ServicesConfig
2523

2624
import java.time.format.DateTimeFormatter
@@ -30,10 +28,9 @@ import javax.inject.Inject
3028
import scala.concurrent.{ExecutionContext, Future}
3129

3230
class HipConnector @Inject() (http: HttpClientV2,
33-
val auditConnector: AuditConnector,
3431
config: ServicesConfig)
3532
(implicit ec: ExecutionContext)
36-
extends RawResponseReads with Logging {
33+
extends RawResponseReads {
3734

3835
lazy val serviceURL: String = config.baseUrl("hip")
3936
val baseURI: String = "/etmp/RESTAdapter/awrs"
@@ -68,23 +65,17 @@ class HipConnector @Inject() (http: HttpClientV2,
6865
http.get(url"$url").setHeader(headers: _*).execute[A]
6966

7067
@inline def cPOST[I, O](url: String, body: I)(implicit wts: Writes[I], rds: HttpReads[O], hc: HeaderCarrier): Future[O] = {
71-
//For debugging purpose only. Remove this before deploying to production
72-
logger.warn(s"[cPOST] Headers being sent: ${headers.mkString(", ")}")
7368
http.post(url"$url").withBody(Json.toJson(body)).setHeader(headers: _*).execute[O]
7469
}
7570

7671
@inline def cPUT[I, O](url: String, body: I)(implicit wts: Writes[I], rds: HttpReads[O], hc: HeaderCarrier): Future[O] =
7772
http.put(url"$url").withBody(Json.toJson(body)).setHeader(headers: _*).execute[O]
7873

7974
def deRegister(awrsRefNo: String, deRegDetails: JsValue)(implicit headerCarrier: HeaderCarrier): Future[HttpResponse] = {
80-
// The below log message have to be removed and should not be deployed to production
81-
logger.warn(s"Deregistration Request: $deRegDetails")
8275
cPOST(s"""$serviceURL$baseURI$subscriptionURI$deRegistrationURI/$awrsRefNo""", deRegDetails)
8376
}
8477

8578
def withdrawal(awrsRefNo: String, withdrawalData: JsValue)(implicit headerCarrier: HeaderCarrier): Future[HttpResponse] = {
86-
// The below log message have to be removed and should not be deployed to production
87-
logger.warn(s"Withdrawal Request: $withdrawalData")
8879
cPOST( s"""$serviceURL$baseURI$subscriptionURI$withdrawalURI/$awrsRefNo""", withdrawalData)
8980
}
9081

@@ -97,14 +88,10 @@ class HipConnector @Inject() (http: HttpClientV2,
9788
}
9889

9990
def subscribe(registerData: JsValue, safeId: String)(implicit headerCarrier: HeaderCarrier): Future[HttpResponse] = {
100-
// The below log message have to be removed and should not be deployed to production
101-
logger.warn(s"Create Request: $registerData")
10291
cPOST( s"""$serviceURL$baseURI$subscriptionURI$subscriptionCreateURI/$safeId""", registerData)
10392
}
10493

10594
def updateSubscription(updateData: JsValue, awrsRefNo: String)(implicit headerCarrier: HeaderCarrier): Future[HttpResponse] = {
106-
// The below log message have to be removed and should not be deployed to production
107-
logger.warn(s"Update Request: $updateData")
10895
cPUT(s"""$serviceURL$baseURI$subscriptionURI$updateURI/$awrsRefNo""", updateData)
10996
}
11097
}

app/services/LookupService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import connectors.{EtmpConnector, HipConnector}
2020
import play.api.http.Status
2121
import play.api.libs.json.Json
2222
import uk.gov.hmrc.http.{HeaderCarrier, HttpResponse}
23-
import utils.Utility.{logger, mapCrnForDesResponse}
23+
import utils.Utility.logger
2424
import utils.{AWRSFeatureSwitches, Utility}
2525

2626
import javax.inject.Inject

app/services/SubscriptionService.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class SubscriptionService @Inject()(
6363
submitResponse <- hipConnector.subscribe(updatedInputJson, safeId)
6464
jsonWithoutSuccessNode = Utility.stripSuccessNode(submitResponse.json)
6565
modifiedSubmitResponse = {
66-
// This Log message have to be removed while deploying HIP
67-
logger.warn(s"[SubscriptionService][createSubscription] Response from HIP endpoint: status=${submitResponse.status}, body=${submitResponse.body}")
6866
HttpResponse(submitResponse.status, Json.stringify(jsonWithoutSuccessNode))
6967
}
7068
enrolmentResponse <- addKnownFacts(modifiedSubmitResponse, safeId, utr, businessType, postcode)

test/connector/HipConnectorTest.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import org.scalatest.wordspec.AnyWordSpecLike
2222
import play.api.libs.json.{JsValue, Json}
2323
import play.mvc.Http.Status
2424
import uk.gov.hmrc.http.{HeaderCarrier, HttpResponse}
25-
import uk.gov.hmrc.play.audit.http.connector.AuditConnector
2625
import uk.gov.hmrc.play.bootstrap.config.ServicesConfig
2726
import utils.BaseSpec
2827

@@ -32,11 +31,10 @@ import scala.concurrent.{ExecutionContext, Future}
3231
class HipConnectorTest extends BaseSpec with AnyWordSpecLike {
3332
implicit val ec: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global
3433

35-
val mockAuditConnector: AuditConnector = mock[AuditConnector]
3634
val config: ServicesConfig = app.injector.instanceOf[ServicesConfig]
3735

3836
trait Setup extends ConnectorTest {
39-
object TestHipConnector extends HipConnector (mockHttpClient, mockAuditConnector, config)
37+
object TestHipConnector extends HipConnector (mockHttpClient, config)
4038
val awrsRefNo = "XAAW0000010001"
4139
implicit val hc: HeaderCarrier = HeaderCarrier()
4240
}

0 commit comments

Comments
 (0)