1616
1717package connectors
1818
19- import play .api .Logging
2019import play .api .libs .json .{JsValue , Json , Writes }
2120import uk .gov .hmrc .http .client .HttpClientV2
2221import uk .gov .hmrc .http .{HeaderCarrier , HttpReads , HttpResponse , StringContextOps }
23- import uk .gov .hmrc .play .audit .http .connector .AuditConnector
2422import uk .gov .hmrc .play .bootstrap .config .ServicesConfig
2523
2624import java .time .format .DateTimeFormatter
@@ -30,10 +28,9 @@ import javax.inject.Inject
3028import scala .concurrent .{ExecutionContext , Future }
3129
3230class 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}
0 commit comments