gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (13e7110 -> 0d05df5)


From: gnunet
Subject: [taler-merchant] branch master updated (13e7110 -> 0d05df5)
Date: Sat, 22 Aug 2020 19:22:07 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from 13e7110  log where parsing failed
     new 97b02a2  pass h_contract separate from URI, that is cleaner
     new ca0fc7c  remove unnecessary h_contract support, fix free() of 
uninitialized variable
     new 0d05df5  add h_contract to refund response

The 3 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:
 ...aler-merchant-httpd_private-post-orders-ID-refund.c | 18 ++++++------------
 src/include/taler_merchant_service.h                   |  7 +++++--
 src/lib/merchant_api_common.c                          | 11 ++++++-----
 src/lib/merchant_api_post_order_refund.c               | 10 +++++++++-
 src/testing/testing_api_cmd_refund_order.c             |  6 +++++-
 5 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c 
b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
index b5ef07b..d308bf4 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c
@@ -40,14 +40,12 @@
  * @param connection MHD connection to take host and path from
  * @param instance_id merchant's instance ID, must not be NULL
  * @param order_id order ID to show a refund for, must not be NULL
- * @param h_contract hash of the contract to pass for authorization
  * @returns the URI, must be freed with #GNUNET_free
  */
 static char *
 make_taler_refund_uri (struct MHD_Connection *connection,
                        const char *instance_id,
-                       const char *order_id,
-                       const struct GNUNET_HashCode *h_contract)
+                       const char *order_id)
 {
   const char *host;
   const char *forwarded_host;
@@ -89,11 +87,6 @@ make_taler_refund_uri (struct MHD_Connection *connection,
   GNUNET_buffer_write_path (&buf, order_id);
   GNUNET_buffer_write_path (&buf,
                             ""); // Trailing slash
-  GNUNET_buffer_write_str (&buf,
-                           "?h_contract=");
-  GNUNET_buffer_write_data_encoded (&buf,
-                                    &h_contract,
-                                    sizeof (*h_contract));
   return GNUNET_buffer_reap_str (&buf);
 }
 
@@ -294,13 +287,14 @@ TMH_private_post_orders_ID_refund (const struct 
TMH_RequestHandler *rh,
 
     taler_refund_uri = make_taler_refund_uri (connection,
                                               hc->instance->settings.id,
-                                              hc->infix,
-                                              &h_contract);
+                                              hc->infix);
     ret = TALER_MHD_reply_json_pack (connection,
                                      MHD_HTTP_OK,
-                                     "{s:s}",
+                                     "{s:s, s:o}",
                                      "taler_refund_uri",
-                                     taler_refund_uri);
+                                     taler_refund_uri,
+                                     "h_contract",
+                                     GNUNET_JSON_from_data_auto (&h_contract));
     GNUNET_free (taler_refund_uri);
     return ret;
   }
diff --git a/src/include/taler_merchant_service.h 
b/src/include/taler_merchant_service.h
index 16a01b9..f59cfec 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -229,7 +229,7 @@ struct TALER_MERCHANT_RefundUriData
  *
  * @param refund_uri the URI to parse.
  * @param[out] parse_data data extracted from the URI. Must be free'd.
