summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index eda6468ba..dfd7432e3 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -359,6 +359,17 @@ prepare_statements (struct PostgresClosure *pg)
" WHERE reserve_pub=$1"
" LIMIT 1;",
1),
+#if FIXME_DD23
+ /* Used in #postgres_get_kyc_status() */
+ GNUNET_PQ_make_prepare ("get_kyc_status",
+ "SELECT"
+ ",kyc_ok"
+ ",wire_target_serial_id AS payment_target_uuid"
+ " FROM wire_targets"
+ " WHERE payto_uri=$1"
+ " LIMIT 1;",
+ 1),
+#endif
/* Used in #reserves_get() */
GNUNET_PQ_make_prepare ("reserves_get",
"SELECT"
@@ -3517,6 +3528,50 @@ postgres_reserves_get (void *cls,
/**
+ * Get the KYC status for a bank account.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param payto_uri payto:// URI that identifies the bank account
+ * @param[out] kyc set to the KYC status of the reserve
+ * @return transaction status
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_get_kyc_status (void *cls,
+ const char *payto_uri,
+ struct TALER_EXCHANGEDB_KycStatus *kyc)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (payto_uri),
+ GNUNET_PQ_query_param_end
+ };
+ uint8_t ok8;
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("payment_target_uuid",
+ &kyc->payment_target_uuid),
+ GNUNET_PQ_result_spec_auto_from_type ("kyc_ok",
+ &ok8),
+ GNUNET_PQ_result_spec_end
+ };
+ enum GNUNET_DB_QueryStatus qs;
+
+#if FIXME_DD23
+ qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "get_kyc_status",
+ params,
+ rs);
+#else
+ qs = 1;
+ ok8 = 0;
+ kyc->payment_target_uuid = 0;
+#endif
+ kyc->type = TALER_EXCHANGEDB_KYC_DEPOSIT;
+ kyc->ok = (0 != ok8);
+ return qs;
+}
+
+
+/**
* Get the summary of a reserve.
*
* @param cls the `struct PostgresClosure` with the plugin-specific state
@@ -11071,6 +11126,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->iterate_auditor_denominations =
&postgres_iterate_auditor_denominations;
plugin->reserves_get = &postgres_reserves_get;
+ plugin->get_kyc_status = &postgres_get_kyc_status;
plugin->reserves_in_insert = &postgres_reserves_in_insert;
plugin->get_latest_reserve_in_reference =
&postgres_get_latest_reserve_in_reference;