diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-07-03 16:18:40 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-07-03 16:18:40 +0200 |
commit | 40629e89920267dadba39f5f7f2ab3d844088a0e (patch) | |
tree | 0c10bc6e983ed628f7a7ce1c9aa5d166733e0118 /src/lib/exchange_api_batch_withdraw2.c | |
parent | 9c3ddcbc183a9a96f10cdb14f28258ea61f5f7c5 (diff) | |
download | exchange-40629e89920267dadba39f5f7f2ab3d844088a0e.tar.xz |
[age-withdraw] added library function for age-withdraw
- Added TALER_EXCHANGE_age_withdraw
- Also: Change TALER_EXCHANGE_batch_withdraw and related functions to
use GNUNET_CURL_ctx, TALER_EXCHANGE_keys and const char *echange_url
Diffstat (limited to 'src/lib/exchange_api_batch_withdraw2.c')
-rw-r--r-- | src/lib/exchange_api_batch_withdraw2.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/lib/exchange_api_batch_withdraw2.c b/src/lib/exchange_api_batch_withdraw2.c index 6dd421cea..a855fc57e 100644 --- a/src/lib/exchange_api_batch_withdraw2.c +++ b/src/lib/exchange_api_batch_withdraw2.c @@ -39,14 +39,14 @@ struct TALER_EXCHANGE_BatchWithdraw2Handle { /** - * The connection to exchange this request handle will use + * The url for this request. */ - struct TALER_EXCHANGE_Handle *exchange; + char *url; /** - * The url for this request. + * The /keys material from the exchange */ - char *url; + const struct TALER_EXCHANGE_Keys *keys; /** * Handle for the request. @@ -219,7 +219,7 @@ reserve_batch_withdraw_payment_required ( if (GNUNET_OK != TALER_EXCHANGE_parse_reserve_history ( - TALER_EXCHANGE_get_keys (wh->exchange), + wh->keys, history, &wh->reserve_pub, balance.currency, @@ -387,7 +387,9 @@ handle_reserve_batch_withdraw_finished (void *cls, struct TALER_EXCHANGE_BatchWithdraw2Handle * TALER_EXCHANGE_batch_withdraw2 ( - struct TALER_EXCHANGE_Handle *exchange, + struct GNUNET_CURL_Context *curl_ctx, + const char *exchange_url, + const struct TALER_EXCHANGE_Keys *keys, const struct TALER_ReservePrivateKeyP *reserve_priv, const struct TALER_PlanchetDetail *pds, unsigned int pds_length, @@ -395,21 +397,15 @@ TALER_EXCHANGE_batch_withdraw2 ( void *res_cb_cls) { struct TALER_EXCHANGE_BatchWithdraw2Handle *wh; - const struct TALER_EXCHANGE_Keys *keys; const struct TALER_EXCHANGE_DenomPublicKey *dk; struct TALER_ReserveSignatureP reserve_sig; char arg_str[sizeof (struct TALER_ReservePublicKeyP) * 2 + 32]; struct TALER_BlindedCoinHashP bch; json_t *jc; - keys = TALER_EXCHANGE_get_keys (exchange); - if (NULL == keys) - { - GNUNET_break (0); - return NULL; - } + GNUNET_assert (NULL != keys); wh = GNUNET_new (struct TALER_EXCHANGE_BatchWithdraw2Handle); - wh->exchange = exchange; + wh->keys = keys; wh->cb = res_cb; wh->cb_cls = res_cb_cls; wh->num_coins = pds_length; @@ -430,14 +426,15 @@ TALER_EXCHANGE_batch_withdraw2 ( *end = '\0'; GNUNET_snprintf (arg_str, sizeof (arg_str), - "/reserves/%s/batch-withdraw", + "reserves/%s/batch-withdraw", pub_str); } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Attempting to batch-withdraw from reserve %s\n", TALER_B2S (&wh->reserve_pub)); - wh->url = TEAH_path_to_url (exchange, - arg_str); + wh->url = TALER_url_join (exchange_url, + arg_str, + NULL); if (NULL == wh->url) { GNUNET_break (0); @@ -513,13 +510,11 @@ TALER_EXCHANGE_batch_withdraw2 ( } { CURL *eh; - struct GNUNET_CURL_Context *ctx; json_t *req; req = GNUNET_JSON_PACK ( GNUNET_JSON_pack_array_steal ("planchets", jc)); - ctx = TEAH_handle_to_context (exchange); eh = TALER_EXCHANGE_curl_easy_get_ (wh->url); if ( (NULL == eh) || (GNUNET_OK != @@ -535,7 +530,7 @@ TALER_EXCHANGE_batch_withdraw2 ( return NULL; } json_decref (req); - wh->job = GNUNET_CURL_job_add2 (ctx, + wh->job = GNUNET_CURL_job_add2 (curl_ctx, eh, wh->post_ctx.headers, &handle_reserve_batch_withdraw_finished, |