[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix #9425
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix #9425 |
Date: |
Sun, 29 Dec 2024 16:54:44 +0100 |
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 01a34b17 fix #9425
01a34b17 is described below
commit 01a34b17bf37e4c4bbe59e47cbc480f31e85ffb0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Dec 29 16:54:35 2024 +0100
fix #9425
---
src/backend/taler-merchant-httpd_config.c | 2 +-
src/backend/taler-merchant-httpd_mhd.c | 9 ++++--
.../taler-merchant-httpd_post-orders-ID-abort.c | 7 +----
.../taler-merchant-httpd_post-orders-ID-refund.c | 35 ++++++++++++----------
src/include/taler_merchant_service.h | 1 +
src/lib/merchant_api_post_order_abort.c | 4 ++-
6 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_config.c
b/src/backend/taler-merchant-httpd_config.c
index cc70f9f9..16239e5e 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -43,7 +43,7 @@
* #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
* merchant_api_config.c!
*/
-#define MERCHANT_PROTOCOL_VERSION "17:0:13"
+#define MERCHANT_PROTOCOL_VERSION "18:0:14"
/**
diff --git a/src/backend/taler-merchant-httpd_mhd.c
b/src/backend/taler-merchant-httpd_mhd.c
index 7eaa84ba..f8a55d00 100644
--- a/src/backend/taler-merchant-httpd_mhd.c
+++ b/src/backend/taler-merchant-httpd_mhd.c
@@ -57,14 +57,19 @@ bool
TMH_MHD_test_html_desired (struct MHD_Connection *connection)
{
const char *accept;
+ double json_q;
+ double html_q;
accept = MHD_lookup_connection_value (connection,
MHD_HEADER_KIND,
MHD_HTTP_HEADER_ACCEPT);
if (NULL == accept)
return false; /* nothing selected, we read this as not HTML */
- if (0.0 < TALER_pattern_matches (accept,
- "text/html"))
+ html_q = TALER_pattern_matches (accept,
+ "text/html");
+ json_q = TALER_pattern_matches (accept,
+ "application/json");
+ if (html_q > json_q)
return true;
return false;
}
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
index 8d848b62..8d7cc363 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
@@ -633,7 +633,6 @@ refund_coins (void *cls,
struct AbortContext *ac = cls;
struct GNUNET_TIME_Timestamp now;
- (void) amount_with_fee;
(void) deposit_fee;
(void) refund_fee;
now = GNUNET_TIME_timestamp_get ();
@@ -649,7 +648,7 @@ refund_coins (void *cls,
strcmp (exchange_url,
rdi->exchange_url)) )
continue; /* not in request */
-
+ rdi->amount_with_fee = *amount_with_fee;
/* Store refund in DB */
qs = TMH_db->refund_coin (TMH_db->cls,
ac->hc->instance->settings.id,
@@ -884,10 +883,6 @@ parse_abort (struct MHD_Connection *connection,
struct RefundDetails *rd = &ac->rd[coins_index];
const char *exchange_url;
struct GNUNET_JSON_Specification ispec[] = {
- /* FIXME-#9425: this is breaking multi-currency support! */
- TALER_JSON_spec_amount ("contribution",
- TMH_currency,
- &rd->amount_with_fee),
TALER_JSON_spec_web_url ("exchange_url",
&exchange_url),
GNUNET_JSON_spec_fixed_auto ("coin_pub",
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
index 57e3ebe5..96552669 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -666,23 +666,26 @@ TMH_post_orders_ID_refund (const struct
TMH_RequestHandler *rh,
NULL);
}
+ qs = TMH_db->lookup_refunds_detailed (TMH_db->cls,
+ hc->instance->settings.id,
+ &prd->h_contract_terms,
+ &process_refunds_cb,
+ prd);
+ if (0 > qs)
{
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (TMH_currency,
- &prd->refund_amount));
- qs = TMH_db->lookup_refunds_detailed (TMH_db->cls,
- hc->instance->settings.id,
- &prd->h_contract_terms,
- &process_refunds_cb,
- prd);
- if (0 > qs)
- {
- GNUNET_break (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "detailed refunds");
- }
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "detailed refunds");
+ }
+ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "no coins found that could be
refunded");
}
/* Now launch exchange interactions, unless we already have the
diff --git a/src/include/taler_merchant_service.h
b/src/include/taler_merchant_service.h
index b4f351e7..01d8d707 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -3759,6 +3759,7 @@ struct TALER_MERCHANT_AbortCoin
/**
* Amount this coin contributes to (including fee).
+ * FIXME: no longer needed since **v18**. Remove eventually!
*/
struct TALER_Amount amount_with_fee;
diff --git a/src/lib/merchant_api_post_order_abort.c
b/src/lib/merchant_api_post_order_abort.c
index 270ceb7e..9d32ca02 100644
--- a/src/lib/merchant_api_post_order_abort.c
+++ b/src/lib/merchant_api_post_order_abort.c
@@ -341,6 +341,7 @@ TALER_MERCHANT_order_abort (
j_coin = GNUNET_JSON_PACK (
GNUNET_JSON_pack_data_auto ("coin_pub",
&ac->coin_pub),
+ /* FIXME: no longer needed since **v18**, remove eventually! */
TALER_JSON_pack_amount ("contribution",
&ac->amount_with_fee),
GNUNET_JSON_pack_string ("exchange_url",
@@ -417,7 +418,8 @@ TALER_MERCHANT_order_abort (
void
-TALER_MERCHANT_order_abort_cancel (struct TALER_MERCHANT_OrderAbortHandle *oah)
+TALER_MERCHANT_order_abort_cancel (
+ struct TALER_MERCHANT_OrderAbortHandle *oah)
{
if (NULL != oah->job)
{
--
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: fix #9425,
gnunet <=