gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] 02/02: Towards #5366..


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] 02/02: Towards #5366..
Date: Wed, 27 Jun 2018 16:10:38 +0200

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

marcello pushed a commit to branch master
in repository merchant.

commit 7305041655d62c3db960ff7235c63ff3eb7d818f
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Jun 27 16:10:18 2018 +0200

    Towards #5366..
---
 src/backend/taler-merchant-httpd_pay.c             | 29 +++++++++++++++++++++-
 .../taler-merchant-generate-payments-alt.c         | 16 +++++++-----
 .../taler-merchant-generate-payments.c             |  1 -
 3 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index bb31afb..bd9cb76 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1316,6 +1316,7 @@ parse_pay (struct MHD_Connection *connection,
   };
   enum GNUNET_DB_QueryStatus qs;
   const char *session_id;
+  struct GNUNET_TIME_Relative used_wire_transfer_delay;
 
   res = TMH_PARSE_json_data (connection,
                              root,
@@ -1452,9 +1453,35 @@ parse_pay (struct MHD_Connection *connection,
       return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
     }
 
+    /* Use the value from config as default.  */
+    used_wire_transfer_delay = wire_transfer_delay;
+    if (NULL != json_object_get (pc->contract_terms,
+                                 "wire_transfer_delay"))
+    {
+
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Frontend specified wire transfer delay\n");
+      
+      struct GNUNET_JSON_Specification wspec[] = {
+        GNUNET_JSON_spec_relative_time ("wire_transfer_delay",
+                                        &used_wire_transfer_delay),
+        GNUNET_JSON_spec_end()
+      };
+
+      res = TMH_PARSE_json_data (connection,
+                                 pc->contract_terms,
+                                 wspec);
+      if (GNUNET_YES != res)
+      {
+        GNUNET_JSON_parse_free (spec);
+        GNUNET_break (0);
+        return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
+      }
+    }
+
     pc->wire_transfer_deadline
       = GNUNET_TIME_absolute_add (pc->timestamp,
-                                  wire_transfer_delay);
+                                  used_wire_transfer_delay);
 
     if (pc->wire_transfer_deadline.abs_value_us < 
pc->refund_deadline.abs_value_us)
     {
diff --git a/src/merchant-tools/taler-merchant-generate-payments-alt.c 
b/src/merchant-tools/taler-merchant-generate-payments-alt.c
index 346d088..4fd1545 100644
--- a/src/merchant-tools/taler-merchant-generate-payments-alt.c
+++ b/src/merchant-tools/taler-merchant-generate-payments-alt.c
@@ -150,7 +150,7 @@ static char *currency;
                    "%s:5.01", \
                    currency); \
   GNUNET_asprintf (&CURRENCY_5, \
-                   "%s:5.01", \
+                   "%s:5", \
                    currency); \
   GNUNET_asprintf (&CURRENCY_4_99, \
                    "%s:4.99", \
@@ -169,8 +169,9 @@ static char *currency;
        {\"currency\":\"%s\",\
         \"value\":0,\
         \"fraction\":50000000},\
-       \"refund_deadline\":\"\\/Date(99999999999)\\/\",\
-       \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
+       \"wire_transfer_delay\":\"\\/forever\\/\",\
+       \"refund_deadline\":\"\\/end of time\\/\",\
+       \"pay_deadline\":\"\\/end of time\\/\",\
        \"amount\":\
          {\"currency\":\"%s\",\
           \"value\":5,\
@@ -287,17 +288,21 @@ run (void *cls,
       ("create-reserve-2",
        CURRENCY_10_02),
 
+    TALER_TESTING_cmd_exec_wirewatch
+      ("wirewatch-2",
+       cfg_filename),
+
     TALER_TESTING_cmd_withdraw_amount
       ("withdraw-coin-2",
        is->exchange,
-       "create-reserve-1",
+       "create-reserve-2",
        CURRENCY_5,
        MHD_HTTP_OK),
 
     TALER_TESTING_cmd_withdraw_amount
       ("withdraw-coin-3",
        is->exchange,
-       "create-reserve-1",
+       "create-reserve-2",
        CURRENCY_5,
        MHD_HTTP_OK),
 
@@ -492,7 +497,6 @@ main (int argc,
      bank_url)))
   {
     TALER_LOG_ERROR ("Failed to run the bank\n");
-    terminate_process (bankd);
     terminate_process (merchantd);
     return FAILED_TO_LAUNCH_BANK;
   }
diff --git a/src/merchant-tools/taler-merchant-generate-payments.c 
b/src/merchant-tools/taler-merchant-generate-payments.c
index d017d96..e8b04ad 100644
--- a/src/merchant-tools/taler-merchant-generate-payments.c
+++ b/src/merchant-tools/taler-merchant-generate-payments.c
@@ -543,7 +543,6 @@ main (int argc,
      bank_url)))
   {
     TALER_LOG_ERROR ("Failed to run the bank\n");
-    terminate_process (bankd);
     terminate_process (merchantd);
     return FAILED_TO_LAUNCH_BANK;
   }

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



reply via email to

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