- * @return GNUNET_SYSERR if @e refund_uri is malformed, GNUNET_OK otherwise.
+ * @return #GNUNET_SYSERR if @e refund_uri is malformed, #GNUNET_OK otherwise.
  */
 int
 TALER_MERCHANT_parse_refund_uri (
@@ -2353,12 +2353,15 @@ struct TALER_MERCHANT_OrderRefundHandle;
  * @param http_status HTTP status code for this request
  * @param ec taler-specific error code
  * @param taler_refund_uri the refund uri offered to the wallet
+ * @param h_contract hash of the contract a Browser may need to authorize
+ *        obtaining the HTTP response.
  */
 typedef void
 (*TALER_MERCHANT_RefundCallback) (
   void *cls,
   const struct TALER_MERCHANT_HttpResponse *hr,
-  const char *taler_refund_uri);
+  const char *taler_refund_uri,
+  const struct GNUNET_HashCode *h_contract);
 
 
 /**
diff --git a/src/lib/merchant_api_common.c b/src/lib/merchant_api_common.c
index 55d4209..faa7a14 100644
--- a/src/lib/merchant_api_common.c
+++ b/src/lib/merchant_api_common.c
@@ -159,7 +159,7 @@ TALER_MERCHANT_baseurl_add_instance (const char *base_url,
  * @param uri the uri to parse.
  * @param[out] action the action the URI is indicating.
  * @param[out] rest the substring of the URI following the action.
- * @return GNUNET_SYSERR if the URI is malformed, GNUNET_OK otherwise.
+ * @return #GNUNET_SYSERR if the URI is malformed, #GNUNET_OK otherwise.
  */
 static int
 parse_taler_uri_scheme_action (const char *uri,
@@ -170,6 +170,7 @@ parse_taler_uri_scheme_action (const char *uri,
   /* Check that the uri starts with "taler://pay" or "taler+http://pay"; and
      then remove it */
   char *path = strchr (scheme, ':');
+
   if ((NULL == path) ||
       (strlen (path) < 3))
   {
@@ -221,9 +222,9 @@ int
 TALER_MERCHANT_parse_pay_uri (const char *pay_uri,
                               struct TALER_MERCHANT_PayUriData *parse_data)
 {
-  char *path;
+  char *path = NULL;
   {
-    char *action;
+    char *action = NULL;
 
     if ((GNUNET_OK !=
          parse_taler_uri_scheme_action (pay_uri,
@@ -368,9 +369,9 @@ TALER_MERCHANT_parse_refund_uri (
   const char *refund_uri,
   struct TALER_MERCHANT_RefundUriData *parse_data)
 {
-  char *path;
+  char *path = NULL;
   {
-    char *action;
+    char *action = NULL;
 
     if ((GNUNET_OK !=
          parse_taler_uri_scheme_action (refund_uri,
diff --git a/src/lib/merchant_api_post_order_refund.c 
b/src/lib/merchant_api_post_order_refund.c
index 834aea5..0810199 100644
--- a/src/lib/merchant_api_post_order_refund.c
+++ b/src/lib/merchant_api_post_order_refund.c
@@ -95,14 +95,18 @@ handle_refund_finished (void *cls,
     hr.ec = TALER_EC_INVALID_RESPONSE;
     orh->cb (orh->cb_cls,
              &hr,
+             NULL,
              NULL);
     break;
   case MHD_HTTP_OK:
     {
       const char *taler_refund_uri;
+      struct GNUNET_HashCode h_contract;
       struct GNUNET_JSON_Specification spec[] = {
         GNUNET_JSON_spec_string ("taler_refund_uri",
                                  &taler_refund_uri),
+        GNUNET_JSON_spec_fixed_auto ("h_contract",
+                                     &h_contract),
         GNUNET_JSON_spec_end ()
       };
 
@@ -116,12 +120,14 @@ handle_refund_finished (void *cls,
         hr.ec = TALER_EC_INVALID_RESPONSE;
         orh->cb (orh->cb_cls,
                  &hr,
+                 NULL,
                  NULL);
         break;
       }
       orh->cb (orh->cb_cls,
                &hr,
-               taler_refund_uri);
+               taler_refund_uri,
+               &h_contract);
       GNUNET_JSON_parse_free (spec);
     }
     break;
@@ -131,6 +137,7 @@ handle_refund_finished (void *cls,
     hr.hint = TALER_JSON_get_error_hint (json);
     orh->cb (orh->cb_cls,
              &hr,
+             NULL,
              NULL);
     break;
   default:
@@ -140,6 +147,7 @@ handle_refund_finished (void *cls,
                                          &hr);
     orh->cb (orh->cb_cls,
              &hr,
+             NULL,
              NULL);
     break;
   }
diff --git a/src/testing/testing_api_cmd_refund_order.c 
b/src/testing/testing_api_cmd_refund_order.c
index bf8474d..a22535e 100644
--- a/src/testing/testing_api_cmd_refund_order.c
+++ b/src/testing/testing_api_cmd_refund_order.c
@@ -78,14 +78,18 @@ struct RefundState
  * @param cls closure
  * @param hr HTTP response
  * @param taler_refund_uri the refund uri offered to the wallet
+ * @param h_contract hash of the contract a Browser may need to authorize
+ *        obtaining the HTTP response.
  */
 static void
 refund_cb (void *cls,
            const struct TALER_MERCHANT_HttpResponse *hr,
-           const char *taler_refund_uri)
+           const char *taler_refund_uri,
+           const struct GNUNET_HashCode *h_contract)
 {
   struct RefundState *ris = cls;
 
+  (void) h_contract;
   ris->orh = NULL;
   if (ris->http_code != hr->http_status)
   {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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