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: refund_fee is retur


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: refund_fee is returned to the callback when fetching a deposit from the db.
Date: Thu, 08 Jun 2017 14:06:56 +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 51add29  refund_fee is returned to the callback when fetching a 
deposit from the db.
51add29 is described below

commit 51add29ac66fef6b05b4392bf89dfe2c6367c29a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Jun 8 14:06:07 2017 +0200

    refund_fee is returned to the callback when fetching
    a deposit from the db.
---
 src/backend/taler-merchant-httpd_pay.c     |  2 ++
 src/backenddb/plugin_merchantdb_postgres.c | 25 ++++++++++++++++++++++++-
 src/backenddb/test_merchantdb.c            |  8 +++++---
 src/include/taler_merchantdb_plugin.h      |  2 ++
 4 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index 3ef8f9f..902a7dc 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -916,6 +916,7 @@ handle_pay_timeout (void *cls)
  * @param coin_pub public key of the coin
  * @param amount_with_fee amount the exchange will deposit for this coin
  * @param deposit_fee fee the exchange will charge for this coin
+ * @param refund_fee fee the exchange will charge for refunding this coin
  * @param exchange_proof proof from exchange that coin was accepted
  */
 static void
@@ -924,6 +925,7 @@ check_coin_paid (void *cls,
                  const struct TALER_CoinSpendPublicKeyP *coin_pub,
                  const struct TALER_Amount *amount_with_fee,
                  const struct TALER_Amount *deposit_fee,
+                 const struct TALER_Amount *refund_fee,
                  const json_t *exchange_proof)
 {
   struct PayContext *pc = cls;
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 6fbb7ab..6b749db 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -323,6 +323,9 @@ postgres_initialize (void *cls)
                             ",deposit_fee_val"
                             ",deposit_fee_frac"
                             ",deposit_fee_curr"
+                            ",refund_fee_val"
+                            ",refund_fee_frac"
+                            ",refund_fee_curr"
                             ",exchange_proof"
                             " FROM merchant_deposits"
                             " WHERE h_contract_terms=$1"
@@ -362,6 +365,9 @@ postgres_initialize (void *cls)
                             ",merchant_deposits.deposit_fee_val"
                             ",merchant_deposits.deposit_fee_frac"
                             ",merchant_deposits.deposit_fee_curr"
+                            ",merchant_deposits.refund_fee_val"
+                            ",merchant_deposits.refund_fee_frac"
+                            ",merchant_deposits.refund_fee_curr"
                             ",merchant_deposits.exchange_proof"
                             " FROM merchant_transfers"
                             "   JOIN merchant_deposits"
@@ -1194,6 +1200,7 @@ postgres_find_payments (void *cls,
     struct TALER_CoinSpendPublicKeyP coin_pub;
     struct TALER_Amount amount_with_fee;
     struct TALER_Amount deposit_fee;
+    struct TALER_Amount refund_fee;
     json_t *exchange_proof;
 
     struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1203,6 +1210,8 @@ postgres_find_payments (void *cls,
                                    &amount_with_fee),
       TALER_PQ_result_spec_amount ("deposit_fee",
                                    &deposit_fee),
+      TALER_PQ_result_spec_amount ("refund_fee",
+                                   &refund_fee),
       TALER_PQ_result_spec_json ("exchange_proof",
                                  &exchange_proof),
       GNUNET_PQ_result_spec_end
@@ -1222,6 +1231,7 @@ postgres_find_payments (void *cls,
         &coin_pub,
         &amount_with_fee,
         &deposit_fee,
+        &refund_fee,
         exchange_proof);
     GNUNET_PQ_cleanup_result (rs);
   }
@@ -1283,6 +1293,7 @@ postgres_find_payments_by_hash_and_coin (void *cls,
   {
     struct TALER_Amount amount_with_fee;
     struct TALER_Amount deposit_fee;
+    struct TALER_Amount refund_fee;
     json_t *exchange_proof;
 
     struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1290,6 +1301,8 @@ postgres_find_payments_by_hash_and_coin (void *cls,
                                    &amount_with_fee),
       TALER_PQ_result_spec_amount ("deposit_fee",
                                    &deposit_fee),
+      TALER_PQ_result_spec_amount ("refund_fee",
+                                   &refund_fee),
       TALER_PQ_result_spec_json ("exchange_proof",
                                  &exchange_proof),
       GNUNET_PQ_result_spec_end
@@ -1309,6 +1322,7 @@ postgres_find_payments_by_hash_and_coin (void *cls,
         coin_pub,
         &amount_with_fee,
         &deposit_fee,
+        &refund_fee,
         exchange_proof);
     GNUNET_PQ_cleanup_result (rs);
   }
@@ -1449,6 +1463,7 @@ postgres_find_deposits_by_wtid (void *cls,
     struct TALER_CoinSpendPublicKeyP coin_pub;
     struct TALER_Amount amount_with_fee;
     struct TALER_Amount deposit_fee;
+    struct TALER_Amount refund_fee;
     json_t *exchange_proof;
 
     struct GNUNET_PQ_ResultSpec rs[] = {
@@ -1460,6 +1475,8 @@ postgres_find_deposits_by_wtid (void *cls,
                                    &amount_with_fee),
       TALER_PQ_result_spec_amount ("deposit_fee",
                                    &deposit_fee),
+      TALER_PQ_result_spec_amount ("refund_fee",
+                                   &refund_fee),
       TALER_PQ_result_spec_json ("exchange_proof",
                                  &exchange_proof),
       GNUNET_PQ_result_spec_end
@@ -1479,6 +1496,7 @@ postgres_find_deposits_by_wtid (void *cls,
         &coin_pub,
         &amount_with_fee,
         &deposit_fee,
+        &refund_fee,
         exchange_proof);
     GNUNET_PQ_cleanup_result (rs);
   }
@@ -1590,7 +1608,12 @@ postgres_increase_refund_for_contract (void *cls,
                                        const struct TALER_Amount *refund,
                                        const char *reason)
 {
-  /*FIXME, put logic*/
+  /*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 */
+
   return GNUNET_SYSERR;
 }
 
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index cca5f19..c085737 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -249,8 +249,9 @@ pd_cb (void *cls,
  * @param cls closure
  * @param transaction_id of the contract
  * @param coin_pub public key of the coin
- * @param amount_with_fee amount the exchange will deposit for this coin
- * @param deposit_fee fee the exchange will charge for this coin
+ * @param aamount_with_fee amount the exchange will deposit for this coin
+ * @param adeposit_fee fee the exchange will charge for this coin
+ * @param adeposit_fee fee the exchange will charge for refunding this coin
  * @param exchange_proof proof from exchange that coin was accepted
  */
 static void
@@ -259,6 +260,7 @@ deposit_cb (void *cls,
             const struct TALER_CoinSpendPublicKeyP *acoin_pub,
             const struct TALER_Amount *aamount_with_fee,
             const struct TALER_Amount *adeposit_fee,
+            const struct TALER_Amount *arefund_fee,
             const json_t *aexchange_proof)
 {
   CHECK ((0 == memcmp (ah_contract_terms,
@@ -534,7 +536,7 @@ run (void *cls)
                                                         &h_contract_terms,
                                                         &refund_cb,
                                                         NULL));
-  FAILIF (GNUNET_OK !=
+  FAILIF (GNUNET_SYSERR !=
           plugin->increase_refund_for_contract (plugin->cls,
                                                 &h_contract_terms,
                                                 &refund_amount,
diff --git a/src/include/taler_merchantdb_plugin.h 
b/src/include/taler_merchantdb_plugin.h
index a006ae0..4115226 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -76,6 +76,7 @@ typedef void
  * @param coin_pub public key of the coin
  * @param amount_with_fee amount the exchange will deposit for this coin
  * @param deposit_fee fee the exchange will charge for this coin
+ * @param refund_fee fee the exchange will charge for refunding this coin
  * @param exchange_proof proof from exchange that coin was accepted,
  *        matches the `interface DepositSuccess` of the documentation.
  */
@@ -85,6 +86,7 @@ typedef void
                                         const struct TALER_CoinSpendPublicKeyP 
*coin_pub,
                                         const struct TALER_Amount 
*amount_with_fee,
                                         const struct TALER_Amount *deposit_fee,
+                                        const struct TALER_Amount *refund_fee,
                                         const json_t *exchange_proof);
 
 

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



reply via email to

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