diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-03-09 21:03:39 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-03-09 21:03:39 +0100 |
commit | 89c8198bbfcba44a37cb124f80a7deb1d98474c1 (patch) | |
tree | 03759bb551edbb33d99709df5d07e400ee373eb0 /src/backend | |
parent | 72062fbe3ecc401fe74613d88b44f1bbb005f69e (diff) |
implement #8608
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/Makefile.am | 2 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 12 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_config.c | 2 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-templates-ID.c | 35 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-templates-ID.h | 7 |
5 files changed, 30 insertions, 28 deletions
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am index 9ece7912..d521608d 100644 --- a/src/backend/Makefile.am +++ b/src/backend/Makefile.am @@ -28,6 +28,8 @@ taler_merchant_httpd_SOURCES = \ taler-merchant-httpd_exchanges.c taler-merchant-httpd_exchanges.h \ taler-merchant-httpd_get-orders-ID.c \ taler-merchant-httpd_get-orders-ID.h \ + taler-merchant-httpd_get-templates-ID.c \ + taler-merchant-httpd_get-templates-ID.h \ taler-merchant-httpd_helper.c \ taler-merchant-httpd_helper.h \ taler-merchant-httpd_mhd.c \ diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index 8220f84d..7384bfc9 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -31,6 +31,7 @@ #include "taler-merchant-httpd_config.h" #include "taler-merchant-httpd_exchanges.h" #include "taler-merchant-httpd_get-orders-ID.h" +#include "taler-merchant-httpd_get-templates-ID.h" #include "taler-merchant-httpd_mhd.h" #include "taler-merchant-httpd_private-delete-account-ID.h" #include "taler-merchant-httpd_private-delete-instances-ID.h" @@ -1268,7 +1269,6 @@ url_handler (void *cls, .url_prefix = "/tokenfamilies/", .method = MHD_HTTP_METHOD_GET, .have_id_segment = true, - .allow_deleted_instance = true, .handler = &TMH_private_get_tokenfamilies_SLUG }, /* DELETE /tokenfamilies/$SLUG/: */ @@ -1276,7 +1276,6 @@ url_handler (void *cls, .url_prefix = "/tokenfamilies/", .method = MHD_HTTP_METHOD_DELETE, .have_id_segment = true, - .allow_deleted_instance = true, .handler = &TMH_private_delete_token_families_SLUG }, /* PATCH /tokenfamilies/$SLUG/: */ @@ -1284,7 +1283,6 @@ url_handler (void *cls, .url_prefix = "/tokenfamilies/", .method = MHD_HTTP_METHOD_PATCH, .have_id_segment = true, - .allow_deleted_instance = true, .handler = &TMH_private_patch_token_family_SLUG, }, { @@ -1414,12 +1412,18 @@ url_handler (void *cls, .have_id_segment = true, .handler = &TMH_return_static }, + /* GET /templates/$ID/: */ + { + .url_prefix = "/templates/", + .method = MHD_HTTP_METHOD_GET, + .have_id_segment = true, + .handler = &TMH_get_templates_ID + }, /* POST /templates/$ID: */ { .url_prefix = "/templates/", .method = MHD_HTTP_METHOD_POST, .have_id_segment = true, - .allow_deleted_instance = true, .handler = &TMH_post_using_templates_ID, .max_upload = 1024 * 1024 }, diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c index 074c2a7e..d020985b 100644 --- a/src/backend/taler-merchant-httpd_config.c +++ b/src/backend/taler-merchant-httpd_config.c @@ -42,7 +42,7 @@ * #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in * merchant_api_config.c! */ -#define MERCHANT_PROTOCOL_VERSION "10:0:6" +#define MERCHANT_PROTOCOL_VERSION "11:0:7" /** diff --git a/src/backend/taler-merchant-httpd_private-get-templates-ID.c b/src/backend/taler-merchant-httpd_private-get-templates-ID.c index e9dfc00f..a5b05f0c 100644 --- a/src/backend/taler-merchant-httpd_private-get-templates-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-templates-ID.c @@ -23,18 +23,11 @@ #include <taler/taler_json_lib.h> -/** - * Handle a GET "/templates/$ID" request. - * - * @param rh context of the handler - * @param connection the MHD connection to handle - * @param[in,out] hc context with further information about the request - * @return MHD result code - */ MHD_RESULT -TMH_private_get_templates_ID (const struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - struct TMH_HandlerContext *hc) +TMH_private_get_templates_ID ( + const struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + struct TMH_HandlerContext *hc) { struct TMH_MerchantInstance *mi = hc->instance; struct TALER_MERCHANTDB_TemplateDetails tp = { 0 }; @@ -48,17 +41,19 @@ TMH_private_get_templates_ID (const struct TMH_RequestHandler *rh, if (0 > qs) { GNUNET_break (0); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_INTERNAL_SERVER_ERROR, - TALER_EC_GENERIC_DB_FETCH_FAILED, - "lookup_template"); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "lookup_template"); } - if (0 == qs) + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_TEMPLATE_UNKNOWN, - hc->infix); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_MERCHANT_GENERIC_TEMPLATE_UNKNOWN, + hc->infix); } { MHD_RESULT ret; diff --git a/src/backend/taler-merchant-httpd_private-get-templates-ID.h b/src/backend/taler-merchant-httpd_private-get-templates-ID.h index 384ab818..fcdd6a2e 100644 --- a/src/backend/taler-merchant-httpd_private-get-templates-ID.h +++ b/src/backend/taler-merchant-httpd_private-get-templates-ID.h @@ -33,9 +33,10 @@ * @return MHD result code */ MHD_RESULT -TMH_private_get_templates_ID (const struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - struct TMH_HandlerContext *hc); +TMH_private_get_templates_ID ( + const struct TMH_RequestHandler *rh, + struct MHD_Connection *connection, + struct TMH_HandlerContext *hc); /* end of taler-merchant-httpd_private-get-templates-ID.h */ #endif |