diff options
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 6040c9af..baaad568 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -37,6 +37,9 @@ #include "pg_update_wirewatch_progress.h" #include "pg_select_wirewatch_accounts.h" #include "pg_select_open_transfers.h" +#include "pg_delete_exchange_accounts.h" +#include "pg_select_accounts_by_exchange.h" +#include "pg_insert_exchange_account.h" /** @@ -4553,8 +4556,8 @@ postgres_store_wire_fee_by_exchange ( * @param instance_id which instance is the reserve tied to * @param reserve_priv which reserve is topped up or created * @param reserve_pub which reserve is topped up or created + * @param master_pub master public key of the exchange * @param exchange_url what URL is the exchange reachable at where the reserve is located - * @param payto_uri URI to use to fund the reserve * @param initial_balance how much money will be added to the reserve * @param expiration when does the reserve expire? * @return transaction status, usually @@ -4565,8 +4568,8 @@ postgres_insert_reserve (void *cls, const char *instance_id, const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_ReservePublicKeyP *reserve_pub, + const struct TALER_MasterPublicKeyP *master_pub, const char *exchange_url, - const char *payto_uri, const struct TALER_Amount *initial_balance, struct GNUNET_TIME_Timestamp expiration) { @@ -4618,7 +4621,7 @@ RETRY: GNUNET_PQ_query_param_auto_from_type (reserve_pub), GNUNET_PQ_query_param_auto_from_type (reserve_priv), GNUNET_PQ_query_param_string (exchange_url), - GNUNET_PQ_query_param_string (payto_uri), + GNUNET_PQ_query_param_auto_from_type (reserve_pub), GNUNET_PQ_query_param_end }; @@ -5084,9 +5087,9 @@ postgres_lookup_reserve (void *cls, struct TALER_Amount exchange_initial_balance; struct TALER_Amount pickup_amount; struct TALER_Amount committed_amount; - uint8_t active; + struct TALER_MasterPublicKeyP master_pub; + bool active; char *exchange_url = NULL; - char *payto_uri = NULL; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_timestamp ("creation_time", &creation_time), @@ -5100,16 +5103,14 @@ postgres_lookup_reserve (void *cls, &pickup_amount), TALER_PQ_RESULT_SPEC_AMOUNT ("tips_committed", &committed_amount), - GNUNET_PQ_result_spec_auto_from_type ("active", - &active), + GNUNET_PQ_result_spec_auto_from_type ("master_pub", + &master_pub), + GNUNET_PQ_result_spec_bool ("active", + &active), GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_string ("exchange_url", &exchange_url), NULL), - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("payto_uri", - &payto_uri), - NULL), GNUNET_PQ_result_spec_end }; enum GNUNET_DB_QueryStatus qs; @@ -5130,9 +5131,9 @@ postgres_lookup_reserve (void *cls, &exchange_initial_balance, &pickup_amount, &committed_amount, - (0 != active), + active, + &master_pub, exchange_url, - payto_uri, 0, NULL); GNUNET_PQ_cleanup_result (rs); @@ -5155,9 +5156,9 @@ postgres_lookup_reserve (void *cls, &exchange_initial_balance, &pickup_amount, &committed_amount, - 0 != active, + active, + &master_pub, exchange_url, - payto_uri, ltc.tips_length, ltc.tips); } @@ -9064,7 +9065,7 @@ postgres_connect (void *cls) "(reserve_serial" ",reserve_priv" ",exchange_url" - ",payto_uri" + ",master_pub" ")" "SELECT reserve_serial, $3, $4, $5" " FROM merchant_tip_reserves" @@ -9123,7 +9124,7 @@ postgres_connect (void *cls) ",tips_picked_up_frac" ",reserve_priv IS NOT NULL AS active" ",exchange_url" - ",payto_uri" + ",master_pub" " FROM merchant_tip_reserves" " FULL OUTER JOIN merchant_tip_reserve_keys USING (reserve_serial)" " WHERE reserve_pub = $2" @@ -9804,6 +9805,12 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) plugin->delete_pending_webhook = &postgres_delete_pending_webhook; plugin->insert_pending_webhook = &postgres_insert_pending_webhook; plugin->update_pending_webhook = &postgres_update_pending_webhook; + plugin->delete_exchange_accounts + = &TMH_PG_delete_exchange_accounts; + plugin->select_accounts_by_exchange + = &TMH_PG_select_accounts_by_exchange; + plugin->insert_exchange_account + = &TMH_PG_insert_exchange_account; return plugin; } |