From 634fc3090574ca303d0fe30ad3189c889782d2cb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 3 May 2023 15:46:00 +0200 Subject: expand merchant order logic to return exchanges trusted by the merchant and indicate priority based on exchange /wire respons availability and restrictions --- ...-merchant-httpd_private-post-orders-ID-refund.c | 39 +++++----------------- 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c') diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c index 3953fa06..5b5f6b05 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c +++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-refund.c @@ -26,6 +26,7 @@ #include #include "taler-merchant-httpd_private-post-orders-ID-refund.h" #include "taler-merchant-httpd_private-get-orders.h" +#include "taler-merchant-httpd_helper.h" /** @@ -82,43 +83,21 @@ make_taler_refund_uri (struct MHD_Connection *connection, const char *instance_id, const char *order_id) { - const char *host; - const char *forwarded_host; - const char *uri_path; - struct GNUNET_Buffer buf = { 0 }; + struct GNUNET_Buffer buf; GNUNET_assert (NULL != instance_id); GNUNET_assert (NULL != order_id); - host = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - "Host"); - forwarded_host = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - "X-Forwarded-Host"); - uri_path = MHD_lookup_connection_value (connection, - MHD_HEADER_KIND, - "X-Forwarded-Prefix"); - if (NULL != forwarded_host) - host = forwarded_host; - if (NULL == host) + if (GNUNET_OK != + TMH_taler_uri_by_connection (connection, + "refund", + instance_id, + &buf)) { - /* Should never happen, at least the host header should be defined */ GNUNET_break (0); return NULL; } - GNUNET_buffer_write_str (&buf, "taler"); - if (GNUNET_NO == TALER_mhd_is_https (connection)) - GNUNET_buffer_write_str (&buf, "+http"); - GNUNET_buffer_write_str (&buf, "://refund/"); - GNUNET_buffer_write_str (&buf, host); - if (NULL != uri_path) - GNUNET_buffer_write_path (&buf, uri_path); - if (0 != strcmp ("default", instance_id)) - { - GNUNET_buffer_write_path (&buf, "instances"); - GNUNET_buffer_write_path (&buf, instance_id); - } - GNUNET_buffer_write_path (&buf, order_id); + GNUNET_buffer_write_path (&buf, + order_id); GNUNET_buffer_write_path (&buf, ""); /* Trailing slash */ return GNUNET_buffer_reap_str (&buf); -- cgit v1.2.3