gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: KYC DB methods: sto


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: KYC DB methods: store a wire transfer.
Date: Tue, 10 Jul 2018 13:10:36 +0200

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

marcello pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 109a4a5  KYC DB methods: store a wire transfer.
109a4a5 is described below

commit 109a4a5aa1393da6241e479d13bce6d8c37b3275
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Jul 10 13:08:53 2018 +0200

    KYC DB methods: store a wire transfer.
---
 src/exchangedb/plugin_exchangedb_postgres.c | 34 +++++++++++++++++++++++++++++
 src/exchangedb/test_exchangedb.c            | 23 ++++++++++++++++---
 src/include/taler_exchangedb_plugin.h       | 17 +++++++++++++++
 3 files changed, 71 insertions(+), 3 deletions(-)

diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 790805b..fef35d5 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -6577,6 +6577,39 @@ postgres_unmark_kyc_merchant
 }
 
 /**
+ * Record timestamp where a particular merchant performed
+ * a wire transfer.
+ *
+ * @param cls closure.
+ * @param session db session.
+ * @param merchant_serial_id serial id of the merchant who
+ *        performed the wire transfer.
+ * @param amount amount of the wire transfer being monitored.
+ * @return database transaction status.
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_insert_kyc_event
+  (void *cls,
+   struct TALER_EXCHANGEDB_Session *session,
+   uint64_t merchant_serial_id,
+   struct TALER_Amount *amount)
+{
+  struct GNUNET_TIME_Absolute now;
+
+  now = GNUNET_TIME_absolute_get ();
+  struct GNUNET_PQ_QueryParam params[] = {
+    GNUNET_PQ_query_param_uint64 (&merchant_serial_id),
+    TALER_PQ_query_param_amount (amount),
+    GNUNET_PQ_query_param_absolute_time (&now),
+    GNUNET_PQ_query_param_end
+  };
+
+  return GNUNET_PQ_eval_prepared_non_select (session->conn,
+                                             "insert_kyc_event",
+                                             params);
+}
+
+/**
  * Mark a merchant as KYC-checked.
  *
  * @param payto_url payto:// URL indentifying the merchant
@@ -6814,6 +6847,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
   plugin->mark_kyc_merchant = postgres_mark_kyc_merchant;
   plugin->unmark_kyc_merchant = postgres_unmark_kyc_merchant;
   plugin->get_kyc_status = postgres_get_kyc_status;
+  plugin->insert_kyc_event = postgres_insert_kyc_event;
 
   return plugin;
 }
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 8b3486b..5be7ecb 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -361,7 +361,25 @@ kcs (void *cls,
      uint8_t kyc_checked,
      uint64_t merchant_serial_id)
 {
-  GNUNET_break (0);
+
+  struct TALER_EXCHANGEDB_Session *session = cls;
+  struct TALER_Amount amount;
+
+
+  TALER_amount_get_zero (CURRENCY,
+                         &amount);
+  FAILIF
+    (GNUNET_OK != plugin->insert_kyc_event (NULL,
+                                            session,
+                                            merchant_serial_id,
+                                            &amount));
+  FAILIF
+    (GNUNET_OK != plugin->insert_kyc_event (NULL,
+                                            session,
+                                            merchant_serial_id,
+                                            &amount));
+  drop:
+    return;
 }
 
 /**
@@ -2215,13 +2233,12 @@ run (void *cls)
                                   session,
                                   "payto://mock",
                                   &kcs,
-                                  NULL));
+                                  session));
 
   FAILIF (GNUNET_OK !=
           plugin->unmark_kyc_merchant (NULL,
                                        session,
                                        "payto://mock"));
-
   plugin->preflight (plugin->cls,
                      session);
 
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 3cecfb5..cf2842e 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2305,6 +2305,23 @@ struct TALER_EXCHANGEDB_Plugin
                      const char *payto_url,
                      TALER_EXCHANGEDB_KycStatusCallback ksc,
                      void *ksc_cls);
+
+  /**
+   * Record timestamp where a particular merchant performed
+   * a wire transfer.
+   *
+   * @param cls closure.
+   * @param session db session.
+   * @param merchant_serial_id serial id of the merchant who
+   *        performed the wire transfer.
+   * @param amount amount of the wire transfer being monitored.
+   * @return database transaction status.
+   */
+  enum GNUNET_DB_QueryStatus
+  (*insert_kyc_event) (void *cls,
+                       struct TALER_EXCHANGEDB_Session *session,
+                       uint64_t merchant_serial_id,
+                       struct TALER_Amount *amount);
 };
 
 #endif /* _TALER_EXCHANGE_DB_H */

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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