diff options
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 00df78a4..8f1a864e 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -2309,7 +2309,7 @@ process_deposits_for_refund_cb (void *cls, enum GNUNET_DB_QueryStatus qs; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_uint64 (&rcd[i].order_serial), - GNUNET_PQ_query_param_uint64 (&rcd[i].max_rtransaction_id), + GNUNET_PQ_query_param_uint64 (&rcd[i].max_rtransaction_id), /* already inc'ed */ GNUNET_PQ_query_param_auto_from_type (&rcd[i].coin_pub), GNUNET_PQ_query_param_string (ctx->reason), TALER_PQ_query_param_amount (increment), @@ -5538,14 +5538,46 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) " WHERE merchant_id=$1)" " AND order_id=$2", 2), + /* for process_refund_cb() used in postgres_increase_refund() */ GNUNET_PQ_make_prepare ("find_refunds_by_coin", "SELECT" " refund_amount_val" ",refund_amount_frac" + ",rtransaction_id" " FROM merchant_refunds" " WHERE coin_pub=$1" " AND order_serial=$2", 2), + /* for process_deposits_for_refund_cb() used in postgres_increase_refund() */ + GNUNET_PQ_make_prepare ("insert_refund", + "INSERT INTO merchant_refunds" + "(order_serial" + ",rtransaction_id" + ",coin_pub" + ",reason" + ",refund_amount_val" + ",refund_amount_frac" + ") VALUES" + "($1, $2, $3, $4, $5, $6)", + 6), + /* for postgres_increase_refund() */ + GNUNET_PQ_make_prepare ("find_deposits_for_refund", + "SELECT" + " coin_pub" + ",order_serial" + ",amount_with_fee_val" + ",amount_with_fee_frac" + " FROM merchant_deposits" + " WHERE order_serial=" + " (SELECT order_serial" + " FROM merchant_contract_terms" + " WHERE order_id=$2" + " AND paid=true" + " AND merchant_serial=" + " (SELECT merchant_serial" + " FROM merchant_instances" + " WHERE merchant_id=$1))", + 2), /* OLD API: */ @@ -5557,17 +5589,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) ",wtid) VALUES " "($1, $2, $3)", 3), - GNUNET_PQ_make_prepare ("insert_refund", - "INSERT INTO merchant_refunds" - "(merchant_pub" - ",h_contract_terms" - ",coin_pub" - ",reason" - ",refund_amount_val" - ",refund_amount_frac" - ") VALUES" - "($1, $2, $3, $4, $5, $6)", - 6), GNUNET_PQ_make_prepare ("insert_proof", "INSERT INTO merchant_proofs" "(exchange_url" |