gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] 79/277: backend code for /refund handling


From: gnunet
Subject: [taler-merchant] 79/277: backend code for /refund handling
Date: Sun, 05 Jul 2020 20:49:52 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

commit e6931be74dc8487d5f3020f265b84145d779b45b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat May 2 18:51:49 2020 +0200

    backend code for /refund handling
---
 src/backenddb/plugin_merchantdb_postgres.c | 45 ++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 12 deletions(-)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 00df78a..8f1a864 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"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]