summaryrefslogtreecommitdiff
path: root/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c
diff options
context:
space:
mode:
authorCedric Zwahlen <cedric.zwahlen@students.bfh.ch>2024-04-16 18:54:24 +0200
committerCedric Zwahlen <cedric.zwahlen@students.bfh.ch>2024-04-19 20:47:34 +0200
commitba725b627efe5d5a6b4131898c7ee643fce85380 (patch)
tree01aad63c0e7a12f37e026fc64d1fc8f839fda5ce /src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c
parent962bcbc6a6bd10f3bbe80766278c36b02f53c7e4 (diff)
downloadexchange-ba725b627efe5d5a6b4131898c7ee643fce85380.tar.gz
exchange-ba725b627efe5d5a6b4131898c7ee643fce85380.tar.bz2
exchange-ba725b627efe5d5a6b4131898c7ee643fce85380.zip
Fix various CRUD bugs
Diffstat (limited to 'src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c')
-rw-r--r--src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c77
1 files changed, 21 insertions, 56 deletions
diff --git a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c
index e2c9a00a5..693f1323f 100644
--- a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-get.c
+++ b/src/auditor/taler-auditor-httpd_reserve-not-closed-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,22 +36,22 @@
*/
static enum GNUNET_GenericReturnValue
process_reserve_not_closed_inconsistency (void *cls,
- uint64_t serial_id,
- const struct
- TALER_AUDITORDB_ReserveNotClosedInconsistency
- *dc)
+ uint64_t serial_id,
+ const struct
+ TALER_AUDITORDB_ReserveNotClosedInconsistency
+ *dc)
{
json_t *list = cls;
json_t *obj;
obj = GNUNET_JSON_PACK (
- GNUNET_JSON_pack_int64("row_id", serial_id),
-GNUNET_JSON_pack_data_auto("reserve_pub", &dc->reserve_pub),
-TALER_JSON_pack_amount("balance", &dc->balance),
-GNUNET_JSON_pack_int64("expiration_time", dc->expiration_time),
-GNUNET_JSON_pack_data_auto("diagnostic", &dc->diagnostic),
-GNUNET_JSON_pack_bool("suppressed", dc->suppressed)
+ GNUNET_JSON_pack_int64 ("row_id", serial_id),
+ GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub),
+ TALER_JSON_pack_amount ("balance", &dc->balance),
+ GNUNET_JSON_pack_int64 ("expiration_time", dc->expiration_time),
+ GNUNET_JSON_pack_data_auto ("diagnostic", &dc->diagnostic),
+ GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
);
@@ -79,12 +75,12 @@ GNUNET_JSON_pack_bool("suppressed", dc->suppressed)
*/
MHD_RESULT
TAH_RESERVE_NOT_CLOSED_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;
@@ -122,40 +118,12 @@ TAH_RESERVE_NOT_CLOSED_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_not_closed_inconsistency (
@@ -183,6 +151,3 @@ TAH_RESERVE_NOT_CLOSED_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh,
GNUNET_JSON_pack_array_steal ("reserve-not-closed-inconsistency",
ja));
}
-
-
- \ No newline at end of file