[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 161/277: fix misc issues in client APIs
From: |
gnunet |
Subject: |
[taler-merchant] 161/277: fix misc issues in client APIs |
Date: |
Sun, 05 Jul 2020 20:51:14 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit 990f4d4d5192506aa4a5f6510449e0aa79a2e61f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun May 31 19:26:14 2020 +0200
fix misc issues in client APIs
---
src/lib/merchant_api_tip_authorize.c | 8 ++++----
src/lib/merchant_api_tip_pickup2.c | 27 +++++++++++++++++--------
src/lib/merchant_api_tip_query.c | 39 ++++++++++++++++++++++++++----------
3 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/src/lib/merchant_api_tip_authorize.c
b/src/lib/merchant_api_tip_authorize.c
index 4604fc0..0147ec7 100644
--- a/src/lib/merchant_api_tip_authorize.c
+++ b/src/lib/merchant_api_tip_authorize.c
@@ -239,8 +239,8 @@ TALER_MERCHANT_tip_authorize2 (
tao->cb_cls = authorize_cb_cls;
{
- char res_str[sizeof (struct GNUNET_HashCode) * 2];
- char arg_str[sizeof (struct TALER_CoinSpendPublicKeyP) * 2 + 32];
+ char res_str[sizeof (*reserve_pub) * 2];
+ char arg_str[sizeof (res_str) + 48];
char *end;
end = GNUNET_STRINGS_data_to_string (reserve_pub,
@@ -250,7 +250,7 @@ TALER_MERCHANT_tip_authorize2 (
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "/reserves/%s/tip-authorize",
+ "/private/reserves/%s/tip-authorize",
res_str);
tao->url = TALER_url_join (backend_url,
arg_str,
@@ -341,7 +341,7 @@ TALER_MERCHANT_tip_authorize (struct GNUNET_CURL_Context
*ctx,
tao->cb_cls = authorize_cb_cls;
tao->url = TALER_url_join (backend_url,
- "/tips",
+ "/private/tips",
NULL);
if (NULL == tao->url)
{
diff --git a/src/lib/merchant_api_tip_pickup2.c
b/src/lib/merchant_api_tip_pickup2.c
index a06de61..4e26217 100644
--- a/src/lib/merchant_api_tip_pickup2.c
+++ b/src/lib/merchant_api_tip_pickup2.c
@@ -283,11 +283,7 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context
*ctx,
return NULL;
}
}
- tp_obj = json_pack ("{"
- " s:o," /* tip_id */
- " s:o," /* planchets */
- "}",
- "tip_id", GNUNET_JSON_from_data_auto (tip_id),
+ tp_obj = json_pack ("{s:o}",
"planchets", pa);
if (NULL == tp_obj)
{
@@ -300,9 +296,24 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context
*ctx,
tpo->cb = pickup_cb;
tpo->cb_cls = pickup_cb_cls;
- tpo->url = TALER_url_join (backend_url,
- "tip-pickup",
- NULL);
+ {
+ char tip_str[sizeof (*tip_id) * 2];
+ char arg_str[sizeof (tip_str) + 32];
+ char *end;
+
+ end = GNUNET_STRINGS_data_to_string (tip_id,
+ sizeof (*tip_id),
+ tip_str,
+ sizeof (tip_str));
+ *end = '\0';
+ GNUNET_snprintf (arg_str,
+ sizeof (arg_str),
+ "/tips/%s/pickup",
+ tip_str);
+ tpo->url = TALER_url_join (backend_url,
+ arg_str,
+ NULL);
+ }
if (NULL == tpo->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/lib/merchant_api_tip_query.c b/src/lib/merchant_api_tip_query.c
index b25fac8..cf2f804 100644
--- a/src/lib/merchant_api_tip_query.c
+++ b/src/lib/merchant_api_tip_query.c
@@ -16,7 +16,7 @@
*/
/**
* @file lib/merchant_api_tip_query.c => FIXME: rename!
- * @brief Implementation of the /tip-query request of the merchant's HTTP API
+ * @brief Implementation of the GET /tips/$TIP_ID request of the merchant's
HTTP API
* @author Florian Dold
*/
#include "platform.h"
@@ -92,15 +92,16 @@ handle_tip_get_finished (void *cls,
{
case MHD_HTTP_OK:
{
- struct GNUNET_TIME_Absolute reserve_expiration;
const char *exchange_url;
struct TALER_Amount amount_remaining;
- struct TALER_ReservePublicKeyP reserve_pub;
+ struct GNUNET_TIME_Absolute expiration;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("reserve_pub", &reserve_pub),
+ GNUNET_JSON_spec_absolute_time ("expiration",
+ &expiration),
GNUNET_JSON_spec_string ("exchange_url",
&exchange_url),
- TALER_JSON_spec_amount ("amount_remaining", &amount_remaining),
+ TALER_JSON_spec_amount ("tip_amount",
+ &amount_remaining),
GNUNET_JSON_spec_end ()
};
@@ -116,7 +117,7 @@ handle_tip_get_finished (void *cls,
}
tqo->cb (tqo->cb_cls,
&hr,
- reserve_expiration,
+ expiration,
exchange_url,
&amount_remaining);
TALER_MERCHANT_tip_get_cancel (tqo);
@@ -155,7 +156,7 @@ handle_tip_get_finished (void *cls,
/**
- * Issue a /tip-get request to the backend. Informs the backend
+ * Issue a GET /tips/$TIP_ID request to the backend. Informs the backend
* that a customer wants to pick up a tip.
*
* @param ctx execution context
@@ -179,9 +180,25 @@ TALER_MERCHANT_tip_get (struct GNUNET_CURL_Context *ctx,
tqo->ctx = ctx;
tqo->cb = cb;
tqo->cb_cls = cb_cls;
- tqo->url = TALER_url_join (backend_url,
- "tip-get",
- NULL);
+ {
+ char res_str[sizeof (*tip_id) * 2];
+ char arg_str[sizeof (res_str) + 48];
+ char *end;
+
+ end = GNUNET_STRINGS_data_to_string (tip_id,
+ sizeof (*tip_id),
+ res_str,
+ sizeof (res_str));
+ *end = '\0';
+ GNUNET_snprintf (arg_str,
+ sizeof (arg_str),
+ "/tips/%s",
+ res_str);
+ tqo->url = TALER_url_join (backend_url,
+ arg_str,
+ NULL);
+ }
+
if (NULL == tqo->url)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -210,7 +227,7 @@ TALER_MERCHANT_tip_get (struct GNUNET_CURL_Context *ctx,
/**
- * Cancel a /tip-get request. This function cannot be used
+ * Cancel a GET /tips/$TIP_ID request. This function cannot be used
* on a request handle if a response is already served for it.
*
* @param tqo handle to the operation being cancelled
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] 163/277: implement filter, (continued)
- [taler-merchant] 163/277: implement filter, gnunet, 2020/07/05
- [taler-merchant] 165/277: add logic for activation of reserves to merchant backend DB, gnunet, 2020/07/05
- [taler-merchant] 147/277: added more tests for contract terms, deposits, and transfers, gnunet, 2020/07/05
- [taler-merchant] 160/277: address DB fixes for missing EC values, gnunet, 2020/07/05
- [taler-merchant] 157/277: fix DB use, gnunet, 2020/07/05
- [taler-merchant] 166/277: SQL fixing, gnunet, 2020/07/05
- [taler-merchant] 152/277: wrote db tests for tips/lookups, gnunet, 2020/07/05
- [taler-merchant] 145/277: refactored the existing product and order tests, gnunet, 2020/07/05
- [taler-merchant] 171/277: tests/fixes for tips and pickups in backenddb, gnunet, 2020/07/05
- [taler-merchant] 169/277: implement POST /private/reserves, gnunet, 2020/07/05
- [taler-merchant] 161/277: fix misc issues in client APIs,
gnunet <=
- [taler-merchant] 162/277: implement GET /reserves/RPUB, gnunet, 2020/07/05
- [taler-merchant] 170/277: implement POST /private/reserves, gnunet, 2020/07/05
- [taler-merchant] 175/277: avoid amount_zero, use DEFAULT instead, gnunet, 2020/07/05
- [taler-merchant] 174/277: new backenddb APIs for GET /private/orders/ID, gnunet, 2020/07/05
- [taler-merchant] 168/277: implement GET /reserves/RESERVE_ID, gnunet, 2020/07/05
- [taler-merchant] 167/277: implement TALER_MERCHANT_reserves_get(), gnunet, 2020/07/05
- [taler-merchant] 173/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05
- [taler-merchant] 172/277: first high-level hack job at GET /orders/ID -- certainly FTBFS still, gnunet, 2020/07/05
- [taler-merchant] 176/277: cleaned backenddb test code, completed tests for instances & products, gnunet, 2020/07/05
- [taler-merchant] 179/277: Merge branch 'protocolV1' of git+ssh://git.taler.net/merchant into protocolV1, gnunet, 2020/07/05