From 3963f1d726667dd29fecb12a498ed9d17b035c80 Mon Sep 17 00:00:00 2001 From: FabioPinheiro Date: Thu, 6 Apr 2023 12:43:55 +0100 Subject: [PATCH] fixes --- .../protocol/trustping/TrustPingResponse.scala | 2 +- .../io/iohk/atala/agent/server/Modules.scala | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mercury/mercury-library/protocol-trust-ping/src/main/scala/io/iohk/atala/mercury/protocol/trustping/TrustPingResponse.scala b/mercury/mercury-library/protocol-trust-ping/src/main/scala/io/iohk/atala/mercury/protocol/trustping/TrustPingResponse.scala index 0ff23b6a5c..15aa4bb5b3 100644 --- a/mercury/mercury-library/protocol-trust-ping/src/main/scala/io/iohk/atala/mercury/protocol/trustping/TrustPingResponse.scala +++ b/mercury/mercury-library/protocol-trust-ping/src/main/scala/io/iohk/atala/mercury/protocol/trustping/TrustPingResponse.scala @@ -6,7 +6,7 @@ import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder} import io.iohk.atala.mercury.model._ final case class TrustPingResponse( - `type`: PIURI = TrustPing.`type`, + `type`: PIURI = TrustPingResponse.`type`, id: String = java.util.UUID.randomUUID().toString, thid: String, from: DidId, diff --git a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala index 67599acc71..f5d80c5909 100644 --- a/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala +++ b/prism-agent/service/server/src/main/scala/io/iohk/atala/agent/server/Modules.scala @@ -228,11 +228,16 @@ object Modules { case Some(true) => Some(trustPing.makeReply.makeMessage) case Some(false) => None } - // service <- ZIO.service[HttpClient] - // aaa = service.postDIDComm(service) - _ = trustPingResponseMsg match - case None => ZIO.logWarning(s"Did not reply to the ${TrustPing.`type`}") - case Some(message) => MessagingService.send(message) + _ <- trustPingResponseMsg match + case None => ZIO.logWarning(s"Did not reply to the ${TrustPing.`type`}") + case Some(message) => + MessagingService + .send(message) + .flatMap(response => + response.status match + case c if c >= 200 & c < 300 => ZIO.unit + case c => ZIO.logWarning(response.toString()) + ) } yield () // ########################