summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2024-02-10 13:15:09 +0100
committerChristian Grothoff <grothoff@gnunet.org>2024-02-10 13:16:05 +0100
commita63ae8bba773b5e2371ee82c23ba1172d9465bfe (patch)
tree0516e1494fa5a0d7aeb3bcdfa5e9f57b992f2691 /src/backend
parent935f9b571d2b47f10a552980feecee76ebcc3593 (diff)
downloadmerchant-a63ae8bba773b5e2371ee82c23ba1172d9465bfe.tar.gz
merchant-a63ae8bba773b5e2371ee82c23ba1172d9465bfe.tar.bz2
merchant-a63ae8bba773b5e2371ee82c23ba1172d9465bfe.zip
try to fix #8353
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_config.c4
-rw-r--r--src/backend/taler-merchant-httpd_get-orders-ID.c17
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c18
3 files changed, 36 insertions, 3 deletions
diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c
index 784bdcf9..7a9d2324 100644
--- a/src/backend/taler-merchant-httpd_config.c
+++ b/src/backend/taler-merchant-httpd_config.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2019, 2020, 2021, 2023 Taler Systems SA
+ (C) 2019, 2020, 2021, 2023, 2024 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -42,7 +42,7 @@
* #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
* merchant_api_config.c!
*/
-#define MERCHANT_PROTOCOL_VERSION "8:2:0"
+#define MERCHANT_PROTOCOL_VERSION "9:0:5"
/**
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c
index 02f2997f..13ff3fc9 100644
--- a/src/backend/taler-merchant-httpd_get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_get-orders-ID.c
@@ -162,6 +162,12 @@ struct GetOrderData
enum GNUNET_GenericReturnValue suspended;
/**
+ * Set to YES if refunded orders should be included when
+ * doing repurchase detection.
+ */
+ enum TALER_EXCHANGE_YesNoAll allow_refunded_for_repurchase;
+
+ /**
* Set to true if the client passed 'h_contract'.
*/
bool h_contract_provided;
@@ -795,6 +801,7 @@ god_cleanup (void *cls)
}
+// FIXME: this function should probably be refactored...
MHD_RESULT
TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
struct MHD_Connection *connection,
@@ -827,6 +834,14 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
"token",
&god->claim_token,
god->claim_token_provided);
+ if (! (TALER_arg_to_yna (connection,
+ "allow_refunded_for_repurchase",
+ TALER_EXCHANGE_YNA_NO,
+ &god->allow_refunded_for_repurchase)) )
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "allow_refunded_for_repurchase");
god->session_id = MHD_lookup_connection_value (connection,
MHD_GET_ARGUMENT_KIND,
"session_id");
@@ -1227,6 +1242,8 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh,
hc->instance->settings.id,
god->fulfillment_url,
god->session_id,
+ TALER_EXCHANGE_YNA_NO !=
+ god->allow_refunded_for_repurchase,
&already_paid_order_id);
if (qs < 0)
{
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 b5810174..1c850990 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2017-2023 Taler Systems SA
+ (C) 2017-2024 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -335,6 +335,12 @@ struct GetOrderRequestContext
enum TALER_ErrorCode wire_ec;
/**
+ * Set to YES if refunded orders should be included when
+ * doing repurchase detection.
+ */
+ enum TALER_EXCHANGE_YesNoAll allow_refunded_for_repurchase;
+
+ /**
* HTTP status to return with @e wire_ec, 0 if @e wire_ec is #TALER_EC_NONE.
*/
unsigned int wire_hc;
@@ -813,6 +819,8 @@ phase_check_repurchase (struct GetOrderRequestContext *gorc)
hc->instance->settings.id,
gorc->fulfillment_url,
gorc->session_id,
+ TALER_EXCHANGE_YNA_NO !=
+ gorc->allow_refunded_for_repurchase,
&already_paid_order_id);
if (0 > qs)
{
@@ -1457,6 +1465,14 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
gorc->session_id = MHD_lookup_connection_value (connection,
MHD_GET_ARGUMENT_KIND,
"session_id");
+ if (! (TALER_arg_to_yna (connection,
+ "allow_refunded_for_repurchase",
+ TALER_EXCHANGE_YNA_NO,
+ &gorc->allow_refunded_for_repurchase)) )
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "allow_refunded_for_repurchase");
TALER_MHD_parse_request_timeout (connection,
&gorc->sc.long_poll_timeout);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,