gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: -work on #6975, still does not p


From: gnunet
Subject: [taler-merchant] branch master updated: -work on #6975, still does not pass
Date: Wed, 04 Aug 2021 17:15:18 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 977c3d47 -work on #6975, still does not pass
977c3d47 is described below

commit 977c3d47538d071e2b37599bb71c0fae3ad36d44
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Aug 4 17:15:09 2021 +0200

    -work on #6975, still does not pass
---
 src/backend/taler-merchant-httpd_get-orders-ID.c | 43 ++++++++++++------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c 
b/src/backend/taler-merchant-httpd_get-orders-ID.c
index ffe7657a..c679211f 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -125,11 +125,11 @@ struct GetOrderData
   bool suspended;
 
   /**
-   * Set to true if we are dealing with an unclaimed order
-   * (and thus @e h_contract_terms is not set, and certain
+   * Set to true if we are dealing with a claimed order
+   * (and thus @e h_contract_terms is set, otherwise certain
    * DB queries will not work).
    */
-  bool unclaimed;
+  bool claimed;
 
   /**
    * Set to true if this payment has been refunded and
@@ -748,11 +748,9 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                                            "token");
       }
     }
-
     god->session_id = MHD_lookup_connection_value (connection,
                                                    MHD_GET_ARGUMENT_KIND,
                                                    "session_id");
-
     {
       const char *long_poll_timeout_ms;
 
@@ -847,7 +845,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
          serialization problems */
       GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
       /* Always report on hard error as well to enable diagnostics */
-      GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+      GNUNET_break (0);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_INTERNAL_SERVER_ERROR,
                                          TALER_EC_GENERIC_DB_FETCH_FAILED,
@@ -887,7 +885,11 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     }
   }
 
-  if (! contract_match)
+  if (contract_match)
+  {
+    god->claimed = true;
+  }
+  else
   {
     struct TALER_ClaimTokenP db_claim_token;
     struct GNUNET_HashCode unused;
@@ -906,16 +908,14 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
          serialization problems */
       GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
       /* Always report on hard error as well to enable diagnostics */
-      GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+      GNUNET_break (0);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_INTERNAL_SERVER_ERROR,
                                          TALER_EC_GENERIC_DB_FETCH_FAILED,
                                          "lookup_order");
     }
-    god->unclaimed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) &&
-                     ! contract_available;
     if ( (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) &&
-         (NULL == god->contract_terms) )
+         (! contract_available) )
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                   "Unknown order id given: `%s'\n",
@@ -925,8 +925,11 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                                          
TALER_EC_MERCHANT_GENERIC_ORDER_UNKNOWN,
                                          order_id);
     }
-    token_match = (0 == GNUNET_memcmp (&db_claim_token,
-                                       &god->claim_token));
+    god->claimed = ( (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) ||
+                     (contract_available) );
+    token_match = ( (0 == GNUNET_memcmp (&db_claim_token,
+                                         &god->claim_token)) &&
+                    (! god->claimed) );
   }   /* end unclaimed order logic */
 
   GNUNET_assert (NULL != god->contract_terms);
@@ -946,11 +949,12 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
                                                 god->contract_terms,
                                                 "fulfillment_url"));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Token match: %d, contract match: %d, unclaimed: %d\n",
+              "Token match: %d, contract_available: %d, contract match: %d, 
claimed: %d\n",
               token_match,
+              contract_available,
               contract_match,
-              god->unclaimed);
-  if ( (god->unclaimed) &&
+              god->claimed);
+  if ( (! god->claimed) &&
        (! token_match) )
   {
     /* Token wrong, and required because contract is unclaimed */
@@ -972,8 +976,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
     if (NULL == public_reorder_url)
     {
       /* We cannot give the client a new order, just fail */
-      if (GNUNET_NO ==
-          GNUNET_is_zero (&god->h_contract_terms))
+      if (! GNUNET_is_zero (&god->h_contract_terms))
       {
         GNUNET_break_op (0);
         return TALER_MHD_reply_with_error (
@@ -982,7 +985,6 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
           TALER_EC_MERCHANT_GENERIC_CONTRACT_HASH_DOES_NOT_MATCH_ORDER,
           NULL);
       }
-      GNUNET_break_op (0);
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_FORBIDDEN,
                                          
TALER_EC_MERCHANT_GET_ORDERS_ID_INVALID_TOKEN,
@@ -1027,8 +1029,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
       GNUNET_JSON_pack_string ("public_reorder_url",
                                public_reorder_url));
   }
-
-  if (god->unclaimed)
+  if (! god->claimed)
   {
     /* Order is unclaimed, no need to check for payments or even
        refunds, simply always generate payment request */

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