commit d6a79317b64a03844cc4d27d52016b589a6743d1
parent ad2210f7eb4fa392c2140962fd1ff493034cae56
Author: Bohdan Potuzhnyi <potub1@bfh.ch>
Date: Tue, 8 Oct 2024 15:50:23 +0000
few updates
Diffstat:
5 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
@@ -226,7 +226,9 @@ taler_merchant_httpd_LDADD += \
taler_merchant_httpd_SOURCES += \
taler-merchant-httpd_private-get-donau-instances.c \
- taler-merchant-httpd_private-get-donau-instances.h
+ taler-merchant-httpd_private-get-donau-instances.h \
+ taler-merchant-httpd_private-post-donau-instance.c \
+ taler-merchant-httpd_private-post-donau-instance.h
endif
taler_merchant_httpd_CFLAGS = \
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
@@ -99,7 +99,8 @@
#ifdef HAVE_DONAU_DONAU_SERVICE_H
#include "taler-merchant-httpd_private-get-donau-instances.h"
-//#include "taler-merchant-httpd_private-post-donau-instance.h"
+#include "taler-merchant-httpd_private-post-donau-instance.h"
+//#include "taler-merchant-httpd_private-delete-donau-instance.h"
#endif
/**
@@ -1349,11 +1350,17 @@ url_handler (void *cls,
.handler = &TMH_private_get_donau_instances
},
/* POST /donau */
-// {
-// .url_prefix = "/donau",
-// .method = MHD_HTTP_METHOD_POST,
-// .handler = &TMH_private_post_donau_instance
-// }
+ {
+ .url_prefix = "/donau",
+ .method = MHD_HTTP_METHOD_POST,
+ .handler = &TMH_private_post_donau_instance
+ },
+ /* DELETE /donau/$charity-id */
+ /* {
+ .url_prefix = "/donau/",
+ .method = MHD_HTTP_METHOD_DELETE,
+ .handler = &TMH_private_delete_donau_instance
+ } */
#endif
{
.url_prefix = NULL
diff --git a/src/backend/taler-merchant-httpd_private-get-donau-instances.c b/src/backend/taler-merchant-httpd_private-get-donau-instances.c
@@ -42,7 +42,7 @@ add_donau_instance_to_json (json_t *json_instances, const struct TALER_MERCHANTD
instance = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("donau_url", di->donau_url),
GNUNET_JSON_pack_string ("charity_name", di->charity_name),
- GNUNET_JSON_pack_data_auto("charity_pub_key", &di->charity_pub_key->eddsa_pub.q_y),
+ GNUNET_JSON_pack_data_auto("charity_pub_key", &di->charity_pub_key),
GNUNET_JSON_pack_uint64 ("charity_id", di->charity_id),
TALER_JSON_pack_amount ("charity_max_per_year", &di->charity_max_per_year),
TALER_JSON_pack_amount ("charity_receipts_to_date", &di->charity_receipts_to_date),
diff --git a/src/backenddb/pg_insert_donau_instance.c b/src/backenddb/pg_insert_donau_instance.c
@@ -38,7 +38,7 @@ TMH_PG_insert_donau_instance (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (donau_url),
GNUNET_PQ_query_param_string (charity->name),
- GNUNET_PQ_query_param_auto_from_type (charity->charity_pub.eddsa_pub.q_y),
+ GNUNET_PQ_query_param_auto_from_type (&charity->charity_pub),
GNUNET_PQ_query_param_uint64 (&charity_id),
TALER_PQ_query_param_amount_with_currency (pg->conn,
&charity->max_per_year),
diff --git a/src/backenddb/pg_select_donau_instance.c b/src/backenddb/pg_select_donau_instance.c
@@ -36,14 +36,22 @@ TMH_PG_select_donau_instance (void *cls,
};
struct GNUNET_PQ_ResultSpec rs[] = {
- GNUNET_PQ_result_spec_string ("donau_url", &di->donau_url),
- GNUNET_PQ_result_spec_string ("charity_name", &di->charity_name),
- GNUNET_PQ_result_spec_auto_from_type ("charity_pub_key", &di->charity_pub_key->eddsa_pub.q_y),
- GNUNET_PQ_result_spec_uint64 ("charity_id", &di->charity_id),
- TALER_PQ_result_spec_amount_with_currency ("charity_max_per_year", &di->charity_max_per_year),
- TALER_PQ_result_spec_amount_with_currency ("charity_receipts_to_date", &di->charity_receipts_to_date),
- GNUNET_PQ_result_spec_int64 ("current_year", &di->current_year),
- TALER_PQ_result_spec_json ("keys_json", &di->donau_keys_json),
+ GNUNET_PQ_result_spec_string ("donau_url",
+ &di->donau_url),
+ GNUNET_PQ_result_spec_string ("charity_name",
+ &di->charity_name),
+ GNUNET_PQ_result_spec_auto_from_type ("charity_pub_key",
+ &di->charity_pub_key),
+ GNUNET_PQ_result_spec_uint64 ("charity_id",
+ &di->charity_id),
+ TALER_PQ_result_spec_amount_with_currency ("charity_max_per_year",
+ &di->charity_max_per_year),
+ TALER_PQ_result_spec_amount_with_currency ("charity_receipts_to_date",
+ &di->charity_receipts_to_date),
+ GNUNET_PQ_result_spec_int64 ("current_year",
+ &di->current_year),
+ TALER_PQ_result_spec_json ("keys_json",
+ &di->donau_keys_json),
GNUNET_PQ_result_spec_end
};