From b5b8f96cc94e3a3c0ee7d989819197ab5df393cd Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 12 Mar 2020 19:25:38 +0530 Subject: improved error reporting / towards a working recoup --- src/types/ReserveTransaction.ts | 34 +++++++++++----------------------- src/types/dbTypes.ts | 5 +++++ src/types/notifications.ts | 21 +++++++++++++-------- src/types/pending.ts | 2 ++ src/types/talerTypes.ts | 16 ++++++++++++++-- 5 files changed, 45 insertions(+), 33 deletions(-) (limited to 'src/types') diff --git a/src/types/ReserveTransaction.ts b/src/types/ReserveTransaction.ts index e889f36a8..ba5ce3ffc 100644 --- a/src/types/ReserveTransaction.ts +++ b/src/types/ReserveTransaction.ts @@ -40,7 +40,7 @@ import { Timestamp, codecForTimestamp } from "../util/time"; export const enum ReserveTransactionType { Withdraw = "WITHDRAW", Deposit = "DEPOSIT", - Payback = "PAYBACK", + Recoup = "RECOUP", Closing = "CLOSING", } @@ -139,24 +139,14 @@ export interface ReserveClosingTransaction { timestamp: Timestamp; } -export interface ReservePaybackTransaction { - type: ReserveTransactionType.Payback; +export interface ReserveRecoupTransaction { + type: ReserveTransactionType.Recoup; /** * Amount paid back. */ amount: AmountString; - /** - * Receiver account details. - */ - receiver_account_details: any; - - /** - * Wire transfer identifier. - */ - wire_transfer: any; - /** * This is a signature over * a struct TALER_PaybackConfirmationPS with purpose @@ -187,7 +177,7 @@ export type ReserveTransaction = | ReserveWithdrawTransaction | ReserveDepositTransaction | ReserveClosingTransaction - | ReservePaybackTransaction; + | ReserveRecoupTransaction; export const codecForReserveWithdrawTransaction = () => typecheckedCodec( @@ -229,18 +219,16 @@ export const codecForReserveClosingTransaction = () => .build("ReserveClosingTransaction"), ); -export const codecForReservePaybackTransaction = () => - typecheckedCodec( - makeCodecForObject() +export const codecForReserveRecoupTransaction = () => + typecheckedCodec( + makeCodecForObject() .property("amount", codecForString) .property("coin_pub", codecForString) .property("exchange_pub", codecForString) .property("exchange_sig", codecForString) - .property("receiver_account_details", codecForString) .property("timestamp", codecForTimestamp) - .property("type", makeCodecForConstString(ReserveTransactionType.Payback)) - .property("wire_transfer", codecForString) - .build("ReservePaybackTransaction"), + .property("type", makeCodecForConstString(ReserveTransactionType.Recoup)) + .build("ReserveRecoupTransaction"), ); export const codecForReserveTransaction = () => @@ -256,8 +244,8 @@ export const codecForReserveTransaction = () => codecForReserveClosingTransaction(), ) .alternative( - ReserveTransactionType.Payback, - codecForReservePaybackTransaction(), + ReserveTransactionType.Recoup, + codecForReserveRecoupTransaction(), ) .alternative( ReserveTransactionType.Deposit, diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts index 56c1f82eb..36b45f5ac 100644 --- a/src/types/dbTypes.ts +++ b/src/types/dbTypes.ts @@ -1457,6 +1457,11 @@ export namespace Stores { "denomPubIndex", "denomPub", ); + denomPubHashIndex = new Index( + this, + "denomPubHashIndex", + "denomPubHash", + ); } class ProposalsStore extends Store { diff --git a/src/types/notifications.ts b/src/types/notifications.ts index 34e98fe2c..39930dcca 100644 --- a/src/types/notifications.ts +++ b/src/types/notifications.ts @@ -26,8 +26,8 @@ export const enum NotificationType { ProposalAccepted = "proposal-accepted", ProposalDownloaded = "proposal-downloaded", RefundsSubmitted = "refunds-submitted", - RecoupStarted = "payback-started", - RecoupFinished = "payback-finished", + RecoupStarted = "recoup-started", + RecoupFinished = "recoup-finished", RefreshRevealed = "refresh-revealed", RefreshMelted = "refresh-melted", RefreshStarted = "refresh-started", @@ -44,7 +44,7 @@ export const enum NotificationType { RefundFinished = "refund-finished", ExchangeOperationError = "exchange-operation-error", RefreshOperationError = "refresh-operation-error", - RecoupOperationError = "refresh-operation-error", + RecoupOperationError = "recoup-operation-error", RefundApplyOperationError = "refund-apply-error", RefundStatusOperationError = "refund-status-error", ProposalOperationError = "proposal-error", @@ -82,11 +82,11 @@ export interface RefundsSubmittedNotification { proposalId: string; } -export interface PaybackStartedNotification { +export interface RecoupStartedNotification { type: NotificationType.RecoupStarted; } -export interface PaybackFinishedNotification { +export interface RecoupFinishedNotification { type: NotificationType.RecoupFinished; } @@ -171,6 +171,10 @@ export interface WithdrawOperationErrorNotification { type: NotificationType.WithdrawOperationError; } +export interface RecoupOperationErrorNotification { + type: NotificationType.RecoupOperationError; +} + export interface ReserveOperationErrorNotification { type: NotificationType.ReserveOperationError; operationError: OperationError; @@ -197,8 +201,8 @@ export type WalletNotification = | ProposalAcceptedNotification | ProposalDownloadedNotification | RefundsSubmittedNotification - | PaybackStartedNotification - | PaybackFinishedNotification + | RecoupStartedNotification + | RecoupFinishedNotification | RefreshMeltedNotification | RefreshRevealedNotification | RefreshStartedNotification @@ -214,4 +218,5 @@ export type WalletNotification = | RefundQueriedNotification | WithdrawSessionCreatedNotification | CoinWithdrawnNotification - | WildcardNotification; + | WildcardNotification + | RecoupOperationErrorNotification; diff --git a/src/types/pending.ts b/src/types/pending.ts index 5d732c520..d9d17a3b9 100644 --- a/src/types/pending.ts +++ b/src/types/pending.ts @@ -204,6 +204,8 @@ export interface PendingRefundApplyOperation { export interface PendingRecoupOperation { type: PendingOperationType.Recoup; recoupGroupId: string; + retryInfo: RetryInfo; + lastError: OperationError | undefined; } /** diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts index e65c82383..2ecb82340 100644 --- a/src/types/talerTypes.ts +++ b/src/types/talerTypes.ts @@ -148,10 +148,10 @@ export class Auditor { */ export interface RecoupRequest { /** - * Denomination public key of the coin we want to get + * Hashed enomination public key of the coin we want to get * paid back. */ - denom_pub: string; + denom_pub_hash: string; /** * Signature over the coin public key by the denomination. @@ -744,6 +744,10 @@ export class TipPickupGetResponse { stamp_created: Timestamp; } +export class WithdrawResponse { + ev_sig: string; +} + export type AmountString = string; export type Base32String = string; export type EddsaSignatureString = string; @@ -976,3 +980,11 @@ export const codecForRecoupConfirmation = () => .property("exchange_pub", codecForString) .build("RecoupConfirmation"), ); + + +export const codecForWithdrawResponse = () => + typecheckedCodec( + makeCodecForObject() + .property("ev_sig", codecForString) + .build("WithdrawResponse"), + ); \ No newline at end of file -- cgit v1.2.3