[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant-backoffice] branch master updated: collect amount to wit
From: |
gnunet |
Subject: |
[taler-merchant-backoffice] branch master updated: collect amount to withdraw |
Date: |
Wed, 09 Feb 2022 19:03:08 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository merchant-backoffice.
The following commit(s) were added to refs/heads/master by this push:
new cfd4303 collect amount to withdraw
cfd4303 is described below
commit cfd4303db0a908fca7cb2540e58fa75e36a7d4d2
Author: ms <ms@taler.net>
AuthorDate: Wed Feb 9 19:02:52 2022 +0100
collect amount to withdraw
---
packages/bank/src/pages/home/index.tsx | 48 +++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 6 deletions(-)
diff --git a/packages/bank/src/pages/home/index.tsx
b/packages/bank/src/pages/home/index.tsx
index 352650b..75620c5 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -619,6 +619,45 @@ async function registrationCall(
* Functional components. *
*************************/
+/**
+ * Let user choose a amount and submit the withdtawal.
+ */
+function TalerWithdrawal(Props: any): VNode {
+ const {backendState, pageStateSetter} = Props;
+ const i18n = useTranslator();
+ const amountRegex = "^[0-9]+(\.[0-9]+)?$";
+ var submitAmount = ""; // without currency.
+ var submitButton = <button
+ onClick={() => {
+ console.log("Maybe valid amount", submitAmount);
+ submitAmount = submitAmount.replace(",", "."); // tolerating comma
instead of point.
+ const re = RegExp(amountRegex)
+ if (!re.test(submitAmount)) {
+ console.log("Not withdrawing invalid amount", submitAmount);
+ return;
+ }
+ console.log("Valid amount", submitAmount);
+ createWithdrawalCall(
+ `EUR:${submitAmount}`, // FIXME: take currency from the balance.
+ backendState,
+ pageStateSetter
+ )}}>{i18n`Charge Taler wallet`}
+ </button>;
+
+ return <Fragment>
+ <input
+ type="text"
+ placeholder="amount"
+ required
+ pattern={amountRegex}
+ onInput={(e): void => {
+ submitAmount = e.currentTarget.value
+ }} />
+ <label>FIXME: currency here!</label>
+ { submitButton }
+ </Fragment>
+}
+
/**
* Collect and submit login data.
*/
@@ -974,12 +1013,9 @@ export function BankHome(): VNode {
* No action is currently being performed (page is 'pristine'):
* offer the Taler withdrawal button.
*/
- !pageState.withdrawalInProgress && !pageState.transferOutcome &&
<button onClick={() => {
- createWithdrawalCall(
- "EUR:5",
- backendState,
- pageStateSetter
- )}}>{i18n`Charge Taler wallet`}</button>
+ !pageState.withdrawalInProgress && !pageState.transferOutcome &&
<TalerWithdrawal
+ backendState={backendState}
+ pageStateSetter={pageStateSetter} />
}
{ /**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant-backoffice] branch master updated: collect amount to withdraw,
gnunet <=