summaryrefslogtreecommitdiff
path: root/src/auditor/taler-auditor-httpd_purses-get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditor/taler-auditor-httpd_purses-get.c')
-rw-r--r--src/auditor/taler-auditor-httpd_purses-get.c77
1 files changed, 21 insertions, 56 deletions
diff --git a/src/auditor/taler-auditor-httpd_purses-get.c b/src/auditor/taler-auditor-httpd_purses-get.c
index 20d97ac83..81b5e16a7 100644
--- a/src/auditor/taler-auditor-httpd_purses-get.c
+++ b/src/auditor/taler-auditor-httpd_purses-get.c
@@ -1,6 +1,3 @@
-
-
-
/*
This file is part of TALER
Copyright (C) 2024 Taler Systems SA
@@ -18,7 +15,6 @@
*/
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -40,22 +36,22 @@
*/
static enum GNUNET_GenericReturnValue
process_purses (void *cls,
- uint64_t serial_id,
- const struct
- TALER_AUDITORDB_Purses
- *dc)
+ uint64_t serial_id,
+ const struct
+ TALER_AUDITORDB_Purses
+ *dc)
{
json_t *list = cls;
json_t *obj;
obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64("auditor_purses_rowid", dc->auditor_purses_rowid),
-GNUNET_JSON_pack_data_auto("purse_pub", &dc->purse_pub),
-TALER_JSON_pack_amount("balance", &dc->balance),
-TALER_JSON_pack_amount("target", &dc->target),
-GNUNET_JSON_pack_int64("expiration_date", dc->expiration_date),
-GNUNET_JSON_pack_bool("suppressed", dc->suppressed)
+ GNUNET_JSON_pack_int64 ("auditor_purses_rowid", dc->auditor_purses_rowid),
+ GNUNET_JSON_pack_data_auto ("purse_pub", &dc->purse_pub),
+ TALER_JSON_pack_amount ("balance", &dc->balance),
+ TALER_JSON_pack_amount ("target", &dc->target),
+ GNUNET_JSON_pack_int64 ("expiration_date", dc->expiration_date),
+ GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
);
@@ -79,12 +75,12 @@ GNUNET_JSON_pack_bool("suppressed", dc->suppressed)
*/
MHD_RESULT
TAH_PURSES_handler_get (struct TAH_RequestHandler *rh,
- struct MHD_Connection *
- connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size,
- const char *const args[])
+ struct MHD_Connection *
+ connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size,
+ const char *const args[])
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
@@ -122,40 +118,12 @@ TAH_PURSES_handler_get (struct TAH_RequestHandler *rh,
&offset);
bool return_suppressed = false;
-
- struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_bool ("return_suppressed", &return_suppressed),
- GNUNET_JSON_spec_end ()
- };
-
- // read the input json
- json_t *json_in;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- enum GNUNET_GenericReturnValue res;
-
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json_in);
- if (GNUNET_SYSERR == res)
- return MHD_NO;
- if ((GNUNET_NO == res) ||
- (NULL == json_in))
- return MHD_YES;
- res = TALER_MHD_parse_json_data (connection,
- json_in,
- spec);
- if (GNUNET_SYSERR == res)
- {
- json_decref (json_in);
- return MHD_NO; /* hard failure */
- }
- if (GNUNET_NO == res)
- {
- json_decref (json_in);
- return MHD_YES; /* failure */
- }
+ return_suppressed = true;
}
qs = TAH_plugin->get_purses (
@@ -183,6 +151,3 @@ TAH_PURSES_handler_get (struct TAH_RequestHandler *rh,
GNUNET_JSON_pack_array_steal ("purses",
ja));
}
-
-
- \ No newline at end of file