gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated (870ca3f -> 141807f)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated (870ca3f -> 141807f)
Date: Tue, 20 Jun 2017 11:49:41 +0200

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

marcello pushed a change to branch master
in repository merchant.

    from 870ca3f  get /refund increase requested from the tests
     new f48df59  Return a signed confirmation of the refund
     new 141807f  fix non returning testcase

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/taler-merchant-httpd_refund.c | 45 ++++++++++++++++++++++++++++++-
 src/lib/test_merchant_api.c               |  9 ++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

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));
 }
 
 
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index b45799b..b7383b2 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -1582,7 +1582,6 @@ cleanup_state (struct InterpreterState *is)
       }
       break;
     case OC_HISTORY:
-
       if (NULL != cmd->details.history.ho)
       {
         TALER_MERCHANT_history_cancel (cmd->details.history.ho);
@@ -1590,6 +1589,14 @@ cleanup_state (struct InterpreterState *is)
       }
       break;
 
+    case OC_REFUND_INCREASE:
+      if (NULL != cmd->details.refund_increase.rio)
+      {
+        TALER_MERCHANT_refund_increase_cancel 
(cmd->details.refund_increase.rio);
+        cmd->details.refund_increase.rio = NULL;
+      }
+      break;
+
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Shutdown: unknown instruction %d at %u (%s)\n",

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



reply via email to

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