merchant

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

commit 7cfebb6a165ac641d083e94b3077812f94078890
parent f92a67b1f2a9109b30ae26169496c8a99ef3be8e
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  7 Jan 2026 22:30:54 +0100

add report_generators field to /config

Diffstat:
Msrc/backend/taler-merchant-httpd_config.c | 42++++++++++++++++++++++++++++++++++++++++++
Msrc/backend/taler-merchant-httpd_private-post-reports.c | 21+++++++++++++++++++++
2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c @@ -77,6 +77,41 @@ add_exchange (void *cls, } +/** + * Function to iterate over configuration sections, looking for + * the report generators. + * + * @param cls closure with the `json *` array to build + * @param section name of the section + */ +static void +add_report_generator (void *cls, + const char *section) +{ + json_t *rgs = cls; + + if (0 != strncasecmp (section, + "report-generator-", + strlen ("report-generator-"))) + return; + if (GNUNET_YES != + GNUNET_CONFIGURATION_have_value (TMH_cfg, + section, + "BINARY")) + { + GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, + section, + "BINARY"); + return; + } + GNUNET_assert (0 == + json_array_append_new (rgs, + json_string (section + + strlen ( + "report-generator-")))); +} + + MHD_RESULT MH_handler_config (const struct TMH_RequestHandler *rh, struct MHD_Connection *connection, @@ -91,10 +126,15 @@ MH_handler_config (const struct TMH_RequestHandler *rh, json_t *specs = json_object (); json_t *exchanges = json_array (); json_t *mtc = json_array (); + json_t *rgs = json_array (); GNUNET_assert (NULL != specs); GNUNET_assert (NULL != exchanges); GNUNET_assert (NULL != mtc); + GNUNET_assert (NULL != rgs); + GNUNET_CONFIGURATION_iterate_sections (TMH_cfg, + &add_report_generator, + rgs); TMH_exchange_get_trusted (&add_exchange, exchanges); if (0 != (TEH_TCS_SMS & TEH_mandatory_tan_channels)) @@ -145,6 +185,8 @@ MH_handler_config (const struct TMH_RequestHandler *rh, #endif GNUNET_JSON_pack_object_steal ("currencies", specs), + GNUNET_JSON_pack_object_steal ("report_generators", + rgs), GNUNET_JSON_pack_array_steal ("exchanges", exchanges), GNUNET_JSON_pack_array_steal ("mandatory_tan_channels", diff --git a/src/backend/taler-merchant-httpd_private-post-reports.c b/src/backend/taler-merchant-httpd_private-post-reports.c @@ -76,7 +76,28 @@ TMH_private_post_reports (const struct TMH_RequestHandler *rh, : MHD_NO; } } + { + char *section; + /* Check program_section exists in config! */ + GNUNET_asprintf (&section, + "report-generator-%s", + program_section); + if (GNUNET_YES != + GNUNET_CONFIGURATION_have_value (TMH_cfg, + section, + "BINARY")) + { + GNUNET_free (section); + GNUNET_break (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_NOT_IMPLEMENTED, + TALER_EC_MERCHANT_GENERIC_REPORT_GENERATOR_UNCONFIGURED, + program_section); + } + GNUNET_free (section); + } qs = TMH_db->insert_report (TMH_db->cls, hc->instance->settings.id, program_section,