diff options
author | Sebastian <sebasjm@gmail.com> | 2022-08-08 14:09:28 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-08-08 14:09:36 -0300 |
commit | 7a600514c6d43bbaeba6b962533415e59fc46057 (patch) | |
tree | d96c02537cda29f1637787a8fb8e659a37ea8c1f /packages/taler-wallet-webextension/src/cta/Payment/index.ts | |
parent | 4409d8384b77401489c2a92d3de20f79959ae34a (diff) | |
download | wallet-core-7a600514c6d43bbaeba6b962533415e59fc46057.tar.xz |
fixing #6096
merchant details and contract terms details factored out, to be used by other components
tests and stories updated
payment completed != confirmed (confirmed if paid by someone else)
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment/index.ts')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/index.ts | 16 |
1 files changed, 13 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 0e67a4991..5c0f6f0d6 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/index.ts @@ -14,7 +14,7 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { AmountJson, ConfirmPayResult, PreparePayResult } from "@gnu-taler/taler-util"; +import { AmountJson, ConfirmPayResult, PreparePayResult, PreparePayResultAlreadyConfirmed, PreparePayResultInsufficientBalance, PreparePayResultPaymentPossible } from "@gnu-taler/taler-util"; import { Loading } from "../../components/Loading.js"; import { HookError } from "../../hooks/useAsyncAsHook.js"; import { ButtonHandler } from "../../mui/handlers.js"; @@ -37,6 +37,7 @@ export type State = | State.Ready | State.NoEnoughBalance | State.NoBalanceForCurrency + | State.Completed | State.Confirmed; export namespace State { @@ -52,8 +53,6 @@ export namespace State { interface BaseInfo { amount: AmountJson; - totalFees: AmountJson; - payStatus: PreparePayResult; uri: string; error: undefined; goToWalletManualWithdraw: (currency?: string) => Promise<void>; @@ -61,20 +60,30 @@ export namespace State { } export interface NoBalanceForCurrency extends BaseInfo { status: "no-balance-for-currency" + payStatus: PreparePayResult; balance: undefined; } export interface NoEnoughBalance extends BaseInfo { status: "no-enough-balance" + payStatus: PreparePayResult; balance: AmountJson; } export interface Ready extends BaseInfo { status: "ready"; + payStatus: PreparePayResultPaymentPossible; payHandler: ButtonHandler; balance: AmountJson; } export interface Confirmed extends BaseInfo { status: "confirmed"; + payStatus: PreparePayResultAlreadyConfirmed; + balance: AmountJson; + } + + export interface Completed extends BaseInfo { + status: "completed"; + payStatus: PreparePayResult; payResult: ConfirmPayResult; payHandler: ButtonHandler; balance: AmountJson; @@ -87,6 +96,7 @@ const viewMapping: StateViewMap<State> = { "no-balance-for-currency": BaseView, "no-enough-balance": BaseView, confirmed: BaseView, + completed: BaseView, ready: BaseView, }; |