summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-05-03 23:13:51 +0200
committerChristian Grothoff <christian@grothoff.org>2023-05-03 23:13:51 +0200
commit8535f1e81939e87258ad9d2503ad25df9cfb021d (patch)
tree6a01388ace0fcd23f57eb3bf19ea7d756b8401b7 /src/backenddb/plugin_merchantdb_postgres.c
parent63960574154ca1615fb095a71b958ec5d00df4ae (diff)
downloadmerchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.tar.gz
merchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.tar.bz2
merchant-8535f1e81939e87258ad9d2503ad25df9cfb021d.zip
simplify POST /private/transfers implementation to match new situation with taler-merchant-exchange (incomplete)
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c46
1 files changed, 6 insertions, 40 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index ca26c01d..710fbdb3 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -42,6 +42,7 @@
#include "pg_insert_exchange_account.h"
#include "pg_lookup_reserves.h"
#include "pg_update_transfer_status.h"
+#include "pg_set_transfer_status_to_confirmed.h"
/**
@@ -3609,13 +3610,12 @@ postgres_insert_transfer (
bool confirmed)
{
struct PostgresClosure *pg = cls;
- uint8_t confirmed8 = confirmed;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (exchange_url),
GNUNET_PQ_query_param_auto_from_type (wtid),
TALER_PQ_query_param_amount (credit_amount),
GNUNET_PQ_query_param_string (payto_uri),
- GNUNET_PQ_query_param_auto_from_type (&confirmed8),
+ GNUNET_PQ_query_param_bool (confirmed),
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_end
};
@@ -4227,35 +4227,6 @@ postgres_lookup_transfer (
/**
- * Set transfer status to verified.
- *
- * @param cls closure
- * @param exchange_url the exchange that made the transfer
- * @param wtid wire transfer subject
- * @return transaction status
- */
-static enum GNUNET_DB_QueryStatus
-postgres_set_transfer_status_to_verified (
- void *cls,
- const char *exchange_url,
- const struct TALER_WireTransferIdentifierRawP *wtid)
-{
- struct PostgresClosure *pg = cls;
- struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (wtid),
- GNUNET_PQ_query_param_string (exchange_url),
- GNUNET_PQ_query_param_end
- };
-
- check_connection (pg);
- return GNUNET_PQ_eval_prepared_non_select (
- pg->conn,
- "set_transfer_status_to_verified",
- params);
-}
-
-
-/**
* Closure for #lookup_transfer_summary_cb().
*/
struct LookupTransferSummaryContext
@@ -8637,7 +8608,8 @@ postgres_connect (void *cls)
" AND merchant_serial="
" (SELECT merchant_serial"
" FROM merchant_instances"
- " WHERE merchant_id=$7)"),
+ " WHERE merchant_id=$7)"
+ " ON CONFLICT DO NOTHING;"),
/* for postgres_delete_transfer() */
GNUNET_PQ_make_prepare ("delete_transfer",
"DELETE FROM merchant_transfers"
@@ -8805,12 +8777,6 @@ postgres_connect (void *cls)
" WHERE wtid=$2"
" AND exchange_url=$1"
" AND merchant_id=$3;"),
- /* for postgres_set_transfer_status_to_verified() */
- GNUNET_PQ_make_prepare ("set_transfer_status_to_verified",
- "UPDATE merchant_transfers SET"
- " verified=TRUE"
- " WHERE wtid=$1"
- " AND exchange_url=$2"),
/* for postgres_lookup_transfer_summary() */
GNUNET_PQ_make_prepare ("lookup_transfer_summary",
"SELECT"
@@ -9555,8 +9521,8 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
plugin->lookup_deposits_by_contract_and_coin =
&postgres_lookup_deposits_by_contract_and_coin;
plugin->lookup_transfer = &postgres_lookup_transfer;
- plugin->set_transfer_status_to_verified =
- &postgres_set_transfer_status_to_verified;
+ plugin->set_transfer_status_to_confirmed =
+ &TMH_PG_set_transfer_status_to_confirmed;
plugin->lookup_transfer_summary = &postgres_lookup_transfer_summary;
plugin->lookup_transfer_details = &postgres_lookup_transfer_details;
plugin->lookup_instances