From e4ea2019430fb3c4b788f67427fbd743f604b7e5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 14 May 2022 18:09:33 -0300 Subject: feat: awaiting refund --- packages/taler-util/src/talerTypes.ts | 32 ++++++++++++++++------------ packages/taler-util/src/transactionsTypes.ts | 20 +++++++++++++++++ packages/taler-util/src/walletTypes.ts | 10 ++++----- 3 files changed, 43 insertions(+), 19 deletions(-) (limited to 'packages/taler-util/src') diff --git a/packages/taler-util/src/talerTypes.ts b/packages/taler-util/src/talerTypes.ts index b21c6caec..d9213ef5d 100644 --- a/packages/taler-util/src/talerTypes.ts +++ b/packages/taler-util/src/talerTypes.ts @@ -562,8 +562,8 @@ export interface MerchantAbortPayRefundDetails { refund_amount: string; /** - * Fee for the refund. - */ + * Fee for the refund. + */ refund_fee: string; /** @@ -888,18 +888,18 @@ export type BlindedDenominationSignature = | RsaBlindedDenominationSignature | CSBlindedDenominationSignature; -export const codecForBlindedDenominationSignature = () => - buildCodecForUnion() - .discriminateOn("cipher") - .alternative(DenomKeyType.Rsa, codecForRsaBlindedDenominationSignature()) - .build("BlindedDenominationSignature"); - export const codecForRsaBlindedDenominationSignature = () => buildCodecForObject() .property("cipher", codecForConstString(DenomKeyType.Rsa)) .property("blinded_rsa_signature", codecForString()) .build("RsaBlindedDenominationSignature"); +export const codecForBlindedDenominationSignature = () => + buildCodecForUnion() + .discriminateOn("cipher") + .alternative(DenomKeyType.Rsa, codecForRsaBlindedDenominationSignature()) + .build("BlindedDenominationSignature"); + export class WithdrawResponse { ev_sig: BlindedDenominationSignature; } @@ -1024,15 +1024,17 @@ export interface ExchangeRevealResponse { } interface MerchantOrderStatusPaid { - /** - * Was the payment refunded (even partially, via refund or abort)? - */ + // Was the payment refunded (even partially, via refund or abort)? refunded: boolean; - /** - * Amount that was refunded in total. - */ + // Is any amount of the refund still waiting to be picked up (even partially)? + refund_pending: boolean; + + // Amount that was refunded in total. refund_amount: AmountString; + + // Amount that already taken by the wallet. + refund_taken: AmountString; } interface MerchantOrderRefundResponse { @@ -1528,6 +1530,8 @@ export const codecForMerchantOrderStatusPaid = (): Codec => buildCodecForObject() .property("refund_amount", codecForString()) + .property("refund_taken", codecForString()) + .property("refund_pending", codecForBoolean()) .property("refunded", codecForBoolean()) .build("MerchantOrderStatusPaid"); diff --git a/packages/taler-util/src/transactionsTypes.ts b/packages/taler-util/src/transactionsTypes.ts index b9a227b68..37c1c7ef1 100644 --- a/packages/taler-util/src/transactionsTypes.ts +++ b/packages/taler-util/src/transactionsTypes.ts @@ -228,6 +228,21 @@ export interface TransactionPayment extends TransactionCommon { * Amount that was paid, including deposit, wire and refresh fees. */ amountEffective: AmountString; + + /** + * Amount that has been refunded by the merchant + */ + totalRefundRaw: AmountString; + + /** + * Amount will be added to the wallet's balance after fees and refreshing + */ + totalRefundEffective: AmountString; + + /** + * Amount pending to be picked up + */ + refundPending: AmountString | undefined; } export interface OrderShortInfo { @@ -287,6 +302,11 @@ export interface TransactionRefund extends TransactionCommon { // 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/walletTypes.ts b/packages/taler-util/src/walletTypes.ts index a8946fbbb..fa884c414 100644 --- a/packages/taler-util/src/walletTypes.ts +++ b/packages/taler-util/src/walletTypes.ts @@ -279,11 +279,11 @@ export class ReturnCoinsRequest { export interface PrepareRefundResult { proposalId: string; - applied: number; - failed: number; - total: number; - - amountEffectivePaid: AmountString; + effectivePaid: AmountString; + gone: AmountString; + granted: AmountString; + pending: boolean; + awaiting: AmountString; info: OrderShortInfo; } -- cgit v1.2.3