aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-09-21 18:02:36 +0200
committerFlorian Dold <florian@dold.me>2023-09-21 18:02:36 +0200
commita99156ed22d21c88cddbfa5fb5908d093b32fbf8 (patch)
tree3186b3140da29f67a83fc7028164d4b0a5e8ad4e
parent58debefbe0456ce203877f1cc417c42f4abb0685 (diff)
wallet-core,harness: remove separate fakebank withdrawal API
-rw-r--r--packages/taler-harness/src/bench1.ts6
-rw-r--r--packages/taler-harness/src/bench3.ts6
-rw-r--r--packages/taler-harness/src/integrationtests/test-withdrawal-fakebank.ts6
-rw-r--r--packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts6
-rw-r--r--packages/taler-wallet-cli/src/index.ts23
-rw-r--r--packages/taler-wallet-core/src/wallet-api-types.ts14
-rw-r--r--packages/taler-wallet-core/src/wallet.ts40
7 files changed, 12 insertions, 89 deletions
diff --git a/packages/taler-harness/src/bench1.ts b/packages/taler-harness/src/bench1.ts
index 618eb683e..f7b42836d 100644
--- a/packages/taler-harness/src/bench1.ts
+++ b/packages/taler-harness/src/bench1.ts
@@ -96,10 +96,10 @@ export async function runBench1(configJson: any): Promise<void> {
logger.trace(`Starting withdrawal amount=${withdrawAmount}`);
let start = Date.now();
- await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
+ await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
amount: b1conf.currency + ":" + withdrawAmount,
- bank: b1conf.bank,
- exchange: b1conf.exchange,
+ bankAccessApiBaseUrl: b1conf.bank,
+ exchangeBaseUrl: b1conf.exchange,
});
await wallet.runTaskLoop({
diff --git a/packages/taler-harness/src/bench3.ts b/packages/taler-harness/src/bench3.ts
index 0b5371af5..55cd335f2 100644
--- a/packages/taler-harness/src/bench3.ts
+++ b/packages/taler-harness/src/bench3.ts
@@ -107,10 +107,10 @@ export async function runBench3(configJson: any): Promise<void> {
logger.trace(`Starting withdrawal amount=${withdrawAmount}`);
let start = Date.now();
- await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
+ await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
amount: b3conf.currency + ":" + withdrawAmount,
- bank: b3conf.bank,
- exchange: b3conf.exchange,
+ bankAccessApiBaseUrl: b3conf.bank,
+ exchangeBaseUrl: b3conf.exchange,
});
await wallet.runTaskLoop({
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-fakebank.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-fakebank.ts
index 7cd0548a5..84b7b37bf 100644
--- a/packages/taler-harness/src/integrationtests/test-withdrawal-fakebank.ts
+++ b/packages/taler-harness/src/integrationtests/test-withdrawal-fakebank.ts
@@ -79,10 +79,10 @@ export async function runWithdrawalFakebankTest(t: GlobalTestState) {
exchangeBaseUrl: exchange.baseUrl,
});
- await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
- exchange: exchange.baseUrl,
+ await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
+ bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
+ exchangeBaseUrl: exchange.baseUrl,
amount: "TESTKUDOS:10",
- bank: bank.baseUrl,
});
await exchange.runWirewatchOnce();
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts
index 8777b19e2..0dfc77447 100644
--- a/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts
+++ b/packages/taler-harness/src/integrationtests/test-withdrawal-huge.ts
@@ -99,10 +99,10 @@ export async function runWithdrawalHugeTest(t: GlobalTestState) {
});
// Results in about 1K coins withdrawn
- await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
- exchange: exchange.baseUrl,
+ await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
+ exchangeBaseUrl: exchange.baseUrl,
amount: "TESTKUDOS:10000",
- bank: bank.baseUrl,
+ bankAccessApiBaseUrl: bank.baseUrl,
});
await withdrawalFinishedCond;
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index b37d4974b..e21a8ce35 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -1291,29 +1291,6 @@ advancedCli
});
advancedCli
- .subcommand("withdrawFakebank", "withdraw-fakebank", {
- help: "Withdraw via a fakebank.",
- })
- .requiredOption("exchange", ["--exchange"], clk.STRING, {
- help: "Base URL of the exchange to use",
- })
- .requiredOption("amount", ["--amount"], clk.STRING, {
- help: "Amount to withdraw (before fees).",
- })
- .requiredOption("bank", ["--bank"], clk.STRING, {
- help: "Base URL of the Taler fakebank service.",
- })
- .action(async (args) => {
- await withWallet(args, async (wallet) => {
- await wallet.client.call(WalletApiOperation.WithdrawFakebank, {
- amount: args.withdrawFakebank.amount,
- bank: args.withdrawFakebank.bank,
- exchange: args.withdrawFakebank.exchange,
- });
- });
- });
-
-advancedCli
.subcommand("genSegwit", "gen-segwit")
.requiredArgument("paytoUri", clk.STRING)
.requiredArgument("reservePub", clk.STRING)
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
index 67c05a42f..3520a05cb 100644
--- a/packages/taler-wallet-core/src/wallet-api-types.ts
+++ b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -118,7 +118,6 @@ import {
WalletContractData,
WalletCoreVersion,
WalletCurrencyInfo,
- WithdrawFakebankRequest,
WithdrawTestBalanceRequest,
WithdrawUriInfoResponse,
} from "@gnu-taler/taler-util";
@@ -199,7 +198,6 @@ export enum WalletApiOperation {
GenerateDepositGroupTxId = "generateDepositGroupTxId",
CreateDepositGroup = "createDepositGroup",
SetWalletDeviceId = "setWalletDeviceId",
- WithdrawFakebank = "withdrawFakebank",
ImportDb = "importDb",
ExportDb = "exportDb",
PreparePeerPushCredit = "preparePeerPushCredit",
@@ -935,17 +933,6 @@ export type TestPayOp = {
};
/**
- * Make a withdrawal from a fakebank, i.e.
- * a bank where test users can be registered freely
- * and testing APIs are available.
- */
-export type WithdrawFakebankOp = {
- op: WalletApiOperation.WithdrawFakebank;
- request: WithdrawFakebankRequest;
- response: EmptyObject;
-};
-
-/**
* Get wallet-internal pending tasks.
*/
export type GetUserAttentionRequests = {
@@ -1040,7 +1027,6 @@ export type ForceRefreshOp = {
export type WalletOperations = {
[WalletApiOperation.InitWallet]: InitWalletOp;
[WalletApiOperation.GetVersion]: GetVersionOp;
- [WalletApiOperation.WithdrawFakebank]: WithdrawFakebankOp;
[WalletApiOperation.PreparePayForUri]: PreparePayForUriOp;
[WalletApiOperation.SharePayment]: SharePaymentOp;
[WalletApiOperation.PreparePayForTemplate]: PreparePayForTemplateOp;
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 2c4f1ba6f..75f1a33a9 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -1492,46 +1492,6 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>(
trustedExchanges: [],
};
}
- case WalletApiOperation.WithdrawFakebank: {
- const req = codecForWithdrawFakebankRequest().decode(payload);
- const amount = Amounts.parseOrThrow(req.amount);
- const details = await getExchangeWithdrawalInfo(
- ws,
- req.exchange,
- amount,
- undefined,
- );
- const wres = await createManualWithdrawal(ws, {
- amount: amount,
- exchangeBaseUrl: req.exchange,
- });
- const paytoUri = details.exchangePaytoUris[0];
- const pt = parsePaytoUri(paytoUri);
- if (!pt) {
- throw Error("failed to parse payto URI");
- }
- const components = pt.targetPath.split("/");
- const creditorAcct = components[components.length - 1];
- logger.info(`making testbank transfer to '${creditorAcct}'`);
- const fbReq = await ws.http.fetch(
- new URL(
- `accounts/${creditorAcct}/taler-wire-gateway/admin/add-incoming`,
- req.bank,
- ).href,
- {
- method: "POST",
- body: {
- amount: Amounts.stringify(amount),
- reserve_pub: wres.reservePub,
- debit_account:
- "payto://x-taler-bank/localhost/testdebtor?receiver-name=Foo",
- },
- },
- );
- const fbResp = await readSuccessResponseJsonOrThrow(fbReq, codecForAny());
- logger.info(`started fakebank withdrawal: ${j2s(fbResp)}`);
- return {};
- }
case WalletApiOperation.TestCrypto: {
return await ws.cryptoApi.hashString({ str: "hello world" });
}