summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-11-30 01:51:54 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-11-30 01:51:54 +0100
commiteaaebef04fb544e271e791545c08168c9302b0a1 (patch)
tree0572d8d3c5d9cf33a15e881a3100bb8cb87c7867
parent1d3ce16ea5b48e67c0675f179ccfb2edb1f7fd9e (diff)
downloadmerchant-eaaebef04fb544e271e791545c08168c9302b0a1.tar.gz
merchant-eaaebef04fb544e271e791545c08168c9302b0a1.tar.bz2
merchant-eaaebef04fb544e271e791545c08168c9302b0a1.zip
uri->url, add tip_token with pickup_url in /tip-authorize
-rw-r--r--src/backend/taler-merchant-httpd_tip-authorize.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/backend/taler-merchant-httpd_tip-authorize.c b/src/backend/taler-merchant-httpd_tip-authorize.c
index bdfd48c4..a8b90d44 100644
--- a/src/backend/taler-merchant-httpd_tip-authorize.c
+++ b/src/backend/taler-merchant-httpd_tip-authorize.c
@@ -86,10 +86,12 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
struct TALER_Amount amount;
const char *instance;
const char *justification;
+ const char *pickup_url;
struct GNUNET_JSON_Specification spec[] = {
TALER_JSON_spec_amount ("amount", &amount),
GNUNET_JSON_spec_string ("instance", &instance),
GNUNET_JSON_spec_string ("justification", &justification),
+ GNUNET_JSON_spec_string ("pickup_url", &pickup_url),
GNUNET_JSON_spec_end()
};
json_t *root;
@@ -198,13 +200,23 @@ MH_handler_tip_authorize (struct TMH_RequestHandler *rh,
TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS,
"Insufficient funds for tip");
}
+ json_t *tip_token = json_pack ("{s:o, s:o, s:s, s:s}"
+ "tip_id", GNUNET_JSON_from_data_auto (&tip_id),
+ "expiration", GNUNET_JSON_from_time_abs (expiration),
+ "exchange_url", mi->tip_exchange,
+ "pickup_url", pickup_url);
+ char *tip_token_str = json_dumps (tip_token, JSON_ENSURE_ASCII | JSON_COMPACT);
+ json_decref (tip_token);
json_decref (root);
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o, s:o, s:s}",
- "tip_id", GNUNET_JSON_from_data_auto (&tip_id),
- "expiration", GNUNET_JSON_from_time_abs (expiration),
- "exchange_uri", mi->tip_exchange);
+ int ret = TMH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_OK,
+ "{s:o, s:o, s:s, s:s}",
+ "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_str);
+ GNUNET_free (tip_token_str);
+ return ret;
}
/* end of taler-merchant-httpd_tip-authorize.c */