commit f1cc5beaf957ba7ae575ee4055700c699112c9e6
parent 923e2faef20ca34002170cf0f3b8e3890377c47e
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 21 Nov 2023 20:53:46 +0100
-fix spa redirect for instances
Diffstat:
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -602,6 +602,7 @@ spa_redirect (const struct TMH_RequestHandler *rh,
{
const char *text = "Redirecting to /webui/";
struct MHD_Response *response;
+ char *dst;
response = MHD_create_response_from_buffer (strlen (text),
(void *) text,
@@ -616,6 +617,12 @@ spa_redirect (const struct TMH_RequestHandler *rh,
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"text/plain"));
+ if (NULL == hc->instance)
+ dst = GNUNET_strdup ("/webui/");
+ else
+ GNUNET_asprintf (&dst,
+ "/instances/%s/webui/",
+ hc->instance->settings.id);
if (MHD_NO ==
MHD_add_response_header (response,
MHD_HTTP_HEADER_LOCATION,
@@ -623,8 +630,10 @@ spa_redirect (const struct TMH_RequestHandler *rh,
{
GNUNET_break (0);
MHD_destroy_response (response);
+ GNUNET_free (dst);
return MHD_NO;
}
+ GNUNET_free (dst);
{
MHD_RESULT ret;
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -892,6 +892,13 @@ update_stefan (struct OrderContext *oc,
TALER_EXCHANGE_keys_stefan_round (keys,
&net);
+ if (-1 == TALER_amount_cmp (&oc->brutto,
+ &net))
+ {
+ /* brutto < netto! */
+ /* => after rounding, there is no real difference */
+ net = oc->brutto;
+ }
GNUNET_assert (0 <=
TALER_amount_subtract (&fee,
&oc->brutto,