From 869f528a944c76e99a63549f2c2485d35f039243 Mon Sep 17 00:00:00 2001 From: Shailesh Patil <53746241+mineme0110@users.noreply.github.com> Date: Thu, 7 Sep 2023 13:06:41 +0100 Subject: [PATCH] fix: Added DidSubject to report problem when not enrolled (#111) fix(mediator): Added didsubject to reprrt problem on the event of not enrolled did is used Signed-off-by: Shailesh Patil Signed-off-by: Shailesh --- .../iohk/atala/mediator/protocols/ForwardMessageExecuter.scala | 2 ++ .../io/iohk/atala/mediator/protocols/PickupExecuter.scala | 2 ++ .../main/scala/io/iohk/atala/mediator/protocols/Problems.scala | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala index dd816ec2..cf0794c2 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/ForwardMessageExecuter.scala @@ -52,6 +52,7 @@ object ForwardMessageExecuter from = agent.id, pthid = plaintextMessage.id, piuri = plaintextMessage.`type`, + didNotEnrolled = m.next, ) case None => Problems.notEnroledError( @@ -59,6 +60,7 @@ object ForwardMessageExecuter from = agent.id, pthid = plaintextMessage.id, piuri = plaintextMessage.`type`, + didNotEnrolled = m.next, ) } } yield Reply(problem.toPlaintextMessage) diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala index 941efe92..0c7f4ffa 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/PickupExecuter.scala @@ -59,6 +59,7 @@ object PickupExecuter to = Some(m.from.asTO), pthid = m.id, // TODO CHECK pthid piuri = m.piuri, + didNotEnrolled = didRequestingMessages.asFROM.toDIDSubject, ) .toPlaintextMessage case Some(didAccount) => @@ -106,6 +107,7 @@ object PickupExecuter to = Some(m.from.asTO), pthid = m.id, // TODO CHECK pthid piuri = m.piuri, + didNotEnrolled = didRequestingMessages.asFROM.toDIDSubject, ) .toPlaintextMessage ) diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala index 121ba014..7536834e 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/protocols/Problems.scala @@ -99,6 +99,7 @@ object Problems { from: FROM, pthid: MsgID, piuri: PIURI, + didNotEnrolled: DIDSubject ) = ProblemReport( // id: MsgID = MsgID(), to = to.toSet, @@ -107,7 +108,7 @@ object Problems { ack = None, code = ProblemCode.ErroFail("req", "not_enroll"), comment = Some("The DID '{1}' is not enroled."), - args = Some(to.map(_.value).toSeq), + args = Some(Seq(didNotEnrolled.did)), escalate_to = email, )