merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 7c5bd36d8ca811bf6fc104229cde3cbd30d69b6d
parent 4f1d294fa7fc8a291a94bbbdb0a32e283bbc8726
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Thu, 29 Jan 2026 18:08:31 +0900

rename for consistency

Diffstat:
Msrc/backend/Makefile.am | 4++--
Msrc/backend/taler-merchant-httpd.c | 2+-
Msrc/backend/taler-merchant-httpd_dispatcher.c | 2+-
Asrc/backend/taler-merchant-httpd_get-webui.c | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/backend/taler-merchant-httpd_get-webui.h | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/backend/taler-merchant-httpd_spa.c | 87-------------------------------------------------------------------------------
Dsrc/backend/taler-merchant-httpd_spa.h | 52----------------------------------------------------
7 files changed, 143 insertions(+), 143 deletions(-)

diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am @@ -249,8 +249,8 @@ taler_merchant_httpd_SOURCES = \ taler-merchant-httpd_private-get-statistics-report-transactions.h \ taler-merchant-httpd_qr.c \ taler-merchant-httpd_qr.h \ - taler-merchant-httpd_spa.c \ - taler-merchant-httpd_spa.h \ + taler-merchant-httpd_get-webui.c \ + taler-merchant-httpd_get-webui.h \ taler-merchant-httpd_private-delete-report-ID.c \ taler-merchant-httpd_private-delete-report-ID.h \ taler-merchant-httpd_private-get-report-ID.c \ diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c @@ -40,7 +40,7 @@ #include "taler-merchant-httpd_get-orders-ID.h" #include "taler-merchant-httpd_get-sessions-ID.h" #include "taler-merchant-httpd_exchanges.h" -#include "taler-merchant-httpd_spa.h" +#include "taler-merchant-httpd_get-webui.h" #include "taler-merchant-httpd_get-terms.h" #include "taler-merchant-httpd_private-get-instances-ID-kyc.h" #include "taler-merchant-httpd_private-get-statistics-report-transactions.h" diff --git a/src/backend/taler-merchant-httpd_dispatcher.c b/src/backend/taler-merchant-httpd_dispatcher.c @@ -100,7 +100,7 @@ #include "taler-merchant-httpd_post-orders-ID-pay.h" #include "taler-merchant-httpd_post-templates-ID.h" #include "taler-merchant-httpd_post-orders-ID-refund.h" -#include "taler-merchant-httpd_spa.h" +#include "taler-merchant-httpd_get-webui.h" #include "taler-merchant-httpd_statics.h" #include "taler-merchant-httpd_get-terms.h" #include "taler-merchant-httpd_post-reports-ID.h" diff --git a/src/backend/taler-merchant-httpd_get-webui.c b/src/backend/taler-merchant-httpd_get-webui.c @@ -0,0 +1,87 @@ +/* + This file is part of TALER + Copyright (C) 2020, 2023, 2025 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 + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-merchant-httpd_spa.c + * @brief logic to load the single page app (/) + * @author Christian Grothoff + */ +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <taler/taler_util.h> +#include <taler/taler_mhd_lib.h> +#include "taler_merchant_util.h" +#include "taler-merchant-httpd_statics.h" +#include "taler-merchant-httpd_get-webui.h" +#include <gnunet/gnunet_mhd_compat.h> + + +/** + * Resources of the Merchant SPA. + */ +static struct TALER_MHD_Spa *spa; + + +MHD_RESULT +TMH_return_spa (const struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + struct TMH_HandlerContext *hc) +{ + const char *infix = hc->infix; + + if ( (NULL == infix) || + (0 == strcmp (infix, + "")) ) + infix = "index.html"; + return TALER_MHD_spa_handler (spa, + connection, + infix); +} + + +enum GNUNET_GenericReturnValue +TMH_spa_init (const char *spa_dir) +{ + if (NULL == spa_dir) + spa = TALER_MHD_spa_load (TALER_MERCHANT_project_data (), + "spa/"); + else + spa = TALER_MHD_spa_load_dir (spa_dir); + + if (NULL == spa) + { + GNUNET_break (0); + return GNUNET_SYSERR; + } + return GNUNET_OK; +} + + +/** + * Nicely shut down. + */ +void __attribute__ ((destructor)) +get_spa_fini (void); + +/* Declaration to avoid compiler warning */ +void __attribute__ ((destructor)) +get_spa_fini () +{ + if (NULL != spa) + { + TALER_MHD_spa_free (spa); + spa = NULL; + } +} diff --git a/src/backend/taler-merchant-httpd_get-webui.h b/src/backend/taler-merchant-httpd_get-webui.h @@ -0,0 +1,52 @@ +/* + This file is part of TALER + Copyright (C) 2021 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 + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +*/ +/** + * @file taler-merchant-httpd_spa.h + * @brief logic to preload and serve static files + * @author Christian Grothoff + */ +#ifndef TALER_MERCHANT_HTTPD_GET_WEBUI_H +#define TALER_MERCHANT_HTTPD_GET_WEBUI_H + +#include <microhttpd.h> +#include "taler-merchant-httpd.h" + + +/** + * Return our single-page-app user interface (see contrib/spa/). + * + * @param rh request handler + * @param connection the connection we act upon + * @param hc handler context + * @return #MHD_YES on success (reply queued), #MHD_NO on error (close connection) + */ +MHD_RESULT +TMH_return_spa (const struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + struct TMH_HandlerContext *hc); + + +/** + * Preload and compress SPA files. + * + * @param spa_dir override SPA dir + * @return #GNUNET_OK on success + */ +enum GNUNET_GenericReturnValue +TMH_spa_init (const char *spa_dir); + + +#endif diff --git a/src/backend/taler-merchant-httpd_spa.c b/src/backend/taler-merchant-httpd_spa.c @@ -1,87 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2020, 2023, 2025 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 - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -*/ -/** - * @file taler-merchant-httpd_spa.c - * @brief logic to load the single page app (/) - * @author Christian Grothoff - */ -#include "platform.h" -#include <gnunet/gnunet_util_lib.h> -#include <taler/taler_util.h> -#include <taler/taler_mhd_lib.h> -#include "taler_merchant_util.h" -#include "taler-merchant-httpd_statics.h" -#include "taler-merchant-httpd_spa.h" -#include <gnunet/gnunet_mhd_compat.h> - - -/** - * Resources of the Merchant SPA. - */ -static struct TALER_MHD_Spa *spa; - - -MHD_RESULT -TMH_return_spa (const struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - struct TMH_HandlerContext *hc) -{ - const char *infix = hc->infix; - - if ( (NULL == infix) || - (0 == strcmp (infix, - "")) ) - infix = "index.html"; - return TALER_MHD_spa_handler (spa, - connection, - infix); -} - - -enum GNUNET_GenericReturnValue -TMH_spa_init (const char *spa_dir) -{ - if (NULL == spa_dir) - spa = TALER_MHD_spa_load (TALER_MERCHANT_project_data (), - "spa/"); - else - spa = TALER_MHD_spa_load_dir (spa_dir); - - if (NULL == spa) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } - return GNUNET_OK; -} - - -/** - * Nicely shut down. - */ -void __attribute__ ((destructor)) -get_spa_fini (void); - -/* Declaration to avoid compiler warning */ -void __attribute__ ((destructor)) -get_spa_fini () -{ - if (NULL != spa) - { - TALER_MHD_spa_free (spa); - spa = NULL; - } -} diff --git a/src/backend/taler-merchant-httpd_spa.h b/src/backend/taler-merchant-httpd_spa.h @@ -1,52 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2021 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 - Foundation; either version 3, or (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> -*/ -/** - * @file taler-merchant-httpd_spa.h - * @brief logic to preload and serve static files - * @author Christian Grothoff - */ -#ifndef TALER_MERCHANT_HTTPD_SPA_H -#define TALER_MERCHANT_HTTPD_SPA_H - -#include <microhttpd.h> -#include "taler-merchant-httpd.h" - - -/** - * Return our single-page-app user interface (see contrib/spa/). - * - * @param rh request handler - * @param connection the connection we act upon - * @param hc handler context - * @return #MHD_YES on success (reply queued), #MHD_NO on error (close connection) - */ -MHD_RESULT -TMH_return_spa (const struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - struct TMH_HandlerContext *hc); - - -/** - * Preload and compress SPA files. - * - * @param spa_dir override SPA dir - * @return #GNUNET_OK on success - */ -enum GNUNET_GenericReturnValue -TMH_spa_init (const char *spa_dir); - - -#endif