gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: allow refund_delay to override d


From: gnunet
Subject: [taler-merchant] branch master updated: allow refund_delay to override default wire deadline; check if confliciting refund_deadline exists already during order creation
Date: Sun, 11 Apr 2021 14:17:15 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 9b5717ec allow refund_delay to override default wire deadline; check 
if confliciting refund_deadline exists already during order creation
9b5717ec is described below

commit 9b5717ecbc40a02e71572c490c7e2882f8109b32
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Apr 11 14:17:11 2021 +0200

    allow refund_delay to override default wire deadline; check if confliciting 
refund_deadline exists already during order creation
---
 .../taler-merchant-httpd_private-post-orders.c     | 25 ++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c 
b/src/backend/taler-merchant-httpd_private-post-orders.c
index a06b6ac6..528cb9ef 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -808,20 +808,20 @@ patch_order (struct MHD_Connection *connection,
     if (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us ==
         refund_deadline.abs_value_us)
     {
-      struct GNUNET_TIME_Absolute rd =
-        GNUNET_TIME_relative_to_absolute (refund_delay);
+      refund_deadline = GNUNET_TIME_relative_to_absolute (refund_delay);
 
-      (void) GNUNET_TIME_round_abs (&rd);
+      (void) GNUNET_TIME_round_abs (&refund_deadline);
       if (0 == refund_delay.rel_value_us)
       {
         GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                     "Refund delay is zero, no refunds are possible for this 
order\n");
-        rd = now; /* if delay was 0, ensure that refund_deadline == timestamp 
*/
+        refund_deadline = now; /* if delay was 0, ensure that refund_deadline 
== timestamp */
       }
       GNUNET_assert (0 ==
                      json_object_set_new (order,
                                           "refund_deadline",
-                                          GNUNET_JSON_from_time_abs (rd)));
+                                          GNUNET_JSON_from_time_abs (
+                                            refund_deadline)));
     }
   }
 
@@ -842,13 +842,26 @@ patch_order (struct MHD_Connection *connection,
     struct GNUNET_TIME_Absolute t;
 
     t = GNUNET_TIME_relative_to_absolute (
-      settings->default_wire_transfer_delay);
+      GNUNET_TIME_relative_max (settings->default_wire_transfer_delay,
+                                refund_delay));
+    wire_deadline = GNUNET_TIME_absolute_max (refund_deadline,
+                                              wire_deadline);
     (void) GNUNET_TIME_round_abs (&t);
     GNUNET_assert (0 ==
                    json_object_set_new (order,
                                         "wire_transfer_deadline",
                                         GNUNET_JSON_from_time_abs (t)));
   }
+  if (wire_deadline.abs_value_us < refund_deadline.abs_value_us)
+  {
+    GNUNET_break_op (0);
+    return TALER_MHD_reply_with_error (
+      connection,
+      MHD_HTTP_BAD_REQUEST,
+      TALER_EC_MERCHANT_PRIVATE_POST_ORDERS_REFUND_AFTER_WIRE_DEADLINE,
+      NULL);
+
+  }
 
   if (GNUNET_OK !=
       TALER_amount_is_valid (&max_wire_fee))

-- 
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]