From 7f0edb6a783d9a50f94f65c815c1280baecaac89 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 5 May 2023 19:03:44 +0200 Subject: wallet-core: refund DD37 refactoring --- packages/taler-util/src/notifications.ts | 10 --------- packages/taler-util/src/transactions-types.ts | 10 ++------- packages/taler-util/src/wallet-types.ts | 31 +++++++++++++++++++++------ 3 files changed, 27 insertions(+), 24 deletions(-) (limited to 'packages/taler-util/src') diff --git a/packages/taler-util/src/notifications.ts b/packages/taler-util/src/notifications.ts index f0683b31b..fc3286435 100644 --- a/packages/taler-util/src/notifications.ts +++ b/packages/taler-util/src/notifications.ts @@ -44,7 +44,6 @@ export enum NotificationType { WaitingForRetry = "waiting-for-retry", RefundStarted = "refund-started", RefundQueried = "refund-queried", - RefundFinished = "refund-finished", ExchangeOperationError = "exchange-operation-error", ExchangeAdded = "exchange-added", RefreshOperationError = "refresh-operation-error", @@ -192,14 +191,6 @@ export interface WaitingForRetryNotification { numDue: number; } -export interface RefundFinishedNotification { - type: NotificationType.RefundFinished; - - /** - * Transaction ID of the purchase (NOT the refund transaction). - */ - transactionId: string; -} export interface ExchangeAddedNotification { type: NotificationType.ExchangeAdded; @@ -321,7 +312,6 @@ export type WalletNotification = | WithdrawalGroupFinishedNotification | WaitingForRetryNotification | RefundStartedNotification - | RefundFinishedNotification | RefundQueriedNotification | WithdrawalGroupCreatedNotification | CoinWithdrawnNotification diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts index 8c5b59f5e..fac10cc88 100644 --- a/packages/taler-util/src/transactions-types.ts +++ b/packages/taler-util/src/transactions-types.ts @@ -130,6 +130,8 @@ export enum TransactionMinorState { Withdraw = "withdraw", MerchantOrderProposed = "merchant-order-proposed", Proposed = "proposed", + RefundAvailable = "refund-available", + AcceptRefund = "accept-refund", } export interface TransactionsResponse { @@ -549,14 +551,6 @@ export interface TransactionRefund extends TransactionCommon { // ID for the transaction that is refunded refundedTransactionId: string; - // Additional information about the refunded payment - info: OrderShortInfo; - - /** - * Amount pending to be picked up - */ - refundPending: AmountString | undefined; - // Amount that has been refunded by the merchant amountRaw: AmountString; diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index d2355be6f..9c3bbe815 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -419,6 +419,7 @@ export const codecForPreparePayResultPaymentPossible = .property("amountEffective", codecForAmountString()) .property("amountRaw", codecForAmountString()) .property("contractTerms", codecForMerchantContractTerms()) + .property("transactionId", codecForString()) .property("proposalId", codecForString()) .property("contractTermsHash", codecForString()) .property("talerUri", codecForString()) @@ -494,6 +495,7 @@ export const codecForPreparePayResultInsufficientBalance = .property("contractTerms", codecForAny()) .property("talerUri", codecForString()) .property("proposalId", codecForString()) + .property("transactionId", codecForString()) .property("noncePriv", codecForString()) .property( "status", @@ -518,6 +520,7 @@ export const codecForPreparePayResultAlreadyConfirmed = .property("talerUri", codecOptional(codecForString())) .property("contractTerms", codecForAny()) .property("contractTermsHash", codecForString()) + .property("transactionId", codecForString()) .property("proposalId", codecForString()) .build("PreparePayResultAlreadyConfirmed"); @@ -551,6 +554,10 @@ export type PreparePayResult = */ export interface PreparePayResultPaymentPossible { status: PreparePayResultType.PaymentPossible; + transactionId: string; + /** + * @deprecated use transactionId instead + */ proposalId: string; contractTerms: MerchantContractTerms; contractTermsHash: string; @@ -562,6 +569,7 @@ export interface PreparePayResultPaymentPossible { export interface PreparePayResultInsufficientBalance { status: PreparePayResultType.InsufficientBalance; + transactionId: string; proposalId: string; contractTerms: MerchantContractTerms; amountRaw: string; @@ -572,6 +580,7 @@ export interface PreparePayResultInsufficientBalance { export interface PreparePayResultAlreadyConfirmed { status: PreparePayResultType.AlreadyConfirmed; + transactionId: string; contractTerms: MerchantContractTerms; paid: boolean; amountRaw: string; @@ -1352,14 +1361,14 @@ export const codecForAcceptExchangeTosRequest = .property("etag", codecOptional(codecForString())) .build("AcceptExchangeTosRequest"); -export interface ApplyRefundRequest { - talerRefundUri: string; +export interface AcceptRefundRequest { + transactionId: string; } -export const codecForApplyRefundRequest = (): Codec => - buildCodecForObject() - .property("talerRefundUri", codecForString()) - .build("ApplyRefundRequest"); +export const codecForApplyRefundRequest = (): Codec => + buildCodecForObject() + .property("transactionId", codecForString()) + .build("AcceptRefundRequest"); export interface ApplyRefundFromPurchaseIdRequest { purchaseId: string; @@ -1641,6 +1650,16 @@ export const codecForPrepareRefundRequest = (): Codec => .property("talerRefundUri", codecForString()) .build("PrepareRefundRequest"); +export interface StartRefundQueryRequest { + transactionId: string; +} + +export const codecForStartRefundQueryRequest = (): Codec => + buildCodecForObject() + .property("transactionId", codecForString()) + .build("StartRefundQueryRequest"); + + export interface PrepareTipRequest { talerTipUri: string; } -- cgit v1.2.3