gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-donau] branch master updated: [db] fix errors


From: gnunet
Subject: [taler-donau] branch master updated: [db] fix errors
Date: Sat, 06 Jan 2024 22:53:03 +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 fb51789  [db] fix errors
fb51789 is described below

commit fb51789539086221404b84628b6ab031e9398e78
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sat Jan 6 22:52:12 2024 +0100

    [db] fix errors
---
 src/donaudb/Makefile.am                   |  6 +++---
 src/donaudb/pg_get_charities.c            |  6 +++---
 src/donaudb/pg_get_charities.h            |  4 +++-
 src/donaudb/pg_insert_charity.c           |  8 +++++---
 src/donaudb/pg_insert_charity.h           |  4 +++-
 src/donaudb/pg_insert_history_entry.c     |  3 ++-
 src/donaudb/pg_insert_issued_receipt.c    |  6 ++++--
 src/donaudb/pg_insert_issued_receipt.h    |  3 +--
 src/donaudb/pg_insert_submitted_receipt.c |  7 ++++---
 src/donaudb/pg_insert_submitted_receipt.h |  7 ++++---
 src/donaudb/pg_lookup_charity.c           |  6 +++---
 src/include/donau_crypto_lib.h            | 11 +++++++++++
 src/include/donau_service.h               | 12 +++++++++++
 src/include/donaudb_plugin.h              | 33 +++++++++++++++++++++++++++++++
 14 files changed, 91 insertions(+), 25 deletions(-)

diff --git a/src/donaudb/Makefile.am b/src/donaudb/Makefile.am
index 79a90c0..56a4cc9 100644
--- a/src/donaudb/Makefile.am
+++ b/src/donaudb/Makefile.am
@@ -75,12 +75,12 @@ libtaler_plugin_donaudb_postgres_la_SOURCES = \
   pg_lookup_signing_key.h pg_lookup_signing_key.c \
   pg_add_donation_unit_key.c pg_add_donation_unit_key.h \
   pg_lookup_donation_unit.c pg_lookup_donation_unit.h \
-  #pg_get_charities.h pg_get_charities.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 \
   pg_insert_history_entry.h pg_insert_history_entry.c \
-  pg_insert_issued_receipts.h pg_insert_issued_receipts.c \
-  pg_insert_submitted_receipts.h pg_insert_submitted_receipts.c
+  pg_insert_issued_receipt.h pg_insert_issued_receipt.c \
+  pg_insert_submitted_receipt.h pg_insert_submitted_receipt.c
   
 libtaler_plugin_donaudb_postgres_la_LIBADD = \
   $(LTLIBINTL)
diff --git a/src/donaudb/pg_get_charities.c b/src/donaudb/pg_get_charities.c
index fb1b51a..7628edf 100644
--- a/src/donaudb/pg_get_charities.c
+++ b/src/donaudb/pg_get_charities.c
@@ -14,7 +14,7 @@
    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 /**
- * @file donaudb/pg_lookup_donation_unit_key.c
+ * @file donaudb/pg_get_charities.c
  * @brief Implementation of the lookup_donation_unit_key function for Postgres
  * @author Johannes Casaburi
  */
@@ -22,7 +22,7 @@
 #include "taler/taler_error_codes.h"
 #include "taler/taler_dbevents.h"
 #include "taler/taler_pq_lib.h"
-#include "pg_lookup_charity.h"
+#include "pg_get_charities.h"
 #include "pg_helper.h"
 
 
@@ -72,7 +72,7 @@ get_charities_cb (void *cls,
       GNUNET_PQ_result_spec_string ("charity_name",
                                     &charity_name),
       GNUNET_PQ_result_spec_string ("charity_url",
-                                    &charity_url)
+                                    &charity_url),
       GNUNET_PQ_result_spec_end
     };
 
diff --git a/src/donaudb/pg_get_charities.h b/src/donaudb/pg_get_charities.h
index 3c6a807..29d0f78 100644
--- a/src/donaudb/pg_get_charities.h
+++ b/src/donaudb/pg_get_charities.h
@@ -14,13 +14,15 @@
    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
  */
 /**
- * @file donaudb/pg_lookup_charity.h
+ * @file donaudb/pg_get_charities.h
  * @brief implementation of the get_charities function for Postgres
  * @author Johannes Casaburi
  */
 #ifndef PG_GET_CHARITIES_H
 #define PG_GET_CHARITIES_H
 
