summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-07-10 13:08:53 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-07-10 13:08:53 +0200
commit109a4a5aa1393da6241e479d13bce6d8c37b3275 (patch)
tree1034b1cf5b87d042de603286b63d5439f7844311 /src/exchangedb/plugin_exchangedb_postgres.c
parent8f6b8dbe97181de6deced776f68e3ac30e3834fc (diff)
downloadexchange-109a4a5aa1393da6241e479d13bce6d8c37b3275.tar.gz
exchange-109a4a5aa1393da6241e479d13bce6d8c37b3275.tar.bz2
exchange-109a4a5aa1393da6241e479d13bce6d8c37b3275.zip
KYC DB methods: store a wire transfer.
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 790805b67..fef35d53c 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;
}