add receiver name to iban form and fix some bugs
This commit is contained in:
parent
5ed4d5d54d
commit
7d69aca76f
@ -182,7 +182,7 @@ export function useComponentState(
|
||||
async function doSend(): Promise<void> {
|
||||
if (!parsedAmount || !currency) return;
|
||||
|
||||
const depositPaytoUri = `payto://${currentAccount.targetType}/${currentAccount.targetPath}`;
|
||||
const depositPaytoUri = stringifyPaytoUri(currentAccount);
|
||||
const amount = Amounts.stringify(parsedAmount);
|
||||
await api.wallet.call(WalletApiOperation.CreateDepositGroup, {
|
||||
amount, depositPaytoUri
|
||||
|
@ -71,7 +71,7 @@ export function useComponentState(
|
||||
? "that account is already present"
|
||||
: undefined;
|
||||
|
||||
const unableToAdd = !type || !alias || paytoUriError !== undefined || uri !== undefined;
|
||||
const unableToAdd = !type || !alias || paytoUriError !== undefined || uri === undefined;
|
||||
|
||||
const accountByType: AccountByType = {
|
||||
iban: [],
|
||||
|
@ -204,6 +204,9 @@ function IbanTable({
|
||||
<th>
|
||||
<i18n.Translate>Int. Account Number</i18n.Translate>
|
||||
</th>
|
||||
<th>
|
||||
<i18n.Translate>Account name</i18n.Translate>
|
||||
</th>
|
||||
<th class="kyc">
|
||||
<i18n.Translate>KYC</i18n.Translate>
|
||||
</th>
|
||||
@ -217,6 +220,7 @@ function IbanTable({
|
||||
<tr key={account.alias}>
|
||||
<td>{account.alias}</td>
|
||||
<td>{p.targetPath}</td>
|
||||
<td>{p.params["receiver-name"]}</td>
|
||||
<td class="kyc">
|
||||
{account.kyc_completed ? (
|
||||
<SvgIcon
|
||||
@ -484,9 +488,11 @@ function TalerBankAddressAccount({
|
||||
|
||||
function IbanAddressAccount({ field }: { field: TextFieldHandler }): VNode {
|
||||
const { i18n } = useTranslationContext();
|
||||
const [value, setValue] = useState<string | undefined>(undefined);
|
||||
const [number, setNumber] = useState<string | undefined>(undefined);
|
||||
const [name, setName] = useState<string | undefined>(undefined);
|
||||
const errors = undefinedIfEmpty({
|
||||
value: !value ? i18n.str`Can't be empty` : undefined,
|
||||
number: !number ? i18n.str`Can't be empty` : undefined,
|
||||
name: !name ? i18n.str`Can't be empty` : undefined,
|
||||
});
|
||||
return (
|
||||
<Fragment>
|
||||
@ -494,17 +500,33 @@ function IbanAddressAccount({ field }: { field: TextFieldHandler }): VNode {
|
||||
label="IBAN number"
|
||||
variant="standard"
|
||||
fullWidth
|
||||
value={value}
|
||||
error={value !== undefined && !!errors?.value}
|
||||
value={number}
|
||||
error={number !== undefined && !!errors?.number}
|
||||
onChange={(v) => {
|
||||
setValue(v);
|
||||
setNumber(v);
|
||||
if (!errors) {
|
||||
field.onInput(`payto://iban/${v}`);
|
||||
field.onInput(`payto://iban/${v}?receiver-name=${name}`);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{value !== undefined && errors?.value && (
|
||||
<ErrorMessage title={<span>{errors?.value}</span>} />
|
||||
{number !== undefined && errors?.number && (
|
||||
<ErrorMessage title={<span>{errors?.number}</span>} />
|
||||
)}
|
||||
<TextField
|
||||
label="Account name"
|
||||
variant="standard"
|
||||
fullWidth
|
||||
value={name}
|
||||
error={name !== undefined && !!errors?.name}
|
||||
onChange={(v) => {
|
||||
setName(v);
|
||||
if (!errors) {
|
||||
field.onInput(`payto://iban/${number}?receiver-name=${v}`);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{name !== undefined && errors?.name && (
|
||||
<ErrorMessage title={<span>{errors?.name}</span>} />
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user