2019-12-12 20:53:15 +01:00
|
|
|
/*
|
|
|
|
This file is part of GNU Taler
|
|
|
|
(C) 2019 GNUnet e.V.
|
|
|
|
|
|
|
|
GNU Taler is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Type and schema definitions for notifications from the wallet to clients
|
|
|
|
* of the wallet.
|
|
|
|
*/
|
|
|
|
|
2020-04-07 10:07:32 +02:00
|
|
|
/**
|
|
|
|
* Imports.
|
|
|
|
*/
|
2023-04-22 14:17:49 +02:00
|
|
|
import { TransactionState } from "./transactions-types.js";
|
2022-10-14 22:38:40 +02:00
|
|
|
import { TalerErrorDetail } from "./wallet-types.js";
|
2020-04-07 10:07:32 +02:00
|
|
|
|
2020-09-02 07:51:42 +02:00
|
|
|
export enum NotificationType {
|
2019-12-12 20:53:15 +01:00
|
|
|
CoinWithdrawn = "coin-withdrawn",
|
|
|
|
ProposalAccepted = "proposal-accepted",
|
|
|
|
ProposalDownloaded = "proposal-downloaded",
|
|
|
|
RefundsSubmitted = "refunds-submitted",
|
2020-03-12 14:55:38 +01:00
|
|
|
RecoupStarted = "recoup-started",
|
|
|
|
RecoupFinished = "recoup-finished",
|
2019-12-12 20:53:15 +01:00
|
|
|
RefreshRevealed = "refresh-revealed",
|
|
|
|
RefreshMelted = "refresh-melted",
|
|
|
|
RefreshStarted = "refresh-started",
|
2019-12-16 21:10:57 +01:00
|
|
|
RefreshUnwarranted = "refresh-unwarranted",
|
2020-04-02 17:03:01 +02:00
|
|
|
WithdrawGroupCreated = "withdraw-group-created",
|
|
|
|
WithdrawGroupFinished = "withdraw-group-finished",
|
2019-12-12 20:53:15 +01:00
|
|
|
RefundStarted = "refund-started",
|
|
|
|
RefundQueried = "refund-queried",
|
|
|
|
ExchangeOperationError = "exchange-operation-error",
|
2021-11-24 12:55:37 +01:00
|
|
|
ExchangeAdded = "exchange-added",
|
2021-06-25 13:27:06 +02:00
|
|
|
BackupOperationError = "backup-error",
|
2020-07-20 12:50:32 +02:00
|
|
|
InternalError = "internal-error",
|
|
|
|
PendingOperationProcessed = "pending-operation-processed",
|
2023-03-29 05:06:24 +02:00
|
|
|
KycRequested = "kyc-requested",
|
2023-04-06 12:47:34 +02:00
|
|
|
TransactionStateTransition = "transaction-state-transition",
|
|
|
|
}
|
|
|
|
|
2023-06-20 11:40:06 +02:00
|
|
|
export interface ErrorInfoSummary {
|
|
|
|
code: number;
|
|
|
|
hint?: string;
|
|
|
|
message?: string;
|
|
|
|
}
|
|
|
|
|
2023-04-06 12:47:34 +02:00
|
|
|
export interface TransactionStateTransitionNotification {
|
|
|
|
type: NotificationType.TransactionStateTransition;
|
|
|
|
transactionId: string;
|
|
|
|
oldTxState: TransactionState;
|
|
|
|
newTxState: TransactionState;
|
2023-06-20 11:40:06 +02:00
|
|
|
errorInfo?: ErrorInfoSummary;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProposalAcceptedNotification {
|
|
|
|
type: NotificationType.ProposalAccepted;
|
|
|
|
proposalId: string;
|
|
|
|
}
|
|
|
|
|
2020-07-20 12:50:32 +02:00
|
|
|
export interface InternalErrorNotification {
|
|
|
|
type: NotificationType.InternalError;
|
|
|
|
message: string;
|
|
|
|
exception: any;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export interface CoinWithdrawnNotification {
|
|
|
|
type: NotificationType.CoinWithdrawn;
|
2023-02-09 22:44:36 +01:00
|
|
|
numWithdrawn: number;
|
|
|
|
numTotal: number;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundStartedNotification {
|
|
|
|
type: NotificationType.RefundStarted;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundQueriedNotification {
|
|
|
|
type: NotificationType.RefundQueried;
|
2023-02-14 11:16:58 +01:00
|
|
|
/**
|
|
|
|
* Transaction ID of the purchase (NOT the refund transaction).
|
|
|
|
*/
|
|
|
|
transactionId: string;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProposalDownloadedNotification {
|
|
|
|
type: NotificationType.ProposalDownloaded;
|
|
|
|
proposalId: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundsSubmittedNotification {
|
|
|
|
type: NotificationType.RefundsSubmitted;
|
|
|
|
proposalId: string;
|
|
|
|
}
|
|
|
|
|
2020-03-12 14:55:38 +01:00
|
|
|
export interface RecoupStartedNotification {
|
2020-03-11 20:14:28 +01:00
|
|
|
type: NotificationType.RecoupStarted;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2020-03-12 14:55:38 +01:00
|
|
|
export interface RecoupFinishedNotification {
|
2020-03-11 20:14:28 +01:00
|
|
|
type: NotificationType.RecoupFinished;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefreshMeltedNotification {
|
|
|
|
type: NotificationType.RefreshMelted;
|
|
|
|
}
|
|
|
|
|
2023-03-29 05:06:24 +02:00
|
|
|
export interface KycRequestedNotification {
|
|
|
|
type: NotificationType.KycRequested;
|
2023-02-12 19:30:59 +01:00
|
|
|
transactionId: string;
|
|
|
|
kycUrl: string;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export interface RefreshRevealedNotification {
|
|
|
|
type: NotificationType.RefreshRevealed;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefreshStartedNotification {
|
|
|
|
type: NotificationType.RefreshStarted;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefreshRefusedNotification {
|
2019-12-16 21:10:57 +01:00
|
|
|
type: NotificationType.RefreshUnwarranted;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2020-04-02 17:03:01 +02:00
|
|
|
export interface WithdrawalGroupCreatedNotification {
|
|
|
|
type: NotificationType.WithdrawGroupCreated;
|
|
|
|
withdrawalGroupId: string;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2020-04-02 17:03:01 +02:00
|
|
|
export interface WithdrawalGroupFinishedNotification {
|
|
|
|
type: NotificationType.WithdrawGroupFinished;
|
2020-09-08 15:57:08 +02:00
|
|
|
reservePub: string;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2021-11-24 12:55:37 +01:00
|
|
|
export interface ExchangeAddedNotification {
|
|
|
|
type: NotificationType.ExchangeAdded;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export interface ExchangeOperationErrorNotification {
|
|
|
|
type: NotificationType.ExchangeOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2021-06-25 13:27:06 +02:00
|
|
|
export interface BackupOperationErrorNotification {
|
|
|
|
type: NotificationType.BackupOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2021-06-25 13:27:06 +02:00
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
|
2020-07-20 12:50:32 +02:00
|
|
|
export interface PendingOperationProcessedNotification {
|
|
|
|
type: NotificationType.PendingOperationProcessed;
|
2022-10-23 19:05:46 +02:00
|
|
|
id: string;
|
2020-07-20 12:50:32 +02:00
|
|
|
}
|
|
|
|
|
2020-11-04 12:07:34 +01:00
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export type WalletNotification =
|
2021-06-25 13:27:06 +02:00
|
|
|
| BackupOperationErrorNotification
|
2021-11-24 12:55:37 +01:00
|
|
|
| ExchangeAddedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| ExchangeOperationErrorNotification
|
|
|
|
| ProposalAcceptedNotification
|
|
|
|
| ProposalDownloadedNotification
|
|
|
|
| RefundsSubmittedNotification
|
2020-03-12 14:55:38 +01:00
|
|
|
| RecoupStartedNotification
|
|
|
|
| RecoupFinishedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| RefreshMeltedNotification
|
|
|
|
| RefreshRevealedNotification
|
|
|
|
| RefreshStartedNotification
|
|
|
|
| RefreshRefusedNotification
|
2020-04-02 17:03:01 +02:00
|
|
|
| WithdrawalGroupFinishedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| RefundStartedNotification
|
|
|
|
| RefundQueriedNotification
|
2020-04-02 17:03:01 +02:00
|
|
|
| WithdrawalGroupCreatedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| CoinWithdrawnNotification
|
2020-07-20 12:50:32 +02:00
|
|
|
| InternalErrorNotification
|
|
|
|
| PendingOperationProcessedNotification
|
2023-03-29 05:06:24 +02:00
|
|
|
| KycRequestedNotification
|
2023-04-06 12:47:34 +02:00
|
|
|
| TransactionStateTransitionNotification;
|