summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-12-01 10:09:38 -0300
committerSebastian <sebasjm@gmail.com>2023-12-01 10:09:54 -0300
commit1e5abb5b2aa9545e194f6db879e7480162f6d481 (patch)
treed5e31d4cfe595aeb20c6e0dce2719e2a5ebc352c /packages/taler-wallet-webextension/src/wallet
parentce2e58962cb0a61725fe0fe3dd8535965f482b95 (diff)
downloadwallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.tar.gz
wallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.tar.bz2
wallet-core-1e5abb5b2aa9545e194f6db879e7480162f6d481.zip
exchange account info
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ReserveCreated.stories.tsx12
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx23
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.tsx76
3 files changed, 59 insertions, 52 deletions
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 <http://www.gnu.org/licenses/>
*/
-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<void>;
}
@@ -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 <Fragment />;
- return (
- <BankDetailsByPaytoType
- amount={amount}
- exchangeBaseUrl={exchangeBaseUrl}
- subject={reservePub}
- />
- );
- }
-
return (
<Fragment>
<section>
@@ -71,7 +60,11 @@ export function ReserveCreated({
</i18n.Translate>
</p>
</section>
- <TransferDetails />
+ <BankDetailsByPaytoType
+ amount={amount}
+ accounts={accounts}
+ subject={reservePub}
+ />
<section>
<p>
<i18n.Translate>
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 (
<TransactionTemplate
transaction={transaction}
@@ -472,7 +465,7 @@ export function TransactionView({
//manual withdrawal
<BankDetailsByPaytoType
amount={raw}
- exchangeBaseUrl={transaction.exchangeBaseUrl}
+ accounts={transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []}
subject={transaction.withdrawalDetails.reservePub}
/>
) : (
@@ -973,12 +966,12 @@ export function TransactionView({
kind="neutral"
/>
{transaction.talerUri && (
- <Part
- title={i18n.str`URI`}
- text={<ShowQrWithCopy text={transaction.talerUri} />}
- kind="neutral"
- />
- )}
+ <Part
+ title={i18n.str`URI`}
+ text={<ShowQrWithCopy text={transaction.talerUri} />}
+ kind="neutral"
+ />
+ )}
<Part
title={i18n.str`Details`}
text={
@@ -1417,7 +1410,7 @@ export function TransferPickupDetails({
</PurchaseDetailsTable>
);
}
-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 (
<PurchaseDetailsTable>
- <tr>
- <td>
- <i18n.Translate>Transfer</i18n.Translate>
- </td>
- <td>
- <Amount value={amount.value} maxFracSize={amount.maxFrac} />
- </td>
- </tr>
-
+ {conversion ?
+ <Fragment>
+ <tr>
+ <td>
+ <i18n.Translate>Transfer</i18n.Translate>
+ </td>
+ <td>
+ <Amount value={conversion} maxFracSize={amount.maxFrac} />
+ </td>
+ </tr>
+ {conversion.fraction === amount.value.fraction && conversion.value === amount.value.value ? undefined :
+ <tr>
+ <td>
+ <i18n.Translate>Converted</i18n.Translate>
+ </td>
+ <td>
+ <Amount value={amount.value} maxFracSize={amount.maxFrac} />
+ </td>
+ </tr>
+ }
+ </Fragment>
+ : <tr>
+ <td>
+ <i18n.Translate>Transfer</i18n.Translate>
+ </td>
+ <td>
+ <Amount value={amount.value} maxFracSize={amount.maxFrac} />
+ </td>
+ </tr>
+ }
{Amounts.isNonZero(amount.fee) && (
<tr>
<td>
@@ -2007,7 +2021,7 @@ function ShowWithdrawalDetailForBankIntegrated({
{showDetails && (
<BankDetailsByPaytoType
amount={raw}
- exchangeBaseUrl={transaction.exchangeBaseUrl}
+ accounts={transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []}
subject={transaction.withdrawalDetails.reservePub}
/>
)}