You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/12/14 13:59:00 UTC

[camel] branch main updated: [Hyperledger-Aries] Add support for service=present-proof/send-proposal (#8901)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 489a66c2abe [Hyperledger-Aries] Add support for service=present-proof/send-proposal (#8901)
489a66c2abe is described below

commit 489a66c2abee7eb908f0cd7a8228bd41a275e576
Author: Thomas Diesler <td...@redhat.com>
AuthorDate: Wed Dec 14 14:58:51 2022 +0100

    [Hyperledger-Aries] Add support for service=present-proof/send-proposal (#8901)
---
 .../aries/handler/PresentProofServiceHandler.java       | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/handler/PresentProofServiceHandler.java b/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/handler/PresentProofServiceHandler.java
index fea58cfa884..10ef5bcbf8c 100644
--- a/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/handler/PresentProofServiceHandler.java
+++ b/components/camel-hyperledger-aries/src/main/java/org/apache/camel/component/aries/handler/PresentProofServiceHandler.java
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.aries.HyperledgerAriesEndpoint;
 import org.apache.camel.component.aries.UnsupportedServiceException;
+import org.hyperledger.aries.api.present_proof.PresentProofProposal;
 import org.hyperledger.aries.api.present_proof.PresentProofRequest;
 import org.hyperledger.aries.api.present_proof.PresentationExchangeRecord;
 import org.hyperledger.aries.api.present_proof.PresentationRequest;
@@ -40,7 +41,17 @@ public class PresentProofServiceHandler extends AbstractServiceHandler {
     @Override
     public void process(Exchange exchange, String service) throws Exception {
 
-        if (service.equals("/present-proof/send-request")) {
+        if (service.equals("/present-proof/create-request")) {
+            PresentProofRequest reqObj = assertBody(exchange, PresentProofRequest.class);
+            PresentationExchangeRecord resObj = createClient().presentProofCreateRequest(reqObj).get();
+            exchange.getIn().setBody(resObj);
+
+        } else if (service.equals("/present-proof/send-proposal")) {
+            PresentProofProposal reqObj = assertBody(exchange, PresentProofProposal.class);
+            PresentationExchangeRecord resObj = adminClient().presentProofSendProposal(reqObj).get();
+            exchange.getIn().setBody(resObj);
+
+        } else if (service.equals("/present-proof/send-request")) {
             PresentProofRequest reqObj = assertBody(exchange, PresentProofRequest.class);
             PresentationExchangeRecord resObj = createClient().presentProofSendRequest(reqObj).get();
             exchange.getIn().setBody(resObj);
@@ -81,10 +92,6 @@ public class PresentProofServiceHandler extends AbstractServiceHandler {
                 throw new UnsupportedServiceException(service);
             }
 
-        } else if (service.equals("/present-proof/create-request")) {
-            PresentProofRequest reqObj = assertBody(exchange, PresentProofRequest.class);
-            PresentationExchangeRecord resObj = createClient().presentProofCreateRequest(reqObj).get();
-            exchange.getIn().setBody(resObj);
         } else {
             throw new UnsupportedServiceException(service);
         }