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: max deposit fee pic


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: max deposit fee picked from defaults
Date: Fri, 27 Oct 2017 10:52:25 +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 3344dac  max deposit fee picked from defaults
3344dac is described below

commit 3344dac3b942a57c28296f45b3f3107caa6659d2
Author: Marcello Stanisci <address@hidden>
AuthorDate: Fri Oct 27 10:51:55 2017 +0200

    max deposit fee picked from defaults
---
 src/backend/taler-merchant-httpd.c          | 51 ++++++++++++++---------------
 src/backend/taler-merchant-httpd.h          |  7 ++++
 src/backend/taler-merchant-httpd_proposal.c | 15 ++++++---
 3 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 9c95b8b..bb4b458 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -88,6 +88,13 @@ struct GNUNET_TIME_Relative default_pay_deadline;
 struct TALER_Amount default_max_wire_fee;
 
 /**
+ * Default max deposit fee that the merchant is willing to
+ * pay; if deposit costs more, then the customer will cover
+ * the difference.
+ */
+struct TALER_Amount default_max_deposit_fee;
+
+/**
  * Default factor for wire fee amortization.
  */
 unsigned long long default_wire_fee_amortization;
@@ -751,7 +758,6 @@ iterate_instances (const struct GNUNET_CONFIGURATION_Handle 
*config,
   return GNUNET_SYSERR;
 }
 
-
 /**
  * Main function that will be run by the scheduler.
  *
@@ -836,33 +842,24 @@ run (void *cls,
                               "DEFAULT_MAX_WIRE_FEE",
                               &default_max_wire_fee))
   {
-    char *currency;
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "merchant",
+                               "DEFAULT_MAX_WIRE_FEE");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  } 
 
-    if (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_string (config,
-                                               "taler",
-                                               "CURRENCY",
-                                               &currency))
-    {
-      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                                 "taler",
-                                 "CURRENCY");
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-    }
-    if (GNUNET_OK !=
-        TALER_amount_get_zero (currency,
-                               &default_max_wire_fee))
-    {
-      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                                 "taler",
-                                 "CURRENCY",
-                                 "Specified value not legal for a Taler 
currency");
-      GNUNET_SCHEDULER_shutdown ();
-      GNUNET_free (currency);
-      return;
-    }
-    GNUNET_free (currency);
+  if (GNUNET_OK !=
+      TALER_config_get_denom (config,
+                              "merchant",
+                              "DEFAULT_MAX_DEPOSIT_FEE",
+                              &default_max_deposit_fee))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "merchant",
+                               "DEFAULT_MAX_DEPOSIT_FEE");
+    GNUNET_SCHEDULER_shutdown ();
+    return;
   }
 
   if (GNUNET_OK !=
diff --git a/src/backend/taler-merchant-httpd.h 
b/src/backend/taler-merchant-httpd.h
index 83e9c07..6fd3195 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -243,6 +243,13 @@ extern json_t *j_wire;
 extern struct TALER_Amount default_max_wire_fee;
 
 /**
+ * Default max deposit fee that the merchant is willing to
+ * pay; if deposit costs more, then the customer will cover
+ * the difference.
+ */
+extern struct TALER_Amount default_max_deposit_fee;
+
+/**
  * Default factor for wire fee amortization.
  */
 extern unsigned long long default_wire_fee_amortization;
diff --git a/src/backend/taler-merchant-httpd_proposal.c 
b/src/backend/taler-merchant-httpd_proposal.c
index 59bd62a..df69bb6 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -138,7 +138,6 @@ proposal_put (struct MHD_Connection *connection,
   struct TALER_ProposalDataPS pdps;
   struct GNUNET_CRYPTO_EddsaSignature merchant_sig;
   struct TALER_Amount total;
-  struct TALER_Amount max_fee;
   const char *order_id;
   json_t *products;
   json_t *merchant;
@@ -148,9 +147,9 @@ proposal_put (struct MHD_Connection *connection,
   struct GNUNET_JSON_Specification spec[] = {
     TALER_JSON_spec_amount ("amount", &total),
     GNUNET_JSON_spec_string ("order_id", &order_id),
-    TALER_JSON_spec_amount ("max_fee", &max_fee),
-    /* The following entries we don't actually need, except to check that
-       the order is well-formed */
+    /**
+     * The following entries we don't actually need,
+     * except to check that the order is well-formed */
     GNUNET_JSON_spec_json ("products", &products),
     GNUNET_JSON_spec_json ("merchant", &merchant),
     GNUNET_JSON_spec_absolute_time ("timestamp", &timestamp),
@@ -229,6 +228,14 @@ proposal_put (struct MHD_Connection *connection,
   }
 
   if (NULL == json_object_get (order,
+                               "max_fee"))
+  {
+    json_object_set_new (order,
+                         "max_fee",
+                         TALER_JSON_from_amount (&default_max_deposit_fee));
+  }
+
+  if (NULL == json_object_get (order,
                                "wire_fee_amortization"))
   {
     json_object_set_new (order,

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



reply via email to

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