taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 05c4a6b4d89191a68b32876b75753d8554970176
parent 3bff7fe6b0a13ff29c798b8f1ecea762fa1df120
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Tue,  9 Dec 2025 15:09:01 -0300

fix #10746

Diffstat:
Mpackages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx | 62++++++++++++++++++++++++++++++++------------------------------
1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx @@ -37,10 +37,9 @@ import { InputGroup } from "./InputGroup.js"; import { InputSelector } from "./InputSelector.js"; import { InputProps, useField } from "./useField.js"; - const TALER_SCREEN_ID = 11; -export interface Props<T> extends InputProps<T> { } +export interface Props<T> extends InputProps<T> {} // type Entity = PaytoUriGeneric // https://datatracker.ietf.org/doc/html/rfc8905 @@ -194,17 +193,21 @@ function validateIBAN_path1( const allTargets = ["iban", "bitcoin", "ethereum", "x-taler-bank"]; -function checkServerRegex(i18n: InternationalizationAPI, payto: string | undefined, serverReg: string | undefined) { - if (!payto || !serverReg) return undefined +function checkServerRegex( + i18n: InternationalizationAPI, + payto: string | undefined, + serverReg: string | undefined, +) { + if (!payto || !serverReg) return undefined; try { - const validator = new RegExp(serverReg) + const validator = new RegExp(serverReg); if (!validator.test(payto)) { - return i18n.str`This account is not allowed.` + return i18n.str`This account is not allowed.`; } else { - return undefined + return undefined; } } catch (e) { - return undefined + return undefined; } } @@ -245,11 +248,11 @@ export function InputPaytoForm<T>({ initialPayto === undefined ? defaultTarget : { - target: initialPayto.targetType, - params: initialPayto.params, - path1: initialPath1, - path2: initialPath2, - }; + target: initialPayto.targetType, + params: initialPayto.params, + path1: initialPath1, + path2: initialPath2, + }; const [value, setValue] = useState<Partial<Entity>>(initial); @@ -263,14 +266,14 @@ export function InputPaytoForm<T>({ ? validateBitcoin_path1(cleanupPath1(value.path1, value.target), i18n) : value.target === "ethereum" ? validateEthereum_path1( - cleanupPath1(value.path1, value.target), - i18n, - ) - : value.target === "x-taler-bank" - ? validateTalerBank_path1( cleanupPath1(value.path1, value.target), i18n, ) + : value.target === "x-taler-bank" + ? validateTalerBank_path1( + cleanupPath1(value.path1, value.target), + i18n, + ) : undefined, path2: value.target === "x-taler-bank" @@ -294,17 +297,17 @@ export function InputPaytoForm<T>({ hasErrors || !value.target ? undefined : ({ - targetType: value.target, - targetPath: value.path2 - ? `${path1WithSlash}${value.path2}` - : path1WithSlash ?? "", - params: value.params ?? {}, - isKnown: false as const, - } as PaytoUri); + targetType: value.target, + targetPath: value.path2 + ? `${path1WithSlash}${value.path2}` + : path1WithSlash ?? "", + params: value.params ?? {}, + isKnown: false as const, + } as PaytoUri); const str = !pto ? undefined : stringifyPaytoUri(pto); - const regexError = checkServerRegex(i18n, str, config.payment_target_regex) + const regexError = checkServerRegex(i18n, str, config.payment_target_regex); useEffect(() => { onChange(str as T[keyof T]); @@ -322,7 +325,7 @@ export function InputPaytoForm<T>({ <InputGroup name="payto" label={label} fixed tooltip={tooltip}> <FormProvider<Entity> name="tax" - errors={regexError ? {path1: regexError} : errors} + errors={regexError ? { path1: regexError } : errors} object={value} valueHandler={setValue} > @@ -372,8 +375,7 @@ export function InputPaytoForm<T>({ label={i18n.str`IBAN`} tooltip={i18n.str`International Bank Account Number`} readonly={readonly} - placeholder="e.g. DE12 0000 1111 2222 3333 00" - inputExtra={{ style: { textTransform: "uppercase" } }} + placeholder={i18n.str`your bank account number, e.g. DE12 0000 1111 2222 3333 00`} /> </Fragment> )} @@ -467,7 +469,7 @@ export function InputPaytoForm<T>({ name="params.receiver-name" readonly={readonly} label={i18n.str`Name of the account holder`} - placeholder="John Doe" + placeholder={i18n.str`John Doe`} tooltip={i18n.str`Legal name of the person holding the account.`} /> </Fragment>