gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: require correct h_contract_terms


From: gnunet
Subject: [taler-merchant] branch master updated: require correct h_contract_terms in GET /orders/
Date: Sat, 22 Aug 2020 10:06:36 +0200

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

jonathan-buchanan pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 838e8bf  require correct h_contract_terms in GET /orders/
838e8bf is described below

commit 838e8bf4f11a6713c61a80addfc5517254f72759
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Sat Aug 22 04:06:25 2020 -0400

    require correct h_contract_terms in GET /orders/
---
 src/backend/taler-merchant-httpd_get-orders-ID.c | 92 ++++++++++++------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c 
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index aabdde7..638db2a 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -837,9 +837,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     contract_match = (0 ==
                       GNUNET_memcmp (&h,
                                      &god->h_contract_terms));
-    if ( (GNUNET_NO ==
-          GNUNET_is_zero (&god->h_contract_terms)) &&
-         (! contract_match) )
+    /* No matter what, the contract terms are required to match if the order
+       has been claimed. */
+    if (! contract_match)
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (connection,
@@ -849,8 +849,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     }
   }
 
-  if ( (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) ||
-       (! contract_match) )
+  if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
     struct TALER_ClaimTokenP db_claim_token;
 
@@ -922,47 +921,6 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                                        
TALER_EC_MERCHANT_GET_ORDER_INVALID_TOKEN,
                                        "Claim token invalid");
   }
-  if ( (! token_match) &&
-       (! contract_match) )
-  {
-    if (god->generate_html)
-    {
-      /* Contract was claimed (maybe by another device), so this client
-         cannot get the status information. Redirect to fulfillment page,
-         where the client may be able to pickup a fresh order -- or might
-         be able authenticate via session ID */
-      struct MHD_Response *reply;
-      MHD_RESULT ret;
-
-      reply = MHD_create_response_from_buffer (0,
-                                               NULL,
-                                               MHD_RESPMEM_PERSISTENT);
-      if (NULL == reply)
-      {
-        GNUNET_break (0);
-        return MHD_NO;
-      }
-      GNUNET_break (MHD_YES ==
-                    MHD_add_response_header (reply,
-                                             MHD_HTTP_HEADER_LOCATION,
-                                             god->fulfillment_url));
-      ret = MHD_queue_response (connection,
-                                MHD_HTTP_FOUND,
-                                reply);
-      MHD_destroy_response (reply);
-      return ret;
-    }
-    else
-    {
-      /* Need to generate JSON reply */
-      return TALER_MHD_reply_json_pack (
-        connection,
-        MHD_HTTP_ACCEPTED,
-        "{s:s}",
-        "fulfillment_url",
-        god->fulfillment_url);
-    }
-  }
 
   if (god->unclaimed)
   {
@@ -1038,6 +996,48 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
       return send_pay_request (god,
                                NULL);
     }
+    else if (GNUNET_NO == GNUNET_is_zero (&god->claim_token))
+    {
+      /* If the order has been paid but the request was made with a claim 
token,
+         redirect to the fulfillment url. */
+      if (god->generate_html)
+      {
+        /* Contract was claimed (maybe by another device), so this client
+           cannot get the status information. Redirect to fulfillment page,
+           where the client may be able to pickup a fresh order -- or might
+           be able authenticate via session ID */
+        struct MHD_Response *reply;
+        MHD_RESULT ret;
+
+        reply = MHD_create_response_from_buffer (0,
+                                                 NULL,
+                                                 MHD_RESPMEM_PERSISTENT);
+        if (NULL == reply)
+        {
+          GNUNET_break (0);
+          return MHD_NO;
+        }
+        GNUNET_break (MHD_YES ==
+                      MHD_add_response_header (reply,
+                                               MHD_HTTP_HEADER_LOCATION,
+                                               god->fulfillment_url));
+        ret = MHD_queue_response (connection,
+                                  MHD_HTTP_FOUND,
+                                  reply);
+        MHD_destroy_response (reply);
+        return ret;
+      }
+      else
+      {
+        /* Need to generate JSON reply */
+        return TALER_MHD_reply_json_pack (
+          connection,
+          MHD_HTTP_ACCEPTED,
+          "{s:s}",
+          "fulfillment_url",
+          god->fulfillment_url);
+      }
+    }
   }
 
   /* At this point, we know the contract was paid. Let's check for

-- 
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]