diff options
author | Cedric Zwahlen <cedric.zwahlen@students.bfh.ch> | 2024-04-28 14:54:48 +0200 |
---|---|---|
committer | Cedric Zwahlen <cedric.zwahlen@students.bfh.ch> | 2024-04-28 14:54:48 +0200 |
commit | 028e8d833015855870d006462f9a812f78beaafc (patch) | |
tree | 393049a9a15db60b795ce5383cdc8a2b11cf2642 | |
parent | 1b8f043e8e311a32c17b0739680d4bda648c4ff2 (diff) | |
download | exchange-dev/nic/real-time-auditor-zwah.tar.gz exchange-dev/nic/real-time-auditor-zwah.tar.bz2 exchange-dev/nic/real-time-auditor-zwah.zip |
Fix bugs and add missing CRUDdev/nic/real-time-auditor-zwah
140 files changed, 3155 insertions, 401 deletions
diff --git a/src/auditor/Makefile.am b/src/auditor/Makefile.am index 2b9f459ed..32cf9f6a6 100644 --- a/src/auditor/Makefile.am +++ b/src/auditor/Makefile.am @@ -268,6 +268,14 @@ taler-auditor-httpd_row-minor-inconsistencies-del.c taler-auditor-httpd_row-mino taler-auditor-httpd_row-minor-inconsistencies-put.c taler-auditor-httpd_row-minor-inconsistencies-put.h \ taler-auditor-httpd_row-minor-inconsistencies-get.c taler-auditor-httpd_row-minor-inconsistencies-get.h \ taler-auditor-httpd_row-minor-inconsistencies-upd.c taler-auditor-httpd_row-minor-inconsistencies-upd.h \ +taler-auditor-httpd_fee-time-inconsistency-del.c taler-auditor-httpd_fee-time-inconsistency-del.h \ +taler-auditor-httpd_fee-time-inconsistency-put.c taler-auditor-httpd_fee-time-inconsistency-put.h \ +taler-auditor-httpd_fee-time-inconsistency-get.c taler-auditor-httpd_fee-time-inconsistency-get.h \ +taler-auditor-httpd_fee-time-inconsistency-upd.c taler-auditor-httpd_fee-time-inconsistency-upd.h \ +taler-auditor-httpd_balances-del.c taler-auditor-httpd_balances-del.h \ +taler-auditor-httpd_balances-put.c taler-auditor-httpd_balances-put.h \ +taler-auditor-httpd_balances-get.c taler-auditor-httpd_balances-get.h \ +taler-auditor-httpd_balances-upd.c taler-auditor-httpd_balances-upd.h \ taler-auditor-httpd_mhd.c taler-auditor-httpd_mhd.h taler_auditor_httpd_LDADD = \ $(LIBGCRYPT_LIBS) \ diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c index c79e4551d..c7697cafd 100644 --- a/src/auditor/taler-auditor-httpd.c +++ b/src/auditor/taler-auditor-httpd.c @@ -182,6 +182,16 @@ #include "taler-auditor-httpd_row-minor-inconsistencies-get.h" #include "taler-auditor-httpd_row-minor-inconsistencies-upd.h" +#include "taler-auditor-httpd_fee-time-inconsistency-del.h" +#include "taler-auditor-httpd_fee-time-inconsistency-put.h" +#include "taler-auditor-httpd_fee-time-inconsistency-get.h" +#include "taler-auditor-httpd_fee-time-inconsistency-upd.h" + +#include "taler-auditor-httpd_balances-del.h" +#include "taler-auditor-httpd_balances-put.h" +#include "taler-auditor-httpd_balances-get.h" +#include "taler-auditor-httpd_balances-upd.h" + /** * Auditor protocol version string. * @@ -965,6 +975,48 @@ handle_mhd_request (void *cls, &TAH_ROW_MINOR_INCONSISTENCIES_handler_update, MHD_HTTP_OK, false }, + { "/fee-time-inconsistency", MHD_HTTP_METHOD_GET, + "application/json", + NULL, 0, + &TAH_FEE_TIME_INCONSISTENCY_handler_get, + MHD_HTTP_OK, false }, + { "/fee-time-inconsistency", MHD_HTTP_METHOD_PUT, + "application/json", + NULL, 0, + &TAH_FEE_TIME_INCONSISTENCY_handler_put, + MHD_HTTP_OK, false }, + { "/fee-time-inconsistency", MHD_HTTP_METHOD_DELETE, + "application/json", + NULL, 0, + &TAH_FEE_TIME_INCONSISTENCY_handler_delete, + MHD_HTTP_OK, false }, + { "/fee-time-inconsistency", MHD_HTTP_METHOD_PATCH, + "application/json", + NULL, 0, + &TAH_FEE_TIME_INCONSISTENCY_handler_update, + MHD_HTTP_OK, false }, + + { "/balances", MHD_HTTP_METHOD_GET, + "application/json", + NULL, 0, + &TAH_BALANCES_handler_get, + MHD_HTTP_OK }, + { "/balances", MHD_HTTP_METHOD_PUT, + "application/json", + NULL, 0, + &TAH_BALANCES_handler_put, + MHD_HTTP_OK }, + { "/balances", MHD_HTTP_METHOD_DELETE, + "application/json", + NULL, 0, + &TAH_BALANCES_handler_delete, + MHD_HTTP_OK }, + { "/balances", MHD_HTTP_METHOD_PATCH, + "application/json", + NULL, 0, + &TAH_BALANCES_handler_update, + MHD_HTTP_OK }, + { "/config", MHD_HTTP_METHOD_GET, "application/json", NULL, 0, &handle_config, MHD_HTTP_OK, true }, @@ -1069,13 +1121,7 @@ handle_mhd_request (void *cls, "'" RFC_8959_PREFIX "' prefix or 'Bearer' missing in 'Authorization' header"); - if (strcmp (auth,TMA_auth) == 0) - { - - printf ("AUTH SUCCESS \n"); - - } - else + if (strcmp (auth,TMA_auth) != 0) { return TALER_MHD_reply_with_error (connection, diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c index 56731da94..88655cd7f 100644 --- a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include <gnunet/gnunet_util_lib.h> diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h index 53199c0ce..62269a14e 100644 --- a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h +++ b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-get.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_H #define SRC_TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_GET_H diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.c b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.c index 56c713847..0806f32c6 100644 --- a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.c +++ b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include <gnunet/gnunet_util_lib.h> diff --git a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.h b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.h index c0a85ac63..9f8e15fd4 100644 --- a/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.h +++ b/src/auditor/taler-auditor-httpd_amount-arithmetic-inconsistency-put.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_PUT_H #define SRC_TALER_AUDITOR_HTTPD_AMOUNT_ARITHMETIC_INCONSISTENCY_PUT_H diff --git a/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c b/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c index b54dac515..4117bec37 100644 --- a/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c +++ b/src/auditor/taler-auditor-httpd_bad-sig-losses-get.c @@ -123,11 +123,69 @@ TAH_BAD_SIG_LOSSES_handler_get (struct TAH_RequestHandler *rh, return_suppressed = true; } + const char *op = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "op"); + + + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub; + memset (&op_spec_pub,0, sizeof(op_spec_pub)); + + bool filter_spec_pub = false; + const char *ret_osp = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "use_op_spec_pub"); + if (ret_osp != NULL && strcmp (ret_osp, "true") == 0) + { + filter_spec_pub = true; + + + struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_fixed_auto ("operation_specific_pub", &op_spec_pub), + GNUNET_JSON_spec_end () + }; + + + json_t *json; + { + enum GNUNET_GenericReturnValue res; + + res = TALER_MHD_parse_post_json (connection, + connection_cls, + upload_data, + upload_data_size, + &json); + if (GNUNET_SYSERR == res) + return MHD_NO; + if ((GNUNET_NO == res) || + (NULL == json)) + return MHD_YES; + res = TALER_MHD_parse_json_data (connection, + json, + spec); + if (GNUNET_SYSERR == res) + { + json_decref (json); + return MHD_NO; /* hard failure */ + } + if (GNUNET_NO == res) + { + json_decref (json); + return MHD_YES; /* failure */ + } + } + + } + + qs = TAH_plugin->get_bad_sig_losses ( TAH_plugin->cls, limit, offset, return_suppressed, + filter_spec_pub, + op_spec_pub, + op, &add_bad_sig_losses, ja); diff --git a/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.c b/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.c index 09b37e766..b0e28f649 100644 --- a/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.c +++ b/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.c @@ -118,7 +118,7 @@ TAH_BAD_SIG_LOSSES_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.h b/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.h index 5d4fef4bc..9ab5bfbc0 100644 --- a/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.h +++ b/src/auditor/taler-auditor-httpd_bad-sig-losses-upd.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 08/04/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_BAD_SIG_LOSSES_UPD_H #define SRC_TALER_AUDITOR_HTTPD_BAD_SIG_LOSSES_UPD_H diff --git a/src/auditor/taler-auditor-httpd_balances-del.c b/src/auditor/taler-auditor-httpd_balances-del.c new file mode 100644 index 000000000..cee260961 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-del.c @@ -0,0 +1,82 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "taler-auditor-httpd_balances-del.h" + + +MHD_RESULT +TAH_BALANCES_handler_delete (struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]) +{ + + MHD_RESULT res; + enum GNUNET_DB_QueryStatus qs; + + uint64_t row_id; + + if (args[1] != NULL) + row_id = atoi (args[1]); + else + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + // TODO: not the correct ec + TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, + "exchange signature invalid"); + + if (GNUNET_SYSERR == + TAH_plugin->preflight (TAH_plugin->cls)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_SETUP_FAILED, + NULL); + } + + + // execute the transaction + qs = TAH_plugin->delete_balances (TAH_plugin->cls, + row_id); + + if (0 == qs) + { + // goes in here if there was an error with the transaction + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); + TALER_LOG_WARNING ( + "Failed to handle DELETE /balances/ %s", + args[1]); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + // TODO: not the correct ec + TALER_EC_AUDITOR_DEPOSIT_CONFIRMATION_SIGNATURE_INVALID, + "exchange signature invalid"); + + } + + // on success? + return TALER_MHD_REPLY_JSON_PACK (connection, + MHD_HTTP_NO_CONTENT, + GNUNET_JSON_pack_string ("status", + "BALANCES_OK")); + + return res; +} diff --git a/src/auditor/taler-auditor-httpd_balances-del.h b/src/auditor/taler-auditor-httpd_balances-del.h new file mode 100644 index 000000000..3c0460300 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-del.h @@ -0,0 +1,58 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H +#define SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H + + +#include <microhttpd.h> +#include "taler-auditor-httpd.h" + +/** + * Initialize subsystem. + */ +void +TEAH_BALANCES_DELETE_init (void); + +/** + * Shut down subsystem. + */ +void +TEAH_BALANCES_DELETE_done (void); + +/** + * Handle a "/balances" request. Parses the JSON, and, if + * successful, checks the signatures and stores the result in the DB. + * + * @param rh context of the handler + * @param connection the MHD connection to handle + * @param[in,out] connection_cls the connection's closure (can be updated) + * @param upload_data upload data + * @param[in,out] upload_data_size number of bytes (left) in @a upload_data + * @return MHD result code + */ +MHD_RESULT +TAH_BALANCES_handler_delete (struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]); + + +#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_DEL_H diff --git a/src/auditor/taler-auditor-httpd_balances-get.c b/src/auditor/taler-auditor-httpd_balances-get.c new file mode 100644 index 000000000..99d2b1e80 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-get.c @@ -0,0 +1,157 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include <pthread.h> +#include "taler_json_lib.h" +#include "taler_mhd_lib.h" +#include "taler-auditor-httpd.h" +#include "taler-auditor-httpd_balances-get.h" + +/** +* Add balances to the list. +* +* @param[in,out] cls a `json_t *` array to extend +* @param serial_id location of the @a dc in the database +* @param dc struct of inconsistencies +* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating +*/ +static enum GNUNET_GenericReturnValue +process_balances (void *cls, + uint64_t serial_id, + const struct + TALER_AUDITORDB_Balances + *dc) +{ + json_t *list = cls; + json_t *obj; + + obj = GNUNET_JSON_PACK ( + + GNUNET_JSON_pack_uint64 ("row_id", serial_id), + GNUNET_JSON_pack_string ("balance_key", dc->balance_key), + TALER_JSON_pack_amount ("balance_value", &dc->balance_value), + GNUNET_JSON_pack_bool ("suppressed", dc->suppressed) + + + ); + GNUNET_break (0 == + json_array_append_new (list, + obj)); + + + return GNUNET_OK; +} + + +/** +* +* @param rh context of the handler +* @param connection the MHD connection to handle +* @param[in,out] connection_cls the connection's closure (can be updated) +* @param upload_data upload data +* @param[in,out] upload_data_size number of bytes (left) in @a upload_data +* @return MHD result code +*/ +MHD_RESULT +TAH_BALANCES_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[]) +{ + json_t *ja; + enum GNUNET_DB_QueryStatus qs; + + (void) rh; + (void) connection_cls; + (void) upload_data; + (void) upload_data_size; + if (GNUNET_SYSERR == + TAH_plugin->preflight (TAH_plugin->cls)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_SETUP_FAILED, + NULL); + } + ja = json_array (); + GNUNET_break (NULL != ja); + + int64_t limit = -20; + uint64_t offset; + + TALER_MHD_parse_request_snumber (connection, + "limit", + &limit); + + if (limit < 0) + offset = INT64_MAX; + else + offset = 0; + + TALER_MHD_parse_request_number (connection, + "offset", + &offset); + + bool return_suppressed = false; + const char *ret_s = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "return_suppressed"); + if (ret_s != NULL && strcmp (ret_s, "true") == 0) + { + return_suppressed = true; + } + + const char *balance_key = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + "balance_key"); + + + qs = TAH_plugin->get_balances ( + TAH_plugin->cls, + limit, + offset, + return_suppressed, + balance_key, + &process_balances, + ja); + + if (0 > qs) + { + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); + json_decref (ja); + TALER_LOG_WARNING ( + "Failed to handle GET /balances"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_FETCH_FAILED, + "balances"); + } + return TALER_MHD_REPLY_JSON_PACK ( + connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_array_steal ("balances", + ja)); +} diff --git a/src/auditor/taler-auditor-httpd_balances-get.h b/src/auditor/taler-auditor-httpd_balances-get.h new file mode 100644 index 000000000..d9d062b86 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-get.h @@ -0,0 +1,57 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + + #ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_GET_H +#define SRC_TALER_AUDITOR_HTTPD_BALANCES_GET_H + +#include <gnunet/gnunet_util_lib.h> +#include <microhttpd.h> +#include "taler-auditor-httpd.h" + +/** +* Initialize subsystem. +*/ +void +TEAH_BALANCES_GET_init (void); + +/** +* Shut down subsystem. +*/ +void +TEAH_BAD_BALANCES_GET_done (void); + +/** +* Handle a "/balances" request. +* +* @param rh context of the handler +* @param connection the MHD connection to handle +* @param[in,out] connection_cls the connection's closure (can be updated) +* @param upload_data upload data +* @param[in,out] upload_data_size number of bytes (left) in @a upload_data +* @return MHD result code +*/ +MHD_RESULT +TAH_BALANCES_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[]); + + +#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_GET_H diff --git a/src/auditor/taler-auditor-httpd_balances-put.c b/src/auditor/taler-auditor-httpd_balances-put.c new file mode 100644 index 000000000..5667639df --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-put.c @@ -0,0 +1,155 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include <pthread.h> +#include "taler_json_lib.h" +#include "taler_mhd_lib.h" +#include "taler-auditor-httpd.h" +#include "taler-auditor-httpd_balances-put.h" + +/** +* We have parsed the JSON information about the balances, do some +* basic sanity checks and then execute the +* transaction. +* +* @param connection the MHD connection to handle +* @param dc information about the balances +* @return MHD result code +*/ +static MHD_RESULT +process_inconsistency ( + struct MHD_Connection *connection, + const struct TALER_AUDITORDB_Balances *dc) +{ + + enum GNUNET_DB_QueryStatus qs; + + if (GNUNET_SYSERR == + TAH_plugin->preflight (TAH_plugin->cls)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_SETUP_FAILED, + NULL); + } + + /* execute transaction */ + qs = TAH_plugin->insert_balances (TAH_plugin->cls, + dc); + if (0 > qs) + { + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs); + TALER_LOG_WARNING ( + "Failed to store /balances in database"); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, + "balances"); + } + return TALER_MHD_REPLY_JSON_PACK (connection, + MHD_HTTP_OK, + GNUNET_JSON_pack_string ("status", + "BALANCES_OK")); +} + + +MHD_RESULT +TAH_BALANCES_handler_put ( + 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 TALER_AUDITORDB_Balances dc; + + + struct GNUNET_JSON_Specification spec[] = { + + GNUNET_JSON_spec_string ("balance_key", (const char **) &dc.balance_key), + TALER_JSON_spec_amount ("balance_value", TAH_currency, &dc.balance_value), + + + GNUNET_JSON_spec_end () + }; + + + json_t *json; + + (void) rh; + (void) connection_cls; + (void) upload_data; + (void) upload_data_size; + { + enum GNUNET_GenericReturnValue res; + + res = TALER_MHD_parse_post_json (connection, + connection_cls, + upload_data, + upload_data_size, + &json); + if (GNUNET_SYSERR == res) + return MHD_NO; + if ((GNUNET_NO == res) || + (NULL == json)) + return MHD_YES; + res = TALER_MHD_parse_json_data (connection, + json, + spec); + if (GNUNET_SYSERR == res) + { + json_decref (json); + return MHD_NO; /* hard failure */ + } + if (GNUNET_NO == res) + { + json_decref (json); + return MHD_YES; /* failure */ + } + } + + MHD_RESULT res; + + res = process_inconsistency (connection, &dc); + GNUNET_JSON_parse_free (spec); + + json_decref (json); + return res; + +} + + +void +TEAH_BALANCES_PUT_init (void) +{ + +} + + +void +TEAH_BALANCES_PUT_done (void) +{ + +} diff --git a/src/auditor/taler-auditor-httpd_balances-put.h b/src/auditor/taler-auditor-httpd_balances-put.h new file mode 100644 index 000000000..8443924c7 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-put.h @@ -0,0 +1,58 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H +#define SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H + +#include <microhttpd.h> +#include "taler-auditor-httpd.h" + +/** +* Initialize subsystem. +*/ +void +TEAH_BAD_BALANCES_init (void); + +/** +* Shut down subsystem. +*/ +void +TEAH_BAD_BALANCES_done (void); + + +/** +* Handle a "/balances" request. Parses the JSON, and, if +* successful, checks the signatures and stores the result in the DB. +* +* @param rh context of the handler +* @param connection the MHD connection to handle +* @param[in,out] connection_cls the connection's closure (can be updated) +* @param upload_data upload data +* @param[in,out] upload_data_size number of bytes (left) in @a upload_data +* @return MHD result code +*/ +MHD_RESULT +TAH_BALANCES_handler_put (struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]); + + +#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_PUT_H diff --git a/src/auditor/taler-auditor-httpd_balances-upd.c b/src/auditor/taler-auditor-httpd_balances-upd.c new file mode 100644 index 000000000..fca4c75ba --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-upd.c @@ -0,0 +1,134 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include <pthread.h> +#include "taler_json_lib.h" +#include "taler_mhd_lib.h" +#include "taler-auditor-httpd.h" +#include "taler-auditor-httpd_balances-upd.h" + +MHD_RESULT +TAH_BALANCES_handler_update ( + struct TAH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]) +{ + enum GNUNET_DB_QueryStatus qs; + + if (GNUNET_SYSERR == + TAH_plugin->preflight (TAH_plugin->cls)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_SETUP_FAILED, + NULL); + } + + struct TALER_AUDITORDB_Generic_Update gu; + + struct GNUNET_JSON_Specification spec[] = { + + GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), + GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), + + GNUNET_JSON_spec_end () + }; + + json_t *json; + + (void) rh; + (void) connection_cls; + (void) upload_data; + (void) upload_data_size; + { + enum GNUNET_GenericReturnValue res; + + res = TALER_MHD_parse_post_json (connection, + connection_cls, + upload_data, + upload_data_size, + &json); + if (GNUNET_SYSERR == res) + return MHD_NO; + if ((GNUNET_NO == res) || + (NULL == json)) + return MHD_YES; + res = TALER_MHD_parse_json_data (connection, + json, + spec); + if (GNUNET_SYSERR == res) + { + json_decref (json); + return MHD_NO; /* hard failure */ + } + if (GNUNET_NO == res) + { + json_decref (json); + return MHD_YES; /* failure */ + } + } + + /* execute transaction */ + qs = TAH_plugin->update_balances (TAH_plugin->cls, &gu); + + GNUNET_JSON_parse_free (spec); + json_decref (json); + + MHD_RESULT ret = MHD_NO; + + switch (qs) + { + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, + "update_account"); + break; + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, + "unexpected serialization problem"); + break; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + "no updates executed"); + break; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + ret = TALER_MHD_reply_static (connection, + MHD_HTTP_NO_CONTENT, + NULL, + NULL, + 0); + break; + } + + return ret; +} diff --git a/src/auditor/taler-auditor-httpd_balances-upd.h b/src/auditor/taler-auditor-httpd_balances-upd.h new file mode 100644 index 000000000..202258ab1 --- /dev/null +++ b/src/auditor/taler-auditor-httpd_balances-upd.h @@ -0,0 +1,34 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H +#define SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H + + +#include <microhttpd.h> +#include "taler-auditor-httpd.h" + +MHD_RESULT +TAH_BALANCES_handler_update (struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]); + +#endif // SRC_TALER_AUDITOR_HTTPD_BALANCES_UPD_H diff --git a/src/auditor/taler-auditor-httpd_closure-lags-upd.c b/src/auditor/taler-auditor-httpd_closure-lags-upd.c index 546d77304..8b2240b50 100644 --- a/src/auditor/taler-auditor-httpd_closure-lags-upd.c +++ b/src/auditor/taler-auditor-httpd_closure-lags-upd.c @@ -118,7 +118,7 @@ TAH_CLOSURE_LAGS_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-del.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-del.c index 3f767a649..f52adabf1 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-del.c +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-del.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "taler-auditor-httpd_coin-inconsistency-del.h" diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-del.h b/src/auditor/taler-auditor-httpd_coin-inconsistency-del.h index 765fcf233..57752297b 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-del.h +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-del.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_DEL_H #define SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_DEL_H diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c index b8179e1ee..cf123e67e 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h index 271b8f1d9..659455852 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_GET_H #define SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_GET_H diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-put.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-put.c index 1535a3e42..b6b9636b0 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-put.c +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-put.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-put.h b/src/auditor/taler-auditor-httpd_coin-inconsistency-put.h index 7fab43ef0..4e8e1024a 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-put.h +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-put.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_PUT_H #define SRC_TALER_AUDITOR_HTTPD_COIN_INCONSISTENCY_PUT_H diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-upd.c index 1e47ef2ab..b2cc33c57 100644 --- a/src/auditor/taler-auditor-httpd_coin-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-upd.c @@ -118,7 +118,7 @@ TAH_COIN_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c index a8410b41d..73378f574 100644 --- a/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_denomination-key-validity-withdraw-inconsistency-upd.c @@ -120,7 +120,7 @@ TAH_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_denomination-pending-upd.c b/src/auditor/taler-auditor-httpd_denomination-pending-upd.c index 15fef5454..10727b0f5 100644 --- a/src/auditor/taler-auditor-httpd_denomination-pending-upd.c +++ b/src/auditor/taler-auditor-httpd_denomination-pending-upd.c @@ -118,7 +118,7 @@ TAH_DENOMINATION_PENDING_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_denominations-without-sigs-upd.c b/src/auditor/taler-auditor-httpd_denominations-without-sigs-upd.c index 15e21df99..dbda72dc4 100644 --- a/src/auditor/taler-auditor-httpd_denominations-without-sigs-upd.c +++ b/src/auditor/taler-auditor-httpd_denominations-without-sigs-upd.c @@ -118,7 +118,7 @@ TAH_DENOMINATIONS_WITHOUT_SIGS_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-upd.c b/src/auditor/taler-auditor-httpd_emergency-by-count-upd.c index 5b5d1b079..d9231e168 100644 --- a/src/auditor/taler-auditor-httpd_emergency-by-count-upd.c +++ b/src/auditor/taler-auditor-httpd_emergency-by-count-upd.c @@ -118,7 +118,7 @@ TAH_EMERGENCY_BY_COUNT_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_emergency-upd.c b/src/auditor/taler-auditor-httpd_emergency-upd.c index ace66b34b..ca0e1c205 100644 --- a/src/auditor/taler-auditor-httpd_emergency-upd.c +++ b/src/auditor/taler-auditor-httpd_emergency-upd.c @@ -118,7 +118,7 @@ TAH_EMERGENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c b/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c index d934284fc..fd59543db 100644 --- a/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c +++ b/src/auditor/taler-auditor-httpd_exchange-signkeys-upd.c @@ -118,7 +118,7 @@ TAH_EXCHANGE_SIGNKEYS_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c index e4e679b1f..2d213b40e 100644 --- a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-get.c @@ -130,7 +130,7 @@ TAH_FEE_TIME_INCONSISTENCY_handler_get (struct TAH_RequestHandler *rh, limit, offset, return_suppressed, - &add_fee_time_inconsistency, + &process_fee_time_inconsistency, ja); if (0 > qs) diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.c b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.c index 66ccc0ec5..4553e1045 100644 --- a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.c +++ b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.c @@ -74,7 +74,7 @@ process_inconsistency ( MHD_RESULT -TAH_FEE_TIME_INCONSISTENCY_PUT_handler ( +TAH_FEE_TIME_INCONSISTENCY_handler_put ( struct TAH_RequestHandler *rh, struct MHD_Connection *connection, void **connection_cls, @@ -88,11 +88,9 @@ TAH_FEE_TIME_INCONSISTENCY_PUT_handler ( struct GNUNET_JSON_Specification spec[] = { - // TODO: fill in - - GNUNET_JSON_spec_string ("type", &dc->type), - GNUNET_JSON_spec_int64 ("time", &dc->time), - GNUNET_JSON_spec_string ("diagnostic", &dc->diagnostic), + GNUNET_JSON_spec_string ("type", (const char **) &dc.type), + GNUNET_JSON_spec_int64 ("time", &dc.time), + GNUNET_JSON_spec_string ("diagnostic", (const char **) &dc.diagnostic), GNUNET_JSON_spec_end () diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.h b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.h index 13be30d4e..3deae033b 100644 --- a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.h +++ b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-put.h @@ -46,7 +46,7 @@ TEAH_FEE_TIME_INCONSISTENCY_PUT_done (void); * @return MHD result code */ MHD_RESULT -TAH_FEE_TIME_INCONSISTENCY_PUT_handler (struct TAH_RequestHandler *rh, +TAH_FEE_TIME_INCONSISTENCY_handler_put (struct TAH_RequestHandler *rh, struct MHD_Connection * connection, void **connection_cls, diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.c new file mode 100644 index 000000000..e49939a1d --- /dev/null +++ b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.c @@ -0,0 +1,134 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> +#include <jansson.h> +#include <microhttpd.h> +#include <pthread.h> +#include "taler_json_lib.h" +#include "taler_mhd_lib.h" +#include "taler-auditor-httpd.h" +#include "taler-auditor-httpd_fee-time-inconsistency-upd.h" + +MHD_RESULT +TAH_FEE_TIME_INCONSISTENCY_handler_update ( + struct TAH_RequestHandler *rh, + struct MHD_Connection *connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]) +{ + enum GNUNET_DB_QueryStatus qs; + + if (GNUNET_SYSERR == + TAH_plugin->preflight (TAH_plugin->cls)) + { + GNUNET_break (0); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_SETUP_FAILED, + NULL); + } + + struct TALER_AUDITORDB_Generic_Update gu; + + struct GNUNET_JSON_Specification spec[] = { + + GNUNET_JSON_spec_uint64 ("row_id", &gu.row_id), + GNUNET_JSON_spec_bool ("suppressed", &gu.suppressed), + + GNUNET_JSON_spec_end () + }; + + json_t *json; + + (void) rh; + (void) connection_cls; + (void) upload_data; + (void) upload_data_size; + { + enum GNUNET_GenericReturnValue res; + + res = TALER_MHD_parse_post_json (connection, + connection_cls, + upload_data, + upload_data_size, + &json); + if (GNUNET_SYSERR == res) + return MHD_NO; + if ((GNUNET_NO == res) || + (NULL == json)) + return MHD_YES; + res = TALER_MHD_parse_json_data (connection, + json, + spec); + if (GNUNET_SYSERR == res) + { + json_decref (json); + return MHD_NO; /* hard failure */ + } + if (GNUNET_NO == res) + { + json_decref (json); + return MHD_YES; /* failure */ + } + } + + /* execute transaction */ + qs = TAH_plugin->update_fee_time_inconsistency (TAH_plugin->cls, &gu); + + GNUNET_JSON_parse_free (spec); + json_decref (json); + + MHD_RESULT ret = MHD_NO; + + switch (qs) + { + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, + "update_account"); + break; + case GNUNET_DB_STATUS_SOFT_ERROR: + GNUNET_break (0); + ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, + "unexpected serialization problem"); + break; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_NOT_FOUND, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, + "no updates executed"); + break; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + ret = TALER_MHD_reply_static (connection, + MHD_HTTP_NO_CONTENT, + NULL, + NULL, + 0); + break; + } + + return ret; +} diff --git a/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.h b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.h new file mode 100644 index 000000000..04aa5c90d --- /dev/null +++ b/src/auditor/taler-auditor-httpd_fee-time-inconsistency-upd.h @@ -0,0 +1,34 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_TALER_AUDITOR_HTTPD_FEE_TIME_INCONSISTENCY_UPD_H +#define SRC_TALER_AUDITOR_HTTPD_FEE_TIME_INCONSISTENCY_UPD_H + + +#include <microhttpd.h> +#include "taler-auditor-httpd.h" + +MHD_RESULT +TAH_FEE_TIME_INCONSISTENCY_handler_update (struct TAH_RequestHandler *rh, + struct MHD_Connection * + connection, + void **connection_cls, + const char *upload_data, + size_t *upload_data_size, + const char *const args[]); + +#endif // SRC_TALER_AUDITOR_HTTPD_FEE_TIME_INCONSISTENCY_UPD_H diff --git a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c index 39865004f..ec85c3efb 100644 --- a/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c +++ b/src/auditor/taler-auditor-httpd_historic-denomination-revenue-upd.c @@ -118,7 +118,7 @@ TAH_HISTORIC_DENOMINATION_REVENUE_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c b/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c index 10d5264d3..f4d11baf3 100644 --- a/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c +++ b/src/auditor/taler-auditor-httpd_historic-reserve-summary-upd.c @@ -118,7 +118,7 @@ TAH_HISTORIC_RESERVE_SUMMARY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-upd.c index b237b2f03..fbb57e7f6 100644 --- a/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_misattribution-in-inconsistency-upd.c @@ -119,7 +119,7 @@ TAH_MISATTRIBUTION_IN_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_progress-upd.c b/src/auditor/taler-auditor-httpd_progress-upd.c index 5788364cd..13c785c0b 100644 --- a/src/auditor/taler-auditor-httpd_progress-upd.c +++ b/src/auditor/taler-auditor-httpd_progress-upd.c @@ -118,7 +118,7 @@ TAH_PROGRESS_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c b/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c index c72531f9e..4707b61bc 100644 --- a/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c +++ b/src/auditor/taler-auditor-httpd_purse-not-closed-inconsistencies-upd.c @@ -119,7 +119,7 @@ TAH_PURSE_NOT_CLOSED_INCONSISTENCIES_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_purses-upd.c b/src/auditor/taler-auditor-httpd_purses-upd.c index 9956e1f46..559c9742c 100644 --- a/src/auditor/taler-auditor-httpd_purses-upd.c +++ b/src/auditor/taler-auditor-httpd_purses-upd.c @@ -118,7 +118,7 @@ TAH_PURSES_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_refreshes-hanging-upd.c b/src/auditor/taler-auditor-httpd_refreshes-hanging-upd.c index 8675ea4fc..682e670ba 100644 --- a/src/auditor/taler-auditor-httpd_refreshes-hanging-upd.c +++ b/src/auditor/taler-auditor-httpd_refreshes-hanging-upd.c @@ -118,7 +118,7 @@ TAH_REFRESHES_HANGING_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c index fb9a008f9..a765cefa6 100644 --- a/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_reserve-balance-insufficient-inconsistency-upd.c @@ -119,7 +119,7 @@ TAH_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c index 4810fa3be..03f335259 100644 --- a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-upd.c @@ -119,7 +119,7 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-upd.c index 5d731f01e..952219092 100644 --- a/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_reserve-in-inconsistency-upd.c @@ -118,7 +118,7 @@ TAH_RESERVE_IN_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c index 81a5365de..6ea57f06b 100644 --- a/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_reserve-not-closed-inconsistency-upd.c @@ -119,7 +119,7 @@ TAH_RESERVE_NOT_CLOSED_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_reserves-upd.c b/src/auditor/taler-auditor-httpd_reserves-upd.c index d177d439d..583561b0b 100644 --- a/src/auditor/taler-auditor-httpd_reserves-upd.c +++ b/src/auditor/taler-auditor-httpd_reserves-upd.c @@ -118,7 +118,7 @@ TAH_RESERVES_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-del.c b/src/auditor/taler-auditor-httpd_row-inconsistency-del.c index 04d32d775..d76a094cf 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-del.c +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-del.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "taler-auditor-httpd_row-inconsistency-del.h" diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-del.h b/src/auditor/taler-auditor-httpd_row-inconsistency-del.h index a1dea7c71..e6fe8dd87 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-del.h +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-del.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_DEL_H #define SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_DEL_H diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c index 9826c0dd3..d391797ef 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.h b/src/auditor/taler-auditor-httpd_row-inconsistency-get.h index e17110ded..e00dbf406 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-get.h +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-get.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_GET_H #define SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_GET_H diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-put.c b/src/auditor/taler-auditor-httpd_row-inconsistency-put.c index b8544eb90..ee33deb4a 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-put.c +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-put.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include <gnunet/gnunet_util_lib.h> diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-put.h b/src/auditor/taler-auditor-httpd_row-inconsistency-put.h index 571ea507c..5c1f70e50 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-put.h +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-put.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_PUT_H #define SRC_TALER_AUDITOR_HTTPD_ROW_INCONSISTENCY_PUT_H diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_row-inconsistency-upd.c index ee65492d3..d06cd5fff 100644 --- a/src/auditor/taler-auditor-httpd_row-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_row-inconsistency-upd.c @@ -118,7 +118,7 @@ TAH_ROW_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-upd.c b/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-upd.c index 57cfc3d50..83fe4e923 100644 --- a/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-upd.c +++ b/src/auditor/taler-auditor-httpd_row-minor-inconsistencies-upd.c @@ -118,7 +118,7 @@ TAH_ROW_MINOR_INCONSISTENCIES_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_wire-format-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_wire-format-inconsistency-upd.c index 1eacc2e6c..4766adce3 100644 --- a/src/auditor/taler-auditor-httpd_wire-format-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_wire-format-inconsistency-upd.c @@ -118,7 +118,7 @@ TAH_WIRE_FORMAT_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditor/taler-auditor-httpd_wire-out-inconsistency-upd.c b/src/auditor/taler-auditor-httpd_wire-out-inconsistency-upd.c index a0fdd11e3..84a72ff0b 100644 --- a/src/auditor/taler-auditor-httpd_wire-out-inconsistency-upd.c +++ b/src/auditor/taler-auditor-httpd_wire-out-inconsistency-upd.c @@ -118,7 +118,7 @@ TAH_WIRE_OUT_INCONSISTENCY_handler_update ( case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: return TALER_MHD_reply_with_error (connection, MHD_HTTP_NOT_FOUND, - TALER_EC_MERCHANT_GENERIC_ACCOUNT_UNKNOWN, + TALER_EC_AUDITOR_RESOURCE_NOT_FOUND, "no updates executed"); break; case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: diff --git a/src/auditordb/0002-auditor_balances.sql b/src/auditordb/0002-auditor_balances.sql index 7692bf50b..dad3d0873 100644 --- a/src/auditordb/0002-auditor_balances.sql +++ b/src/auditordb/0002-auditor_balances.sql @@ -16,6 +16,7 @@ CREATE TABLE IF NOT EXISTS auditor_balances ( + row_id BIGINT GENERATED BY DEFAULT AS IDENTITY, balance_key TEXT PRIMARY KEY NOT NULL ,balance_value taler_amount, suppressed BOOLEAN NOT NULL DEFAULT FALSE diff --git a/src/auditordb/Makefile.am b/src/auditordb/Makefile.am index 0dc499d35..d262df5cf 100644 --- a/src/auditordb/Makefile.am +++ b/src/auditordb/Makefile.am @@ -192,7 +192,15 @@ pg_get_row_minor_inconsistencies.c pg_get_row_minor_inconsistencies.h \ pg_del_row_minor_inconsistencies.c pg_del_row_minor_inconsistencies.h \ pg_insert_row_minor_inconsistencies.c pg_insert_row_minor_inconsistencies.h \ pg_update_row_minor_inconsistencies.c pg_update_row_minor_inconsistencies.h \ -pg_del_auditor_progress.c pg_del_auditor_progress.h +pg_del_auditor_progress.c pg_del_auditor_progress.h \ +pg_get_fee_time_inconsistency.c pg_get_fee_time_inconsistency.h \ +pg_del_fee_time_inconsistency.c pg_del_fee_time_inconsistency.h \ +pg_insert_fee_time_inconsistency.c pg_insert_fee_time_inconsistency.h \ +pg_update_fee_time_inconsistency.c pg_update_fee_time_inconsistency.h \ +pg_get_balances.c pg_get_balances.h \ +pg_del_balances.c pg_del_balances.h \ +pg_insert_balances.c pg_insert_balances.h \ +pg_update_balances.c pg_update_balances.h libtaler_plugin_auditordb_postgres_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) libtaler_plugin_auditordb_postgres_la_LIBADD = \ diff --git a/src/auditordb/pg_del_amount_arithmetic_inconsistency.c b/src/auditordb/pg_del_amount_arithmetic_inconsistency.c index 42dd2d2b1..5af3bdda7 100644 --- a/src/auditordb/pg_del_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_del_amount_arithmetic_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_amount_arithmetic_inconsistency.h" diff --git a/src/auditordb/pg_del_amount_arithmetic_inconsistency.h b/src/auditordb/pg_del_amount_arithmetic_inconsistency.h index bf253617d..ff7f12cf2 100644 --- a/src/auditordb/pg_del_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_del_amount_arithmetic_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_DEL_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_auditor_closure_lags.c b/src/auditordb/pg_del_auditor_closure_lags.c index dd12f1b73..89f230af3 100644 --- a/src/auditordb/pg_del_auditor_closure_lags.c +++ b/src/auditordb/pg_del_auditor_closure_lags.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_closure_lags.h" diff --git a/src/auditordb/pg_del_auditor_closure_lags.h b/src/auditordb/pg_del_auditor_closure_lags.h index a0f885f1b..7c6f2db51 100644 --- a/src/auditordb/pg_del_auditor_closure_lags.h +++ b/src/auditordb/pg_del_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_DEL_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_del_auditor_emergency.c b/src/auditordb/pg_del_auditor_emergency.c index 6fb274990..a4afd14c5 100644 --- a/src/auditordb/pg_del_auditor_emergency.c +++ b/src/auditordb/pg_del_auditor_emergency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_emergency.h" diff --git a/src/auditordb/pg_del_auditor_emergency.h b/src/auditordb/pg_del_auditor_emergency.h index 1d893255b..94c8bc4e9 100644 --- a/src/auditordb/pg_del_auditor_emergency.h +++ b/src/auditordb/pg_del_auditor_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_EMERGENCY_H #define SRC_PG_DEL_AUDITOR_EMERGENCY_H diff --git a/src/auditordb/pg_del_auditor_progress.c b/src/auditordb/pg_del_auditor_progress.c index 38034548d..087e2783c 100644 --- a/src/auditordb/pg_del_auditor_progress.c +++ b/src/auditordb/pg_del_auditor_progress.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_auditor_progress.h" diff --git a/src/auditordb/pg_del_auditor_progress.h b/src/auditordb/pg_del_auditor_progress.h index a4b7542c3..51e974040 100644 --- a/src/auditordb/pg_del_auditor_progress.h +++ b/src/auditordb/pg_del_auditor_progress.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_AUDITOR_PROGRESS_H #define SRC_PG_DEL_AUDITOR_PROGRESS_H diff --git a/src/auditordb/pg_del_bad_sig_losses.c b/src/auditordb/pg_del_bad_sig_losses.c index b8fe175f9..2bf48642c 100644 --- a/src/auditordb/pg_del_bad_sig_losses.c +++ b/src/auditordb/pg_del_bad_sig_losses.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_bad_sig_losses.h" diff --git a/src/auditordb/pg_del_bad_sig_losses.h b/src/auditordb/pg_del_bad_sig_losses.h index 0579b64c0..4881e8715 100644 --- a/src/auditordb/pg_del_bad_sig_losses.h +++ b/src/auditordb/pg_del_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_BAD_SIG_LOSSES_H #define SRC_PG_DEL_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_del_balances.c b/src/auditordb/pg_del_balances.c new file mode 100644 index 000000000..9cdf9e2ea --- /dev/null +++ b/src/auditordb/pg_del_balances.c @@ -0,0 +1,42 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "pg_del_balances.h" + +#include "taler_pq_lib.h" +#include "pg_helper.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_del_balances ( + void *cls, + uint64_t row_id) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&row_id), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "auditor_delete_balances", + "DELETE" + " FROM auditor_balances" + " WHERE row_id=$1;"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "auditor_delete_balances", + params); +} diff --git a/src/auditordb/pg_del_balances.h b/src/auditordb/pg_del_balances.h new file mode 100644 index 000000000..03baebebc --- /dev/null +++ b/src/auditordb/pg_del_balances.h @@ -0,0 +1,36 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_DEL_BALANCES_H +#define SRC_PG_DEL_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +/** + * Delete a row from the bad sig losses table. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param row_id row to delete + * @return query transaction status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_del_balances ( + void *cls, + uint64_t row_id); + +#endif // SRC_PG_DEL_BALANCES_H diff --git a/src/auditordb/pg_del_coin_inconsistency.c b/src/auditordb/pg_del_coin_inconsistency.c index 9d9265ebb..d1426c955 100644 --- a/src/auditordb/pg_del_coin_inconsistency.c +++ b/src/auditordb/pg_del_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_coin_inconsistency.h" diff --git a/src/auditordb/pg_del_coin_inconsistency.h b/src/auditordb/pg_del_coin_inconsistency.h index 99be77d45..8fc43c1c5 100644 --- a/src/auditordb/pg_del_coin_inconsistency.h +++ b/src/auditordb/pg_del_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_COIN_INCONSISTENCY_H #define SRC_PG_DEL_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c index 54533854b..fa8d01580 100644 --- a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_denomination_key_validity_withdraw_inconsistency.h" diff --git a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h index 6778ec40d..9c11dd768 100644 --- a/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_del_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_DEL_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_emergency_by_count.c b/src/auditordb/pg_del_emergency_by_count.c index 418a157b5..84ab0def0 100644 --- a/src/auditordb/pg_del_emergency_by_count.c +++ b/src/auditordb/pg_del_emergency_by_count.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_emergency_by_count.h" diff --git a/src/auditordb/pg_del_emergency_by_count.h b/src/auditordb/pg_del_emergency_by_count.h index 84e2205a5..734c7ae7e 100644 --- a/src/auditordb/pg_del_emergency_by_count.h +++ b/src/auditordb/pg_del_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_EMERGENCY_BY_COUNT_H #define SRC_PG_DEL_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_del_fee_time_inconsistency.c b/src/auditordb/pg_del_fee_time_inconsistency.c index 7697e09f9..94fbff42f 100644 --- a/src/auditordb/pg_del_fee_time_inconsistency.c +++ b/src/auditordb/pg_del_fee_time_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_fee_time_inconsistency.h" diff --git a/src/auditordb/pg_del_fee_time_inconsistency.h b/src/auditordb/pg_del_fee_time_inconsistency.h index 46262f5e1..49b7e253e 100644 --- a/src/auditordb/pg_del_fee_time_inconsistency.h +++ b/src/auditordb/pg_del_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_FEE_TIME_INCONSISTENCY_H #define SRC_PG_DEL_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c index 0bc9477dc..3bc82f1e9 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_purse_not_closed_inconsistencies.h" diff --git a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h index 417dfd05a..25d4305e2 100644 --- a/src/auditordb/pg_del_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_del_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_DEL_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_del_refreshes_hanging.c b/src/auditordb/pg_del_refreshes_hanging.c index cba4aa5d5..43a1cbba1 100644 --- a/src/auditordb/pg_del_refreshes_hanging.c +++ b/src/auditordb/pg_del_refreshes_hanging.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_refreshes_hanging.h" diff --git a/src/auditordb/pg_del_refreshes_hanging.h b/src/auditordb/pg_del_refreshes_hanging.h index 8905514ca..f2cdee95e 100644 --- a/src/auditordb/pg_del_refreshes_hanging.h +++ b/src/auditordb/pg_del_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_REFRESHES_HANGING_H #define SRC_PG_DEL_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c index ea94afed0..001969e51 100644 --- a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_reserve_balance_insufficient_inconsistency.h" diff --git a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h index 3cfab01c2..783dea493 100644 --- a/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_del_reserve_balance_insufficient_inconsistency.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_DEL_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_del_row_inconsistency.c b/src/auditordb/pg_del_row_inconsistency.c index d906628c9..f4ab9e068 100644 --- a/src/auditordb/pg_del_row_inconsistency.c +++ b/src/auditordb/pg_del_row_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "pg_del_row_inconsistency.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_del_row_inconsistency.h b/src/auditordb/pg_del_row_inconsistency.h index 665792c3b..2584f5265 100644 --- a/src/auditordb/pg_del_row_inconsistency.h +++ b/src/auditordb/pg_del_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_DEL_ROW_INCONSISTENCY_H #define SRC_PG_DEL_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_amount_arithmetic_inconsistency.c b/src/auditordb/pg_get_amount_arithmetic_inconsistency.c index 921856daa..604167de7 100644 --- a/src/auditordb/pg_get_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_get_amount_arithmetic_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" diff --git a/src/auditordb/pg_get_amount_arithmetic_inconsistency.h b/src/auditordb/pg_get_amount_arithmetic_inconsistency.h index 3d00cccce..7cf4260fe 100644 --- a/src/auditordb/pg_get_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_get_amount_arithmetic_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 19/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_GET_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_auditor_closure_lags.c b/src/auditordb/pg_get_auditor_closure_lags.c index 8cc48caa2..18a506cba 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.c +++ b/src/auditordb/pg_get_auditor_closure_lags.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" diff --git a/src/auditordb/pg_get_auditor_closure_lags.h b/src/auditordb/pg_get_auditor_closure_lags.h index d94d8fa74..03822864e 100644 --- a/src/auditordb/pg_get_auditor_closure_lags.h +++ b/src/auditordb/pg_get_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_GET_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_get_bad_sig_losses.c b/src/auditordb/pg_get_bad_sig_losses.c index bb8afe2a7..746f713a4 100644 --- a/src/auditordb/pg_get_bad_sig_losses.c +++ b/src/auditordb/pg_get_bad_sig_losses.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" @@ -100,11 +112,31 @@ TAH_PG_get_bad_sig_losses ( void *cls, int64_t limit, uint64_t offset, - bool return_suppressed, // maybe not needed + bool return_suppressed, + bool filter_spec_pub, + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub, + const char *op, TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls) { + /*if true, does not filter for an operation specific key*/ + bool any_spec_pub = ! filter_spec_pub; + + /*if true, does not filter for an operation*/ + bool any_op = true; + const char *o; + + if (op != NULL) + { + any_op = false; + o = op; + } + else + { + o = ""; + } + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); struct PostgresClosure *pg = cls; @@ -112,6 +144,10 @@ TAH_PG_get_bad_sig_losses ( GNUNET_PQ_query_param_uint64 (&offset), GNUNET_PQ_query_param_bool (return_suppressed), GNUNET_PQ_query_param_uint64 (&plimit), + GNUNET_PQ_query_param_bool (any_spec_pub), + GNUNET_PQ_query_param_auto_from_type (&op_spec_pub), + GNUNET_PQ_query_param_bool (any_op), + GNUNET_PQ_query_param_string (o), GNUNET_PQ_query_param_end }; struct BadSigLossesContext dcc = { @@ -131,6 +167,8 @@ TAH_PG_get_bad_sig_losses ( " FROM auditor_bad_sig_losses" " WHERE (row_id < $1)" " AND ($2 OR suppressed is false)" + " AND ($4 OR operation_specific_pub = $5)" + " AND ($6 OR operation = $7)" " ORDER BY row_id DESC" " LIMIT $3" ); @@ -144,6 +182,8 @@ TAH_PG_get_bad_sig_losses ( " FROM auditor_bad_sig_losses" " WHERE (row_id > $1)" " AND ($2 OR suppressed is false)" + " AND ($4 OR operation_specific_pub = $5)" + " AND ($6 OR operation = $7)" " ORDER BY row_id ASC" " LIMIT $3" ); diff --git a/src/auditordb/pg_get_bad_sig_losses.h b/src/auditordb/pg_get_bad_sig_losses.h index 4e5bbd98b..5694458d3 100644 --- a/src/auditordb/pg_get_bad_sig_losses.h +++ b/src/auditordb/pg_get_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_BAD_SIG_LOSSES_H #define SRC_PG_GET_BAD_SIG_LOSSES_H @@ -26,6 +38,9 @@ TAH_PG_get_bad_sig_losses ( int64_t limit, uint64_t offset, bool return_suppressed, + bool filter_spec_pub, + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub, + const char *op, TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls); diff --git a/src/auditordb/pg_get_balances.c b/src/auditordb/pg_get_balances.c new file mode 100644 index 000000000..ae1e484f4 --- /dev/null +++ b/src/auditordb/pg_get_balances.c @@ -0,0 +1,194 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_error_codes.h" +#include "taler_dbevents.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_get_balances.h" + + +struct BalancesContext +{ + + /** + * Function to call for each bad sig loss. + */ + TALER_AUDITORDB_BalancesCallback cb; + + /** + * Closure for @e cb + */ + void *cb_cls; + + /** + * Plugin context. + */ + struct PostgresClosure *pg; + + /** + * Query status to return. + */ + enum GNUNET_DB_QueryStatus qs; +}; + + +/** + * Helper function for #TAH_PG_get_balances(). + * To be called with the results of a SELECT statement + * that has returned @a num_results results. + * + * @param cls closure of type `struct BalancesContext *` + * @param result the postgres result + * @param num_results the number of results in @a result + */ +static void +balances_cb (void *cls, + PGresult *result, + unsigned int num_results) +{ + struct BalancesContext *dcc = cls; + struct PostgresClosure *pg = dcc->pg; + + for (unsigned int i = 0; i < num_results; i++) + { + uint64_t serial_id; + + struct TALER_AUDITORDB_Balances dc; + + struct GNUNET_PQ_ResultSpec rs[] = { + + GNUNET_PQ_result_spec_uint64 ("row_id", &serial_id), + + GNUNET_PQ_result_spec_string ("balance_key", &dc.balance_key), + TALER_PQ_RESULT_SPEC_AMOUNT ("balance_value", &dc.balance_value), + GNUNET_PQ_result_spec_bool ("suppressed", &dc.suppressed), + + + GNUNET_PQ_result_spec_end + }; + enum GNUNET_GenericReturnValue rval; + + if (GNUNET_OK != + GNUNET_PQ_extract_result (result, + rs, + i)) + { + GNUNET_break (0); + dcc->qs = GNUNET_DB_STATUS_HARD_ERROR; + return; + } + + dcc->qs = i + 1; + + rval = dcc->cb (dcc->cb_cls, + serial_id, + &dc); + GNUNET_PQ_cleanup_result (rs); + if (GNUNET_OK != rval) + break; + } +} + + +enum GNUNET_DB_QueryStatus +TAH_PG_get_balances ( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + const char *balance_key, + TALER_AUDITORDB_BalancesCallback cb, + void *cb_cls) +{ + + /*if true, does not filter for a specific balance*/ + bool any_balance = true; + const char *bk; + + if (balance_key != NULL) + { + any_balance = false; + bk = balance_key; + } + else + { + bk = ""; + } + + + uint64_t plimit = (uint64_t) ((limit < 0) ? -limit : limit); + + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&offset), + GNUNET_PQ_query_param_bool (return_suppressed), + GNUNET_PQ_query_param_uint64 (&plimit), + GNUNET_PQ_query_param_bool (any_balance), + GNUNET_PQ_query_param_string (bk), + GNUNET_PQ_query_param_end + }; + struct BalancesContext dcc = { + .cb = cb, + .cb_cls = cb_cls, + .pg = pg + }; + enum GNUNET_DB_QueryStatus qs; + + PREPARE (pg, + "auditor_balances_get_desc", + "SELECT" + " row_id," + " balance_key," + " balance_value," + " suppressed" + " FROM auditor_balances" + " WHERE (row_id < $1)" + " AND ($2 OR suppressed is false)" + " AND ($4 OR balance_key = $5)" + " ORDER BY row_id DESC" + " LIMIT $3" + ); + PREPARE (pg, + "auditor_balances_get_asc", + "SELECT" + " row_id," + " balance_key," + " balance_value," + " suppressed" + " FROM auditor_balances" + " WHERE (row_id > $1)" + " AND ($2 OR suppressed is false)" + " AND ($4 OR balance_key = $5)" + " ORDER BY row_id ASC" + " LIMIT $3" + ); + qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, + (limit > 0) + ? "auditor_balances_get_asc" + : "auditor_balances_get_desc", + params, + &balances_cb, + &dcc); + + if (qs > 0) + return dcc.qs; + GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR != qs); + return qs; +} diff --git a/src/auditordb/pg_get_balances.h b/src/auditordb/pg_get_balances.h new file mode 100644 index 000000000..7d210d6b8 --- /dev/null +++ b/src/auditordb/pg_get_balances.h @@ -0,0 +1,46 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_GET_BALANCES_H +#define SRC_PG_GET_BALANCES_H + +#include "taler_util.h" +#include "taler_json_lib.h" +#include "taler_auditordb_plugin.h" + +/** + * Get information about balances from the database. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param start_id row/serial ID where to start the iteration (0 from + * the start, exclusive, i.e. serial_ids must start from 1) + * @param return_suppressed should suppressed rows be returned anyway? + * @param cb function to call with results + * @param cb_cls closure for @a cb + * @return query result status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_get_balances ( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + const char *balance_key, + TALER_AUDITORDB_BalancesCallback cb, + void *cb_cls); + +#endif // SRC_PG_GET_BALANCES_H diff --git a/src/auditordb/pg_get_coin_inconsistency.c b/src/auditordb/pg_get_coin_inconsistency.c index 88db302c9..8c1f465c9 100644 --- a/src/auditordb/pg_get_coin_inconsistency.c +++ b/src/auditordb/pg_get_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_coin_inconsistency.h b/src/auditordb/pg_get_coin_inconsistency.h index bff9b82b5..9bff05397 100644 --- a/src/auditordb/pg_get_coin_inconsistency.h +++ b/src/auditordb/pg_get_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_COIN_INCONSISTENCY_H #define SRC_PG_GET_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c index 8dd4d231f..4a123201f 100644 --- a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c +++ b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h index ab40da401..199e2c364 100644 --- a/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_get_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_GET_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_emergency.c b/src/auditordb/pg_get_emergency.c index ae1d8e545..c1ab7c0fd 100644 --- a/src/auditordb/pg_get_emergency.c +++ b/src/auditordb/pg_get_emergency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_emergency.h b/src/auditordb/pg_get_emergency.h index 64415750b..09530920e 100644 --- a/src/auditordb/pg_get_emergency.h +++ b/src/auditordb/pg_get_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_EMERGENCY_H #define SRC_PG_GET_EMERGENCY_H diff --git a/src/auditordb/pg_get_emergency_by_count.c b/src/auditordb/pg_get_emergency_by_count.c index bf7a19137..dbdf246d3 100644 --- a/src/auditordb/pg_get_emergency_by_count.c +++ b/src/auditordb/pg_get_emergency_by_count.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_emergency_by_count.h b/src/auditordb/pg_get_emergency_by_count.h index b6b4e0f04..2054e2aee 100644 --- a/src/auditordb/pg_get_emergency_by_count.h +++ b/src/auditordb/pg_get_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_EMERGENCY_BY_COUNT_H #define SRC_PG_GET_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_get_fee_time_inconsistency.c b/src/auditordb/pg_get_fee_time_inconsistency.c index ac5459283..730d3d5e3 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.c +++ b/src/auditordb/pg_get_fee_time_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_fee_time_inconsistency.h b/src/auditordb/pg_get_fee_time_inconsistency.h index 7c4796b4b..8874cffff 100644 --- a/src/auditordb/pg_get_fee_time_inconsistency.h +++ b/src/auditordb/pg_get_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_FEE_TIME_INCONSISTENCY_H #define SRC_PG_GET_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c index 270f2dfe6..4278e445e 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.c +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h index 658aeea80..ef7bdb3ae 100644 --- a/src/auditordb/pg_get_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_get_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_GET_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_get_refreshes_hanging.c b/src/auditordb/pg_get_refreshes_hanging.c index 904df0a42..59a4ef9a7 100644 --- a/src/auditordb/pg_get_refreshes_hanging.c +++ b/src/auditordb/pg_get_refreshes_hanging.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_get_refreshes_hanging.h b/src/auditordb/pg_get_refreshes_hanging.h index 7603c9b3d..b4fd26708 100644 --- a/src/auditordb/pg_get_refreshes_hanging.h +++ b/src/auditordb/pg_get_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_REFRESHES_HANGING_H #define SRC_PG_GET_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c index ddbe44c87..f84d5bbaa 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" diff --git a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h index 5133f8149..d2e0fa3ed 100644 --- a/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_get_reserve_balance_insufficient_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_GET_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_get_row_inconsistency.c b/src/auditordb/pg_get_row_inconsistency.c index ff2671a8e..14e454f00 100644 --- a/src/auditordb/pg_get_row_inconsistency.c +++ b/src/auditordb/pg_get_row_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_error_codes.h" diff --git a/src/auditordb/pg_get_row_inconsistency.h b/src/auditordb/pg_get_row_inconsistency.h index ef0136f39..4aa13e36d 100644 --- a/src/auditordb/pg_get_row_inconsistency.h +++ b/src/auditordb/pg_get_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 20/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_GET_ROW_INCONSISTENCY_H #define SRC_PG_GET_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c index 9d25a20a9..ee689f112 100644 --- a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c +++ b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h index 410f6e683..31d94e279 100644 --- a/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h +++ b/src/auditordb/pg_insert_amount_arithmetic_inconsistency.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_AMOUNT_ARITHMETIC_INCONSISTENCY_H #define SRC_PG_INSERT_AMOUNT_ARITHMETIC_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_auditor_closure_lags.h b/src/auditordb/pg_insert_auditor_closure_lags.h index 0a607b483..745a95093 100644 --- a/src/auditordb/pg_insert_auditor_closure_lags.h +++ b/src/auditordb/pg_insert_auditor_closure_lags.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_AUDITOR_CLOSURE_LAGS_H #define SRC_PG_INSERT_AUDITOR_CLOSURE_LAGS_H diff --git a/src/auditordb/pg_insert_bad_sig_losses.h b/src/auditordb/pg_insert_bad_sig_losses.h index 26b2182ed..fdad6a38b 100644 --- a/src/auditordb/pg_insert_bad_sig_losses.h +++ b/src/auditordb/pg_insert_bad_sig_losses.h @@ -1,7 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_BAD_SIG_LOSSES_H #define SRC_PG_INSERT_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_insert_balances.c b/src/auditordb/pg_insert_balances.c new file mode 100644 index 000000000..d6d4f35ce --- /dev/null +++ b/src/auditordb/pg_insert_balances.c @@ -0,0 +1,49 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_insert_balances.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_insert_balances ( + void *cls, + const struct TALER_AUDITORDB_Balances *dc) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + + GNUNET_PQ_query_param_string (dc->balance_key), + TALER_PQ_query_param_amount (pg->conn, &dc->balance_value), + + + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "auditor_balances_insert", + "INSERT INTO auditor_balances " + "( balance_key," + " balance_value" + ") VALUES ($1,$2);" + ); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "auditor_balances_insert", + params); +} diff --git a/src/auditordb/pg_insert_balances.h b/src/auditordb/pg_insert_balances.h new file mode 100644 index 000000000..19d2bc046 --- /dev/null +++ b/src/auditordb/pg_insert_balances.h @@ -0,0 +1,37 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_INSERT_BALANCES_H +#define SRC_PG_INSERT_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + + +/** + * Insert information about a bad sig loss into the database. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param dc deposit confirmation information to store + * @return query result status + */ +enum GNUNET_DB_QueryStatus +TAH_PG_insert_balances ( + void *cls, + const struct TALER_AUDITORDB_Balances *dc); + +#endif // SRC_PG_INSERT_BALANCES_H diff --git a/src/auditordb/pg_insert_coin_inconsistency.c b/src/auditordb/pg_insert_coin_inconsistency.c index 0aaf3205c..532f94c23 100644 --- a/src/auditordb/pg_insert_coin_inconsistency.c +++ b/src/auditordb/pg_insert_coin_inconsistency.c @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" diff --git a/src/auditordb/pg_insert_coin_inconsistency.h b/src/auditordb/pg_insert_coin_inconsistency.h index 2dac42497..64904a5b4 100644 --- a/src/auditordb/pg_insert_coin_inconsistency.h +++ b/src/auditordb/pg_insert_coin_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_COIN_INCONSISTENCY_H #define SRC_PG_INSERT_COIN_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h index a8a5e57e4..08484a5bf 100644 --- a/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h +++ b/src/auditordb/pg_insert_denomination_key_validity_withdraw_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H #define SRC_PG_INSERT_DENOMINATION_KEY_VALIDITY_WITHDRAW_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_emergency.h b/src/auditordb/pg_insert_emergency.h index db8f39cbf..077602a96 100644 --- a/src/auditordb/pg_insert_emergency.h +++ b/src/auditordb/pg_insert_emergency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_EMERGENCY_H #define SRC_PG_INSERT_EMERGENCY_H diff --git a/src/auditordb/pg_insert_emergency_by_count.h b/src/auditordb/pg_insert_emergency_by_count.h index 4f4f6bb64..7fc694243 100644 --- a/src/auditordb/pg_insert_emergency_by_count.h +++ b/src/auditordb/pg_insert_emergency_by_count.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_EMERGENCY_BY_COUNT_H #define SRC_PG_INSERT_EMERGENCY_BY_COUNT_H diff --git a/src/auditordb/pg_insert_fee_time_inconsistency.c b/src/auditordb/pg_insert_fee_time_inconsistency.c index bd3f25515..857249711 100644 --- a/src/auditordb/pg_insert_fee_time_inconsistency.c +++ b/src/auditordb/pg_insert_fee_time_inconsistency.c @@ -30,9 +30,9 @@ TAH_PG_insert_fee_time_inconsistency ( struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (*dc->type), + GNUNET_PQ_query_param_string (dc->type), GNUNET_PQ_query_param_int64 (&dc->time), - GNUNET_PQ_query_param_string (*dc->diagnostic), + GNUNET_PQ_query_param_string (dc->diagnostic), GNUNET_PQ_query_param_end }; diff --git a/src/auditordb/pg_insert_fee_time_inconsistency.h b/src/auditordb/pg_insert_fee_time_inconsistency.h index 5718072e2..0d90fca41 100644 --- a/src/auditordb/pg_insert_fee_time_inconsistency.h +++ b/src/auditordb/pg_insert_fee_time_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_FEE_TIME_INCONSISTENCY_H #define SRC_PG_INSERT_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h index 1fead79b1..61705b69b 100644 --- a/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h +++ b/src/auditordb/pg_insert_purse_not_closed_inconsistencies.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_PURSE_NOT_CLOSED_INCONSISTENCIES_H #define SRC_PG_INSERT_PURSE_NOT_CLOSED_INCONSISTENCIES_H diff --git a/src/auditordb/pg_insert_refreshes_hanging.h b/src/auditordb/pg_insert_refreshes_hanging.h index 261b0a254..9965a5f62 100644 --- a/src/auditordb/pg_insert_refreshes_hanging.h +++ b/src/auditordb/pg_insert_refreshes_hanging.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_REFRESHES_HANGING_H #define SRC_PG_INSERT_REFRESHES_HANGING_H diff --git a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h index 205186549..49f262707 100644 --- a/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h +++ b/src/auditordb/pg_insert_reserve_balance_insufficient_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 27/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H #define SRC_PG_INSERT_RESERVE_BALANCE_INSUFFICIENT_INCONSISTENCY_H diff --git a/src/auditordb/pg_insert_row_inconsistency.c b/src/auditordb/pg_insert_row_inconsistency.c index 253779665..d9155d68c 100644 --- a/src/auditordb/pg_insert_row_inconsistency.c +++ b/src/auditordb/pg_insert_row_inconsistency.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_insert_row_inconsistency.h b/src/auditordb/pg_insert_row_inconsistency.h index 654adcd3e..280ef2f04 100644 --- a/src/auditordb/pg_insert_row_inconsistency.h +++ b/src/auditordb/pg_insert_row_inconsistency.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 21/03/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_INSERT_ROW_INCONSISTENCY_H #define SRC_PG_INSERT_ROW_INCONSISTENCY_H diff --git a/src/auditordb/pg_update_bad_sig_losses.c b/src/auditordb/pg_update_bad_sig_losses.c index 2ca92d8e1..4fdb1ae94 100644 --- a/src/auditordb/pg_update_bad_sig_losses.c +++ b/src/auditordb/pg_update_bad_sig_losses.c @@ -1,7 +1,18 @@ -// -// Created by parallels on 08/04/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #include "platform.h" #include "taler_pq_lib.h" diff --git a/src/auditordb/pg_update_bad_sig_losses.h b/src/auditordb/pg_update_bad_sig_losses.h index affb6a74c..aa36bb847 100644 --- a/src/auditordb/pg_update_bad_sig_losses.h +++ b/src/auditordb/pg_update_bad_sig_losses.h @@ -1,6 +1,18 @@ -// -// Created by parallels on 08/04/24. -// +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ #ifndef SRC_PG_UPDATE_BAD_SIG_LOSSES_H #define SRC_PG_UPDATE_BAD_SIG_LOSSES_H diff --git a/src/auditordb/pg_update_balances.c b/src/auditordb/pg_update_balances.c new file mode 100644 index 000000000..110184ed0 --- /dev/null +++ b/src/auditordb/pg_update_balances.c @@ -0,0 +1,48 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_update_balances.h" + +/* +Update a given resource – for now this only means suppressing +*/ +enum GNUNET_DB_QueryStatus +TAH_PG_update_balances ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&gu->row_id), + GNUNET_PQ_query_param_bool (gu->suppressed), + GNUNET_PQ_query_param_end + }; + + + PREPARE (pg, + "update_balances", + "UPDATE auditor_balances SET" + " suppressed=$2" + " WHERE row_id=$1"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_balances", + params); +} diff --git a/src/auditordb/pg_update_balances.h b/src/auditordb/pg_update_balances.h new file mode 100644 index 000000000..4253897e5 --- /dev/null +++ b/src/auditordb/pg_update_balances.h @@ -0,0 +1,29 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_UPDATE_BALANCES_H +#define SRC_PG_UPDATE_BALANCES_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_update_balances ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *dc); + +#endif // SRC_PG_UPDATE_BALANCES_H diff --git a/src/auditordb/pg_update_fee_time_inconsistency.c b/src/auditordb/pg_update_fee_time_inconsistency.c new file mode 100644 index 000000000..fe324edf8 --- /dev/null +++ b/src/auditordb/pg_update_fee_time_inconsistency.c @@ -0,0 +1,48 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#include "platform.h" +#include "taler_pq_lib.h" +#include "pg_helper.h" + +#include "pg_update_fee_time_inconsistency.h" + +/* +Update a given resource – for now this only means suppressing +*/ +enum GNUNET_DB_QueryStatus +TAH_PG_update_fee_time_inconsistency ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu) +{ + struct PostgresClosure *pg = cls; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&gu->row_id), + GNUNET_PQ_query_param_bool (gu->suppressed), + GNUNET_PQ_query_param_end + }; + + + PREPARE (pg, + "update_fee_time_inconsistency", + "UPDATE auditor_fee_time_inconsistency SET" + " suppressed=$2" + " WHERE row_id=$1"); + return GNUNET_PQ_eval_prepared_non_select (pg->conn, + "update_fee_time_inconsistency", + params); +} diff --git a/src/auditordb/pg_update_fee_time_inconsistency.h b/src/auditordb/pg_update_fee_time_inconsistency.h new file mode 100644 index 000000000..ef55de19f --- /dev/null +++ b/src/auditordb/pg_update_fee_time_inconsistency.h @@ -0,0 +1,29 @@ +/* + This file is part of TALER + Copyright (C) 2024 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + + +#ifndef SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H +#define SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H + +#include "taler_util.h" +#include "taler_auditordb_plugin.h" + +enum GNUNET_DB_QueryStatus +TAH_PG_update_fee_time_inconsistency ( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *dc); + +#endif // SRC_PG_UPDATE_FEE_TIME_INCONSISTENCY_H diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 9eb5df7b4..72d52da32 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -105,6 +105,7 @@ #include "pg_get_fee_time_inconsistency.h" #include "pg_del_fee_time_inconsistency.h" #include "pg_insert_fee_time_inconsistency.h" +#include "pg_update_fee_time_inconsistency.h" #include "pg_get_purse_not_closed_inconsistencies.h" #include "pg_del_purse_not_closed_inconsistencies.h" @@ -188,6 +189,11 @@ #include "pg_insert_row_minor_inconsistencies.h" #include "pg_update_row_minor_inconsistencies.h" +#include "pg_get_balances.h" +#include "pg_del_balances.h" +#include "pg_insert_balances.h" +#include "pg_update_balances.h" + #define LOG(kind,...) GNUNET_log_from (kind, "taler-auditordb-postgres", \ __VA_ARGS__) @@ -736,100 +742,145 @@ libtaler_plugin_auditordb_postgres_init (void *cls) plugin->insert_refreshes_hanging = &TAH_PG_insert_refreshes_hanging; plugin->get_refreshes_hanging = &TAH_PG_get_refreshes_hanging; - plugin->update_emergency_by_count = &TAH_PG_update_emergency_by_count; - plugin->update_row_inconsistency = &TAH_PG_update_row_inconsistency; - plugin->update_purse_not_closed_inconsistencies = &TAH_PG_update_purse_not_closed_inconsistencies; - plugin->update_reserve_balance_insufficient_inconsistency = &TAH_PG_update_reserve_balance_insufficient_inconsistency; - plugin->update_coin_inconsistency = &TAH_PG_update_coin_inconsistency; - plugin->update_progress = &TAH_PG_update_progress; - plugin->update_denomination_key_validity_withdraw_inconsistency = &TAH_PG_update_denomination_key_validity_withdraw_inconsistency; - plugin->update_refreshes_hanging = &TAH_PG_update_refreshes_hanging; - plugin->update_emergency = &TAH_PG_update_emergency; - plugin->update_closure_lags = &TAH_PG_update_closure_lags; - - - plugin->delete_reserve_in_inconsistency = &TAH_PG_del_reserve_in_inconsistency; - plugin->insert_reserve_in_inconsistency = &TAH_PG_insert_reserve_in_inconsistency; - plugin->get_reserve_in_inconsistency = &TAH_PG_get_reserve_in_inconsistency; - plugin->update_reserve_in_inconsistency = &TAH_PG_update_reserve_in_inconsistency; - - - plugin->delete_reserve_not_closed_inconsistency = &TAH_PG_del_reserve_not_closed_inconsistency; - plugin->insert_reserve_not_closed_inconsistency = &TAH_PG_insert_reserve_not_closed_inconsistency; - plugin->get_reserve_not_closed_inconsistency = &TAH_PG_get_reserve_not_closed_inconsistency; - plugin->update_reserve_not_closed_inconsistency = &TAH_PG_update_reserve_not_closed_inconsistency; - - - plugin->delete_denominations_without_sigs = &TAH_PG_del_denominations_without_sigs; - plugin->insert_denominations_without_sigs = &TAH_PG_insert_denominations_without_sigs; - plugin->get_denominations_without_sigs = &TAH_PG_get_denominations_without_sigs; - plugin->update_denominations_without_sigs = &TAH_PG_update_denominations_without_sigs; - - - plugin->delete_misattribution_in_inconsistency = &TAH_PG_del_misattribution_in_inconsistency; - plugin->insert_misattribution_in_inconsistency = &TAH_PG_insert_misattribution_in_inconsistency; - plugin->get_misattribution_in_inconsistency = &TAH_PG_get_misattribution_in_inconsistency; - plugin->update_misattribution_in_inconsistency = &TAH_PG_update_misattribution_in_inconsistency; - - - plugin->delete_reserves = &TAH_PG_del_reserves; - plugin->insert_reserves = &TAH_PG_insert_reserves; - plugin->get_reserves = &TAH_PG_get_reserves; - plugin->update_reserves = &TAH_PG_update_reserves; - - - plugin->delete_purses = &TAH_PG_del_purses; - plugin->insert_purses = &TAH_PG_insert_purses; - plugin->get_purses = &TAH_PG_get_purses; - plugin->update_purses = &TAH_PG_update_purses; - - - plugin->delete_historic_denomination_revenue = &TAH_PG_del_historic_denomination_revenue; - plugin->insert_historic_denomination_revenue = &TAH_PG_insert_historic_denomination_revenue; - plugin->get_historic_denomination_revenue = &TAH_PG_get_historic_denomination_revenue; - plugin->update_historic_denomination_revenue = &TAH_PG_update_historic_denomination_revenue; - - - plugin->delete_denomination_pending = &TAH_PG_del_denomination_pending; - plugin->insert_denomination_pending = &TAH_PG_insert_denomination_pending; - plugin->get_denomination_pending = &TAH_PG_get_denomination_pending; - plugin->update_denomination_pending = &TAH_PG_update_denomination_pending; - - - plugin->delete_historic_reserve_summary = &TAH_PG_del_historic_reserve_summary; - plugin->insert_historic_reserve_summary = &TAH_PG_insert_historic_reserve_summary; - plugin->get_historic_reserve_summary = &TAH_PG_get_historic_reserve_summary; - plugin->update_historic_reserve_summary = &TAH_PG_update_historic_reserve_summary; - - - plugin->delete_exchange_signkeys = &TAH_PG_del_exchange_signkeys; - plugin->insert_exchange_signkeys = &TAH_PG_insert_exchange_signkeys; - plugin->get_exchange_signkeys = &TAH_PG_get_exchange_signkeys; - plugin->update_exchange_signkeys = &TAH_PG_update_exchange_signkeys; - - - plugin->delete_wire_format_inconsistency = &TAH_PG_del_wire_format_inconsistency; - plugin->insert_wire_format_inconsistency = &TAH_PG_insert_wire_format_inconsistency; - plugin->get_wire_format_inconsistency = &TAH_PG_get_wire_format_inconsistency; - plugin->update_wire_format_inconsistency = &TAH_PG_update_wire_format_inconsistency; - - - plugin->delete_wire_out_inconsistency = &TAH_PG_del_wire_out_inconsistency; - plugin->insert_wire_out_inconsistency = &TAH_PG_insert_wire_out_inconsistency; - plugin->get_wire_out_inconsistency = &TAH_PG_get_wire_out_inconsistency; - plugin->update_wire_out_inconsistency = &TAH_PG_update_wire_out_inconsistency; - - - plugin->delete_reserve_balance_summary_wrong_inconsistency = &TAH_PG_del_reserve_balance_summary_wrong_inconsistency; - plugin->insert_reserve_balance_summary_wrong_inconsistency = &TAH_PG_insert_reserve_balance_summary_wrong_inconsistency; - plugin->get_reserve_balance_summary_wrong_inconsistency = &TAH_PG_get_reserve_balance_summary_wrong_inconsistency; - plugin->update_reserve_balance_summary_wrong_inconsistency = &TAH_PG_update_reserve_balance_summary_wrong_inconsistency; - - - plugin->delete_row_minor_inconsistencies = &TAH_PG_del_row_minor_inconsistencies; - plugin->insert_row_minor_inconsistencies = &TAH_PG_insert_row_minor_inconsistencies; - plugin->get_row_minor_inconsistencies = &TAH_PG_get_row_minor_inconsistencies; - plugin->update_row_minor_inconsistencies = &TAH_PG_update_row_minor_inconsistencies; + plugin->update_emergency_by_count = &TAH_PG_update_emergency_by_count; + plugin->update_row_inconsistency = &TAH_PG_update_row_inconsistency; + plugin->update_purse_not_closed_inconsistencies = + &TAH_PG_update_purse_not_closed_inconsistencies; + plugin->update_reserve_balance_insufficient_inconsistency = + &TAH_PG_update_reserve_balance_insufficient_inconsistency; + plugin->update_coin_inconsistency = &TAH_PG_update_coin_inconsistency; + plugin->update_progress = &TAH_PG_update_progress; + plugin->update_denomination_key_validity_withdraw_inconsistency = + &TAH_PG_update_denomination_key_validity_withdraw_inconsistency; + plugin->update_refreshes_hanging = &TAH_PG_update_refreshes_hanging; + plugin->update_emergency = &TAH_PG_update_emergency; + plugin->update_closure_lags = &TAH_PG_update_closure_lags; + + + plugin->delete_reserve_in_inconsistency = + &TAH_PG_del_reserve_in_inconsistency; + plugin->insert_reserve_in_inconsistency = + &TAH_PG_insert_reserve_in_inconsistency; + plugin->get_reserve_in_inconsistency = &TAH_PG_get_reserve_in_inconsistency; + plugin->update_reserve_in_inconsistency = + &TAH_PG_update_reserve_in_inconsistency; + + + plugin->delete_reserve_not_closed_inconsistency = + &TAH_PG_del_reserve_not_closed_inconsistency; + plugin->insert_reserve_not_closed_inconsistency = + &TAH_PG_insert_reserve_not_closed_inconsistency; + plugin->get_reserve_not_closed_inconsistency = + &TAH_PG_get_reserve_not_closed_inconsistency; + plugin->update_reserve_not_closed_inconsistency = + &TAH_PG_update_reserve_not_closed_inconsistency; + + + plugin->delete_denominations_without_sigs = + &TAH_PG_del_denominations_without_sigs; + plugin->insert_denominations_without_sigs = + &TAH_PG_insert_denominations_without_sigs; + plugin->get_denominations_without_sigs = + &TAH_PG_get_denominations_without_sigs; + plugin->update_denominations_without_sigs = + &TAH_PG_update_denominations_without_sigs; + + + plugin->delete_misattribution_in_inconsistency = + &TAH_PG_del_misattribution_in_inconsistency; + plugin->insert_misattribution_in_inconsistency = + &TAH_PG_insert_misattribution_in_inconsistency; + plugin->get_misattribution_in_inconsistency = + &TAH_PG_get_misattribution_in_inconsistency; + plugin->update_misattribution_in_inconsistency = + &TAH_PG_update_misattribution_in_inconsistency; + + + plugin->delete_reserves = &TAH_PG_del_reserves; + plugin->insert_reserves = &TAH_PG_insert_reserves; + plugin->get_reserves = &TAH_PG_get_reserves; + plugin->update_reserves = &TAH_PG_update_reserves; + + + plugin->delete_purses = &TAH_PG_del_purses; + plugin->insert_purses = &TAH_PG_insert_purses; + plugin->get_purses = &TAH_PG_get_purses; + plugin->update_purses = &TAH_PG_update_purses; + + + plugin->delete_historic_denomination_revenue = + &TAH_PG_del_historic_denomination_revenue; + plugin->insert_historic_denomination_revenue = + &TAH_PG_insert_historic_denomination_revenue; + plugin->get_historic_denomination_revenue = + &TAH_PG_get_historic_denomination_revenue; + plugin->update_historic_denomination_revenue = + &TAH_PG_update_historic_denomination_revenue; + + + plugin->delete_denomination_pending = &TAH_PG_del_denomination_pending; + plugin->insert_denomination_pending = &TAH_PG_insert_denomination_pending; + plugin->get_denomination_pending = &TAH_PG_get_denomination_pending; + plugin->update_denomination_pending = &TAH_PG_update_denomination_pending; + + + plugin->delete_historic_reserve_summary = + &TAH_PG_del_historic_reserve_summary; + plugin->insert_historic_reserve_summary = + &TAH_PG_insert_historic_reserve_summary; + plugin->get_historic_reserve_summary = &TAH_PG_get_historic_reserve_summary; + plugin->update_historic_reserve_summary = + &TAH_PG_update_historic_reserve_summary; + + + plugin->delete_exchange_signkeys = &TAH_PG_del_exchange_signkeys; + plugin->insert_exchange_signkeys = &TAH_PG_insert_exchange_signkeys; + plugin->get_exchange_signkeys = &TAH_PG_get_exchange_signkeys; + plugin->update_exchange_signkeys = &TAH_PG_update_exchange_signkeys; + + + plugin->delete_wire_format_inconsistency = + &TAH_PG_del_wire_format_inconsistency; + plugin->insert_wire_format_inconsistency = + &TAH_PG_insert_wire_format_inconsistency; + plugin->get_wire_format_inconsistency = &TAH_PG_get_wire_format_inconsistency; + plugin->update_wire_format_inconsistency = + &TAH_PG_update_wire_format_inconsistency; + + + plugin->delete_wire_out_inconsistency = &TAH_PG_del_wire_out_inconsistency; + plugin->insert_wire_out_inconsistency = &TAH_PG_insert_wire_out_inconsistency; + plugin->get_wire_out_inconsistency = &TAH_PG_get_wire_out_inconsistency; + plugin->update_wire_out_inconsistency = &TAH_PG_update_wire_out_inconsistency; + + + plugin->delete_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_del_reserve_balance_summary_wrong_inconsistency; + plugin->insert_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_insert_reserve_balance_summary_wrong_inconsistency; + plugin->get_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_get_reserve_balance_summary_wrong_inconsistency; + plugin->update_reserve_balance_summary_wrong_inconsistency = + &TAH_PG_update_reserve_balance_summary_wrong_inconsistency; + + + plugin->delete_row_minor_inconsistencies = + &TAH_PG_del_row_minor_inconsistencies; + plugin->insert_row_minor_inconsistencies = + &TAH_PG_insert_row_minor_inconsistencies; + plugin->get_row_minor_inconsistencies = &TAH_PG_get_row_minor_inconsistencies; + plugin->update_row_minor_inconsistencies = + &TAH_PG_update_row_minor_inconsistencies; + + plugin->delete_fee_time_inconsistency = &TAH_PG_del_fee_time_inconsistency; + plugin->insert_fee_time_inconsistency = &TAH_PG_insert_fee_time_inconsistency; + plugin->get_fee_time_inconsistency = &TAH_PG_get_fee_time_inconsistency; + plugin->update_fee_time_inconsistency = &TAH_PG_update_fee_time_inconsistency; + + plugin->delete_balances = &TAH_PG_del_balances; + plugin->insert_balances = &TAH_PG_insert_balances; + plugin->get_balances = &TAH_PG_get_balances; + plugin->update_balances = &TAH_PG_update_balances; return plugin; } diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h index 4e4ec81a2..a2253cdc2 100644 --- a/src/include/taler_auditordb_plugin.h +++ b/src/include/taler_auditordb_plugin.h @@ -225,7 +225,7 @@ struct TALER_AUDITORDB_AmountArithmeticInconsistency struct TALER_AUDITORDB_CoinInconsistency { unsigned int row_id; - char *operation; // TODO: change to string + char *operation; struct TALER_Amount exchange_amount; struct TALER_Amount auditor_amount; struct GNUNET_CRYPTO_EddsaPublicKey coin_pub; @@ -359,6 +359,9 @@ struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency struct TALER_Amount inconsistency_amount; }; +/** + * Information about a reserve in inconsistency + */ struct TALER_AUDITORDB_ReserveInInconsistency { unsigned int row_id; @@ -373,6 +376,18 @@ struct TALER_AUDITORDB_ReserveInInconsistency }; /** + * Information about a balance + */ +struct TALER_AUDITORDB_Balances +{ + unsigned int row_id; + char *balance_key; + struct TALER_Amount balance_value; + bool suppressed; + +}; + +/** * Function called with arithmetic inconsistencies stored in * the auditor's database. * @@ -568,6 +583,20 @@ typedef enum GNUNET_GenericReturnValue uint64_t serial_id, const struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency *dc); +/** + * Function called with reserve balance insufficient inconsistency stored in + * the auditor's database. + * + * @param cls closure + * @param serial_id location of the @a dc in the database + * @param dc the balance itself + * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating + */ +typedef enum GNUNET_GenericReturnValue +(*TALER_AUDITORDB_BalancesCallback)( + void *cls, + uint64_t serial_id, + const struct TALER_AUDITORDB_Balances *dc); /** * Balance values for a reserve (or all reserves). @@ -931,6 +960,13 @@ typedef enum GNUNET_GenericReturnValue uint64_t serial_id, const struct TALER_AUDITORDB_RowMinorInconsistencies *dc); + +typedef enum GNUNET_GenericReturnValue +(*TALER_AUDITORDB_FeeTimeInconsistencyCallback)( + void *cls, + uint64_t serial_id, + const struct TALER_AUDITORDB_FeeTimeInconsistency *dc); + /** * @brief The plugin API, returned from the plugin's "init" function. * The argument given to "init" is simply a configuration handle. @@ -1330,6 +1366,9 @@ struct TALER_AUDITORDB_Plugin int64_t limit, uint64_t offset, bool return_suppressed, + bool filter_spec_pub, + struct GNUNET_CRYPTO_EddsaPublicKey op_spec_pub, + const char *op, TALER_AUDITORDB_BadSigLossesCallback cb, void *cb_cls); @@ -1955,17 +1994,73 @@ struct TALER_AUDITORDB_Plugin const struct TALER_AUDITORDB_Generic_Update *gu); + enum GNUNET_DB_QueryStatus + (*get_fee_time_inconsistency)( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + TALER_AUDITORDB_FeeTimeInconsistencyCallback cb, + void *cb_cls); + + + enum GNUNET_DB_QueryStatus + (*delete_fee_time_inconsistency)( + void *cls, + uint64_t row_id); + + + enum GNUNET_DB_QueryStatus + (*insert_fee_time_inconsistency)( + void *cls, + const struct TALER_AUDITORDB_FeeTimeInconsistency *dc); + + + enum GNUNET_DB_QueryStatus + (*update_fee_time_inconsistency)( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu); + + enum GNUNET_DB_QueryStatus + (*get_balances)( + void *cls, + int64_t limit, + uint64_t offset, + bool return_suppressed, + const char *balance_key, + TALER_AUDITORDB_BalancesCallback cb, + void *cb_cls); + + + enum GNUNET_DB_QueryStatus + (*delete_balances)( + void *cls, + uint64_t row_id); + + + enum GNUNET_DB_QueryStatus + (*insert_balances)( + void *cls, + const struct TALER_AUDITORDB_Balances *dc); + + + enum GNUNET_DB_QueryStatus + (*update_balances)( + void *cls, + const struct TALER_AUDITORDB_Generic_Update *gu); + + /** - * Insert information about a reserve. There must not be an - * existing record for the reserve. - * - * @param cls the @e cls of this struct with the plugin-specific state - * @param reserve_pub public key of the reserve - * @param rfb balance amounts for the reserve - * @param expiration_date expiration date of the reserve - * @param origin_account where did the money in the reserve originally come from - * @return transaction status code - */ + * Insert information about a reserve. There must not be an + * existing record for the reserve. + * + * @param cls the @e cls of this struct with the plugin-specific state + * @param reserve_pub public key of the reserve + * @param rfb balance amounts for the reserve + * @param expiration_date expiration date of the reserve + * @param origin_account where did the money in the reserve originally come from + * @return transaction status code + */ enum GNUNET_DB_QueryStatus (*insert_reserve_info)( void *cls, |