gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 205/277: fixed authorize tip and tests for GET /private


From: gnunet
Subject: [taler-merchant] 205/277: fixed authorize tip and tests for GET /private/tips
Date: Sun, 05 Jul 2020 20:51:58 +0200

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

grothoff pushed a commit to branch master
in repository merchant.

commit ae2bfdbeaaa2ef289e79c0b57c428672a8157ff0
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Fri Jun 12 18:52:20 2020 -0400

    fixed authorize tip and tests for GET /private/tips
---
 .../taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c   | 1 +
 src/backend/taler-merchant-httpd_private-post-reserves.c            | 5 +++++
 src/backenddb/plugin_merchantdb_postgres.c                          | 6 +++++-
 src/testing/test_merchant_api.c                                     | 5 ++++-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git 
a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c 
b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
index 0b363cf..61e2b38 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves-ID-authorize-tip.c
@@ -149,6 +149,7 @@ authorize_tip (const struct TMH_RequestHandler *rh,
                                         (NULL == uri_path) ? "" : "/",
                                         hc->instance->settings.id,
                                         hash_enc.encoding));
+    GNUNET_TIME_round_abs (&expiration);
     res = TALER_MHD_reply_json_pack (connection,
                                      MHD_HTTP_OK,
                                      "{s:s, s:s, s:o}",
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c 
b/src/backend/taler-merchant-httpd_private-post-reserves.c
index 9da4105..77854a1 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves.c
@@ -301,6 +301,11 @@ TMH_private_post_reserves (const struct TMH_RequestHandler 
*rh,
                                  &rc->initial_balance,
                                  rc->reserve_expiration);
     GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
+    // Do this temporarily for testing
+    qs = TMH_db->activate_reserve (TMH_db->cls,
+                                   mi->settings.id,
+                                   &reserve_pub,
+                                   &rc->initial_balance);
     if (qs < 0)
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_INTERNAL_SERVER_ERROR,
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index ac18044..0f338ff 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -7561,7 +7561,11 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
                             ",tips_committed_val"
                             ",tips_committed_frac"
                             " FROM merchant_tip_reserves"
-                            " WHERE exchange_initial_balance_val - 
tips_committed_val >= $2"
+                            " WHERE"
+                            " exchange_initial_balance_val - 
tips_committed_val > $2"
+                            " OR"
+                            " (exchange_initial_balance_val - 
tips_committed_val = $2"
+                            " AND exchange_initial_balance_frac - 
tips_committed_frac >= $3)"
                             "  AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 324dd40..5ca5ec6 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -643,11 +643,14 @@ run (void *cls,
                                               "x-taler-bank",
                                               MHD_HTTP_OK),
     TALER_TESTING_cmd_tip_authorize ("authorize-tip-1",
-                                     merchant_url_internal ("tip"),
+                                     merchant_url,
                                      EXCHANGE_URL,
                                      MHD_HTTP_OK,
                                      "tip 1",
                                      "EUR:5.01"),
+    TALER_TESTING_cmd_get_tips ("get-tips-1",
+                                merchant_url,
+                                MHD_HTTP_OK),
 #if 0
     /* Test tipping.  */
     TALER_TESTING_cmd_admin_add_incoming_with_instance ("create-reserve-tip-1",

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