diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-12 18:52:20 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-06-12 18:52:20 -0400 |
commit | ae2bfdbeaaa2ef289e79c0b57c428672a8157ff0 (patch) | |
tree | 775e7f19c117c442a81efe68a5f61f38eb231099 | |
parent | 3f2b7316255c1a583c7720b3e7624ab16d4378b2 (diff) | |
download | merchant-ae2bfdbeaaa2ef289e79c0b57c428672a8157ff0.tar.gz merchant-ae2bfdbeaaa2ef289e79c0b57c428672a8157ff0.tar.bz2 merchant-ae2bfdbeaaa2ef289e79c0b57c428672a8157ff0.zip |
fixed authorize tip and tests for GET /private/tips
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 0b363cfb..61e2b38a 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 9da41057..77854a19 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 ac180443..0f338ff1 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 324dd402..5ca5ec6f 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", |