From 9c708251f92e6691ebba80fa8d129c6c04cec618 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 20 Jun 2023 11:40:06 +0200 Subject: wallet-core: emit DD37 self-transition notifications with errors --- packages/taler-util/src/notifications.ts | 136 ++----------------------------- 1 file changed, 7 insertions(+), 129 deletions(-) (limited to 'packages/taler-util') diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts index 51b56c3fe..b05fea8c9 100644 --- a/packages/taler-util/src/notifications.ts +++ b/packages/taler-util/src/notifications.ts @@ -36,43 +36,31 @@ export enum NotificationType { RefreshMelted = "refresh-melted", RefreshStarted = "refresh-started", RefreshUnwarranted = "refresh-unwarranted", - ReserveUpdated = "reserve-updated", - ReserveConfirmed = "reserve-confirmed", - ReserveCreated = "reserve-created", WithdrawGroupCreated = "withdraw-group-created", WithdrawGroupFinished = "withdraw-group-finished", RefundStarted = "refund-started", RefundQueried = "refund-queried", ExchangeOperationError = "exchange-operation-error", ExchangeAdded = "exchange-added", - RefreshOperationError = "refresh-operation-error", - RecoupOperationError = "recoup-operation-error", - RefundApplyOperationError = "refund-apply-error", - RefundStatusOperationError = "refund-status-error", - ProposalOperationError = "proposal-error", BackupOperationError = "backup-error", - TipOperationError = "tip-error", - PayOperationError = "pay-error", - PayOperationSuccess = "pay-operation-success", - WithdrawOperationError = "withdraw-error", - ReserveNotYetFound = "reserve-not-yet-found", - ReserveOperationError = "reserve-error", InternalError = "internal-error", PendingOperationProcessed = "pending-operation-processed", - ProposalRefused = "proposal-refused", - ReserveRegisteredWithBank = "reserve-registered-with-bank", KycRequested = "kyc-requested", - WithdrawalGroupBankConfirmed = "withdrawal-group-bank-confirmed", - WithdrawalGroupReserveReady = "withdrawal-group-reserve-ready", - DepositOperationError = "deposit-operation-error", TransactionStateTransition = "transaction-state-transition", } +export interface ErrorInfoSummary { + code: number; + hint?: string; + message?: string; +} + export interface TransactionStateTransitionNotification { type: NotificationType.TransactionStateTransition; transactionId: string; oldTxState: TransactionState; newTxState: TransactionState; + errorInfo?: ErrorInfoSummary; } export interface ProposalAcceptedNotification { @@ -86,11 +74,6 @@ export interface InternalErrorNotification { exception: any; } -export interface ReserveNotYetFoundNotification { - type: NotificationType.ReserveNotYetFound; - reservePub: string; -} - export interface CoinWithdrawnNotification { type: NotificationType.CoinWithdrawn; numWithdrawn: number; @@ -137,16 +120,6 @@ export interface KycRequestedNotification { kycUrl: string; } -export interface WithdrawalGroupBankConfirmed { - type: NotificationType.WithdrawalGroupBankConfirmed; - transactionId: string; -} - -export interface WithdrawalGroupReserveReadyNotification { - type: NotificationType.WithdrawalGroupReserveReady; - transactionId: string; -} - export interface RefreshRevealedNotification { type: NotificationType.RefreshRevealed; } @@ -159,10 +132,6 @@ export interface RefreshRefusedNotification { type: NotificationType.RefreshUnwarranted; } -export interface ReserveConfirmedNotification { - type: NotificationType.ReserveConfirmed; -} - export interface WithdrawalGroupCreatedNotification { type: NotificationType.WithdrawGroupCreated; withdrawalGroupId: string; @@ -182,103 +151,22 @@ export interface ExchangeOperationErrorNotification { error: TalerErrorDetail; } -export interface RefreshOperationErrorNotification { - type: NotificationType.RefreshOperationError; - error: TalerErrorDetail; -} - export interface BackupOperationErrorNotification { type: NotificationType.BackupOperationError; error: TalerErrorDetail; } -export interface RefundStatusOperationErrorNotification { - type: NotificationType.RefundStatusOperationError; - error: TalerErrorDetail; -} - -export interface RefundApplyOperationErrorNotification { - type: NotificationType.RefundApplyOperationError; - error: TalerErrorDetail; -} - -export interface PayOperationErrorNotification { - type: NotificationType.PayOperationError; - error: TalerErrorDetail; -} - -export interface ProposalOperationErrorNotification { - type: NotificationType.ProposalOperationError; - error: TalerErrorDetail; -} - -export interface TipOperationErrorNotification { - type: NotificationType.TipOperationError; - error: TalerErrorDetail; -} - -export interface WithdrawOperationErrorNotification { - type: NotificationType.WithdrawOperationError; - error: TalerErrorDetail; -} - -export interface RecoupOperationErrorNotification { - type: NotificationType.RecoupOperationError; - error: TalerErrorDetail; -} - -export interface DepositOperationErrorNotification { - type: NotificationType.DepositOperationError; - error: TalerErrorDetail; -} - -export interface ReserveOperationErrorNotification { - type: NotificationType.ReserveOperationError; - error: TalerErrorDetail; -} - -export interface ReserveCreatedNotification { - type: NotificationType.ReserveCreated; - reservePub: string; -} export interface PendingOperationProcessedNotification { type: NotificationType.PendingOperationProcessed; id: string; } -export interface ProposalRefusedNotification { - type: NotificationType.ProposalRefused; -} - -export interface ReserveRegisteredWithBankNotification { - type: NotificationType.ReserveRegisteredWithBank; -} - -/** - * Notification sent when a pay (or pay replay) operation succeeded. - * - * 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; -} export type WalletNotification = | BackupOperationErrorNotification - | WithdrawOperationErrorNotification - | ReserveOperationErrorNotification | ExchangeAddedNotification | ExchangeOperationErrorNotification - | RefreshOperationErrorNotification - | RefundStatusOperationErrorNotification - | RefundApplyOperationErrorNotification - | ProposalOperationErrorNotification - | PayOperationErrorNotification - | TipOperationErrorNotification | ProposalAcceptedNotification | ProposalDownloadedNotification | RefundsSubmittedNotification @@ -288,22 +176,12 @@ export type WalletNotification = | RefreshRevealedNotification | RefreshStartedNotification | RefreshRefusedNotification - | ReserveCreatedNotification - | ReserveConfirmedNotification | WithdrawalGroupFinishedNotification | RefundStartedNotification | RefundQueriedNotification | WithdrawalGroupCreatedNotification | CoinWithdrawnNotification - | RecoupOperationErrorNotification - | DepositOperationErrorNotification | InternalErrorNotification | PendingOperationProcessedNotification - | ProposalRefusedNotification - | ReserveRegisteredWithBankNotification - | ReserveNotYetFoundNotification - | PayOperationSuccessNotification | KycRequestedNotification - | WithdrawalGroupBankConfirmed - | WithdrawalGroupReserveReadyNotification | TransactionStateTransitionNotification; -- cgit v1.2.3