aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/pg_kycauth_in_insert.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-07-17 10:22:54 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:45 +0200
commitaa8f4440159f267a576d4d56f5f7c05e4136fc09 (patch)
tree23f7301338c5e86d5df8c100197f2626356f4657 /src/exchangedb/pg_kycauth_in_insert.c
parent5dee406eec4ac6d44ccfaa746b2fb3e104dd60c2 (diff)
implement kycauth_in_insert
Diffstat (limited to 'src/exchangedb/pg_kycauth_in_insert.c')
-rw-r--r--src/exchangedb/pg_kycauth_in_insert.c29
1 files changed, 27 insertions, 2 deletions
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);
}