+#include "donaudb_plugin.h"
+
 /**
  * Obtain information about the enabled wire accounts of the exchange.
  *
diff --git a/src/donaudb/pg_insert_charity.c b/src/donaudb/pg_insert_charity.c
index 0c2d783..8cbdd89 100644
--- a/src/donaudb/pg_insert_charity.c
+++ b/src/donaudb/pg_insert_charity.c
@@ -28,8 +28,8 @@
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_charity (void *cls,
                       const struct DONAU_CharityPublicKeyP *charity_pub,
-                      const char *charity_url,
                       const char *charity_name,
+                      const char *charity_url,
                       struct TALER_Amount *max_per_year,
                       struct TALER_Amount *receipts_to_date,
                       uint64_t current_year)
@@ -39,8 +39,10 @@ DH_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 (max_per_year),
-    TALER_PQ_query_param_amount (receipts_to_date),
+    TALER_PQ_query_param_amount (pg->conn,
+                                 max_per_year),
+    TALER_PQ_query_param_amount (pg->conn,
+                                 receipts_to_date),
     GNUNET_PQ_query_param_uint64 (&current_year),
     GNUNET_PQ_query_param_end
   };
diff --git a/src/donaudb/pg_insert_charity.h b/src/donaudb/pg_insert_charity.h
index e1b1e56..88e3996 100644
--- a/src/donaudb/pg_insert_charity.h
+++ b/src/donaudb/pg_insert_charity.h
@@ -32,6 +32,7 @@
  * @param charity_pub charity public key
  * @param charity_name name
  * @param charity_url url
+ * @param max_per_year yearly donation limit
  * @param receipts_to_date current amount of donations in the current year
  * @param current_year current year
  * @return transaction status code
@@ -39,9 +40,10 @@
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_charity (
   void *cls,
-  const struct DONAU_CharityPublicKey *charity_pub,
+  const struct DONAU_CharityPublicKeyP *charity_pub,
   const char *charity_name,
   const char *charity_url,
+  struct TALER_Amount *max_per_year,
   struct TALER_Amount *receipts_to_date,
   uint64_t current_year);
 
diff --git a/src/donaudb/pg_insert_history_entry.c 
b/src/donaudb/pg_insert_history_entry.c
index 76b1256..81bc293 100644
--- a/src/donaudb/pg_insert_history_entry.c
+++ b/src/donaudb/pg_insert_history_entry.c
@@ -34,7 +34,8 @@ DH_PG_insert_history_entry (void *cls,
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_uint64 (charity_id),
-    GNUNET_PQ_query_param_amount (final_amount),
+    TALER_PQ_query_param_amount (pg->conn,
+                                 final_amount),
     GNUNET_PQ_query_param_uint64 (donation_year),
     GNUNET_PQ_query_param_end
   };
diff --git a/src/donaudb/pg_insert_issued_receipt.c 
b/src/donaudb/pg_insert_issued_receipt.c
index 6b9a6c9..d10049c 100644
--- a/src/donaudb/pg_insert_issued_receipt.c
+++ b/src/donaudb/pg_insert_issued_receipt.c
@@ -24,12 +24,13 @@
 #include "taler/taler_pq_lib.h"
 #include "pg_insert_issued_receipt.h"
 #include "pg_helper.h"
+#include "donau_service.h"
 
 enum GNUNET_DB_QueryStatus
 DH_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 DONAU_DonationReceiptHashP 
*h_receipt,
                              const struct TALER_Amount *amount)
 {
   struct PostgresClosure *pg = cls;
@@ -37,7 +38,8 @@ DH_PG_insert_issued_receipt (void *cls,
     GNUNET_PQ_query_param_auto_from_type (charity_sig),
     GNUNET_PQ_query_param_uint64 (charity_id),
     GNUNET_PQ_query_param_auto_from_type (h_receipt),
-    GNUNET_PQ_query_param_amount (amount),
+    TALER_PQ_query_param_amount (pg->conn,
+                                 amount),
     GNUNET_PQ_query_param_end
   };
 
diff --git a/src/donaudb/pg_insert_issued_receipt.h 
b/src/donaudb/pg_insert_issued_receipt.h
index 15a2437..af0deaa 100644
--- a/src/donaudb/pg_insert_issued_receipt.h
+++ b/src/donaudb/pg_insert_issued_receipt.h
@@ -39,8 +39,7 @@ enum GNUNET_DB_QueryStatus
 DH_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 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
index 93b53a8..f14f226 100644
--- a/src/donaudb/pg_insert_submitted_receipt.c
+++ b/src/donaudb/pg_insert_submitted_receipt.c
@@ -24,12 +24,13 @@
 #include "taler/taler_pq_lib.h"
 #include "pg_insert_submitted_receipt.h"
 #include "pg_helper.h"
+#include "donau_service.h"
 
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_submitted_receipt (void *cls,
-                                const struct
-                                TALER_TaxNumberHashP *h_tax_number,
-                                const struct TALER_CsNonce *nonce,
+                                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,
diff --git a/src/donaudb/pg_insert_submitted_receipt.h 
b/src/donaudb/pg_insert_submitted_receipt.h
index a39c40c..0c01c16 100644
--- a/src/donaudb/pg_insert_submitted_receipt.h
+++ b/src/donaudb/pg_insert_submitted_receipt.h
@@ -24,6 +24,7 @@
 #include <taler/taler_util.h>
 #include "taler/taler_json_lib.h"
 #include "donaudb_plugin.h"
+#include "donau_service.h"
 
 /**
  * Insert submitted donation receipt from the donor.
@@ -38,9 +39,9 @@
  */
 enum GNUNET_DB_QueryStatus
 DH_PG_insert_submitted_receipt (void *cls,
-                                const struct
-                                TALER_TaxNumberHashP *h_tax_number,
-                                const struct TALER_CsNonce *nonce,
+                                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,
diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c
index 7b3a62b..6f55fdb 100644
--- a/src/donaudb/pg_lookup_charity.c
+++ b/src/donaudb/pg_lookup_charity.c
@@ -29,7 +29,7 @@ enum GNUNET_DB_QueryStatus
 DH_PG_lookup_charity (
   void *cls,
   unsigned long long charity_id,
-  struct DONAUDB_CharityMetaData *meta)
+  const struct DONAUDB_CharityMetaData *meta)
 {
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_QueryParam params[] = {
@@ -37,9 +37,9 @@ DH_PG_lookup_charity (
     GNUNET_PQ_query_param_end
   };
   struct GNUNET_PQ_ResultSpec rs[] = {
-    GNUNET_PQ_query_param_string ("charity_url",
+    GNUNET_PQ_result_spec_string ("charity_url",
                                   &meta->charity_url),
-    GNUNET_PQ_query_param_string ("charity_name",
+    GNUNET_PQ_result_spec_string ("charity_name",
                                   &meta->charity_name),
     GNUNET_PQ_result_spec_end
   };
diff --git a/src/include/donau_crypto_lib.h b/src/include/donau_crypto_lib.h
index dee8519..917f63e 100644
--- a/src/include/donau_crypto_lib.h
+++ b/src/include/donau_crypto_lib.h
@@ -117,6 +117,17 @@ struct DONAU_DonationUnitHashP
   struct GNUNET_HashCode hash;
 };
 
+/**
+ * Hash used to represent a Donation Receipt
+ */
+struct DONAU_DonationReceiptHashP
+{
+  /**
+   * Actual hash value.
+   */
+  struct GNUNET_HashCode hash;
+};
+
 /**
   * Donor's hashed and salted unique donation identifier.
   */
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
index 3d65a03..086dd1c 100644
--- a/src/include/donau_service.h
+++ b/src/include/donau_service.h
@@ -546,6 +546,18 @@ struct TALER_DonationUnitSignature
 
 };
 
+/**
+ * Donau signature
+ */
+struct TALER_DonauSignatureP
+{
+  /**
+   * The signature
+   */
+  struct TALER_ExchangeSignatureP sig;
+
+};
+
 /**
  * Donation Receipt
  */
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
index 37c48c6..56d4848 100644
--- a/src/include/donaudb_plugin.h
+++ b/src/include/donaudb_plugin.h
@@ -74,6 +74,39 @@ struct DONAUDB_SignkeyMetaData
 
 };
 
+/**
+ * Meta data about a charity.
+ */
+struct DONAUDB_CharityMetaData
+{
+  /**
+   * Charity public key
+   */
+  const struct DONAU_CharityPublicKeyP *charity_pub;
+
+  /**
+   * Charity name
+   */
+  const char *charity_name;
+
+  /**
+   * Charity url
+   */
+  const char *charity_url;
+
+  /**
+   * Charity yearly donation limit
+   */
+  struct TALER_Amount *max_per_year;
+
+  /**
+   * Charity donations received in the current year
+   */
+  struct TALER_Amount *receipts_to_date;
+
+};
+
+
 /**
  * @brief All information about a donation unit key.
  */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]