aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-07-16 21:37:14 +0200
committerChristian Grothoff <christian@grothoff.org>2024-07-29 12:18:45 +0200
commite0e18e34a16dc851588dddd6dd2ee21c00b1ae51 (patch)
tree9b915bc020d771c03a9f28a1c347c1024ee1a78d /src/exchangedb
parentaa04e4af568eb0599b8f4eb89f779ecd9d20cc25 (diff)
implement wad_in_insert
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/pg_wad_in_insert.c26
-rw-r--r--src/exchangedb/pg_wad_in_insert.h2
2 files changed, 26 insertions, 2 deletions
diff --git a/src/exchangedb/pg_wad_in_insert.c b/src/exchangedb/pg_wad_in_insert.c
index 387273d35..95d792b14 100644
--- a/src/exchangedb/pg_wad_in_insert.c
+++ b/src/exchangedb/pg_wad_in_insert.c
@@ -30,11 +30,33 @@ TEH_PG_wad_in_insert (
void *cls,
const struct TALER_WadIdentifierP *wad_id,
const char *origin_exchange_url,
+ const struct TALER_Amount *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 GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (wad_id),
+ GNUNET_PQ_query_param_string (origin_exchange_url),
+ TALER_PQ_query_param_amount (pg->conn,
+ amount),
+ GNUNET_PQ_query_param_timestamp (&execution_date),
+ GNUNET_PQ_query_param_end
+ };
+
+ // FIXME: should we keep the account data + serial_id?
+ PREPARE (pg,
+ "wad_in_insert",
+ "INSERT INTO wads_in "
+ "(wad_id"
+ ",origin_exchange_url"
+ ",amount"
+ ",arrival_time"
+ ") VALUES "
+ "($1, $2, $3, $4);");
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "wad_in_insert",
+ params);
}
diff --git a/src/exchangedb/pg_wad_in_insert.h b/src/exchangedb/pg_wad_in_insert.h
index 0498412c0..d6c2b25c4 100644
--- a/src/exchangedb/pg_wad_in_insert.h
+++ b/src/exchangedb/pg_wad_in_insert.h
@@ -32,6 +32,7 @@
* @param cls the @e cls of this struct with the plugin-specific state
* @param wad_id WAD identifier
* @param origin_exchange_url exchange base URL originating the transfer
+ * @param amount the amount that was transferred
* @param execution_date when was the transfer made
* @param debit_account_uri URI of the debit account
* @param section_name section of the exchange bank account that received the transfer
@@ -42,6 +43,7 @@ TEH_PG_wad_in_insert (
void *cls,
const struct TALER_WadIdentifierP *wad_id,
const char *origin_exchange_url,
+ const struct TALER_Amount *amount,
struct GNUNET_TIME_Timestamp execution_date,
const char *debit_account_uri,
const char *section_name,