commit 908b0b1b5e6c637f1778652d4d5be11758f7dc39
parent c803d558f128551f22d57084726ece14343491c1
Author: Sebastian <sebasjm@taler-systems.com>
Date: Thu, 19 Nov 2026 19:37:33 -0300
fix #12220
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/packages/taler-util/src/payto.test.ts b/packages/taler-util/src/payto.test.ts
@@ -17,6 +17,7 @@
import assert from "node:assert";
import { test } from "node:test";
+import { IbanString } from "./iban.js";
import {
addPaytoQueryParams,
HostPortPath,
@@ -79,6 +80,17 @@ test("parsing payto and stringify again on normalized strings are unchanged", (t
normalized as Paytos.NormalizedPaytoString,
);
});
+test("creating an IBAN payto URI removes grouping separators", () => {
+ const payto = Paytos.createIban(
+ "DE48 3492 6025 0822 2324 52" as IbanString,
+ undefined,
+ );
+ assert.strictEqual(
+ Paytos.toFullString(payto),
+ "payto://iban/DE48349260250822232452",
+ );
+});
+
test("parsing payto and stringify again converts to the normal form", (t) => {
const fullPayto_not_normalized =
"payto://iban/de89370400440532013000?reciever-name=John%20Doe";
diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts
@@ -403,7 +403,7 @@ export namespace Paytos {
bic: string | undefined,
params: Record<string, string> = {},
): PaytoIBAN {
- iban = iban.toUpperCase() as IbanString;
+ iban = iban.toUpperCase().replace(/[\s\-._]/g, "") as IbanString;
return {
targetType: PaytoType.IBAN,
iban,