diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment/state.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/state.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/state.ts b/packages/taler-wallet-webextension/src/cta/Payment/state.ts index ad4bb7004..488263bb8 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/state.ts @@ -14,8 +14,15 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ - -import { AmountJson, Amounts, ConfirmPayResult, ConfirmPayResultType, NotificationType, PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util"; +import { + AmountJson, + Amounts, + ConfirmPayResult, + ConfirmPayResultType, + NotificationType, + PreparePayResultType, + TalerErrorCode, +} from "@gnu-taler/taler-util"; import { TalerError } from "@gnu-taler/taler-wallet-core"; import { useEffect, useState } from "preact/hooks"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; @@ -82,8 +89,9 @@ export function useComponentState( uri: hook.response.uri, amount, error: undefined, - cancel, goToWalletManualWithdraw - } + cancel, + goToWalletManualWithdraw, + }; if (!foundBalance) { return { @@ -91,7 +99,7 @@ export function useComponentState( balance: undefined, payStatus, ...baseResult, - } + }; } const foundAmount = Amounts.parseOrThrow(foundBalance.available); @@ -109,11 +117,11 @@ export function useComponentState( if (payStatus.status === PreparePayResultType.InsufficientBalance) { return { - status: 'no-enough-balance', + status: "no-enough-balance", balance: foundAmount, payStatus, ...baseResult, - } + }; } if (payStatus.status === PreparePayResultType.AlreadyConfirmed) { @@ -125,7 +133,6 @@ export function useComponentState( }; } - async function doPayment(): Promise<void> { try { if (payStatus.status !== "payment-possible") { @@ -169,8 +176,6 @@ export function useComponentState( payHandler, payStatus, ...baseResult, - balance: foundAmount + balance: foundAmount, }; - } - |