donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit bbb6a2b56f1286e176070f6a5c08fc5d1da1da17
parent 42c9c1595b85df8b33bc7d25a08ee48364087c49
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Mon, 27 Nov 2023 14:52:56 +0100

[db] comments and fixes

Diffstat:
Msrc/donaudb/pg_insert_charity.c | 5++++-
Msrc/donaudb/pg_insert_charity.h | 11+++++++----
Msrc/donaudb/pg_insert_history_entry.c | 1-
Msrc/donaudb/pg_insert_history_entry.h | 10++++------
Msrc/donaudb/pg_insert_issued_receipt.c | 9++++-----
Msrc/donaudb/pg_insert_issued_receipt.h | 12+++++++-----
Msrc/donaudb/pg_insert_submitted_receipt.c | 1-
Msrc/donaudb/pg_insert_submitted_receipt.h | 12++++++------
Msrc/donaudb/pg_lookup_donation_unit_key.c | 5++---
Msrc/donaudb/pg_lookup_donation_unit_key.h | 2+-
Msrc/donaudb/pg_lookup_signing_key.h | 3++-
11 files changed, 37 insertions(+), 34 deletions(-)

diff --git a/src/donaudb/pg_insert_charity.c b/src/donaudb/pg_insert_charity.c @@ -30,6 +30,7 @@ TEH_PG_insert_charity (void *cls, const struct DONAU_CharityPublicKeyP *charity_pub, const char *charity_url, const char *charity_name, + struct TALER_Amount *receipts_to_date, uint64_t current_year) { struct PostgresClosure *pg = cls; @@ -37,6 +38,7 @@ TEH_PG_insert_charity (void *cls, GNUNET_PQ_query_param_auto_from_type (charity_pub), GNUNET_PQ_query_param_string (charity_name), GNUNET_PQ_query_param_string (charity_url), + TALER_PQ_query_param_amount (receipts_to_date), GNUNET_PQ_query_param_uint64 (&current_year), GNUNET_PQ_query_param_end }; @@ -47,9 +49,10 @@ TEH_PG_insert_charity (void *cls, "(charity_pub" ",charity_name" ",charity_url" + ",receipts_to_date" ",current_year" ") VALUES " - "($1, $2, $3, $4);"); + "($1, $2, $3, $4, $5);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_charity", params); diff --git a/src/donaudb/pg_insert_charity.h b/src/donaudb/pg_insert_charity.h @@ -26,12 +26,14 @@ #include "taler_donaudb_plugin.h" /** - * Activate donation unit key, turning it into a "current" or "valid" - * denomination key by adding the master signature. + * Add a new charity * * @param cls closure - * @param denom_pub the actual denomination key - * @param meta meta information about the donation unit key + * @param charity_pub charity public key + * @param charity_name name + * @param charity_url url + * @param receipts_to_date current amount of donations in the current year + * @param current_year current year * @return transaction status code */ enum GNUNET_DB_QueryStatus @@ -42,4 +44,5 @@ TEH_PG_insert_charity ( const char *charity_url, struct TALER_Amount *receipts_to_date, uint64_t current_year); + #endif diff --git a/src/donaudb/pg_insert_history_entry.c b/src/donaudb/pg_insert_history_entry.c @@ -39,7 +39,6 @@ TEH_PG_insert_history_entry (void *cls, GNUNET_PQ_query_param_end }; - /* used in #postgres_insert_history_entry() */ PREPARE (pg, "insert_history_entry", "INSERT INTO history " diff --git a/src/donaudb/pg_insert_history_entry.h b/src/donaudb/pg_insert_history_entry.h @@ -26,14 +26,12 @@ #include "taler_donaudb_plugin.h" /** - * Insert information about an auditor that will audit this exchange. + * Insert history entry of a charity * * @param cls closure - * @param auditor_pub key of the auditor - * @param auditor_url base URL of the auditor's REST service - * @param auditor_name name of the auditor (for humans) - * @param start_date date when the auditor was added by the offline system - * (only to be used for replay detection) + * @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 diff --git a/src/donaudb/pg_insert_issued_receipt.c b/src/donaudb/pg_insert_issued_receipt.c @@ -27,10 +27,10 @@ enum GNUNET_DB_QueryStatus TEH_PG_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) + const struct DONAU_CharitySignatureP *charity_sig, + const uint64_t charity_id, + const struct DONAU_DonationReceiptHashP h_receipt, + const struct TALER_Amount *amount) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -41,7 +41,6 @@ TEH_PG_insert_issued_receipt (void *cls, GNUNET_PQ_query_param_end }; - /* used in #postgres_insert_issued_receipt() */ PREPARE (pg, "insert_issued_receipts", "INSERT INTO receipts_issued " diff --git a/src/donaudb/pg_insert_issued_receipt.h b/src/donaudb/pg_insert_issued_receipt.h @@ -26,18 +26,20 @@ #include "taler_donaudb_plugin.h" /** - * Insert information about an auditor that will audit this exchange. + * 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 TEH_PG_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); + const struct DONAU_CharitySignatureP *charity_sig, + const uint64_t charity_id, + const struct DONAU_DonationReceiptHashP *h_receipt, + const struct TALER_Amount *amount); + #endif diff --git a/src/donaudb/pg_insert_submitted_receipt.c b/src/donaudb/pg_insert_submitted_receipt.c @@ -42,7 +42,6 @@ TEH_PG_insert_submitted_receipt (void *cls, GNUNET_PQ_query_param_end }; - /* used in #postgres_insert_submitted_receipt() */ PREPARE (pg, "insert_submitted_receipt", "INSERT INTO receipts_submitted " diff --git a/src/donaudb/pg_insert_submitted_receipt.h b/src/donaudb/pg_insert_submitted_receipt.h @@ -26,14 +26,14 @@ #include "taler_donaudb_plugin.h" /** - * Insert information about an auditor that will audit this exchange. + * Insert submitted donation receipt from the donor. * * @param cls closure - * @param auditor_pub key of the auditor - * @param auditor_url base URL of the auditor's REST service - * @param auditor_name name of the auditor (for humans) - * @param start_date date when the auditor was added by the offline system - * (only to be used for replay detection) + * @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 diff --git a/src/donaudb/pg_lookup_donation_unit_key.c b/src/donaudb/pg_lookup_donation_unit_key.c @@ -38,15 +38,14 @@ TEH_PG_lookup_donation_unit_key ( }; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_auto_from_type ("donation_unit_pub", - &meta->donation_unit_pub), + &meta->donation_unit_pub), GNUNET_PQ_query_param_uint64 ("validity_year", - &meta->validity_year), + &meta->validity_year), TALER_PQ_RESULT_SPEC_AMOUNT ("amount", &meta->value), GNUNET_PQ_result_spec_end }; - /* used in #postgres_lookup_donation_unit_key() */ PREPARE (pg, "lookup_donation_unit_key", "SELECT" diff --git a/src/donaudb/pg_lookup_donation_unit_key.h b/src/donaudb/pg_lookup_donation_unit_key.h @@ -25,7 +25,7 @@ #include "taler_json_lib.h" #include "taler_donaudb_plugin.h" /** - * Lookup information about current donation_unit key. + * Lookup information about current donation unit key. * * @param cls closure * @param h_denom_pub hash of the donation_unit public key diff --git a/src/donaudb/pg_lookup_signing_key.h b/src/donaudb/pg_lookup_signing_key.h @@ -30,7 +30,7 @@ * Lookup signing key meta data. * * @param cls closure - * @param donau_pub the donau online signing public key + * @param donau_pub the donau signing public key * @param[out] meta meta data about @a donau_pub * @return transaction status code */ @@ -39,4 +39,5 @@ TEH_PG_lookup_signing_key ( void *cls, const struct DONAU_DonauPublicKeyP *donau_pub, struct DONAUDB_SignkeyMetaData *meta); + #endif