summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-22 20:42:10 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-22 20:42:10 +0200
commit999dae7c5d0c37473e486fa38816a3f35c42dba9 (patch)
tree2b7241a9e9c13a32fa9ed4695521a9cedcebb1db
parentd4a65faad4144e54633bf627ed7cf7bb64283924 (diff)
downloadexchange-999dae7c5d0c37473e486fa38816a3f35c42dba9.tar.gz
exchange-999dae7c5d0c37473e486fa38816a3f35c42dba9.tar.bz2
exchange-999dae7c5d0c37473e486fa38816a3f35c42dba9.zip
-more exchange API atomization
-rw-r--r--src/include/taler_exchange_service.h6
-rw-r--r--src/lib/exchange_api_purse_delete.c20
-rw-r--r--src/testing/testing_api_cmd_purse_delete.c12
3 files changed, 18 insertions, 20 deletions
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 9460fdbde..32617ba0f 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -6081,7 +6081,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
* Asks the exchange to delete a purse. Will only succeed if
* the purse was not yet merged and did not yet time out.
*
- * @param exchange the exchange to interact with
+ * @param ctx CURL context
+ * @param url exchange base URL
* @param purse_priv private key of the purse
* @param cb function to call with the exchange's result
* @param cb_cls closure for @a cb
@@ -6089,7 +6090,8 @@ struct TALER_EXCHANGE_PurseDeleteHandle;
*/
struct TALER_EXCHANGE_PurseDeleteHandle *
TALER_EXCHANGE_purse_delete (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_PurseContractPrivateKeyP *purse_priv,
TALER_EXCHANGE_PurseDeleteCallback cb,
void *cb_cls);
diff --git a/src/lib/exchange_api_purse_delete.c b/src/lib/exchange_api_purse_delete.c
index 624838105..6f8ecc381 100644
--- a/src/lib/exchange_api_purse_delete.c
+++ b/src/lib/exchange_api_purse_delete.c
@@ -41,11 +41,6 @@ struct TALER_EXCHANGE_PurseDeleteHandle
{
/**
- * The connection to exchange this request handle will use
- */
- struct TALER_EXCHANGE_Handle *exchange;
-
- /**
* The url for this request.
*/
char *url;
@@ -148,26 +143,23 @@ handle_purse_delete_finished (void *cls,
struct TALER_EXCHANGE_PurseDeleteHandle *
TALER_EXCHANGE_purse_delete (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
const struct TALER_PurseContractPrivateKeyP *purse_priv,
TALER_EXCHANGE_PurseDeleteCallback cb,
void *cb_cls)
{
struct TALER_EXCHANGE_PurseDeleteHandle *pdh;
- struct GNUNET_CURL_Context *ctx;
CURL *eh;
struct TALER_PurseContractPublicKeyP purse_pub;
struct TALER_PurseContractSignatureP purse_sig;
char arg_str[sizeof (purse_pub) * 2 + 32];
pdh = GNUNET_new (struct TALER_EXCHANGE_PurseDeleteHandle);
- pdh->exchange = exchange;
pdh->cb = cb;
pdh->cb_cls = cb_cls;
GNUNET_CRYPTO_eddsa_key_get_public (&purse_priv->eddsa_priv,
&purse_pub.eddsa_pub);
- GNUNET_assert (GNUNET_YES ==
- TEAH_handle_is_ready (exchange));
{
char pub_str[sizeof (purse_pub) * 2];
char *end;
@@ -179,11 +171,12 @@ TALER_EXCHANGE_purse_delete (
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "/purses/%s",
+ "purses/%s",
pub_str);
}
- pdh->url = TEAH_path_to_url (exchange,
- arg_str);
+ pdh->url = TALER_url_join (url,
+ arg_str,
+ NULL);
if (NULL == pdh->url)
{
GNUNET_break (0);
@@ -223,7 +216,6 @@ TALER_EXCHANGE_purse_delete (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for purse delete: `%s'\n",
pdh->url);
- ctx = TEAH_handle_to_context (exchange);
pdh->job = GNUNET_CURL_job_add2 (ctx,
eh,
pdh->xhdr,
diff --git a/src/testing/testing_api_cmd_purse_delete.c b/src/testing/testing_api_cmd_purse_delete.c
index 758524ae2..f6b7d5735 100644
--- a/src/testing/testing_api_cmd_purse_delete.c
+++ b/src/testing/testing_api_cmd_purse_delete.c
@@ -97,12 +97,15 @@ purse_delete_run (void *cls,
struct PurseDeleteState *pds = cls;
const struct TALER_PurseContractPrivateKeyP *purse_priv;
const struct TALER_TESTING_Command *ref;
- struct TALER_EXCHANGE_Handle *exchange
- = TALER_TESTING_get_exchange (is);
+ const char *exchange_url;
(void) cmd;
- if (NULL == exchange)
+ exchange_url = TALER_TESTING_get_exchange_url (is);
+ if (NULL == exchange_url)
+ {
+ GNUNET_break (0);
return;
+ }
ref = TALER_TESTING_interpreter_lookup_command (is,
pds->purse_cmd);
if (NULL == ref)
@@ -121,7 +124,8 @@ purse_delete_run (void *cls,
}
pds->is = is;
pds->pdh = TALER_EXCHANGE_purse_delete (
- exchange,
+ TALER_TESTING_interpreter_get_context (is),
+ exchange_url,
purse_priv,
&purse_delete_cb,
pds);