From e4f3acfeb2ae6a24c579e7ba8d89625f398d2ee6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 10 Sep 2022 23:21:44 -0300 Subject: fix #7343 --- .../src/cta/InvoicePay/index.ts | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts') diff --git a/packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts b/packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts index 2521ee69c..71aedc638 100644 --- a/packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts +++ b/packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see */ -import { AbsoluteTime, AmountJson, TalerErrorDetail } from "@gnu-taler/taler-util"; +import { AbsoluteTime, AmountJson, PreparePayResult, TalerErrorDetail } from "@gnu-taler/taler-util"; import { Loading } from "../../components/Loading.js"; import { HookError } from "../../hooks/useAsyncAsHook.js"; import { ButtonHandler } from "../../mui/handlers.js"; @@ -26,11 +26,14 @@ import { LoadingUriView, ReadyView } from "./views.js"; export interface Props { talerPayPullUri: string; onClose: () => Promise; + goToWalletManualWithdraw: (amount?: string) => Promise; } export type State = | State.Loading | State.LoadingUriError + | State.NoEnoughBalance + | State.NoBalanceForCurrency | State.Ready; export namespace State { @@ -47,22 +50,38 @@ export namespace State { export interface BaseInfo { error: undefined; + uri: string; cancel: ButtonHandler; - } - export interface Ready extends BaseInfo { - status: "ready"; amount: AmountJson, + goToWalletManualWithdraw: (currency: string) => Promise; summary: string | undefined, expiration: AbsoluteTime | undefined, + operationError?: TalerErrorDetail; + payStatus: PreparePayResult; + } + + export interface NoBalanceForCurrency extends BaseInfo { + status: "no-balance-for-currency" + balance: undefined; + } + export interface NoEnoughBalance extends BaseInfo { + status: "no-enough-balance" + balance: AmountJson; + } + + export interface Ready extends BaseInfo { + status: "ready"; error: undefined; + balance: AmountJson; accept: ButtonHandler; - operationError?: TalerErrorDetail; } } const viewMapping: StateViewMap = { loading: Loading, "loading-uri": LoadingUriView, + "no-balance-for-currency": ReadyView, + "no-enough-balance": ReadyView, "ready": ReadyView, }; -- cgit v1.2.3