[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: do not run dead logic if we are
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: do not run dead logic if we are only dealing with an order and not a contract |
Date: |
Fri, 17 Jul 2020 01:24:28 +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 b9c6823 do not run dead logic if we are only dealing with an order
and not a contract
b9c6823 is described below
commit b9c68238079015dee68ca1df4c23773e9670190f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jul 17 01:24:24 2020 +0200
do not run dead logic if we are only dealing with an order and not a
contract
---
.../taler-merchant-httpd_private-get-orders-ID.c | 59 +++++++++++++---------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index de5cb98..850b72c 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -752,6 +752,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
enum GNUNET_DB_QueryStatus qs;
bool paid;
bool wired;
+ bool order_only = false;
if (NULL == gorc)
{
@@ -832,6 +833,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler
*rh,
hc->instance->settings.id,
hc->infix,
&gorc->contract_terms);
+ order_only = true;
}
if (0 > qs)
{
@@ -887,15 +889,18 @@ TMH_private_get_orders_ID (const struct
TMH_RequestHandler *rh,
"Merchant database error (contract terms in wrong currency)");
}
}
- if (GNUNET_OK !=
- TALER_JSON_contract_hash (gorc->contract_terms,
- &gorc->h_contract_terms))
+ if (! order_only)
{
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
-
TALER_EC_GET_ORDERS_FAILED_COMPUTE_PROPOSAL_HASH,
- "Failed to hash contract terms");
+ if (GNUNET_OK !=
+ TALER_JSON_contract_hash (gorc->contract_terms,
+ &gorc->h_contract_terms))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+
TALER_EC_GET_ORDERS_FAILED_COMPUTE_PROPOSAL_HASH,
+ "Failed to hash contract terms");
+ }
}
}
if (TALER_EC_NONE != gorc->wire_ec)
@@ -909,22 +914,29 @@ TMH_private_get_orders_ID (const struct
TMH_RequestHandler *rh,
GNUNET_assert (NULL != gorc->contract_terms);
TMH_db->preflight (TMH_db->cls);
- qs = TMH_db->lookup_payment_status (TMH_db->cls,
- gorc->order_serial,
- gorc->session_id,
- &paid,
- &wired);
- if (0 > qs)
+ if (order_only)
{
- /* single, read-only SQL statements should never cause
- serialization problems, and the entry should exist as per above */
- GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
-
TALER_EC_GET_ORDERS_DB_FETCH_PAYMENT_STATUS,
- "DB error fetching payment status");
+ paid = false;
+ wired = false;
+ }
+ else
+ {
+ qs = TMH_db->lookup_payment_status (TMH_db->cls,
+ gorc->order_serial,
+ gorc->session_id,
+ &paid,
+ &wired);
+ if (0 > qs)
+ {
+ /* single, read-only SQL statements should never cause
+ serialization problems, and the entry should exist as per above */
+ GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+
TALER_EC_GET_ORDERS_DB_FETCH_PAYMENT_STATUS,
+ "DB error fetching payment status");
+ }
}
- /* qs == 0: the order hasn't been claimed, but this is okay. */
if ((! paid) &&
(NULL != gorc->session_id))
{
@@ -1037,7 +1049,8 @@ TMH_private_get_orders_ID (const struct
TMH_RequestHandler *rh,
}
/* Here we know the user DID pay, compute refunds... */
-
+ GNUNET_assert (! order_only);
+ GNUNET_assert (paid);
/* Accumulate refunds, if any. */
{
GNUNET_assert (GNUNET_OK ==
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: do not run dead logic if we are only dealing with an order and not a contract,
gnunet <=