diff options
author | Sebastian <sebasjm@gmail.com> | 2022-09-16 14:29:35 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-09-16 14:29:35 -0300 |
commit | 6ddb2de84245ae3914c92b2b2eb7399e7f04500e (patch) | |
tree | 425cc377daf053e5283bee6986f6f437f25d7584 /packages/taler-wallet-webextension/src/cta/Payment/state.ts | |
parent | 860f10e6f004668d3109b5a1d96ddb2b26ddc2f5 (diff) | |
download | wallet-core-6ddb2de84245ae3914c92b2b2eb7399e7f04500e.tar.xz |
pretty
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, }; - } - |