summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/Pay.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-12-06 10:31:19 -0300
committerSebastian <sebasjm@gmail.com>2021-12-06 10:31:26 -0300
commit505eb07d8e42d6787dc23b2024b76e05f807e1ad (patch)
tree3014f55b6d7074faacdd72beb8ba67313dc0ae5c /packages/taler-wallet-webextension/src/cta/Pay.tsx
parentc3b01ad9e4ccd49407a8df7aafce61909291a1b9 (diff)
downloadwallet-core-505eb07d8e42d6787dc23b2024b76e05f807e1ad.tar.gz
wallet-core-505eb07d8e42d6787dc23b2024b76e05f807e1ad.tar.bz2
wallet-core-505eb07d8e42d6787dc23b2024b76e05f807e1ad.zip
show error details in devmode
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Pay.tsx')
-rw-r--r--packages/taler-wallet-webextension/src/cta/Pay.tsx18
1 files changed, 14 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index 9f015280b..f1c8f270c 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -33,6 +33,7 @@ import {
ConfirmPayResultType,
ContractTerms,
i18n,
+ NotificationType,
PreparePayResult,
PreparePayResultType,
} from "@gnu-taler/taler-util";
@@ -56,6 +57,7 @@ import * as wxApi from "../wxApi";
interface Props {
talerPayUri?: string;
+ goToWalletManualWithdraw: () => void;
}
// export function AlreadyPaid({ payStatus }: { payStatus: PreparePayResult }) {
@@ -102,7 +104,10 @@ const doPayment = async (
return res;
};
-export function PayPage({ talerPayUri }: Props): VNode {
+export function PayPage({
+ talerPayUri,
+ goToWalletManualWithdraw,
+}: Props): VNode {
const [payStatus, setPayStatus] = useState<PreparePayResult | undefined>(
undefined,
);
@@ -113,7 +118,9 @@ export function PayPage({ talerPayUri }: Props): VNode {
OperationFailedError | string | undefined
>(undefined);
- const balance = useAsyncAsHook(wxApi.getBalance);
+ const balance = useAsyncAsHook(wxApi.getBalance, [
+ NotificationType.CoinWithdrawn,
+ ]);
const balanceWithoutError = balance?.hasError
? []
: balance?.response.balances || [];
@@ -144,7 +151,7 @@ export function PayPage({ talerPayUri }: Props): VNode {
}
};
doFetch();
- }, [talerPayUri]);
+ }, [talerPayUri, foundAmount]);
if (!talerPayUri) {
return <span>missing pay uri</span>;
@@ -198,6 +205,7 @@ export function PayPage({ talerPayUri }: Props): VNode {
payStatus={payStatus}
payResult={payResult}
onClick={onClick}
+ goToWalletManualWithdraw={goToWalletManualWithdraw}
balance={foundAmount}
/>
);
@@ -209,6 +217,7 @@ export interface PaymentRequestViewProps {
onClick: () => void;
payErrMsg?: string;
uri: string;
+ goToWalletManualWithdraw: () => void;
balance: AmountJson | undefined;
}
export function PaymentRequestView({
@@ -216,6 +225,7 @@ export function PaymentRequestView({
payStatus,
payResult,
onClick,
+ goToWalletManualWithdraw,
balance,
}: PaymentRequestViewProps): VNode {
let totalFees: AmountJson = Amounts.getZero(payStatus.amountRaw);
@@ -306,7 +316,7 @@ export function PaymentRequestView({
)}
</section>
<section>
- <ButtonSuccess upperCased>
+ <ButtonSuccess upperCased onClick={goToWalletManualWithdraw}>
{i18n.str`Withdraw digital cash`}
</ButtonSuccess>
</section>