aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-09-10 23:21:44 -0300
committerSebastian <sebasjm@gmail.com>2022-09-10 23:21:44 -0300
commite4f3acfeb2ae6a24c579e7ba8d89625f398d2ee6 (patch)
treea71787f25c9a6093ef16c7f36dec1d2e7cd94312 /packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts
parentdda90b51f6fc6fca48a68bc53088e1ed3f018a21 (diff)
downloadwallet-core-e4f3acfeb2ae6a24c579e7ba8d89625f398d2ee6.tar.xz
fix #7343
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts')
-rw-r--r--packages/taler-wallet-webextension/src/cta/InvoicePay/index.ts29
1 files changed, 24 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>
*/
-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<void>;
+ goToWalletManualWithdraw: (amount?: string) => Promise<void>;
}
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<void>;
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<State> = {
loading: Loading,
"loading-uri": LoadingUriView,
+ "no-balance-for-currency": ReadyView,
+ "no-enough-balance": ReadyView,
"ready": ReadyView,
};