diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-03-08 22:53:35 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-03-08 22:53:35 +0100 |
commit | 19c368fc47192f44d1cf9e651d9360c4546b2807 (patch) | |
tree | c750e3a06119aa27b00c54890e5db09b1e1d0f4b /src/exchangedb | |
parent | 1beb3e72899aea2ca0b8cf3855be94575d7977c0 (diff) | |
download | exchange-19c368fc47192f44d1cf9e651d9360c4546b2807.tar.xz |
implement protocol v19 in taler-exchange-httpd (for #8000); note that taler-exchange-offline support is still missing
Diffstat (limited to 'src/exchangedb')
-rw-r--r-- | src/exchangedb/Makefile.am | 11 | ||||
-rw-r--r-- | src/exchangedb/pg_get_wire_accounts.c | 16 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_wire.c | 14 | ||||
-rw-r--r-- | src/exchangedb/pg_insert_wire.h | 7 | ||||
-rw-r--r-- | src/exchangedb/pg_update_wire.c | 10 | ||||
-rw-r--r-- | src/exchangedb/pg_update_wire.h | 4 |
6 files changed, 54 insertions, 8 deletions
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am index af6e2166b..45070ac08 100644 --- a/src/exchangedb/Makefile.am +++ b/src/exchangedb/Makefile.am @@ -18,7 +18,9 @@ sqlinputs = \ exchange_do_*.sql \ procedures.sql.in \ 0002-*.sql \ - exchange-0002.sql.in + 0003-*.sql \ + exchange-0002.sql.in \ + exchange-0003.sql.in sql_DATA = \ benchmark-0001.sql \ @@ -26,6 +28,7 @@ sql_DATA = \ auditor-triggers-0001.sql \ exchange-0001.sql \ exchange-0002.sql \ + exchange-0003.sql \ drop.sql \ procedures.sql @@ -37,6 +40,7 @@ BUILT_SOURCES = \ CLEANFILES = \ exchange-0002.sql \ + exchange-0003.sql \ procedures.sql procedures.sql: procedures.sql.in exchange_do_*.sql @@ -49,6 +53,11 @@ exchange-0002.sql: exchange-0002.sql.in 0002-*.sql gcc -E -P -undef - < exchange-0002.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@ chmod ugo-w $@ +exchange-0003.sql: exchange-0003.sql.in 0003-*.sql + chmod +w $@ || true + gcc -E -P -undef - < exchange-0003.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@ + chmod ugo-w $@ + check_SCRIPTS = \ test_idempotency.sh diff --git a/src/exchangedb/pg_get_wire_accounts.c b/src/exchangedb/pg_get_wire_accounts.c index 23b939046..9770be719 100644 --- a/src/exchangedb/pg_get_wire_accounts.c +++ b/src/exchangedb/pg_get_wire_accounts.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022 Taler Systems SA + Copyright (C) 2022, 2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -70,6 +70,8 @@ get_wire_accounts_cb (void *cls, json_t *debit_restrictions = NULL; json_t *credit_restrictions = NULL; struct TALER_MasterSignatureP master_sig; + char *bank_label = NULL; + int64_t priority; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_string ("payto_uri", &payto_uri), @@ -78,6 +80,12 @@ get_wire_accounts_cb (void *cls, &conversion_url), NULL), GNUNET_PQ_result_spec_allow_null ( + GNUNET_PQ_result_spec_string ("bank_label", + &bank_label), + NULL), + GNUNET_PQ_result_spec_int64 ("priority", + &priority), + GNUNET_PQ_result_spec_allow_null ( TALER_PQ_result_spec_json ("debit_restrictions", &debit_restrictions), NULL), @@ -114,7 +122,9 @@ get_wire_accounts_cb (void *cls, conversion_url, debit_restrictions, credit_restrictions, - &master_sig); + &master_sig, + bank_label, + priority); GNUNET_PQ_cleanup_result (rs); } } @@ -144,6 +154,8 @@ TEH_PG_get_wire_accounts (void *cls, ",debit_restrictions" ",credit_restrictions" ",master_sig" + ",bank_label" + ",priority" " FROM wire_accounts" " WHERE is_active"); qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn, diff --git a/src/exchangedb/pg_insert_wire.c b/src/exchangedb/pg_insert_wire.c index 066143b92..b1364cbb3 100644 --- a/src/exchangedb/pg_insert_wire.c +++ b/src/exchangedb/pg_insert_wire.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022, 2023 Taler Systems SA + Copyright (C) 2022, 2023, 2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,7 +33,9 @@ TEH_PG_insert_wire (void *cls, const json_t *debit_restrictions, const json_t *credit_restrictions, struct GNUNET_TIME_Timestamp start_date, - const struct TALER_MasterSignatureP *master_sig) + const struct TALER_MasterSignatureP *master_sig, + const char *bank_label, + int64_t priority) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_QueryParam params[] = { @@ -45,6 +47,10 @@ TEH_PG_insert_wire (void *cls, TALER_PQ_query_param_json (credit_restrictions), GNUNET_PQ_query_param_auto_from_type (master_sig), GNUNET_PQ_query_param_timestamp (&start_date), + NULL == bank_label + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (bank_label), + GNUNET_PQ_query_param_int64 (&priority), GNUNET_PQ_query_param_end }; @@ -58,8 +64,10 @@ TEH_PG_insert_wire (void *cls, ",master_sig" ",is_active" ",last_change" + ",bank_label" + ",priority" ") VALUES " - "($1, $2, $3, $4, $5, true, $6);"); + "($1, $2, $3, $4, $5, true, $6, $7, $8);"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "insert_wire", params); diff --git a/src/exchangedb/pg_insert_wire.h b/src/exchangedb/pg_insert_wire.h index 358946719..7a5e4caca 100644 --- a/src/exchangedb/pg_insert_wire.h +++ b/src/exchangedb/pg_insert_wire.h @@ -36,6 +36,8 @@ * (only to be used for replay detection) * @param master_sig public signature affirming the existence of the account, * must be of purpose #TALER_SIGNATURE_MASTER_WIRE_DETAILS + * @param bank_label label to show this entry under in the UI, can be NULL + * @param priority determines order in which entries are shown in the UI * @return transaction status code */ enum GNUNET_DB_QueryStatus @@ -45,6 +47,9 @@ TEH_PG_insert_wire (void *cls, const json_t *debit_restrictions, const json_t *credit_restrictions, struct GNUNET_TIME_Timestamp start_date, - const struct TALER_MasterSignatureP *master_sig); + const struct TALER_MasterSignatureP *master_sig, + const char *bank_label, + int64_t priority); + #endif diff --git a/src/exchangedb/pg_update_wire.c b/src/exchangedb/pg_update_wire.c index 439c92d4f..5c4bb9045 100644 --- a/src/exchangedb/pg_update_wire.c +++ b/src/exchangedb/pg_update_wire.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022, 2023 Taler Systems SA + Copyright (C) 2022, 2023, 2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -34,6 +34,8 @@ TEH_PG_update_wire (void *cls, const json_t *credit_restrictions, struct GNUNET_TIME_Timestamp change_date, const struct TALER_MasterSignatureP *master_sig, + const char *bank_label, + int64_t priority, bool enabled) { struct PostgresClosure *pg = cls; @@ -53,6 +55,10 @@ TEH_PG_update_wire (void *cls, NULL == master_sig ? GNUNET_PQ_query_param_null () : GNUNET_PQ_query_param_auto_from_type (master_sig), + NULL == bank_label + ? GNUNET_PQ_query_param_null () + : GNUNET_PQ_query_param_string (bank_label), + GNUNET_PQ_query_param_int64 (&priority), GNUNET_PQ_query_param_end }; @@ -66,6 +72,8 @@ TEH_PG_update_wire (void *cls, " ,credit_restrictions=$5" " ,last_change=$6" " ,master_sig=$7" + " ,bank_label=$8" + " ,priority=$9" " WHERE payto_uri=$1"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, "update_wire", diff --git a/src/exchangedb/pg_update_wire.h b/src/exchangedb/pg_update_wire.h index 9c30816e6..a596a0802 100644 --- a/src/exchangedb/pg_update_wire.h +++ b/src/exchangedb/pg_update_wire.h @@ -37,6 +37,8 @@ * @param change_date date when the account status was last changed * (only to be used for replay detection) * @param master_sig master signature to store, can be NULL (if @a enabled is false) + * @param bank_label label to show this entry under in the UI, can be NULL + * @param priority determines order in which entries are shown in the UI * @param enabled true to enable, false to disable (the actual change) * @return transaction status code */ @@ -48,6 +50,8 @@ TEH_PG_update_wire (void *cls, const json_t *credit_restrictions, struct GNUNET_TIME_Timestamp change_date, const struct TALER_MasterSignatureP *master_sig, + const char *bank_label, + int64_t priority, bool enabled); #endif |