gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: add kycauths_in table support to


From: gnunet
Subject: [taler-exchange] branch master updated: add kycauths_in table support to taler-auditor-sync
Date: Fri, 02 Aug 2024 12:39:11 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 830ebef2e add kycauths_in table support to taler-auditor-sync
830ebef2e is described below

commit 830ebef2ea959ccbec0d62a04b947a020ff278c8
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Fri Aug 2 12:00:07 2024 +0200

    add kycauths_in table support to taler-auditor-sync
---
 src/exchangedb/pg_insert_records_by_table.c | 47 ++++++++++++++++++
 src/exchangedb/pg_lookup_records_by_table.c | 76 +++++++++++++++++++++++++++++
 src/exchangedb/pg_lookup_serial_by_table.c  |  8 +++
 src/include/taler_exchangedb_plugin.h       | 11 +++++
 4 files changed, 142 insertions(+)

diff --git a/src/exchangedb/pg_insert_records_by_table.c 
b/src/exchangedb/pg_insert_records_by_table.c
index 592ea01a4..097e6275e 100644
--- a/src/exchangedb/pg_insert_records_by_table.c
+++ b/src/exchangedb/pg_insert_records_by_table.c
@@ -415,6 +415,50 @@ irbt_cb_table_reserves_in (struct PostgresClosure *pg,
 }
 
 
