diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposits_get.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposits_get.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposits_get.c b/src/exchange/taler-exchange-httpd_deposits_get.c index c51e0f426..f32b88b6d 100644 --- a/src/exchange/taler-exchange-httpd_deposits_get.c +++ b/src/exchange/taler-exchange-httpd_deposits_get.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of TALER | 2 | This file is part of TALER |
3 | Copyright (C) 2014-2017 Taler Systems SA | 3 | Copyright (C) 2014-2017, 2021 Taler Systems SA |
4 | 4 | ||
5 | TALER is free software; you can redistribute it and/or modify it under the | 5 | TALER is free software; you can redistribute it and/or modify it under the |
6 | terms of the GNU Affero General Public License as published by the Free Software | 6 | terms of the GNU Affero General Public License as published by the Free Software |
@@ -298,19 +298,8 @@ handle_track_transaction_request ( | |||
298 | } | 298 | } |
299 | 299 | ||
300 | 300 | ||
301 | /** | ||
302 | * Handle a "/deposits/$H_WIRE/$MERCHANT_PUB/$H_CONTRACT_TERMS/$COIN_PUB" | ||
303 | * request. | ||
304 | * | ||
305 | * @param rh context of the handler | ||
306 | * @param connection the MHD connection to handle | ||
307 | * @param args array of additional options (length: 4, contains: | ||
308 | * h_wire, merchant_pub, h_contract_terms and coin_pub) | ||
309 | * @return MHD result code | ||
310 | */ | ||
311 | MHD_RESULT | 301 | MHD_RESULT |
312 | TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | 302 | TEH_handler_deposits_get (struct TEH_RequestContext *rc, |
313 | struct MHD_Connection *connection, | ||
314 | const char *const args[4]) | 303 | const char *const args[4]) |
315 | { | 304 | { |
316 | enum GNUNET_GenericReturnValue res; | 305 | enum GNUNET_GenericReturnValue res; |
@@ -320,7 +309,6 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
320 | .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION) | 309 | .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION) |
321 | }; | 310 | }; |
322 | 311 | ||
323 | (void) rh; | ||
324 | if (GNUNET_OK != | 312 | if (GNUNET_OK != |
325 | GNUNET_STRINGS_string_to_data (args[0], | 313 | GNUNET_STRINGS_string_to_data (args[0], |
326 | strlen (args[0]), | 314 | strlen (args[0]), |
@@ -328,7 +316,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
328 | sizeof (tps.h_wire))) | 316 | sizeof (tps.h_wire))) |
329 | { | 317 | { |
330 | GNUNET_break_op (0); | 318 | GNUNET_break_op (0); |
331 | return TALER_MHD_reply_with_error (connection, | 319 | return TALER_MHD_reply_with_error (rc->connection, |
332 | MHD_HTTP_BAD_REQUEST, | 320 | MHD_HTTP_BAD_REQUEST, |
333 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE, | 321 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_WIRE, |
334 | args[0]); | 322 | args[0]); |
@@ -340,7 +328,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
340 | sizeof (tps.merchant))) | 328 | sizeof (tps.merchant))) |
341 | { | 329 | { |
342 | GNUNET_break_op (0); | 330 | GNUNET_break_op (0); |
343 | return TALER_MHD_reply_with_error (connection, | 331 | return TALER_MHD_reply_with_error (rc->connection, |
344 | MHD_HTTP_BAD_REQUEST, | 332 | MHD_HTTP_BAD_REQUEST, |
345 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB, | 333 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_MERCHANT_PUB, |
346 | args[1]); | 334 | args[1]); |
@@ -352,7 +340,7 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
352 | sizeof (tps.h_contract_terms))) | 340 | sizeof (tps.h_contract_terms))) |
353 | { | 341 | { |
354 | GNUNET_break_op (0); | 342 | GNUNET_break_op (0); |
355 | return TALER_MHD_reply_with_error (connection, | 343 | return TALER_MHD_reply_with_error (rc->connection, |
356 | MHD_HTTP_BAD_REQUEST, | 344 | MHD_HTTP_BAD_REQUEST, |
357 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS, | 345 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_H_CONTRACT_TERMS, |
358 | args[2]); | 346 | args[2]); |
@@ -364,12 +352,12 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
364 | sizeof (tps.coin_pub))) | 352 | sizeof (tps.coin_pub))) |
365 | { | 353 | { |
366 | GNUNET_break_op (0); | 354 | GNUNET_break_op (0); |
367 | return TALER_MHD_reply_with_error (connection, | 355 | return TALER_MHD_reply_with_error (rc->connection, |
368 | MHD_HTTP_BAD_REQUEST, | 356 | MHD_HTTP_BAD_REQUEST, |
369 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB, | 357 | TALER_EC_EXCHANGE_DEPOSITS_GET_INVALID_COIN_PUB, |
370 | args[3]); | 358 | args[3]); |
371 | } | 359 | } |
372 | res = TALER_MHD_parse_request_arg_data (connection, | 360 | res = TALER_MHD_parse_request_arg_data (rc->connection, |
373 | "merchant_sig", | 361 | "merchant_sig", |
374 | &merchant_sig, | 362 | &merchant_sig, |
375 | sizeof (merchant_sig)); | 363 | sizeof (merchant_sig)); |
@@ -384,13 +372,13 @@ TEH_handler_deposits_get (const struct TEH_RequestHandler *rh, | |||
384 | &tps.merchant.eddsa_pub)) | 372 | &tps.merchant.eddsa_pub)) |
385 | { | 373 | { |
386 | GNUNET_break_op (0); | 374 | GNUNET_break_op (0); |
387 | return TALER_MHD_reply_with_error (connection, | 375 | return TALER_MHD_reply_with_error (rc->connection, |
388 | MHD_HTTP_FORBIDDEN, | 376 | MHD_HTTP_FORBIDDEN, |
389 | TALER_EC_EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID, | 377 | TALER_EC_EXCHANGE_DEPOSITS_GET_MERCHANT_SIGNATURE_INVALID, |
390 | NULL); | 378 | NULL); |
391 | } | 379 | } |
392 | 380 | ||
393 | return handle_track_transaction_request (connection, | 381 | return handle_track_transaction_request (rc->connection, |
394 | &tps, | 382 | &tps, |
395 | &tps.merchant); | 383 | &tps.merchant); |
396 | } | 384 | } |