commit 5c984c6c64a88a9859235c6bda45ec9ca09b7070
parent 312fb5d44da21ce1dd2d14ea7f383a6638fda6b5
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 23 Sep 2025 11:36:08 +0200
use charity_id instead of charity-id in POST /charity API, see #10441
Diffstat:
4 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/donau/donau-httpd_charity_insert.c b/src/donau/donau-httpd_charity_insert.c
@@ -157,7 +157,7 @@ DH_handler_charity_post (struct DH_RequestContext *rc,
return TALER_MHD_REPLY_JSON_PACK (
rc->connection,
MHD_HTTP_CREATED,
- GNUNET_JSON_pack_uint64 ("charity-id",
+ GNUNET_JSON_pack_uint64 ("charity_id",
icc.charity_id));
}
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
@@ -1048,19 +1048,19 @@ DONAU_charities_get_cancel (
/* ********************* GET /charities/$CHARITY_ID *********************** */
/**
- * information of a charity
+ * Information about a charity
*/
struct DONAU_Charity
{
/**
* name of the charity
*/
- char *name;
+ const char *name;
/**
* charity url
*/
- char *charity_url;
+ const char *charity_url;
/**
* public key of the charity
diff --git a/src/lib/donau_api_charity_get.c b/src/lib/donau_api_charity_get.c
@@ -76,18 +76,17 @@ handle_charity_get_ok (const json_t *resp_obj,
struct DONAU_GetCharityResponse *gcresp)
{
struct DONAU_Charity *charity = &gcresp->details.ok.charity;
- const char *name;
- const char *url;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("charity_pub",
&charity->charity_pub),
- GNUNET_JSON_spec_string ("name", &name),
- GNUNET_JSON_spec_string ("url", &url),
+ GNUNET_JSON_spec_string ("name",
+ &charity->name),
+ GNUNET_JSON_spec_string ("url",
+ &charity->charity_url),
TALER_JSON_spec_amount_any ("max_per_year",
&charity->max_per_year),
TALER_JSON_spec_amount_any ("receipts_to_date",
- &charity->
- receipts_to_date),
+ &charity->receipts_to_date),
GNUNET_JSON_spec_uint64 ("current_year",
&charity->current_year),
GNUNET_JSON_spec_end ()
@@ -102,8 +101,6 @@ handle_charity_get_ok (const json_t *resp_obj,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- charity->name = GNUNET_strdup (name);
- charity->charity_url = GNUNET_strdup (url);
cgh->cb (cgh->cb_cls,
gcresp);
cgh->cb = NULL;
@@ -124,8 +121,6 @@ handle_charity_get_finished (void *cls,
long response_code,
const void *resp_obj)
{
- // struct DONAU_Charity *cd = NULL;
-
struct DONAU_CharityGetHandle *cgh = cls;
const json_t *j = resp_obj;
struct DONAU_GetCharityResponse gcresp = {
diff --git a/src/lib/donau_api_charity_post.c b/src/lib/donau_api_charity_post.c
@@ -94,7 +94,7 @@ handle_charity_post_finished (void *cls,
case MHD_HTTP_CREATED:
{
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_uint64 ("charity-id",
+ GNUNET_JSON_spec_uint64 ("charity_id",
&pcresp.details.ok.charity_id),
GNUNET_JSON_spec_end ()
};