[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 01/02: revert patch 838e8bf4f11a6713c61a80addfc5517254f
From: |
gnunet |
Subject: |
[taler-merchant] 01/02: revert patch 838e8bf4f11a6713c61a80addfc5517254f72759 |
Date: |
Sat, 22 Aug 2020 19:29:17 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 9cfa86ff0c6382d3ed9bbfe990bb7ad1ae865473
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Aug 22 19:28:33 2020 +0200
revert patch 838e8bf4f11a6713c61a80addfc5517254f72759
---
src/backend/taler-merchant-httpd_get-orders-ID.c | 99 ++++++++++++------------
1 file changed, 50 insertions(+), 49 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..2af92e8 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,7 +883,6 @@ 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));
} /* end unclaimed order logic */
@@ -918,6 +918,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 +1034,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 +1131,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.