gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] 01/02: Return a signed confirmation of the


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 01/02: Return a signed confirmation of the refund
Date: Tue, 20 Jun 2017 11:49:42 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository merchant.

commit f48df598cf421374130beecaa0485c2ff2a2d70e
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jun 20 11:41:30 2017 +0200

    Return a signed confirmation of the refund
---
 src/backend/taler-merchant-httpd_refund.c | 45 ++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/src/backend/taler-merchant-httpd_refund.c 
b/src/backend/taler-merchant-httpd_refund.c
index 2149df1..f8f40af 100644
--- a/src/backend/taler-merchant-httpd_refund.c
+++ b/src/backend/taler-merchant-httpd_refund.c
@@ -26,6 +26,28 @@
 #include "taler-merchant-httpd_parsing.h"
 #include "taler-merchant-httpd_responses.h"
 
+#define REFUND_CONFIRMATION 0
+
+/**
+ * We confirm with a signature that the refund has been successfully
+ * done. Even though the frontend doesn't usually do crypto, this signature
+ * may turn useful in court.
+ */
+struct RefundConfirmationP
+{
+  
+  /**
+   * Purpose is simply set to zero, see macro REFUND_CONFIRMATION above
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Hashing the order id, as frontends don't handle contract terms
+   */
+  struct GNUNET_HashCode h_order_id GNUNET_PACKED;
+
+};
+
 struct ProcessRefundData
 {
   /**
@@ -116,6 +138,8 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
   const char *merchant;
   struct MerchantInstance *mi;
   struct GNUNET_HashCode h_contract_terms;
+  struct RefundConfirmationP confirmation;
+  struct GNUNET_CRYPTO_EddsaSignature sig;
 
   struct GNUNET_JSON_Specification spec[] = {
     TALER_JSON_spec_amount ("refund", &refund),
@@ -239,7 +263,26 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
   json_decref (contract_terms);
   json_decref (root);
   GNUNET_JSON_parse_free (spec);
-  return MHD_YES;
+
+  confirmation.purpose.purpose = REFUND_CONFIRMATION;
+  confirmation.purpose.size = htonl (sizeof (struct RefundConfirmationP));
+
+  if (GNUNET_OK != GNUNET_CRYPTO_eddsa_sign (&mi->privkey.eddsa_priv,
+                                             &confirmation.purpose,
+                                             &sig))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Failed to sign successful refund confirmation\n");
+    return TMH_RESPONSE_reply_internal_error (connection,
+                                              TALER_EC_NONE,
+                                              "Refund done, but failed to sign 
confirmation");
+  
+  }
+
+  return TMH_RESPONSE_reply_json_pack (connection, 
+                                       MHD_HTTP_OK,
+                                       "{s:s}",
+                                       "sig", GNUNET_JSON_from_data_auto 
(&sig));
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]