From acf0dda83f3974187cacf58e7d81c2115f6d950d Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 16 May 2023 19:03:22 +0200 Subject: wallet-core: return purchase information in refund if available --- packages/taler-util/src/transactions-types.ts | 20 +++++++++++-- packages/taler-util/src/wallet-types.ts | 41 ++++----------------------- 2 files changed, 22 insertions(+), 39 deletions(-) (limited to 'packages/taler-util') diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts index 02e95c208..aaf527b89 100644 --- a/packages/taler-util/src/transactions-types.ts +++ b/packages/taler-util/src/transactions-types.ts @@ -545,17 +545,31 @@ export interface RefundInfoShort { amountRaw: AmountString; } +/** + * Summary information about the payment that we got a refund for. + */ +export interface RefundPaymentInfo { + summary: string; + summary_i18n?: InternationalizedString; + /** + * More information about the merchant + */ + merchant: MerchantInfo; +} + export interface TransactionRefund extends TransactionCommon { type: TransactionType.Refund; - // ID for the transaction that is refunded - refundedTransactionId: string; - // Amount that has been refunded by the merchant amountRaw: AmountString; // Amount will be added to the wallet's balance after fees and refreshing amountEffective: AmountString; + + // ID for the transaction that is refunded + refundedTransactionId: string; + + paymentInfo: RefundPaymentInfo | undefined; } export interface TransactionTip extends TransactionCommon { diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 82f62ceb7..bc43652d9 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -1518,7 +1518,6 @@ export interface WithdrawTestBalanceRequest { forcedDenomSel?: ForcedDenomSel; } - /** * Request to the crypto worker to make a sync signature. */ @@ -1590,36 +1589,6 @@ export const codecForWithdrawTestBalance = .property("bankAccessApiBaseUrl", codecForString()) .build("WithdrawTestBalanceRequest"); -export interface ApplyRefundResponse { - contractTermsHash: string; - - transactionId: string; - - proposalId: string; - - amountEffectivePaid: AmountString; - - amountRefundGranted: AmountString; - - amountRefundGone: AmountString; - - pendingAtExchange: boolean; - - info: OrderShortInfo; -} - -export const codecForApplyRefundResponse = (): Codec => - buildCodecForObject() - .property("amountEffectivePaid", codecForAmountString()) - .property("amountRefundGone", codecForAmountString()) - .property("amountRefundGranted", codecForAmountString()) - .property("contractTermsHash", codecForString()) - .property("pendingAtExchange", codecForBoolean()) - .property("proposalId", codecForString()) - .property("transactionId", codecForString()) - .property("info", codecForOrderShortInfo()) - .build("ApplyRefundResponse"); - export interface SetCoinSuspendedRequest { coinPub: string; suspended: boolean; @@ -1658,11 +1627,11 @@ export interface StartRefundQueryRequest { transactionId: string; } -export const codecForStartRefundQueryRequest = (): Codec => - buildCodecForObject() - .property("transactionId", codecForString()) - .build("StartRefundQueryRequest"); - +export const codecForStartRefundQueryRequest = + (): Codec => + buildCodecForObject() + .property("transactionId", codecForString()) + .build("StartRefundQueryRequest"); export interface PrepareTipRequest { talerTipUri: string; -- cgit v1.2.3