+/**
+ * Function called with kycauth_in records to insert into table.
+ *
+ * @param pg plugin context
+ * @param td record to insert
+ */
+static enum GNUNET_DB_QueryStatus
+irbt_cb_table_kycauths_in (struct PostgresClosure *pg,
+                           const struct TALER_EXCHANGEDB_TableData *td)
+{
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_uint64 (&td->serial),
+    GNUNET_PQ_query_param_uint64 (&td->details.kycauth_in.wire_reference),
+    TALER_PQ_query_param_amount (
+      pg->conn,
+      &td->details.reserves_in.credit),
+    GNUNET_PQ_query_param_auto_from_type (
+      &td->details.reserves_in.sender_account_h_payto),
+    GNUNET_PQ_query_param_string (
+      td->details.reserves_in.exchange_account_section),
+    GNUNET_PQ_query_param_timestamp (
+      &td->details.reserves_in.execution_date),
+    GNUNET_PQ_query_param_auto_from_type (&td->details.kycauth_in.account_pub),
+    GNUNET_PQ_query_param_end
+  };
+
+  PREPARE (pg,
+           "insert_into_table_kycauth_in",
+           "INSERT INTO kycauths_in"
+           "(kycauth_in_serial_id"
+           ",wire_reference"
+           ",credit"
+           ",wire_source_h_payto"
+           ",exchange_account_section"
+           ",execution_date"
+           ",account_pub"
+           ") VALUES "
+           "($1, $2, $3, $4, $5, $6, $7);");
+  return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+                                             "insert_into_table_kycauth_in",
+                                             params);
+}
+
+
 /**
  * Function called with reserves_open_requests records to insert into table.
  *
@@ -2270,6 +2314,9 @@ TEH_PG_insert_records_by_table (void *cls,
   case TALER_EXCHANGEDB_RT_RESERVES_IN:
     rh = &irbt_cb_table_reserves_in;
     break;
+  case TALER_EXCHANGEDB_RT_KYCAUTHS_IN:
+    rh = &irbt_cb_table_kycauths_in;
+    break;
   case TALER_EXCHANGEDB_RT_RESERVES_CLOSE:
     rh = &irbt_cb_table_reserves_close;
     break;
diff --git a/src/exchangedb/pg_lookup_records_by_table.c 
b/src/exchangedb/pg_lookup_records_by_table.c
index b98c5963d..cbd972424 100644
--- a/src/exchangedb/pg_lookup_records_by_table.c
+++ b/src/exchangedb/pg_lookup_records_by_table.c
@@ -346,6 +346,67 @@ lrbt_cb_table_reserves_in (void *cls,
 }
 
 
+/**
+ * Function called with kycauth_in table entries.
+ *
+ * @param cls closure
+ * @param result the postgres result
+ * @param num_results the number of results in @a result
+ */
+static void
+lrbt_cb_table_kycauth_in (void *cls,
+                          PGresult *result,
+                          unsigned int num_results)
+{
+  struct LookupRecordsByTableContext *ctx = cls;
+  struct PostgresClosure *pg = ctx->pg;
+  struct TALER_EXCHANGEDB_TableData td = {
+    .table = TALER_EXCHANGEDB_RT_KYCAUTHS_IN
+  };
+
+  for (unsigned int i = 0; i<num_results; i++)
+  {
+    struct GNUNET_PQ_ResultSpec rs[] = {
+      GNUNET_PQ_result_spec_uint64 (
+        "serial",
+        &td.serial),
+      GNUNET_PQ_result_spec_auto_from_type (
+        "account_pub",
+        &td.details.kycauth_in.account_pub),
+      GNUNET_PQ_result_spec_uint64 (
+        "wire_reference",
+        &td.details.kycauth_in.wire_reference),
+      TALER_PQ_RESULT_SPEC_AMOUNT (
+        "credit",
+        &td.details.kycauth_in.credit),
+      GNUNET_PQ_result_spec_auto_from_type (
+        "wire_source_h_payto",
+        &td.details.kycauth_in.sender_account_h_payto),
+      GNUNET_PQ_result_spec_string (
+        "exchange_account_section",
+        &td.details.kycauth_in.exchange_account_section),
+      GNUNET_PQ_result_spec_timestamp (
+        "execution_date",
+        &td.details.kycauth_in.execution_date),
+      GNUNET_PQ_result_spec_end
+    };
+
+    if (GNUNET_OK !=
+        GNUNET_PQ_extract_result (result,
+                                  rs,
+                                  i))
+    {
+      GNUNET_break (0);
+      ctx->error = true;
+      return;
+    }
+    ctx->cb (ctx->cb_cls,
+             &td);
+    GNUNET_PQ_cleanup_result (rs);
+  }
+}
+
+
 /**
  * Function called with reserves_close table entries.
  *
@@ -3087,6 +3148,21 @@ TEH_PG_lookup_records_by_table (void *cls,
               " ORDER BY reserve_in_serial_id ASC;");
     rh = &lrbt_cb_table_reserves_in;
     break;
+  case TALER_EXCHANGEDB_RT_KYCAUTHS_IN:
+    XPREPARE ("select_above_serial_by_table_kycauth_in",
+              "SELECT"
+              " kycauth_in_serial_id AS serial"
+              ",account_pub"
+              ",wire_reference"
+              ",credit"
+              ",wire_source_h_payto"
+              ",exchange_account_section"
+              ",execution_date"
+              " FROM kycauths_in"
+              " WHERE kycauth_in_serial_id > $1"
+              " ORDER BY kycauth_in_serial_id ASC;");
+    rh = &lrbt_cb_table_kycauth_in;
+    break;
   case TALER_EXCHANGEDB_RT_RESERVES_CLOSE:
     XPREPARE ("select_above_serial_by_table_reserves_close",
               "SELECT"
diff --git a/src/exchangedb/pg_lookup_serial_by_table.c 
b/src/exchangedb/pg_lookup_serial_by_table.c
index 4f1d47d55..c4d81adcb 100644
--- a/src/exchangedb/pg_lookup_serial_by_table.c
+++ b/src/exchangedb/pg_lookup_serial_by_table.c
@@ -93,6 +93,14 @@ TEH_PG_lookup_serial_by_table (void *cls,
               " ORDER BY reserve_in_serial_id DESC"
               " LIMIT 1;");
     break;
+  case TALER_EXCHANGEDB_RT_KYCAUTHS_IN:
+    XPREPARE ("select_serial_by_table_kycauths_in",
+              "SELECT"
+              " kycauth_in_serial_id AS serial"
+              " FROM kycauths_in"
+              " ORDER BY kycauths_in_serial_id DESC"
+              " LIMIT 1;");
+    break;
   case TALER_EXCHANGEDB_RT_RESERVES_CLOSE:
     XPREPARE ("select_serial_by_table_reserves_close",
               "SELECT"
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 9b582ddcc..69bb66f03 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -332,6 +332,7 @@ enum TALER_EXCHANGEDB_ReplicatedTable
   TALER_EXCHANGEDB_RT_KYC_ATTRIBUTES,
   TALER_EXCHANGEDB_RT_AML_HISTORY,
   TALER_EXCHANGEDB_RT_KYC_EVENTS,
+  TALER_EXCHANGEDB_RT_KYCAUTHS_IN,
 };
 
 
@@ -470,6 +471,16 @@ struct TALER_EXCHANGEDB_TableData
       struct TALER_ReservePublicKeyP reserve_pub;
     } reserves_in;
 
+    struct
+    {
+      uint64_t wire_reference;
+      struct TALER_Amount credit;
+      struct TALER_PaytoHashP sender_account_h_payto;
+      char *exchange_account_section;
+      struct GNUNET_TIME_Timestamp execution_date;
+      union TALER_AccountPublicKeyP account_pub;
+    } kycauth_in;
+
     struct
     {
       struct TALER_ReservePublicKeyP reserve_pub;

-- 
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]