gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated (0d05df5 -> 1ac2e62)


From: gnunet
Subject: [taler-merchant] branch master updated (0d05df5 -> 1ac2e62)
Date: Sat, 22 Aug 2020 19:29:16 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from 0d05df5  add h_contract to refund response
     new 9cfa86f  revert patch 838e8bf4f11a6713c61a80addfc5517254f72759
     new 1ac2e62  correct fix for #6498 (hopefully)

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_get-orders-ID.c | 104 ++++++++++++-----------
 1 file changed, 53 insertions(+), 51 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c 
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index c289ea2..794dbc5 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -834,9 +834,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     contract_match = (0 ==
                       GNUNET_memcmp (&h,
                                      &god->h_contract_terms));
-    /* No matter what, the contract terms are required to match if the order
-       has been claimed. */
-    if (! contract_match)
+    if ( (GNUNET_NO ==
+          GNUNET_is_zero (&god->h_contract_terms)) &&
+         (! contract_match) )
     {
       GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (connection,
@@ -846,7 +846,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     }
   }
 
-  if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+  if ( (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) ||
+       (! contract_match) )
   {
     struct TALER_ClaimTokenP db_claim_token;
 
@@ -882,9 +883,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                                          TALER_EC_GET_ORDERS_ID_UNKNOWN,
                                          "order_id not found in database");
     }
-
-    token_match = (0 == GNUNET_memcmp (&db_claim_token,
-                                       &god->claim_token));
+    if (god->unclaimed)
+      token_match = (0 == GNUNET_memcmp (&db_claim_token,
+                                         &god->claim_token));
   }   /* end unclaimed order logic */
 
   if (NULL == god->fulfillment_url)
@@ -918,6 +919,47 @@ 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)
   {
@@ -993,54 +1035,13 @@ 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
      refunds. First, clear away refunds found from previous invocations. */
-  GNUNET_assert (GNUNET_OK == TALER_amount_get_zero (TMH_currency,
-                                                     &god->refund_amount));
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_get_zero (TMH_currency,
+                                        &god->refund_amount));
   qs = TMH_db->lookup_refunds_detailed (TMH_db->cls,
                                         hc->instance->settings.id,
                                         &god->h_contract_terms,
@@ -1131,6 +1132,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
       else
       {
         json_t *context;
+
         context = json_pack ("{s:O, s:s, s:s}",
                              "contract_terms",
                              god->contract_terms,

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