gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: add loop over resul


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: add loop over result of refunding information
Date: Thu, 08 Jun 2017 15:54:03 +0200

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

marcello pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 1e2adf9  add loop over result of refunding information
1e2adf9 is described below

commit 1e2adf90d4e1239141426db76c50509751fc614f
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Jun 8 15:53:48 2017 +0200

    add loop over result of refunding information
---
 src/backenddb/plugin_merchantdb_postgres.c | 40 ++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 15ebbf1..526ba6e 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1626,11 +1626,6 @@ postgres_increase_refund_for_contract (void *cls,
                                        const struct TALER_Amount *refund,
                                        const char *reason)
 {
-  /*FIXME, logic incomplete*/
-
-  /* 1 Get coins for a given contract
-     2 "Spread" the refund amount among those coins
-     3 Store the solution into table merchant_refund */
 
   struct PostgresClosure *pg = cls;
   PGresult *result;
@@ -1652,6 +1647,41 @@ postgres_increase_refund_for_contract (void *cls,
     return GNUNET_SYSERR;
   }
 
+  /*FIXME, logic incomplete*/
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "increase DB routine\n");
+  for (i=0;i<PQntuples (result);i++)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "increase DB routine loop (%d)\n",
+                i);
+    struct TALER_CoinSpendPublicKeyP coin_pub;
+    struct TALER_Amount amount_with_fee;
+    struct TALER_Amount refund_amount_awarded;
+
+    struct GNUNET_PQ_ResultSpec rs[] = {
+      GNUNET_PQ_result_spec_auto_from_type ("merchant_deposits.coin_pub",
+                                            &coin_pub),
+      TALER_PQ_result_spec_amount ("merchant_deposits.amount_with_fee",
+                                   &amount_with_fee),
+      TALER_PQ_result_spec_amount ("merchant_refunds.refund_amount",
+                                   &refund_amount_awarded),
+      GNUNET_PQ_result_spec_end
+    };
+
+    if (GNUNET_OK !=
+        GNUNET_PQ_extract_result (result,
+                                  rs,
+                                  i))
+    {
+      GNUNET_break (0);
+      PQclear (result);
+      return GNUNET_SYSERR;
+    }
+
+  }
+
   return GNUNET_OK;
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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