taler-typescript-core

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

commit cf9ea1d7c4c76f1443329398cf5b7e54e4560d07
parent 3026da861fe246e0fb42a1ae21c2819998fcd950
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Thu, 25 Jun 2026 16:34:25 -0300

fix #11481

Diffstat:
Mpackages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx | 13+++++--------
Mpackages/taler-wallet-webextension/src/wallet/Transaction.tsx | 91++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
2 files changed, 67 insertions(+), 37 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx @@ -257,7 +257,7 @@ export function BankDetailsByPaytoType({ } } -function IBANAccountInfoTable({ +export function IBANAccountInfoTable({ payto, qrCodes, subject, @@ -266,13 +266,7 @@ function IBANAccountInfoTable({ subject: string; qrCodes: QrCodeSpec[]; refCode?: string; - payto: - | Paytos.PaytoUnsupported - | Paytos.PaytoIBAN - | Paytos.PaytoTalerReserve - | Paytos.PaytoCyclos - | Paytos.PaytoTalerReserveHttp - | Paytos.PaytoTalerBank; + payto: Paytos.URI }) { const { i18n } = useTranslationContext(); const api = useBackendContext(); @@ -409,6 +403,9 @@ function IBANAccountInfoTable({ /> </Fragment> ); + case PaytoType.Bitcoin: + case PaytoType.Ethereum: + return <Fragment /> default: assertUnreachable(payto); diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -26,6 +26,7 @@ import { NotificationType, OrderShortInfo, parsePaytoUri, + Paytos, PaytoUri, Result, ScopeInfo, @@ -51,7 +52,7 @@ import { isPast } from "date-fns"; import { ComponentChildren, Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; import { Amount } from "../components/Amount.js"; -import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js"; +import { BankDetailsByPaytoType, IBANAccountInfoTable } from "../components/BankDetailsByPaytoType.js"; import { AlertView, ErrorAlertView } from "../components/CurrentAlerts.js"; import { Loading } from "../components/Loading.js"; import { Kind, Part, PartPayto } from "../components/Part.js"; @@ -234,34 +235,18 @@ function TransactionTemplate({ case TransactionMajorState.Pending: { switch (transaction.txState.minor) { case TransactionMinorState.KycAuthRequired: { + if (!transaction.kycAuthTransferInfo) { + throw Error("transaction in KycAuthRequired state, the field kycAuthTransferInfo is expected to be present") + } pendingOrKycInfo = ( <AlertView alert={{ type: "warning", - message: i18n.str`Bank account confirmation required for the transaction to complete.`, + message: i18n.str`The transaction is on hold.`, description: ( <div> <p> - Your account:{" "} - <code> - {transaction.kycAuthTransferInfo?.debitPaytoUri} - </code> - </p> - <p> - Deposit account public key:{" "} - <code>{transaction.kycAuthTransferInfo?.accountPub}</code> - </p> - <p> - Payment targets:{" "} - <ul> - {transaction.kycAuthTransferInfo?.creditPaytoUris.map( - (x) => ( - <li> - <code>{x}</code> - </li> - ), - )} - </ul> + <i18n.Translate>To continue you need to validate the ownership of the account.</i18n.Translate> </p> </div> ), @@ -325,8 +310,8 @@ function TransactionTemplate({ <Fragment> <section style={{ padding: 8, textAlign: "center" }}> {transaction?.error && - // FIXME: wallet core should stop sending this error on KYC - transaction.error.code !== + // FIXME: wallet core should stop sending this error on KYC + transaction.error.code !== TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED ? ( <ErrorAlertView error={alertFromError( @@ -523,9 +508,9 @@ export function TransactionView({ </Header> {transaction.txState.major !== TransactionMajorState.Pending || - blockedByKycOrAml ? undefined : transaction.withdrawalDetails.type === + blockedByKycOrAml ? undefined : transaction.withdrawalDetails.type === WithdrawalType.ManualTransfer && - transaction.withdrawalDetails.exchangeCreditAccountDetails ? ( + transaction.withdrawalDetails.exchangeCreditAccountDetails ? ( <Fragment> <InfoBox> {transaction.withdrawalDetails.exchangeCreditAccountDetails @@ -570,7 +555,7 @@ export function TransactionView({ } /> {transaction.txState.major === TransactionMajorState.Aborted && - transaction.withdrawalDetails.type === WithdrawalType.ManualTransfer ? ( + transaction.withdrawalDetails.type === WithdrawalType.ManualTransfer ? ( <AlertView alert={{ type: "info", @@ -759,11 +744,15 @@ export function TransactionView({ if (transaction.type === TransactionType.Deposit) { const payto = parsePaytoUri(transaction.targetPaytoUri); + // const blockedByKycOrAml = + // transaction.txState.minor === TransactionMinorState.KycAuthRequired; + const info = transaction.kycAuthTransferInfo const wireTime = AbsoluteTime.fromProtocolTimestamp( transaction.wireTransferDeadline, ); const shouldBeWired = wireTime.t_ms !== "never" && isPast(wireTime.t_ms); + return ( <TransactionTemplate transaction={transaction} @@ -782,7 +771,51 @@ export function TransactionView({ > {!payto ? transaction.targetPaytoUri : <NicePayto payto={payto} />} </Header> - {payto && <PartPayto payto={payto} kind="neutral" />} + {/* {payto && <PartPayto payto={payto} kind="neutral" />} */} + {/* <BankDetailsByPaytoType + amount={raw} + accounts={ + transaction.kycAuthTransferInfo.exchangeCreditAccountDetails ?? [] + } + subject={transaction.kycAuthTransferInfo.accountPub} + /> */} + <pre> + {JSON.stringify({ info }, undefined, 2)} + </pre> + + {!info ? undefined : + <section + style={{ + textAlign: "left", + border: "solid 1px black", + padding: 8, + borderRadius: 4, + }} + > + <div + style={{ + display: "flex", + width: "100%", + justifyContent: "space-between", + }} + > + <p style={{ marginTop: 0 }}><i18n.Translate>Bank transfer details</i18n.Translate></p> + <div></div> + </div> + { + info.transferOptions.map(d => { + switch (d.type) { + case "payto": + return <IBANAccountInfoTable payto={Result.unpack(Paytos.fromString(d.paytoUri))} qrCodes={d.qrCodes} subject={info.accountPub} /> + case "uri": + case "ch-qr-bill": + return <i18n.Translate>Transfer option type "{d.type}"" is not supported by this wallet</i18n.Translate> + } + }) + + } + </section> + } <Part title={i18n.str`Details`} text={ @@ -1566,7 +1599,7 @@ export function WithdrawDetails({ </td> </tr> {conversion.fraction === amount.value.fraction && - conversion.value === amount.value.value ? undefined : ( + conversion.value === amount.value.value ? undefined : ( <tr> <td> <i18n.Translate>Converted</i18n.Translate>