gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated: introducing closing


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: introducing closing fee
Date: Mon, 17 Apr 2017 14:18:13 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 164c125  introducing closing fee
164c125 is described below

commit 164c125528e4af078815c0156df54fa0120eed8a
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Apr 17 14:01:55 2017 +0200

    introducing closing fee
---
 src/exchange-lib/exchange_api_wire.c               |  4 +++
 src/exchange-lib/test_exchange_api.conf            | 21 +++++++++++++
 src/exchange-tools/taler-exchange-keyup.c          | 36 ++++++++++++++++++++++
 src/exchange/taler-exchange-httpd_wire.c           |  3 +-
 .../test-taler-exchange-aggregator-postgres.conf   | 11 +++++++
 src/exchangedb/exchangedb_fees.c                   |  4 +++
 src/include/taler_exchange_service.h               |  8 ++++-
 src/include/taler_exchangedb_lib.h                 |  7 ++++-
 src/include/taler_signatures.h                     |  5 +++
 9 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/src/exchange-lib/exchange_api_wire.c 
b/src/exchange-lib/exchange_api_wire.c
index bdf4dc8..f1056fd 100644
--- a/src/exchange-lib/exchange_api_wire.c
+++ b/src/exchange-lib/exchange_api_wire.c
@@ -332,6 +332,8 @@ parse_json_fees (struct TALER_EXCHANGE_WireAggregateFees 
*af,
                                  &af->master_sig),
     TALER_JSON_spec_amount ("wire_fee",
                             &af->wire_fee),
+    TALER_JSON_spec_amount ("closing_fee",
+                            &af->closing_fee),
     GNUNET_JSON_spec_absolute_time ("start_date",
                                     &af->start_date),
     GNUNET_JSON_spec_absolute_time ("end_date",
@@ -376,6 +378,8 @@ check_sig (const struct TALER_EXCHANGE_WireAggregateFees 
*af,
   wp.end_date = GNUNET_TIME_absolute_hton (af->end_date);
   TALER_amount_hton (&wp.wire_fee,
                      &af->wire_fee);
+  TALER_amount_hton (&wp.closing_fee,
+                     &af->closing_fee);
   return GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MASTER_WIRE_FEES,
                                      &wp.purpose,
                                      &af->master_sig.eddsa_signature,
diff --git a/src/exchange-lib/test_exchange_api.conf 
b/src/exchange-lib/test_exchange_api.conf
index 42861ea..19119b7 100644
--- a/src/exchange-lib/test_exchange_api.conf
+++ b/src/exchange-lib/test_exchange_api.conf
@@ -43,6 +43,17 @@ WIRE-FEE-2024 = EUR:0.01
 WIRE-FEE-2025 = EUR:0.01
 WIRE-FEE-2026 = EUR:0.01
 
+CLOSING-FEE-2017 = EUR:0.01
+CLOSING-FEE-2018 = EUR:0.01
+CLOSING-FEE-2019 = EUR:0.01
+CLOSING-FEE-2020 = EUR:0.01
+CLOSING-FEE-2021 = EUR:0.01
+CLOSING-FEE-2022 = EUR:0.01
+CLOSING-FEE-2023 = EUR:0.01
+CLOSING-FEE-2024 = EUR:0.01
+CLOSING-FEE-2025 = EUR:0.01
+CLOSING-FEE-2026 = EUR:0.01
+
 [exchange-wire-incoming-sepa]
 # This is the response we give out for the /wire request.  It provides
 # wallets with the bank information for transfers to the exchange.
@@ -65,6 +76,16 @@ WIRE-FEE-2024 = EUR:0.01
 WIRE-FEE-2025 = EUR:0.01
 WIRE-FEE-2026 = EUR:0.01
 
+CLOSING-FEE-2017 = EUR:0.01
+CLOSING-FEE-2018 = EUR:0.01
+CLOSING-FEE-2019 = EUR:0.01
+CLOSING-FEE-2020 = EUR:0.01
+CLOSING-FEE-2021 = EUR:0.01
+CLOSING-FEE-2022 = EUR:0.01
+CLOSING-FEE-2023 = EUR:0.01
+CLOSING-FEE-2024 = EUR:0.01
+CLOSING-FEE-2025 = EUR:0.01
+CLOSING-FEE-2026 = EUR:0.01
 
 [exchange-wire-incoming-test]
 # This is the response we give out for the /wire request.  It provides
diff --git a/src/exchange-tools/taler-exchange-keyup.c 
b/src/exchange-tools/taler-exchange-keyup.c
index f5e5961..ce6f2ba 100644
--- a/src/exchange-tools/taler-exchange-keyup.c
+++ b/src/exchange-tools/taler-exchange-keyup.c
@@ -949,6 +949,8 @@ create_wire_fee_for_method (void *cls,
     af = GNUNET_new (struct TALER_EXCHANGEDB_AggregateFees);
     af->start_date = start_date;
     af->end_date = end_date;
+
+    /* handle wire fee */
     GNUNET_asprintf (&opt,
                      "wire-fee-%u",
                      year);
@@ -980,6 +982,40 @@ create_wire_fee_for_method (void *cls,
       break;
     }
     GNUNET_free (amounts);
+
+    /* handle closing fee */
+    GNUNET_asprintf (&opt,
+                     "closing-fee-%u",
+                     year);
+    if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_string (kcfg,
+                                               section,
+                                               opt,
+                                               &amounts))
+    {
+      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                                 section,
+                                 opt);
+      *ret = GNUNET_SYSERR;
+      GNUNET_free (opt);
+      break;
+    }
+    if (GNUNET_OK !=
+        TALER_string_to_amount (amounts,
+                                &af->closing_fee))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Invalid amount `%s' specified in `%s' under `%s'\n",
+                  amounts,
+                  wiremethod,
+                  opt);
+      *ret = GNUNET_SYSERR;
+      GNUNET_free (amounts);
+      GNUNET_free (opt);
+      break;
+    }
+    GNUNET_free (amounts);
+    
     GNUNET_free (opt);
     sign_af (af,
              wiremethod,
diff --git a/src/exchange/taler-exchange-httpd_wire.c 
b/src/exchange/taler-exchange-httpd_wire.c
index 2109395..22581ab 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -56,8 +56,9 @@ fees_to_json (struct TALER_EXCHANGEDB_AggregateFees *af)
     }
     if (0 !=
         json_array_append_new (a,
-                               json_pack ("{s:o, s:o, s:o, s:o}",
+                               json_pack ("{s:o, s:o, s:o, s:o, s:o}",
                                           "wire_fee", TALER_JSON_from_amount 
(&af->wire_fee),
+                                         "closing_fee", TALER_JSON_from_amount 
(&af->closing_fee),
                                           "start_date", 
GNUNET_JSON_from_time_abs (af->start_date),
                                           "end_date", 
GNUNET_JSON_from_time_abs (af->end_date),
                                           "sig", GNUNET_JSON_from_data_auto 
(&af->master_sig))))
diff --git a/src/exchange/test-taler-exchange-aggregator-postgres.conf 
b/src/exchange/test-taler-exchange-aggregator-postgres.conf
index e70a933..a5ee91a 100644
--- a/src/exchange/test-taler-exchange-aggregator-postgres.conf
+++ b/src/exchange/test-taler-exchange-aggregator-postgres.conf
@@ -42,6 +42,17 @@ WIRE-FEE-2024 = EUR:0.01
 WIRE-FEE-2025 = EUR:0.01
 WIRE-FEE-2026 = EUR:0.01
 
+CLOSING-FEE-2017 = EUR:0.01
+CLOSING-FEE-2018 = EUR:0.01
+CLOSING-FEE-2019 = EUR:0.01
+CLOSING-FEE-2020 = EUR:0.01
+CLOSING-FEE-2021 = EUR:0.01
+CLOSING-FEE-2022 = EUR:0.01
+CLOSING-FEE-2023 = EUR:0.01
+CLOSING-FEE-2024 = EUR:0.01
+CLOSING-FEE-2025 = EUR:0.01
+CLOSING-FEE-2026 = EUR:0.01
+
 
 [exchange-wire-outgoing-test]
 # What is the main website of the bank?
diff --git a/src/exchangedb/exchangedb_fees.c b/src/exchangedb/exchangedb_fees.c
index 228015c..d6fdac4 100644
--- a/src/exchangedb/exchangedb_fees.c
+++ b/src/exchangedb/exchangedb_fees.c
@@ -62,6 +62,8 @@ wd2af (const struct TALER_WireFeeDiskP *wd)
   af->end_date = GNUNET_TIME_absolute_ntoh (wd->wf.end_date);
   TALER_amount_ntoh (&af->wire_fee,
                      &wd->wf.wire_fee);
+  TALER_amount_ntoh (&af->closing_fee,
+                     &wd->wf.closing_fee);
   af->master_sig = wd->master_sig;
   return af;
 }
