aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-01-29 21:58:35 +0100
committerFlorian Dold <florian@dold.me>2024-01-29 21:58:39 +0100
commit2c9c3d4cdf3f59eabbb47327f78966b781d77256 (patch)
tree17d36c45e67bd12e0beaaf4d5524423419ac2836 /packages/taler-wallet-core/src
parent7b83d8f8dd220e04a26b33b03afc5f989cc5d1fb (diff)
downloadwallet-core-2c9c3d4cdf3f59eabbb47327f78966b781d77256.tar.xz
remove deprecated http client lib methods
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r--packages/taler-wallet-core/src/dbless.ts16
-rw-r--r--packages/taler-wallet-core/src/dev-experiments.ts17
-rw-r--r--packages/taler-wallet-core/src/operations/pay-merchant.ts9
-rw-r--r--packages/taler-wallet-core/src/operations/recoup.ts10
-rw-r--r--packages/taler-wallet-core/src/operations/refresh.ts8
-rw-r--r--packages/taler-wallet-core/src/operations/testing.ts6
6 files changed, 34 insertions, 32 deletions
diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts
index e841d1d20..4a7767771 100644
--- a/packages/taler-wallet-core/src/dbless.ts
+++ b/packages/taler-wallet-core/src/dbless.ts
@@ -106,7 +106,7 @@ export async function checkReserve(
if (longpollTimeoutMs) {
reqUrl.searchParams.set("timeout_ms", `${longpollTimeoutMs}`);
}
- const resp = await http.get(reqUrl.href);
+ const resp = await http.fetch(reqUrl.href, { method: "GET" });
if (resp.status !== 200) {
throw new Error("reserve not okay");
}
@@ -140,9 +140,12 @@ export async function topupReserveWithDemobank(
if (plainPaytoUris.length <= 0) {
throw new Error();
}
- const httpResp = await http.postJson(bankStatusUrl, {
- reserve_pub: reservePub,
- selected_exchange: plainPaytoUris[0],
+ const httpResp = await http.fetch(bankStatusUrl, {
+ method: "POST",
+ body: {
+ reserve_pub: reservePub,
+ selected_exchange: plainPaytoUris[0],
+ },
});
await readSuccessResponseJsonOrThrow(
httpResp,
@@ -369,7 +372,10 @@ export async function refreshCoin(req: {
oldCoin.exchangeBaseUrl,
);
- const revealResp = await http.postJson(reqUrl.href, revealRequest);
+ const revealResp = await http.fetch(reqUrl.href, {
+ method: "POST",
+ body: revealRequest,
+ });
logger.info("requesting reveal done");
diff --git a/packages/taler-wallet-core/src/dev-experiments.ts b/packages/taler-wallet-core/src/dev-experiments.ts
index 176ed09d9..cb8f7aa19 100644
--- a/packages/taler-wallet-core/src/dev-experiments.ts
+++ b/packages/taler-wallet-core/src/dev-experiments.ts
@@ -65,23 +65,6 @@ export class DevExperimentHttpLib implements HttpRequestLibrary {
this.underlyingLib = lib;
}
- get(
- url: string,
- opt?: HttpRequestOptions | undefined,
- ): Promise<HttpResponse> {
- logger.trace(`devexperiment httplib ${url}`);
- return this.underlyingLib.fetch(url, opt);
- }
-
- postJson(
- url: string,
- body: any,
- opt?: HttpRequestOptions | undefined,
- ): Promise<HttpResponse> {
- logger.trace(`devexperiment httplib ${url}`);
- return this.underlyingLib.postJson(url, body, opt);
- }
-
fetch(
url: string,
opt?: HttpRequestOptions | undefined,
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());