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.
|
|
|
|
*/
|
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",
|
2019-12-12 20:53:15 +01:00
|
|
|
ReserveUpdated = "reserve-updated",
|
|
|
|
ReserveConfirmed = "reserve-confirmed",
|
|
|
|
ReserveCreated = "reserve-created",
|
2020-04-02 17:03:01 +02:00
|
|
|
WithdrawGroupCreated = "withdraw-group-created",
|
|
|
|
WithdrawGroupFinished = "withdraw-group-finished",
|
2019-12-12 20:53:15 +01:00
|
|
|
WaitingForRetry = "waiting-for-retry",
|
|
|
|
RefundStarted = "refund-started",
|
|
|
|
RefundQueried = "refund-queried",
|
|
|
|
RefundFinished = "refund-finished",
|
|
|
|
ExchangeOperationError = "exchange-operation-error",
|
2021-11-24 12:55:37 +01:00
|
|
|
ExchangeAdded = "exchange-added",
|
2019-12-12 20:53:15 +01:00
|
|
|
RefreshOperationError = "refresh-operation-error",
|
2020-03-12 14:55:38 +01:00
|
|
|
RecoupOperationError = "recoup-operation-error",
|
2019-12-12 20:53:15 +01:00
|
|
|
RefundApplyOperationError = "refund-apply-error",
|
|
|
|
RefundStatusOperationError = "refund-status-error",
|
|
|
|
ProposalOperationError = "proposal-error",
|
2021-06-25 13:27:06 +02:00
|
|
|
BackupOperationError = "backup-error",
|
2019-12-12 20:53:15 +01:00
|
|
|
TipOperationError = "tip-error",
|
|
|
|
PayOperationError = "pay-error",
|
2020-11-04 12:07:34 +01:00
|
|
|
PayOperationSuccess = "pay-operation-success",
|
2019-12-12 20:53:15 +01:00
|
|
|
WithdrawOperationError = "withdraw-error",
|
2020-07-22 10:52:03 +02:00
|
|
|
ReserveNotYetFound = "reserve-not-yet-found",
|
2019-12-12 20:53:15 +01:00
|
|
|
ReserveOperationError = "reserve-error",
|
2020-07-20 12:50:32 +02:00
|
|
|
InternalError = "internal-error",
|
|
|
|
PendingOperationProcessed = "pending-operation-processed",
|
|
|
|
ProposalRefused = "proposal-refused",
|
|
|
|
ReserveRegisteredWithBank = "reserve-registered-with-bank",
|
2021-01-18 23:35:41 +01:00
|
|
|
DepositOperationError = "deposit-operation-error",
|
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;
|
|
|
|
}
|
|
|
|
|
2020-07-22 10:52:03 +02:00
|
|
|
export interface ReserveNotYetFoundNotification {
|
|
|
|
type: NotificationType.ReserveNotYetFound;
|
|
|
|
reservePub: string;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export interface CoinWithdrawnNotification {
|
|
|
|
type: NotificationType.CoinWithdrawn;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundStartedNotification {
|
|
|
|
type: NotificationType.RefundStarted;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundQueriedNotification {
|
|
|
|
type: NotificationType.RefundQueried;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
export interface ReserveConfirmedNotification {
|
|
|
|
type: NotificationType.ReserveConfirmed;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
export interface WaitingForRetryNotification {
|
|
|
|
type: NotificationType.WaitingForRetry;
|
|
|
|
numPending: number;
|
|
|
|
numGivingLiveness: number;
|
2022-10-23 19:05:46 +02:00
|
|
|
numDue: number;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundFinishedNotification {
|
|
|
|
type: NotificationType.RefundFinished;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefreshOperationErrorNotification {
|
|
|
|
type: NotificationType.RefreshOperationError;
|
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
|
|
|
export interface RefundStatusOperationErrorNotification {
|
|
|
|
type: NotificationType.RefundStatusOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface RefundApplyOperationErrorNotification {
|
|
|
|
type: NotificationType.RefundApplyOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface PayOperationErrorNotification {
|
|
|
|
type: NotificationType.PayOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProposalOperationErrorNotification {
|
|
|
|
type: NotificationType.ProposalOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface TipOperationErrorNotification {
|
|
|
|
type: NotificationType.TipOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface WithdrawOperationErrorNotification {
|
|
|
|
type: NotificationType.WithdrawOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2020-03-12 14:55:38 +01:00
|
|
|
export interface RecoupOperationErrorNotification {
|
|
|
|
type: NotificationType.RecoupOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2020-03-12 14:55:38 +01:00
|
|
|
}
|
|
|
|
|
2021-01-18 23:35:41 +01:00
|
|
|
export interface DepositOperationErrorNotification {
|
|
|
|
type: NotificationType.DepositOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2021-01-18 23:35:41 +01:00
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export interface ReserveOperationErrorNotification {
|
|
|
|
type: NotificationType.ReserveOperationError;
|
2022-03-22 21:16:38 +01:00
|
|
|
error: TalerErrorDetail;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ReserveCreatedNotification {
|
|
|
|
type: NotificationType.ReserveCreated;
|
2020-07-23 20:52:46 +02:00
|
|
|
reservePub: string;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
export interface ProposalRefusedNotification {
|
|
|
|
type: NotificationType.ProposalRefused;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ReserveRegisteredWithBankNotification {
|
|
|
|
type: NotificationType.ReserveRegisteredWithBank;
|
2019-12-12 20:53:15 +01:00
|
|
|
}
|
|
|
|
|
2020-11-04 12:07:34 +01:00
|
|
|
/**
|
|
|
|
* Notification sent when a pay (or pay replay) operation succeeded.
|
2020-12-14 16:45:15 +01:00
|
|
|
*
|
2020-11-04 12:07:34 +01:00
|
|
|
* We send this notification because the confirmPay request can return
|
|
|
|
* a "confirmed" response that indicates that the payment has been confirmed
|
|
|
|
* by the user, but we're still waiting for the payment to succeed or fail.
|
|
|
|
*/
|
|
|
|
export interface PayOperationSuccessNotification {
|
|
|
|
type: NotificationType.PayOperationSuccess;
|
|
|
|
proposalId: string;
|
|
|
|
}
|
|
|
|
|
2019-12-12 20:53:15 +01:00
|
|
|
export type WalletNotification =
|
2021-06-25 13:27:06 +02:00
|
|
|
| BackupOperationErrorNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| WithdrawOperationErrorNotification
|
|
|
|
| ReserveOperationErrorNotification
|
2021-11-24 12:55:37 +01:00
|
|
|
| ExchangeAddedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| ExchangeOperationErrorNotification
|
|
|
|
| RefreshOperationErrorNotification
|
|
|
|
| RefundStatusOperationErrorNotification
|
|
|
|
| RefundApplyOperationErrorNotification
|
|
|
|
| ProposalOperationErrorNotification
|
|
|
|
| PayOperationErrorNotification
|
|
|
|
| TipOperationErrorNotification
|
|
|
|
| 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
|
|
|
|
| ReserveCreatedNotification
|
|
|
|
| ReserveConfirmedNotification
|
2020-04-02 17:03:01 +02:00
|
|
|
| WithdrawalGroupFinishedNotification
|
2019-12-12 20:53:15 +01:00
|
|
|
| WaitingForRetryNotification
|
|
|
|
| RefundStartedNotification
|
|
|
|
| RefundFinishedNotification
|
|
|
|
| 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
|
|
|
| RecoupOperationErrorNotification
|
2021-01-18 23:35:41 +01:00
|
|
|
| DepositOperationErrorNotification
|
2020-07-20 12:50:32 +02:00
|
|
|
| InternalErrorNotification
|
|
|
|
| PendingOperationProcessedNotification
|
|
|
|
| ProposalRefusedNotification
|
2020-07-22 10:52:03 +02:00
|
|
|
| ReserveRegisteredWithBankNotification
|
2020-11-04 12:07:34 +01:00
|
|
|
| ReserveNotYetFoundNotification
|
|
|
|
| PayOperationSuccessNotification;
|