From aa8f4440159f267a576d4d56f5f7c05e4136fc09 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 17 Jul 2024 10:22:54 +0200 Subject: implement kycauth_in_insert --- src/exchangedb/pg_kycauth_in_insert.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/exchangedb/pg_kycauth_in_insert.c') diff --git a/src/exchangedb/pg_kycauth_in_insert.c b/src/exchangedb/pg_kycauth_in_insert.c index 506c4a011..aafbe2acb 100644 --- a/src/exchangedb/pg_kycauth_in_insert.c +++ b/src/exchangedb/pg_kycauth_in_insert.c @@ -25,15 +25,40 @@ #include "pg_kycauth_in_insert.h" #include "pg_helper.h" + enum GNUNET_DB_QueryStatus TEH_PG_kycauth_in_insert ( void *cls, const union TALER_AccountPublicKeyP *account_pub, + const struct TALER_Amount *credit_amount, struct GNUNET_TIME_Timestamp execution_date, const char *debit_account_uri, const char *section_name, uint64_t serial_id) { - // FIXME: not implemented - return -1; + struct PostgresClosure *pg = cls; + struct TALER_PaytoHashP h_payto; + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_auto_from_type (account_pub), + GNUNET_PQ_query_param_uint64 (&serial_id), + TALER_PQ_query_param_amount (pg->conn, + credit_amount), + GNUNET_PQ_query_param_auto_from_type (&h_payto), + GNUNET_PQ_query_param_string (debit_account_uri), + GNUNET_PQ_query_param_string (section_name), + GNUNET_PQ_query_param_timestamp (&execution_date), + GNUNET_PQ_query_param_end + }; + + PREPARE (pg, + "kycauth_in_insert", + "CALL" + " exchange_do_kycauth_in_insert" + " ($1,$2,$3,$4,$5,$6,$7);"); + TALER_payto_hash (debit_account_uri, + &h_payto); + return GNUNET_PQ_eval_prepared_non_select ( + pg->conn, + "kycauth_in_insert", + params); } -- cgit v1.2.3