[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.
- [taler-merchant] 194/277: finish FIXMEs in private-get-orders-ID:, (continued)
- [taler-merchant] 194/277: finish FIXMEs in private-get-orders-ID:, gnunet, 2020/07/05
- [taler-merchant] 195/277: remark, gnunet, 2020/07/05
- [taler-merchant] 182/277: More complete tests for deposits, transfers, refund, lookup orders, gnunet, 2020/07/05
- [taler-merchant] 187/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [taler-merchant] 190/277: implementation of GET /private/tips, gnunet, 2020/07/05
- [taler-merchant] 191/277: test/fix for POST /private/reserves, gnunet, 2020/07/05
- [taler-merchant] 193/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [taler-merchant] 198/277: enable handler, gnunet, 2020/07/05
- [taler-merchant] 200/277: test with MHD error, gnunet, 2020/07/05
- [taler-merchant] 201/277: fix crash, gnunet, 2020/07/05
- [taler-merchant] 205/277: fixed authorize tip and tests for GET /private/tips,
gnunet <=
- [taler-merchant] 203/277: sync, gnunet, 2020/07/05
- [taler-merchant] 188/277: private-get-orders-ID now compiles -- but not more than that, gnunet, 2020/07/05
- [taler-merchant] 208/277: implement missing SQL, gnunet, 2020/07/05
- [taler-merchant] 211/277: adjust API to current spec, gnunet, 2020/07/05
- [taler-merchant] 215/277: this was done by Jonathan, gnunet, 2020/07/05
- [taler-merchant] 213/277: starting with merchant_api_merchant_get_order.c, gnunet, 2020/07/05
- [taler-merchant] 218/277: allow refund_delay to be specified with POST /orders, fix FTBFS, gnunet, 2020/07/05
- [taler-merchant] 216/277: clean up logic: use new EXCHANGE_YNA enum, avoid crazy macro construction to build URLs, use full power of TALER_url_join() instead, gnunet, 2020/07/05
- [taler-merchant] 219/277: tests for new db methods, gnunet, 2020/07/05
- [taler-merchant] 204/277: moved yna to exchange, gnunet, 2020/07/05