diff options
Diffstat (limited to 'src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c')
-rw-r--r-- | src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c | 82 |
1 files changed, 24 insertions, 58 deletions
diff --git a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c index 55773073f..2131ebc41 100644 --- a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-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,24 +36,25 @@ */ static enum GNUNET_GenericReturnValue process_reserve_in_inconsistency (void *cls, - uint64_t serial_id, - const struct - TALER_AUDITORDB_ReserveInInconsistency - *dc) + uint64_t serial_id, + const struct + TALER_AUDITORDB_ReserveInInconsistency + *dc) { json_t *list = cls; json_t *obj; obj = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_int64("row_id", serial_id), -TALER_JSON_pack_amount("amount_exchange_expected", &dc->amount_exchange_expected), -TALER_JSON_pack_amount("amount_wired", &dc->amount_wired), - GNUNET_JSON_pack_data_auto("reserve_pub", &dc->reserve_pub), -GNUNET_JSON_pack_int64("timestamp", dc->timestamp), -GNUNET_JSON_pack_string("account", dc->account), -GNUNET_JSON_pack_string("diagnostic", dc->diagnostic), -GNUNET_JSON_pack_bool("suppressed", dc->suppressed) + GNUNET_JSON_pack_int64 ("row_id", serial_id), + TALER_JSON_pack_amount ("amount_exchange_expected", + &dc->amount_exchange_expected), + TALER_JSON_pack_amount ("amount_wired", &dc->amount_wired), + GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub), + GNUNET_JSON_pack_int64 ("timestamp", dc->timestamp), + GNUNET_JSON_pack_string ("account", dc->account), + GNUNET_JSON_pack_string ("diagnostic", dc->diagnostic), + GNUNET_JSON_pack_bool ("suppressed", dc->suppressed) ); @@ -81,12 +78,12 @@ GNUNET_JSON_pack_bool("suppressed", dc->suppressed) */ MHD_RESULT TAH_RESERVE_IN_INCONSISTENCY_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; @@ -124,40 +121,12 @@ TAH_RESERVE_IN_INCONSISTENCY_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_reserve_in_inconsistency ( @@ -185,6 +154,3 @@ TAH_RESERVE_IN_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, GNUNET_JSON_pack_array_steal ("reserve-in-inconsistency", ja)); } - - -
\ No newline at end of file |