@@ -162,6 +164,8 @@ TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
   wf->end_date = GNUNET_TIME_absolute_hton (af->end_date);
   TALER_amount_hton (&wf->wire_fee,
                      &af->wire_fee);
+  TALER_amount_hton (&wf->closing_fee,
+                     &af->closing_fee);
 }
 
 
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index c097dff..9e8caab 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -351,11 +351,17 @@ struct TALER_EXCHANGE_WireAggregateFees
   struct TALER_EXCHANGE_WireAggregateFees *next;
 
   /**
-   * Fee to be paid.
+   * Fee to be paid whenever the exchange wires funds to the merchant.
    */
   struct TALER_Amount wire_fee;
 
   /**
+   * Fee to be paid when the exchange closes a reserve and wires funds
+   * back to a customer.
+   */
+  struct TALER_Amount closing_fee;
+
+  /**
    * Time when this fee goes into effect (inclusive)
    */
   struct GNUNET_TIME_Absolute start_date;
diff --git a/src/include/taler_exchangedb_lib.h 
b/src/include/taler_exchangedb_lib.h
index 70ae363..561738c 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -332,11 +332,16 @@ struct TALER_EXCHANGEDB_AggregateFees
   struct TALER_EXCHANGEDB_AggregateFees *next;
 
   /**
-   * Fee to be paid.
+   * Fee to be paid for wire transfers to a merchant.
    */
   struct TALER_Amount wire_fee;
 
   /**
+   * Fee to be paid when we close a reserve and send funds back.
+   */
+  struct TALER_Amount closing_fee;
+
+  /**
    * Time when this fee goes into effect (inclusive)
    */
   struct GNUNET_TIME_Absolute start_date;
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index d4c5d86..70560b4 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -938,6 +938,11 @@ struct TALER_MasterWireFeePS
    */
   struct TALER_AmountNBO wire_fee;
 
+  /**
+   * Closing fee charged when we wire back funds of a reserve.
+   */
+  struct TALER_AmountNBO closing_fee;
+
 };
 
 

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



reply via email to

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