commit aa80c3d6bf1ea18c71e4d6a963e67e972f6e68a1
parent 4b01560f00acae2642ea0a8dfead86a8cb529cd4
Author: Florian Dold <florian@dold.me>
Date: Sat, 18 Jul 2026 23:59:27 +0200
harness: fix known-accounts test failure due to stricter payto validation
Diffstat:
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-known-accounts.ts b/packages/taler-harness/src/integrationtests/test-known-accounts.ts
@@ -55,7 +55,7 @@ export async function runKnownAccountsTest(t: GlobalTestState) {
t.assertDeepEqual(accts.accounts.length, 1);
await walletClient.call(WalletApiOperation.AddBankAccount, {
- paytoUri: "payto://iban/FOOBAR",
+ paytoUri: "payto://x-taler-bank/foo/bar",
label: "Foo",
currencies: ["EUR"],
});
@@ -71,7 +71,7 @@ export async function runKnownAccountsTest(t: GlobalTestState) {
// Can use add to update
const addResp1 = await walletClient.call(WalletApiOperation.AddBankAccount, {
- paytoUri: "payto://iban/FOOBAR",
+ paytoUri: "payto://x-taler-bank/foo/bar",
label: "Foo",
currencies: ["CHF"],
});
@@ -84,6 +84,7 @@ export async function runKnownAccountsTest(t: GlobalTestState) {
console.log(`accounts after modify: ${j2s(accts2)}`);
t.assertDeepEqual(accts2.accounts.length, 2);
const e = accts2.accounts.find((x) => x.label == "Foo");
+ t.assertTrue(!!e);
t.assertDeepEqual(e?.currencies, ["CHF", "EUR"]);
}
@@ -91,7 +92,7 @@ export async function runKnownAccountsTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.AddBankAccount, {
replaceBankAccountId: addResp1.bankAccountId,
- paytoUri: "payto://iban/QUUX",
+ paytoUri: "payto://x-taler-bank/foo/bar",
label: "Foo",
currencies: ["CHF"],
});
@@ -104,7 +105,22 @@ export async function runKnownAccountsTest(t: GlobalTestState) {
console.log(`accounts after replace: ${j2s(accts2)}`);
t.assertDeepEqual(accts2.accounts.length, 2);
const e = accts2.accounts.find((x) => x.label == "Foo");
- t.assertDeepEqual(e?.paytoUri, "payto://iban/QUUX");
+ t.assertDeepEqual(e?.paytoUri, "payto://x-taler-bank/foo/bar");
+ }
+
+ await walletClient.call(WalletApiOperation.AddBankAccount, {
+ paytoUri: "payto://iban/CH62414246VCSW2LM4FG0",
+ label: "Foo",
+ currencies: ["CHF"],
+ });
+
+ {
+ const accts2 = await walletClient.call(
+ WalletApiOperation.ListBankAccounts,
+ {},
+ );
+ console.log(`accounts after replace: ${j2s(accts2)}`);
+ t.assertDeepEqual(accts2.accounts.length, 3);
}
}
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
@@ -1205,6 +1205,9 @@ async function handleAddBankAccount(
wex: WalletExecutionContext,
req: AddBankAccountRequest,
): Promise<AddBankAccountResponse> {
+ if (Result.isError(Paytos.fromString(req.paytoUri))) {
+ throw Error("invalid payto");
+ }
const acctId = await wex.runLegacyWalletDbTx(async (tx) => {
let currencies = req.currencies;
let myId: string;
@@ -1218,6 +1221,7 @@ async function handleAddBankAccount(
currencies = [
...new Set([...(req.currencies ?? []), ...(oldAcct.currencies ?? [])]),
];
+ currencies.sort();
} else {
// New Account!
myId = `acct:${encodeCrock(getRandomBytes(32))}`;