aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-11-21 20:53:46 +0100
committerChristian Grothoff <christian@grothoff.org>2023-11-21 20:53:53 +0100
commitf1cc5beaf957ba7ae575ee4055700c699112c9e6 (patch)
tree2983462daef5b5ae8f81b3e396527058d7dd7b8e /src
parent923e2faef20ca34002170cf0f3b8e3890377c47e (diff)
-fix spa redirect for instances
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.c9
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c7
2 files changed, 16 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 9137c39b..64fa7005 100644
--- 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
index 5f06eee2..4d60fa2d 100644
--- 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,