From 207bd07fcd3ab356116c2059f2c019a7d9a4f3b6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 4 Jul 2023 23:21:29 +0200 Subject: adaptations to latest exchange API --- src/lib/merchant_api_post_order_pay.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/lib') diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c index 886d9bd6..e48b7cd3 100644 --- a/src/lib/merchant_api_post_order_pay.c +++ b/src/lib/merchant_api_post_order_pay.c @@ -112,7 +112,7 @@ struct TALER_MERCHANT_OrderPayHandle * Handle to the exchange that issued a problematic * coin (if any). */ - struct TALER_EXCHANGE_Handle *exchange; + struct TALER_EXCHANGE_GetKeysHandle *exchange; /** * Number of @e coins we are paying with. @@ -191,16 +191,20 @@ check_conflict (struct TALER_MERCHANT_OrderPayHandle *oph, * * @param cls a `struct TALER_MERCHANT_OrderPayHandle` * @param kr reply from the exchange + * @param keys keys of the exchange */ static void cert_cb (void *cls, - const struct TALER_EXCHANGE_KeysResponse *kr) + const struct TALER_EXCHANGE_KeysResponse *kr, + struct TALER_EXCHANGE_Keys *keys) { struct TALER_MERCHANT_OrderPayHandle *oph = cls; const struct TALER_EXCHANGE_HttpResponse *ehr = &kr->hr; + oph->exchange = NULL; if ( (MHD_HTTP_OK != ehr->http_status) || - (NULL == kr->details.ok.keys) ) + (NULL == kr->details.ok.keys) || + (NULL == keys) ) { struct TALER_MERCHANT_PayResponse pr = { .hr.http_status = MHD_HTTP_CONFLICT, @@ -230,6 +234,7 @@ cert_cb (void *cls, oph->pay_cb (oph->pay_cb_cls, &pr); TALER_MERCHANT_order_pay_cancel (oph); + TALER_EXCHANGE_keys_decref (keys); return; } @@ -246,6 +251,7 @@ cert_cb (void *cls, oph->pay_cb (oph->pay_cb_cls, &pr); TALER_MERCHANT_order_pay_cancel (oph); + TALER_EXCHANGE_keys_decref (keys); return; } @@ -259,6 +265,7 @@ cert_cb (void *cls, oph->pay_cb (oph->pay_cb_cls, &pr); TALER_MERCHANT_order_pay_cancel (oph); + TALER_EXCHANGE_keys_decref (keys); } } @@ -350,11 +357,11 @@ parse_conflict (struct TALER_MERCHANT_OrderPayHandle *oph, { oph->error_pc = &oph->coins[i]; oph->full_reply = json_incref ((json_t *) json); - oph->exchange = TALER_EXCHANGE_connect (oph->ctx, - oph->error_pc->exchange_url, - &cert_cb, - oph, - TALER_EXCHANGE_OPTION_END); + oph->exchange = TALER_EXCHANGE_get_keys (oph->ctx, + oph->error_pc->exchange_url, + NULL, + &cert_cb, + oph); return GNUNET_NO; } } @@ -814,7 +821,7 @@ TALER_MERCHANT_order_pay_cancel (struct TALER_MERCHANT_OrderPayHandle *oph) } if (NULL != oph->exchange) { - TALER_EXCHANGE_disconnect (oph->exchange); + TALER_EXCHANGE_get_keys_cancel (oph->exchange); oph->exchange = NULL; } TALER_curl_easy_post_finished (&oph->post_ctx); -- cgit v1.2.3