From 1e5abb5b2aa9545e194f6db879e7480162f6d481 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 1 Dec 2023 10:09:38 -0300 Subject: exchange account info --- .../src/wallet/ReserveCreated.stories.tsx | 12 ++-- .../src/wallet/ReserveCreated.tsx | 23 +++---- .../src/wallet/Transaction.tsx | 76 +++++++++++++--------- 3 files changed, 59 insertions(+), 52 deletions(-) (limited to 'packages/taler-wallet-webextension/src/wallet') diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.stories.tsx b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.stories.tsx index 81250d5a4..2fcf580ed 100644 --- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.stories.tsx @@ -39,7 +39,7 @@ export const TalerBank = tests.createExample(TestedComponent, { value: 10, fraction: 0, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); export const IBAN = tests.createExample(TestedComponent, { @@ -52,7 +52,7 @@ export const IBAN = tests.createExample(TestedComponent, { value: 10, fraction: 0, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); export const WithReceiverName = tests.createExample(TestedComponent, { @@ -65,7 +65,7 @@ export const WithReceiverName = tests.createExample(TestedComponent, { value: 10, fraction: 0, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); export const Bitcoin = tests.createExample(TestedComponent, { @@ -78,7 +78,7 @@ export const Bitcoin = tests.createExample(TestedComponent, { value: 0, fraction: 14000000, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); export const BitcoinRegTest = tests.createExample(TestedComponent, { @@ -91,7 +91,7 @@ export const BitcoinRegTest = tests.createExample(TestedComponent, { value: 0, fraction: 14000000, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); export const BitcoinTest = tests.createExample(TestedComponent, { reservePub: "0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00", @@ -103,5 +103,5 @@ export const BitcoinTest = tests.createExample(TestedComponent, { value: 0, fraction: 14000000, }, - exchangeBaseUrl: "https://exchange.demo.taler.net", + accounts: [] }); diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx index f489b805b..144413541 100644 --- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see */ -import { AmountJson, PaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util"; +import { AmountJson, PaytoUri, WithdrawalExchangeAccountDetails, stringifyPaytoUri } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { Amount } from "../components/Amount.js"; import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js"; @@ -26,7 +26,7 @@ import { Button } from "../mui/Button.js"; export interface Props { reservePub: string; paytoURI: PaytoUri | undefined; - exchangeBaseUrl: string; + accounts: WithdrawalExchangeAccountDetails[]; amount: AmountJson; onCancel: () => Promise; } @@ -35,7 +35,7 @@ export function ReserveCreated({ reservePub, paytoURI, onCancel, - exchangeBaseUrl, + accounts, amount, }: Props): VNode { const { i18n } = useTranslationContext(); @@ -47,17 +47,6 @@ export function ReserveCreated({ /> ); } - function TransferDetails(): VNode { - if (!paytoURI) return ; - return ( - - ); - } - return (
@@ -71,7 +60,11 @@ export function ReserveCreated({

- +

diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index 4383dcc9a..e7ab65722 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -19,7 +19,6 @@ import { AmountJson, Amounts, AmountString, - Location, MerchantInfo, NotificationType, OrderShortInfo, @@ -28,7 +27,6 @@ import { stringifyPaytoUri, TalerErrorCode, TalerPreciseTimestamp, - TalerProtocolTimestamp, Transaction, TransactionAction, TransactionDeposit, @@ -39,7 +37,7 @@ import { TransactionType, TransactionWithdrawal, TranslatedString, - WithdrawalType, + WithdrawalType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; @@ -47,13 +45,12 @@ import { styled } from "@linaria/react"; import { isPast } from "date-fns"; import { ComponentChildren, Fragment, h, VNode } from "preact"; import { useEffect, useState } from "preact/hooks"; -import emptyImg from "../../static/img/empty.png"; import { Amount } from "../components/Amount.js"; import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js"; import { AlertView, ErrorAlertView } from "../components/CurrentAlerts.js"; import { EnabledBySettings } from "../components/EnabledBySettings.js"; import { Loading } from "../components/Loading.js"; -import { Kind, Part, PartCollapsible, PartPayto } from "../components/Part.js"; +import { Kind, Part, PartPayto } from "../components/Part.js"; import { QR } from "../components/QR.js"; import { ShowFullContractTermPopup } from "../components/ShowFullContractTermPopup.js"; import { @@ -61,13 +58,11 @@ import { ErrorBox, InfoBox, Link, - ListOfProducts, Overlay, - Row, SmallLightText, SubTitle, SvgIcon, - WarningBox, + WarningBox } from "../components/styled/index.js"; import { Time } from "../components/Time.js"; import { alertFromError, useAlertContext } from "../context/alert.js"; @@ -77,12 +72,8 @@ import { useSettings } from "../hooks/useSettings.js"; import { Button } from "../mui/Button.js"; import { SafeHandler } from "../mui/handlers.js"; import { Pages } from "../NavigationBar.js"; -import { assertUnreachable } from "../utils/index.js"; import refreshIcon from "../svg/refresh_24px.inline.svg"; -import refreshIcon1 from "../svg/refresh_outlined_24px.inline.svg"; -import refreshIcon2 from "../svg/refresh_rounded_24px.inline.svg"; -import refreshIcon3 from "../svg/refresh_sharp_24px.inline.svg"; -import refreshIcon4 from "../svg/refresh_two_tone_24px.inline.svg"; +import { assertUnreachable } from "../utils/index.js"; interface Props { tid: string; @@ -444,6 +435,8 @@ export function TransactionView({ transaction.type === TransactionType.Withdrawal || transaction.type === TransactionType.InternalWithdrawal ) { + const conversion = transaction.withdrawalDetails.type === WithdrawalType.ManualTransfer ? + transaction.withdrawalDetails.exchangeCreditAccountDetails ?? [] : [] return ( ) : ( @@ -973,12 +966,12 @@ export function TransactionView({ kind="neutral" /> {transaction.talerUri && ( - } - kind="neutral" - /> - )} + } + kind="neutral" + /> + )} ); } -export function WithdrawDetails({ amount }: { amount: AmountWithFee }): VNode { +export function WithdrawDetails({ conversion, amount }: { conversion?: AmountJson, amount: AmountWithFee }): VNode { const { i18n } = useTranslationContext(); const maxFrac = [amount.fee, amount.fee] @@ -1428,15 +1421,36 @@ export function WithdrawDetails({ amount }: { amount: AmountWithFee }): VNode { return ( - - - Transfer - - - - - - + {conversion ? + + + + Transfer + + + + + + {conversion.fraction === amount.value.fraction && conversion.value === amount.value.value ? undefined : + + + Converted + + + + + + } + + : + + Transfer + + + + + + } {Amounts.isNonZero(amount.fee) && ( @@ -2007,7 +2021,7 @@ function ShowWithdrawalDetailForBankIntegrated({ {showDetails && ( )} -- cgit v1.2.3