diff options
author | Sebastian <sebasjm@gmail.com> | 2022-11-24 23:16:01 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-11-24 23:16:01 -0300 |
commit | e05ba843a061c8050648ce922f36ed3d8e1cf24a (patch) | |
tree | 4daf3eccc5f2976b980e884499a756cc6f864c6e /packages/taler-wallet-webextension/src/cta/Payment/index.ts | |
parent | 88618df7b870732f4f29a80686dd4f4cf20887f8 (diff) | |
download | wallet-core-e05ba843a061c8050648ce922f36ed3d8e1cf24a.tar.xz |
fix 7465
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment/index.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/index.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/index.ts b/packages/taler-wallet-webextension/src/cta/Payment/index.ts index f0270b96c..80822b381 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/index.ts @@ -18,6 +18,7 @@ import { AmountJson, PreparePayResult, PreparePayResultAlreadyConfirmed, + PreparePayResultInsufficientBalance, PreparePayResultPaymentPossible, } from "@gnu-taler/taler-util"; import { Loading } from "../../components/Loading.js"; @@ -26,7 +27,7 @@ import { ButtonHandler } from "../../mui/handlers.js"; import { compose, StateViewMap } from "../../utils/index.js"; import { wxApi } from "../../wxApi.js"; import { useComponentState } from "./state.js"; -import { BaseView, LoadingUriView } from "./views.js"; +import { BaseView, LoadingUriView, LostView } from "./views.js"; export interface Props { talerPayUri?: string; @@ -40,6 +41,7 @@ export type State = | State.LoadingUriError | State.Ready | State.NoEnoughBalance + | State.Lost | State.NoBalanceForCurrency | State.Confirmed; @@ -62,12 +64,15 @@ export namespace State { } export interface NoBalanceForCurrency extends BaseInfo { status: "no-balance-for-currency"; - payStatus: PreparePayResult; + payStatus: + | PreparePayResultInsufficientBalance + | PreparePayResultPaymentPossible + | PreparePayResultAlreadyConfirmed; balance: undefined; } export interface NoEnoughBalance extends BaseInfo { status: "no-enough-balance"; - payStatus: PreparePayResult; + payStatus: PreparePayResultInsufficientBalance; balance: AmountJson; } export interface Ready extends BaseInfo { @@ -77,6 +82,11 @@ export namespace State { balance: AmountJson; } + export interface Lost { + status: "lost"; + error: undefined; + } + export interface Confirmed extends BaseInfo { status: "confirmed"; payStatus: PreparePayResultAlreadyConfirmed; @@ -89,6 +99,7 @@ const viewMapping: StateViewMap<State> = { "loading-uri": LoadingUriView, "no-balance-for-currency": BaseView, "no-enough-balance": BaseView, + lost: LostView, confirmed: BaseView, ready: BaseView, }; |