aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_withdraw2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_withdraw2.c')
-rw-r--r--src/lib/exchange_api_withdraw2.c49
1 files changed, 9 insertions, 40 deletions
diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c
index 6adf85520..c8a959688 100644
--- a/src/lib/exchange_api_withdraw2.c
+++ b/src/lib/exchange_api_withdraw2.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-2020 Taler Systems SA 3 Copyright (C) 2014-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 General Public License as published by the Free Software 6 terms of the GNU General Public License as published by the Free Software
@@ -344,25 +344,6 @@ handle_reserve_withdraw_finished (void *cls,
344} 344}
345 345
346 346
347/**
348 * Withdraw a coin from the exchange using a /reserve/withdraw
349 * request. This API is typically used by a wallet to withdraw a tip
350 * where the reserve's signature was created by the merchant already.
351 *
352 * Note that to ensure that no money is lost in case of hardware
353 * failures, the caller must have committed (most of) the arguments to
354 * disk before calling, and be ready to repeat the request with the
355 * same arguments in case of failures.
356 *
357 * @param exchange the exchange handle; the exchange must be ready to operate
358 * @param pd planchet details of the planchet to withdraw
359 * @param reserve_priv private key of the reserve to withdraw from
360 * @param res_cb the callback to call when the final result for this request is available
361 * @param res_cb_cls closure for @a res_cb
362 * @return NULL
363 * if the inputs are invalid (i.e. denomination key not with this exchange).
364 * In this case, the callback is not called.
365 */
366struct TALER_EXCHANGE_Withdraw2Handle * 347struct TALER_EXCHANGE_Withdraw2Handle *
367TALER_EXCHANGE_withdraw2 ( 348TALER_EXCHANGE_withdraw2 (
368 struct TALER_EXCHANGE_Handle *exchange, 349 struct TALER_EXCHANGE_Handle *exchange,
@@ -445,20 +426,14 @@ TALER_EXCHANGE_withdraw2 (
445 { 426 {
446 json_t *withdraw_obj; 427 json_t *withdraw_obj;
447 428
448 withdraw_obj = json_pack ("{s:o, s:o, s:o}", 429 withdraw_obj = GNUNET_JSON_PACK (
449 "denom_pub_hash", 430 GNUNET_JSON_pack_data_auto ("denom_pub_hash",
450 GNUNET_JSON_from_data_auto (&pd->denom_pub_hash), 431 &pd->denom_pub_hash),
451 "coin_ev", 432 GNUNET_JSON_pack_data_varsize ("coin_ev",
452 GNUNET_JSON_from_data (pd->coin_ev, 433 pd->coin_ev,
453 pd->coin_ev_size), 434 pd->coin_ev_size),
454 "reserve_sig", 435 GNUNET_JSON_pack_data_auto ("reserve_sig",
455 GNUNET_JSON_from_data_auto (&reserve_sig)); 436 &reserve_sig));
456 if (NULL == withdraw_obj)
457 {
458 GNUNET_break (0);
459 GNUNET_free (wh);
460 return NULL;
461 }
462 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 437 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
463 "Attempting to withdraw from reserve %s\n", 438 "Attempting to withdraw from reserve %s\n",
464 TALER_B2S (&wh->reserve_pub)); 439 TALER_B2S (&wh->reserve_pub));
@@ -502,12 +477,6 @@ TALER_EXCHANGE_withdraw2 (
502} 477}
503 478
504 479
505/**
506 * Cancel a withdraw status request. This function cannot be used
507 * on a request handle if a response is already served for it.
508 *
509 * @param wh the withdraw sign request handle
510 */
511void 480void
512TALER_EXCHANGE_withdraw2_cancel (struct TALER_EXCHANGE_Withdraw2Handle *wh) 481TALER_EXCHANGE_withdraw2_cancel (struct TALER_EXCHANGE_Withdraw2Handle *wh)
513{ 482{