commit d34b6476e086c18f848e78207956a614a113e2bf
parent b4ff52c9c1553c618728833edb1a111ecc65f01c
Author: Florian Dold <florian@dold.me>
Date: Wed, 8 Jan 2025 18:20:07 +0100
wallet-core: do not add external accounts to known accounts
Diffstat:
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts
@@ -56,10 +56,12 @@ export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
const wop = withdrawalRes.body;
+ const talerWithdrawUri = `${wop.taler_withdraw_uri}?external-confirmation=1`;
+
const r1 = await walletClient.call(
WalletApiOperation.GetWithdrawalDetailsForUri,
{
- talerWithdrawUri: wop.taler_withdraw_uri,
+ talerWithdrawUri,
},
);
@@ -71,7 +73,7 @@ export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.AcceptBankIntegratedWithdrawal, {
exchangeBaseUrl: exchange.baseUrl,
- talerWithdrawUri: wop.taler_withdraw_uri,
+ talerWithdrawUri,
});
const txns = await walletClient.call(
@@ -93,6 +95,15 @@ export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
const bal = await walletClient.call(WalletApiOperation.GetBalances, {});
t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:9.72");
+
+ // It's a withdrawal from an external account, so it must not
+ // show up in the list of bank accounts known to the wallet.
+ const bankAccounts = await walletClient.call(
+ WalletApiOperation.ListBankAccounts,
+ {},
+ );
+ console.log(`bank accounts: ${j2s(bankAccounts)}`);
+ t.assertDeepEqual(bankAccounts.accounts.length, 0);
}
runWithdrawalCashacceptorTest.suites = ["wallet"];
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
@@ -3380,7 +3380,7 @@ export async function prepareBankIntegratedWithdrawal(
externalConfirmation,
},
},
- isForeignAccount: req.isForeignAccount,
+ isForeignAccount: req.isForeignAccount || externalConfirmation,
reserveStatus: WithdrawalGroupStatus.DialogProposed,
});
@@ -3517,6 +3517,8 @@ export async function confirmWithdrawal(
logger.warn("no account acceptable by the exchange");
}
+ logger.info(`adding account ${senderWire} to know bank accounts`);
+
const bankAccountId = await wex.db.runReadWriteTx(
{
storeNames: ["bankAccountsV2"],