gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] 02/02: alt currency WIP


From: gnunet
Subject: [taler-wallet-core] 02/02: alt currency WIP
Date: Thu, 30 Nov 2023 15:09:04 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

commit 7b62d04f2c3fec5ee1a67650da4b4087cae7b4dd
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Thu Nov 30 11:08:56 2023 -0300

    alt currency WIP
---
 .../src/cta/Withdraw/index.ts                      |  2 ++
 .../src/cta/Withdraw/state.ts                      |  6 ++--
 .../src/cta/Withdraw/stories.tsx                   | 33 ++++++++++++++++++++++
 .../src/cta/Withdraw/views.tsx                     | 18 +++++++++++-
 4 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
index f80e5a648..3dc2b7f3d 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/index.ts
@@ -18,6 +18,7 @@ import {
   AmountJson,
   AmountString,
   ExchangeListItem,
+  WithdrawalExchangeAccountDetails,
 } from "@gnu-taler/taler-util";
 import { Loading } from "../../components/Loading.js";
 import { State as SelectExchangeState } from 
"../../hooks/useSelectedExchange.js";
@@ -91,6 +92,7 @@ export namespace State {
 
     doWithdrawal: ButtonHandler;
     doSelectExchange: ButtonHandler;
+    accounts: WithdrawalExchangeAccountDetails[];
 
     ageRestriction?: SelectFieldHandler;
 
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts 
b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
index a3855c2f4..46d221766 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts
@@ -324,10 +324,11 @@ function exchangeSelectionState(
         raw: Amounts.parseOrThrow(info.amountRaw),
         effective: Amounts.parseOrThrow(info.amountEffective),
       };
-
+      
       return {
         amount: withdrawAmount,
         ageRestrictionOptions: info.ageRestrictionOptions,
+        accounts: info.withdrawalAccountList
       };
     }, []);
 
@@ -335,7 +336,7 @@ function exchangeSelectionState(
       undefined,
     );
     const [doingWithdraw, setDoingWithdraw] = useState<boolean>(false);
-
+    
     async function doWithdrawAndCheckError(): Promise<void> {
       try {
         setDoingWithdraw(true);
@@ -406,6 +407,7 @@ function exchangeSelectionState(
       doSelectExchange: selectedExchange.doSelect,
       currentExchange,
       toBeReceived,
+      accounts: amountHook.response.accounts,
       withdrawalFee,
       chosenAmount,
       talerWithdrawUri,
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/stories.tsx 
b/packages/taler-wallet-webextension/src/cta/Withdraw/stories.tsx
index 29f7e0a30..df70a5c95 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/stories.tsx
@@ -64,6 +64,7 @@ export const TermsOfServiceNotYetLoaded = 
tests.createExample(SuccessView, {
     fraction: 0,
     value: 1,
   },
+  accounts: [],
 });
 
 export const WithSomeFee = tests.createExample(SuccessView, {
@@ -90,6 +91,7 @@ export const WithSomeFee = tests.createExample(SuccessView, {
     value: 1,
   },
   doSelectExchange: {},
+  accounts: [],
 });
 
 export const WithoutFee = tests.createExample(SuccessView, {
@@ -116,6 +118,7 @@ export const WithoutFee = tests.createExample(SuccessView, {
     fraction: 0,
     value: 2,
   },
+  accounts: [],
 });
 
 export const EditExchangeUntouched = tests.createExample(SuccessView, {
@@ -142,6 +145,7 @@ export const EditExchangeUntouched = 
tests.createExample(SuccessView, {
     fraction: 0,
     value: 2,
   },
+  accounts: [],
 });
 
 export const EditExchangeModified = tests.createExample(SuccessView, {
@@ -168,6 +172,7 @@ export const EditExchangeModified = 
tests.createExample(SuccessView, {
     fraction: 0,
     value: 2,
   },
+  accounts: [],
 });
 
 export const WithAgeRestriction = tests.createExample(SuccessView, {
@@ -195,4 +200,32 @@ export const WithAgeRestriction = 
tests.createExample(SuccessView, {
     fraction: 0,
     value: 2,
   },
+  accounts: [],
+});
+
+export const WithAlternateCurrencies = tests.createExample(SuccessView, {
+  error: undefined,
+  status: "success",
+  chosenAmount: {
+    currency: "USD",
+    value: 2,
+    fraction: 10000000,
+  },
+  accounts: [],
+  doWithdrawal: { onClick: nullFunction },
+  currentExchange: {
+    exchangeBaseUrl: "https://exchange.demo.taler.net";,
+    tos: {},
+  } as Partial<ExchangeListItem> as any,
+  withdrawalFee: {
+    currency: "USD",
+    fraction: 10000000,
+    value: 1,
+  },
+  doSelectExchange: {},
+  toBeReceived: {
+    currency: "USD",
+    fraction: 0,
+    value: 1,
+  },
 });
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx 
b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
index 8a01edaaf..aa8b58707 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw/views.tsx
@@ -39,7 +39,8 @@ export function SuccessView(state: State.Success): VNode {
   const { i18n } = useTranslationContext();
   const currentTosVersionIsAccepted =
     state.currentExchange.tosStatus === ExchangeTosStatus.Accepted;
-  return (
+    const altCurrencies = state.accounts.filter(a => 
!!a.currencySpecification).map(a => a.currencySpecification!.name)
+    return (
     <Fragment>
       <section style={{ textAlign: "left" }}>
         <Part
@@ -66,6 +67,21 @@ export function SuccessView(state: State.Success): VNode {
           kind="neutral"
           big
         />
+        <p>
+          This exchange allows alternative currency
+        </p>
+        <p>
+            <Button
+              variant="outlined"
+            >
+              EUR
+            </Button>
+            <Button
+              variant="outlined"
+            >
+              ARS
+            </Button>
+          </p>
         <Part
           title={i18n.str`Details`}
           text={

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]