commit d63d67bda5e16cc3cb37cef9e3961a7fd968bdfd
parent 8a7dfc770c7de8e35869a0f3e04db4377c951104
Author: Florian Dold <dold@taler.net>
Date: Wed, 25 Nov 2026 16:55:04 +0100
wallet web UI: accept pasted payto links for bank deposits
Issue: https://bugs.taler.net/n/12111
Diffstat:
3 files changed, 59 insertions(+), 12 deletions(-)
diff --git a/packages/wallet-webui/src/routes/App.tsx b/packages/wallet-webui/src/routes/App.tsx
@@ -106,7 +106,10 @@ import {
IndexedDbMetadataStore,
StorageManager,
} from "../platform/storage-manager.js";
-import { completeActionBestEffort } from "../platform/action-inbox.js";
+import {
+ completeActionBestEffort,
+ validateActionUri,
+} from "../platform/action-inbox.js";
import { Shell } from "../ui/Shell.js";
import { Button } from "../ui/Button.js";
import { ErrorCard } from "../ui/ErrorCard.js";
@@ -651,8 +654,10 @@ function UriInputRoute() {
const [error, setError] = useState<string>();
const submit = async () => {
const input = value.trim();
- if (Result.isError(TalerUris.parse(input))) {
- setError(i18n.str`Enter a valid taler:// wallet link.`);
+ try {
+ validateActionUri(input);
+ } catch {
+ setError(i18n.str`Enter a valid taler:// or payto:// link.`);
return;
}
setWorking(true);
diff --git a/packages/wallet-webui/src/screens/UriInputScreen.tsx b/packages/wallet-webui/src/screens/UriInputScreen.tsx
@@ -31,9 +31,7 @@ export function UriInputScreen(props: {
</button>
<div>
<h1 class="text-2xl font-bold">{i18n.str`Enter a wallet link`}</h1>
- <p class="mt-1 text-secondary">{
- /* Translators: Peer payments transfer digital cash between people using links. A shared link can offer money to receive or request money to be paid. */ i18n.str`Paste a Taler payment, withdrawal, refund, or peer-payment link.`
- }</p>
+ <p class="mt-1 text-secondary">{i18n.str`Paste a Taler wallet link or a payto:// link to deposit money into a bank account.`}</p>
</div>
</div>
<Card>
diff --git a/packages/wallet-webui/test/payment-entry.test.tsx b/packages/wallet-webui/test/payment-entry.test.tsx
@@ -24,6 +24,10 @@ import {
demoActionUris,
} from "../src/testing/demo-wallet.js";
import type { ActionEntry } from "../src/api/contracts.js";
+import {
+ SessionStorageActionStore,
+ StoredActionInbox,
+} from "../src/platform/action-inbox.js";
// Match the browser bundle's React alias when rendering SWR-backed routes.
register(
@@ -75,11 +79,19 @@ async function harness(
const { SWRConfig } = await import("swr");
const { App } = await import("../src/routes/App.js");
const services = createDemoServices();
- const entry = await services.platform.actionInbox.put(
- demoActionUris.payment,
- source,
- );
- dom.location.hash = `#/action/${entry.id}`;
+ const platform = {
+ ...services.platform,
+ actionInbox: new StoredActionInbox(new SessionStorageActionStore()),
+ };
+ if (source === "paste") {
+ dom.location.hash = "#/enter";
+ } else {
+ const entry = await platform.actionInbox.put(
+ demoActionUris.payment,
+ source,
+ );
+ dom.location.hash = `#/action/${entry.id}`;
+ }
let prepares = 0;
let confirms = 0;
let release!: () => void;
@@ -99,7 +111,7 @@ async function harness(
};
const view = render(
<SWRConfig value={{ provider: () => new Map(), shouldRetryOnError: false }}>
- <App {...services} />
+ <App {...services} platform={platform} />
</SWRConfig>,
);
const waitFor = async (check: () => void) => {
@@ -119,6 +131,13 @@ async function harness(
view,
act,
waitFor,
+ pasteLink: async (uri: string) => {
+ const { userEvent } = await import("@testing-library/user-event");
+ const user = userEvent.setup({ document });
+ await user.clear(view.getByLabelText("Wallet link"));
+ await user.paste(uri);
+ await user.click(view.getByRole("button", { name: "Open link" }));
+ },
release,
counts: () => ({ prepares, confirms }),
dom,
@@ -134,6 +153,7 @@ for (const source of ["paste", "qr", "protocol"] as const) {
test(`PWA ${source} payment reaches review without action confirmation`, async () => {
const h = await harness(source);
try {
+ if (source === "paste") await h.pasteLink(demoActionUris.payment);
await h.waitFor(() =>
assert(h.view.getByRole("heading", { name: "Review payment" })),
);
@@ -149,6 +169,30 @@ for (const source of ["paste", "qr", "protocol"] as const) {
});
}
+test("entering a payto link opens a deposit to the pasted account", async () => {
+ const h = await harness("paste");
+ try {
+ await h.pasteLink("payto://iban/not-an-iban");
+ assert.equal(
+ h.view.getByRole("alert").textContent,
+ "Enter a valid taler:// or payto:// link.",
+ );
+ assert.equal(h.dom.location.hash, "#/enter");
+
+ const uri = "payto://x-taler-bank/bank.example/alice?receiver-name=Alice";
+ await h.pasteLink(` ${uri} `);
+ await h.waitFor(() =>
+ assert(h.view.getByRole("heading", { name: "Bank-account deposit" })),
+ );
+ assert(h.view.getByText("Detected from pasted text"));
+ await h.act(() => h.view.getByRole("button", { name: "Continue" }).click());
+ await h.waitFor(() => assert(h.view.getByText("bank.example")));
+ assert(h.view.getByText("alice"));
+ } finally {
+ await h.close();
+ }
+});
+
test("automatic payment preparation requires explicit retry after failure", async () => {
const h = await harness("protocol", "failure");
try {