[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: implement redirect-
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: implement redirect-based tipping |
Date: |
Thu, 18 Jan 2018 18:42:27 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 81e2d6b implement redirect-based tipping
81e2d6b is described below
commit 81e2d6b0446c5a2c212495f562d43e6807d12ca1
Author: Florian Dold <address@hidden>
AuthorDate: Thu Jan 18 18:42:04 2018 +0100
implement redirect-based tipping
---
src/backend/taler-merchant-httpd_tip-authorize.c | 40 +++++++++++++++++++-----
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_tip-authorize.c
b/src/backend/taler-merchant-httpd_tip-authorize.c
index bf155e0..d317aa1 100644
--- a/src/backend/taler-merchant-httpd_tip-authorize.c
+++ b/src/backend/taler-merchant-httpd_tip-authorize.c
@@ -326,6 +326,17 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
if ( (GNUNET_NO == res) ||
(NULL == tac->root) )
return MHD_YES;
+
+ if (NULL == json_object_get (tac->root, "pickup_url"))
+ {
+ char *pickup_url = TMH_make_absolute_backend_url (connection,
+ "tip-pickup",
+ NULL);
+ GNUNET_assert (NULL != pickup_url);
+ json_object_set_new (tac->root, "pickup_url", json_string (pickup_url));
+ GNUNET_free (pickup_url);
+ }
+
res = TMH_PARSE_json_data (connection,
tac->root,
spec);
@@ -408,6 +419,8 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
/* generate success response */
{
json_t *tip_token;
+ char *tip_token_str;
+ char *tip_redirect_url;
tip_token = json_pack ("{s:o, s:o, s:o, s:s, s:s, s:s}",
"tip_id", GNUNET_JSON_from_data_auto (&tip_id),
@@ -416,13 +429,26 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
"exchange_url", mi->tip_exchange,
"next_url", tac->next_url,
"pickup_url", tac->pickup_url);
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o, s:o, s:s, s:o}",
- "tip_id", GNUNET_JSON_from_data_auto
(&tip_id),
- "expiration",
GNUNET_JSON_from_time_abs (expiration),
- "exchange_url", mi->tip_exchange,
- "tip_token", tip_token);
+ tip_token_str = json_dumps (tip_token, JSON_COMPACT);
+ GNUNET_assert (NULL != tip_token_str);
+ tip_redirect_url = TMH_make_absolute_backend_url (connection,
"trigger-pay",
+ "tip_token",
tip_token_str,
+ NULL);
+ GNUNET_assert (NULL != tip_redirect_url);
+ /* FIXME: This is pretty redundant, but we want to support some older
+ * merchant implementations. Newer ones should only get the
+ * tip_redirect_url. */
+ res = TMH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_OK,
+ "{s:o, s:o, s:s, s:o}",
+ "tip_id", GNUNET_JSON_from_data_auto
(&tip_id),
+ "expiration",
GNUNET_JSON_from_time_abs (expiration),
+ "exchange_url", mi->tip_exchange,
+ "tip_token", tip_token,
+ "tip_redirect_url", tip_redirect_url);
+ GNUNET_free (tip_token_str);
+ GNUNET_free (tip_redirect_url);
+ return res;
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: implement redirect-based tipping,
gnunet <=