[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-donau] branch master updated: Added get history
From: |
gnunet |
Subject: |
[taler-donau] branch master updated: Added get history |
Date: |
Sun, 14 Jan 2024 21:16:26 +0100 |
This is an automated email from the git hooks/post-receive script.
johannes-casaburi pushed a commit to branch master
in repository donau.
The following commit(s) were added to refs/heads/master by this push:
new 656c959 Added get history
656c959 is described below
commit 656c959876b133f5e3309c10396a18cc7498c466
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sun Jan 14 21:15:46 2024 +0100
Added get history
---
src/donau/Makefile.am | 1 +
src/donau/donau-httpd_get-history-entry.c | 113 ++++++++++++++++++++++++
src/donau/donau-httpd_get-history.c | 120 +++++++++++++++++++++++++
src/donau/donau-httpd_history.h | 39 ++++++++
src/donaudb/Makefile.am | 1 +
src/donaudb/pg_get_history.c | 132 +++++++++++++++++++++++++++
src/donaudb/pg_get_history.h | 39 ++++++++
src/donaudb/pg_helper.h | 60 ++++++-------
src/donaudb/plugin_donaudb_postgres.c | 39 ++++----
src/include/donaudb_plugin.h | 142 +++++++++++++++++++++++++++++-
10 files changed, 636 insertions(+), 50 deletions(-)
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
index 9eda8cf..627ec45 100644
--- a/src/donau/Makefile.am
+++ b/src/donau/Makefile.am
@@ -44,6 +44,7 @@ donau_httpd_SOURCES = \
donau-httpd_config.c donau-httpd_config.h \
donau-httpd_get-charities.c donau_httpd_charity.h \
donau-httpd_get-charity.c donau-httpd_post-charity.c \
+ donau-httpd_get-history.c donau-httpd_history.h \
donau-httpd_terms.c donau-httpd_terms.h
# Testcases
diff --git a/src/donau/donau-httpd_get-history-entry.c
b/src/donau/donau-httpd_get-history-entry.c
new file mode 100644
index 0000000..51853c9
--- /dev/null
+++ b/src/donau/donau-httpd_get-history-entry.c
@@ -0,0 +1,113 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2023 Taler Systems SA
+
+ TALER is free software; you can redistribute it and/or modify it under the
+ terms of the GNU Affero 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 Affero General Public License for more
details.
+
+ You should have received a copy of the GNU Affero General Public License
along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_history-get.c
+ * @brief Return summary information about AML decision
+ * @author Johannes Casaburi
+ */
+#include "taler/platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <jansson.h>
+#include <microhttpd.h>
+#include <pthread.h>
+#include "taler/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler/taler_signatures.h"
+#include "donaudb_plugin.h"
+#include "donau-httpd_history.h"
+// #include "donau-httpd.h"
+// #include "donau-httpd_metrics.h"
+
+
+/**
+ * Maximum number of records we return per request.
+ */
+#define MAX_RECORDS 1024
+
+MHD_RESULT
+DH_handler_history_get (
+ struct DH_RequestContext *rc,
+ const char *const args[])
+{
+ unsigned long long charity_id;
+ char dummy;
+
+ if ( (NULL == args[0]) ||
+ (1 != sscanf (args[0],
+ "%llu%c",
+ &charity_id,
+ &dummy)) )
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PARAMETER_MALFORMED,
+ "charity_id");
+ }
+
+ if (NULL != args[1])
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+ args[1]);
+ }
+
+ {
+ struct DONAUDB_CharityMetaData meta;
+ enum GNUNET_DB_QueryStatus qs;
+ MHD_RESULT result;
+
+ qs = DH_plugin->lookup_history_entry (DH_plugin->cls,
+ charity_id,
+ &meta);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ return TALER_MHD_reply_static (
+ rc->connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ break;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
+
+ result = TALER_MHD_REPLY_JSON_PACK (
+ rc->connection,
+ MHD_HTTP_OK,
+ TALER_JSON_pack_amount ("final_amount",
+ meta.final_amount),
+ GNUNET_JSON_pack_uint64 ("donation_year",
+ meta.donation_year));
+
+ GNUNET_free (meta.final_amount);
+ return result;
+ }
+}
+
+
+/* end of donau-httpd_aml-decision_get.c */
diff --git a/src/donau/donau-httpd_get-history.c
b/src/donau/donau-httpd_get-history.c
new file mode 100644
index 0000000..8ee6365
--- /dev/null
+++ b/src/donau/donau-httpd_get-history.c
@@ -0,0 +1,120 @@
+/*
+ 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 Affero 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 Affero General Public License for more
details.
+
+ You should have received a copy of the GNU Affero General Public License
along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_get-history.c
+ * @brief Return history
+ * @author Johannes Casaburi
+ */
+#include "taler/platform.h"
+#include <gnunet/gnunet_util_lib.h>
+#include <jansson.h>
+#include <microhttpd.h>
+#include "taler/taler_json_lib.h"
+#include "taler/taler_mhd_lib.h"
+#include "taler/taler_signatures.h"
+#include "donau-httpd.h"
+#include "donaudb_plugin.h"
+#include "donau-httpd_history.h"
+// #include "taler-exchange-httpd_metrics.h"
+
+
+/**
+ * Maximum number of history we return per request.
+ */
+#define MAX_RECORDS 1024
+
+/**
+ * Return history information.
+ *
+ * @param cls closure
+ */
+static void
+history_cb (
+ void *cls,
+ uint64_t charity_id,
+ struct TALER_Amount final_amount,
+ uint64_t donation_year)
+{
+ json_t *history = cls;
+
+ GNUNET_assert (
+ 0 ==
+ json_array_append (
+ history,
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_int64 ("charity_id",
+ charity_id),
+ TALER_JSON_pack_amount ("final_amount",
+ &final_amount),
+ GNUNET_JSON_pack_int64 ("donation_year",
+ donation_year))));
+}
+
+
+MHD_RESULT
+DH_handler_history_get (
+ struct DH_RequestContext *rc,
+ const char *const args[])
+{
+
+ if (NULL != args[1])
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_ENDPOINT_UNKNOWN,
+ args[1]);
+ }
+
+ {
+ json_t *history;
+ enum GNUNET_DB_QueryStatus qs;
+
+ history = json_array ();
+ GNUNET_assert (NULL != history);
+ qs = DH_plugin->get_history (DH_plugin->cls,
+ &history_cb,
+ history);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ json_decref (history);
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (rc->connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ NULL);
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ return TALER_MHD_reply_static (
+ rc->connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ }
+ return TALER_MHD_REPLY_JSON_PACK (
+ rc->connection,
+ MHD_HTTP_OK,
+ GNUNET_JSON_pack_array_steal ("history",
+ history));
+ }
+}
+
+
+/* end of donau-httpd_get-history.c */
diff --git a/src/donau/donau-httpd_history.h b/src/donau/donau-httpd_history.h
new file mode 100644
index 0000000..93e7782
--- /dev/null
+++ b/src/donau/donau-httpd_history.h
@@ -0,0 +1,39 @@
+/*
+ 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 Affero 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 Affero General Public License for more
details.
+
+ You should have received a copy of the GNU Affero General Public License
along with
+ TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+*/
+/**
+ * @file donau-httpd_history.h
+ * @brief Handle /history requests
+ * @author Johannes Casaburi
+ */
+#ifndef DONAU_HTTPD_HISTORY_H
+#define DONAU_HTTPD_HISTORY_H
+
+#include <microhttpd.h>
+#include "donau-httpd.h"
+
+/**
+ * Handle a GET "/history" request.
+ *
+ * @param rc request context
+ * @param args GET arguments (should be one)
+ * @return MHD result code
+ */
+MHD_RESULT
+DH_handler_history_get (
+ struct DH_RequestContext *rc,
+ const char *const args[]);
+
+#endif
diff --git a/src/donaudb/Makefile.am b/src/donaudb/Makefile.am
index c8a5abf..fe9468a 100644
--- a/src/donaudb/Makefile.am
+++ b/src/donaudb/Makefile.am
@@ -83,6 +83,7 @@ libtaler_plugin_donaudb_postgres_la_SOURCES = \
pg_add_donation_unit_key.c pg_add_donation_unit_key.h \
pg_lookup_donation_unit.c pg_lookup_donation_unit.h \
pg_get_donation_units.c pg_get_donation_units.h \
+ pg_get_history.h pg_get_history.c \
pg_get_charities.h pg_get_charities.c \
pg_insert_charity.h pg_insert_charity.c \
pg_lookup_charity.h pg_lookup_charity.c \
diff --git a/src/donaudb/pg_get_history.c b/src/donaudb/pg_get_history.c
new file mode 100644
index 0000000..9606e3f
--- /dev/null
+++ b/src/donaudb/pg_get_history.c
@@ -0,0 +1,132 @@
+/*
+ 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 CHARITYABILITY 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/>
+ */
+/**
+ * @file donaudb/pg_get_history.c
+ * @brief Implementation of the lookup_donation_unit_key function for Postgres
+ * @author Johannes Casaburi
+ */
+#include "taler/platform.h"
+#include "taler/taler_error_codes.h"
+#include "taler/taler_dbevents.h"
+#include "taler/taler_pq_lib.h"
+#include "pg_get_history.h"
+#include "pg_helper.h"
+
+
+/**
+ * Closure for #get_history_cb().
+ */
+struct GetHistoryContext
+{
+ /**
+ * Function to call per result.
+ */
+ DONAUDB_GetHistoryCallback cb;
+
+ /**
+ * Closure for @e cb.
+ */
+ void *cb_cls;
+
+ /**
+ * Flag set to #GNUNET_OK as long as everything is fine.
+ */
+ enum GNUNET_GenericReturnValue status;
+
+};
+
+
+/**
+ * Invoke the callback for each result.
+ *
+ * @param cls a `struct MissingWireContext *`
+ * @param result SQL result
+ * @param num_results number of rows in @a result
+ */
+static void
+get_history_cb (void *cls,
+ PGresult *result,
+ unsigned int num_results)
+{
+ struct GetHistoryContext *ctx = cls;
+
+ for (unsigned int i = 0; i < num_results; i++)
+ {
+ uint64_t charity_id;
+ struct TALER_Amount final_amount;
+ uint64_t donation_year;
+
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("charity_id",
+ &charity_id),
+ TALER_PQ_result_spec_amount ("final_amount",
+ "EUR", // TODO: Error if using
TALER_PQ_RESULT_SPEC_AMOUNT
+ &final_amount),
+ GNUNET_PQ_result_spec_uint64 ("donation_year",
+ &donation_year),
+ GNUNET_PQ_result_spec_end
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_PQ_extract_result (result,
+ rs,
+ i))
+ {
+ GNUNET_break (0);
+ ctx->status = GNUNET_SYSERR;
+ return;
+ }
+ ctx->cb (ctx->cb_cls,
+ charity_id,
+ final_amount,
+ donation_year);
+ GNUNET_PQ_cleanup_result (rs);
+ }
+}
+
+
+enum GNUNET_DB_QueryStatus
+DH_PG_get_history (void *cls,
+ DONAUDB_GetHistoryCallback cb,
+ void *cb_cls)
+{
+ struct PostgresClosure *pg = cls;
+ struct GetHistoryContext ctx = {
+ .cb = cb,
+ .cb_cls = cb_cls,
+ .status = GNUNET_OK
+ };
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_end
+ };
+ enum GNUNET_DB_QueryStatus qs;
+
+ PREPARE (pg,
+ "get_history",
+ "SELECT"
+ " charity_id"
+ ",final_amount"
+ ",donation_year"
+ " FROM history");
+ qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
+ "get_history",
+ params,
+ &get_history_cb,
+ &ctx);
+ if (GNUNET_OK != ctx.status)
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ return qs;
+}
diff --git a/src/donaudb/pg_get_history.h b/src/donaudb/pg_get_history.h
new file mode 100644
index 0000000..ab0dbc0
--- /dev/null
+++ b/src/donaudb/pg_get_history.h
@@ -0,0 +1,39 @@
+/*
+ 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 CHARITYABILITY 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/>
+ */
+/**
+ * @file donaudb/pg_get_history.h
+ * @brief implementation of the get_history function for Postgres
+ * @author Johannes Casaburi
+ */
+#ifndef PG_GET_HISTORY_H
+#define PG_GET_HISTORY_H
+
+#include "donaudb_plugin.h"
+
+/**
+ * Obtain information about the enabled wire accounts of the exchange.
+ *
+ * @param cls closure
+ * @param cb function to call on each account
+ * @param cb_cls closure for @a cb
+ * @return transaction status code
+ */
+enum GNUNET_DB_QueryStatus
+DH_PG_get_history (void *cls,
+ DONAUDB_GetHistoryCallback cb,
+ void *cb_cls);
+
+#endif
diff --git a/src/donaudb/pg_helper.h b/src/donaudb/pg_helper.h
index d21a0ea..017e7c4 100644
--- a/src/donaudb/pg_helper.h
+++ b/src/donaudb/pg_helper.h
@@ -78,37 +78,37 @@ struct PostgresClosure
* @param sql actual SQL text
*/
#define PREPARE(pg,name,sql) \
- do { \
- static struct { \
- unsigned long long cnt; \
- struct PostgresClosure *pg; \
- } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \
- unsigned int off = 0; \
+ do { \
+ static struct { \
+ unsigned long long cnt; \
+ struct PostgresClosure *pg; \
+ } preps[2]; /* 2 ctrs for taler-auditor-sync*/ \
+ unsigned int off = 0; \
\
- while ( (NULL != preps[off].pg) && \
- (pg != preps[off].pg) && \
- (off < sizeof(preps) / sizeof(*preps)) ) \
- off++; \
- GNUNET_assert (off < \
- sizeof(preps) / sizeof(*preps)); \
- if (preps[off].cnt < pg->prep_gen) \
- { \
- struct GNUNET_PQ_PreparedStatement ps[] = { \
- GNUNET_PQ_make_prepare (name, sql), \
- GNUNET_PQ_PREPARED_STATEMENT_END \
- }; \
+ while ( (NULL != preps[off].pg) && \
+ (pg != preps[off].pg) && \
+ (off < sizeof(preps) / sizeof(*preps)) ) \
+ off++; \
+ GNUNET_assert (off < \
+ sizeof(preps) / sizeof(*preps)); \
+ if (preps[off].cnt < pg->prep_gen) \
+ { \
+ struct GNUNET_PQ_PreparedStatement ps[] = { \
+ GNUNET_PQ_make_prepare (name, sql), \
+ GNUNET_PQ_PREPARED_STATEMENT_END \
+ }; \
\
- if (GNUNET_OK != \
- GNUNET_PQ_prepare_statements (pg->conn, \
- ps)) \
- { \
- GNUNET_break (0); \
- return GNUNET_DB_STATUS_HARD_ERROR; \
- } \
- preps[off].pg = pg; \
- preps[off].cnt = pg->prep_gen; \
- } \
- } while (0)
+ if (GNUNET_OK != \
+ GNUNET_PQ_prepare_statements (pg->conn, \
+ ps)) \
+ { \
+ GNUNET_break (0); \
+ return GNUNET_DB_STATUS_HARD_ERROR; \
+ } \
+ preps[off].pg = pg; \
+ preps[off].cnt = pg->prep_gen; \
+ } \
+ } while (0)
/**
@@ -120,7 +120,7 @@ struct PostgresClosure
*/
#define TALER_PQ_RESULT_SPEC_AMOUNT(field, \
amountp) TALER_PQ_result_spec_amount ( \
- field,pg->currency,amountp)
+ field,pg->currency,amountp)
#endif
diff --git a/src/donaudb/plugin_donaudb_postgres.c
b/src/donaudb/plugin_donaudb_postgres.c
index 6386d15..ba11bd3 100644
--- a/src/donaudb/plugin_donaudb_postgres.c
+++ b/src/donaudb/plugin_donaudb_postgres.c
@@ -52,6 +52,7 @@
#include "pg_add_donation_unit_key.h"
#include "pg_lookup_donation_unit.h"
#include "pg_insert_history_entry.h"
+#include "pg_get_history.h"
#include "pg_insert_issued_receipt.h"
#include "pg_insert_submitted_receipt.h"
#include "pg_insert_signing_key.h"
@@ -274,27 +275,29 @@ libtaler_plugin_donaudb_postgres_init (void *cls)
= &DH_PG_event_listen_cancel;
plugin->event_notify
= &DH_PG_event_notify;
- // plugin->get_policy_details
- // = &DH_PG_get_policy_details;
- // plugin->persist_policy_details
- // = &DH_PG_persist_policy_details;
+ //plugin->get_policy_details
+ // = &DH_PG_get_policy_details;
+ //plugin->persist_policy_details
+ // = &DH_PG_persist_policy_details;
// plugin->gc
// = &DH_PG_gc;
- // plugin->add_donation_unit_key
- // = &DH_PG_add_donation_unit_key;
- // plugin->lookup_donation_unit
- // = &DH_PG_lookup_donation_unit;
- // plugin->insert_history_entry
- // = &DH_PG_insert_history_entry;
- // plugin->insert_issued_receipt
- // = &DH_PG_insert_issued_receipt;
- // plugin->insert_submitted_receipt
- // = &DH_PG_insert_submitted_receipt;
- // plugin->insert_signing_key
- // = &DH_PG_insert_signing_key;
- // plugin->lookup_signing_key
- // = &DH_PG_lookup_signing_key;
+ plugin->add_donation_unit_key
+ = &DH_PG_add_donation_unit_key;
+ plugin->lookup_donation_unit
+ = &DH_PG_lookup_donation_unit;
+ plugin->insert_history_entry
+ = &DH_PG_insert_history_entry;
+ plugin->get_history
+ = &DH_PG_get_history;
+ plugin->insert_issued_receipt
+ = &DH_PG_insert_issued_receipt;
+ plugin->insert_submitted_receipt
+ = &DH_PG_insert_submitted_receipt;
+ plugin->insert_signing_key
+ = &DH_PG_insert_signing_key;
+ plugin->lookup_signing_key
+ = &DH_PG_lookup_signing_key;
plugin->lookup_charity
= &DH_PG_lookup_charity;
plugin->insert_charity
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index 5ae015c..c841eb2 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -189,6 +189,20 @@ typedef void
struct TALER_Amount receipts_to_date,
uint64_t current_year);
+/**
+ * Return history.
+ *
+ * @param cls closure
+ * @param charity_url
+ * @param charity_name
+ */
+typedef void
+(*DONAUDB_GetHistoryCallback)(
+ void *cls,
+ uint64_t charity_id,
+ struct TALER_Amount final_amount,
+ uint64_t donation_year);
+
/**
* @brief The plugin API, returned from the plugin's "init" function.
* The argument given to "init" is simply a configuration handle.
@@ -373,7 +387,7 @@ struct DONAUDB_Plugin
uint64_t charity_id,
struct DONAUDB_CharityMetaData *meta);
-/**
+ /**
* Get charities.
*
* @param cls closure
@@ -418,7 +432,131 @@ struct DONAUDB_Plugin
void *cls,
DONAUDB_GetDonationUnitsCallback cb,
void *cb_cls);
-};
+ /**
+ * Get history.
+ *
+ * @param cls closure
+ * @param cb callback to invoke on each match
+ * @param cb_cls closure for @a cb
+ * @return database transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*get_history)(
+ void *cls,
+ DONAUDB_GetHistoryCallback cb,
+ void *cb_cls);
+
+ /**
+ * Get donation_unit_key.
+ *
+ * @param cls closure
+ * @param donation_unit_pub
+ * @param meta
+ * @return database transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*add_donation_unit_key)(
+ void *cls,
+ const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
+ struct DONAUDB_DonationUnitKeyMetaData *meta);
+
+ /**
+ * Lookup information about current donation unit key.
+ *
+ * @param cls closure
+ * @param h_donation_unit_pub hash of the donation_unit public key
+ * @param[out] meta set to various meta data about the key
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_donation_unit)(
+ void *cls,
+ const struct DONAU_DonationUnitHashP *h_donation_unit_pub,
+ struct DONAUDB_DonationUnitKeyMetaData *meta);
+
+ /**
+ * Insert history entry of a charity
+ *
+ * @param cls closure
+ * @param charity_id charity id
+ * @param final_amount final donation amount at the end of the donation year
+ * @param donation_year year of the donations
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_history_entry) (
+ void *cls,
+ const uint64_t charity_id,
+ const struct TALER_Amount *final_amount,
+ const uint64_t donation_year);
+
+ /**
+ * Insert issued blinded donation receipt to the charity.
+ *
+ * @param cls closure
+ * @param charity_sig signature from the charity
+ * @param charity_id identifier of the charity
+ * @param h_receipt hash of the donation receipt
+ * @param amount donation amount
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_issued_receipt) (
+ void *cls,
+ const struct DONAU_CharitySignatureP *charity_sig,
+ const uint64_t charity_id,
+ const struct DONAU_DonationReceiptHashP *h_receipt,
+ const struct TALER_Amount *amount);
+
+ /**
+ * Insert submitted donation receipt from the donor.
+ *
+ * @param cls closure
+ * @param h_tax_number salted hash of the donors tax number
+ * @param nonce nonce that is part of the unique donation identifier
+ * @param donation_unit_pub donation unit public key
+ * @param donau_sig donau signature in case the sign keys changed
+ * @param donation_year year of the donation
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_submitted_receipt) (
+ void *cls,
+ const struct DONAU_HashDonorTaxId *h_tax_number,
+ const union GNUNET_CRYPTO_BlindSessionNonce *nonce,
+ const struct DONAU_DonationUnitPublicKey *donation_unit_pub,
+ const struct TALER_DonauSignatureP *donau_sig,
+ const uint64_t donation_year);
+
+ /**
+ * Add signing key.
+ *
+ * @param cls closure
+ * @param donau_pub the donau online signing public key
+ * @param meta meta data about @a donau_pub
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_signing_key) (
+ void *cls,
+ const struct DONAU_DonauPublicKeyP *donau_pub,
+ struct DONAUDB_SignkeyMetaData *meta);
+
+ /**
+ * Lookup signing key meta data.
+ *
+ * @param cls closure
+ * @param donau_pub the donau signing public key
+ * @param[out] meta meta data about @a donau_pub
+ * @return transaction status code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_signing_key) (
+ void *cls,
+ const struct DONAU_DonauPublicKeyP *donau_pub,
+ struct DONAUDB_SignkeyMetaData *meta);
+
+};
#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-donau] branch master updated: Added get history,
gnunet <=