From 2c9c3d4cdf3f59eabbb47327f78966b781d77256 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 29 Jan 2024 21:58:35 +0100 Subject: remove deprecated http client lib methods --- packages/taler-wallet-core/src/operations/pay-merchant.ts | 9 ++++++--- packages/taler-wallet-core/src/operations/recoup.ts | 10 ++++++++-- packages/taler-wallet-core/src/operations/refresh.ts | 8 ++++++-- packages/taler-wallet-core/src/operations/testing.ts | 6 +++--- 4 files changed, 23 insertions(+), 10 deletions(-) (limited to 'packages/taler-wallet-core/src/operations') diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index c71dd7d90..3acfbd457 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -2060,7 +2060,7 @@ async function processPurchasePay( }; logger.trace(`/paid request body: ${j2s(reqBody)}`); const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], () => - ws.http.postJson(payAgainUrl, reqBody), + ws.http.fetch(payAgainUrl, { method: "POST", body: reqBody }), ); logger.trace(`/paid response status: ${resp.status}`); if ( @@ -2777,8 +2777,11 @@ async function processPurchaseAcceptRefund( logger.trace(`making refund request to ${requestUrl.href}`); - const request = await ws.http.postJson(requestUrl.href, { - h_contract: download.contractData.contractTermsHash, + const request = await ws.http.fetch(requestUrl.href, { + method: "POST", + body: { + h_contract: download.contractData.contractTermsHash, + }, }); const refundResponse = await readSuccessResponseJsonOrThrow( diff --git a/packages/taler-wallet-core/src/operations/recoup.ts b/packages/taler-wallet-core/src/operations/recoup.ts index 0ae873125..a6270783e 100644 --- a/packages/taler-wallet-core/src/operations/recoup.ts +++ b/packages/taler-wallet-core/src/operations/recoup.ts @@ -152,7 +152,10 @@ async function recoupWithdrawCoin( }); const reqUrl = new URL(`/coins/${coin.coinPub}/recoup`, coin.exchangeBaseUrl); logger.trace(`requesting recoup via ${reqUrl.href}`); - const resp = await ws.http.postJson(reqUrl.href, recoupRequest); + const resp = await ws.http.fetch(reqUrl.href, { + method: "POST", + body: recoupRequest, + }); const recoupConfirmation = await readSuccessResponseJsonOrThrow( resp, codecForRecoupConfirmation(), @@ -226,7 +229,10 @@ async function recoupRefreshCoin( ); logger.trace(`making recoup request for ${coin.coinPub}`); - const resp = await ws.http.postJson(reqUrl.href, recoupRequest); + const resp = await ws.http.fetch(reqUrl.href, { + method: "POST", + body: recoupRequest, + }); const recoupConfirmation = await readSuccessResponseJsonOrThrow( resp, codecForRecoupConfirmation(), diff --git a/packages/taler-wallet-core/src/operations/refresh.ts b/packages/taler-wallet-core/src/operations/refresh.ts index 39c6ef906..dff6d3019 100644 --- a/packages/taler-wallet-core/src/operations/refresh.ts +++ b/packages/taler-wallet-core/src/operations/refresh.ts @@ -599,7 +599,9 @@ async function refreshMelt( }; const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], async () => { - return await ws.http.postJson(reqUrl.href, meltReqBody, { + return await ws.http.fetch(reqUrl.href, { + method: "POST", + body: meltReqBody, timeout: getRefreshRequestTimeout(refreshGroup), }); }); @@ -906,7 +908,9 @@ async function refreshReveal( }); const resp = await ws.runSequentialized([EXCHANGE_COINS_LOCK], async () => { - return await ws.http.postJson(reqUrl.href, req, { + return await ws.http.fetch(reqUrl.href, { + body: req, + method: "POST", timeout: getRefreshRequestTimeout(refreshGroup), }); }); diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index f2fb74bdb..92ce504fe 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -38,9 +38,7 @@ import { Logger, NotificationType, PreparePayResultType, - stringifyTalerUri, TalerCorebankApiClient, - TalerUriAction, TestPayArgs, TestPayResult, TransactionMajorState, @@ -200,7 +198,9 @@ async function createOrder( wire_transfer_deadline: { t_s: t }, }, }; - const resp = await http.postJson(reqUrl, orderReq, { + const resp = await http.fetch(reqUrl, { + method: "POST", + body: orderReq, headers: getMerchantAuthHeader(merchantBackend), }); const r = await readSuccessResponseJsonOrThrow(resp, codecForAny()); -- cgit v1.2.3