summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-02-26 17:00:41 +0100
committerChristian Grothoff <christian@grothoff.org>2020-02-26 17:00:41 +0100
commitfb9324338d9580b520b3713bf973bfcd9c49b569 (patch)
treeaa90b29dbad21957c864834895fe6b00272a058f /src/exchange/taler-exchange-httpd_deposit.c
parent30b24448c8250b01eba8368f38c9ccdc2075f903 (diff)
downloadexchange-fb9324338d9580b520b3713bf973bfcd9c49b569.tar.gz
exchange-fb9324338d9580b520b3713bf973bfcd9c49b569.tar.bz2
exchange-fb9324338d9580b520b3713bf973bfcd9c49b569.zip
phase 1 of #6067: update exchange HTTPD to new API style
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 49b9cc2f..da89ff47 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -381,27 +381,22 @@ check_timestamp_current (struct GNUNET_TIME_Absolute ts)
/**
- * Handle a "/deposit" request. Parses the JSON, and, if successful,
- * passes the JSON data to #verify_and_execute_deposit() to further
- * check the details of the operation specified. If everything checks
+ * Handle a "/coins/$COIN_PUB/deposit" request. Parses the JSON, and, if
+ * successful, passes the JSON data to #verify_and_execute_deposit() to
+ * further check the details of the operation specified. If everything checks
* out, this will ultimately lead to the "/deposit" being executed, or
* rejected.
*
- * @param rh context of the handler
* @param connection the MHD connection to handle
- * @param[in,out] connection_cls the connection's closure (can be updated)
- * @param upload_data upload data
- * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
+ * @param coin_pub public key of the coin
+ * @param root uploaded JSON data
* @return MHD result code
*/
int
-TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+TEH_DEPOSIT_handler_deposit (struct MHD_Connection *connection,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const json_t *root)
{
- json_t *json;
int res;
json_t *wire;
enum TALER_ErrorCode ec;
@@ -415,7 +410,6 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&deposit.coin.denom_pub_hash),
TALER_JSON_spec_denomination_signature ("ub_sig", &deposit.coin.denom_sig),
- GNUNET_JSON_spec_fixed_auto ("coin_pub", &deposit.coin.coin_pub),
GNUNET_JSON_spec_fixed_auto ("merchant_pub", &deposit.merchant_pub),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &deposit.h_contract_terms),
GNUNET_JSON_spec_fixed_auto ("h_wire", &deposit.h_wire),
@@ -428,27 +422,13 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
GNUNET_JSON_spec_end ()
};
- (void) rh;
- res = TALER_MHD_parse_post_json (connection,
- connection_cls,
- upload_data,
- upload_data_size,
- &json);
- if (GNUNET_SYSERR == res)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- if ( (GNUNET_NO == res) ||
- (NULL == json) )
- return MHD_YES;
memset (&deposit,
0,
sizeof (deposit));
+ deposit.coin.coin_pub = *coin_pub;
res = TALER_MHD_parse_json_data (connection,
- json,
+ root,
spec);
- json_decref (json);
if (GNUNET_SYSERR == res)
{
GNUNET_break (0);