From d6409f185d332f6ade298f143cdb7803391f4b0b Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 18 Nov 2020 12:44:06 +0100 Subject: re-enable tipping support in the WebExtension UI --- packages/taler-wallet-core/src/operations/tip.ts | 1 + .../taler-wallet-core/src/types/walletTypes.ts | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/src/operations/tip.ts b/packages/taler-wallet-core/src/operations/tip.ts index 1d19a72ed..119695de6 100644 --- a/packages/taler-wallet-core/src/operations/tip.ts +++ b/packages/taler-wallet-core/src/operations/tip.ts @@ -121,6 +121,7 @@ export async function prepareTip( accepted: !!tipRecord && !!tipRecord.acceptedTimestamp, tipAmountRaw: Amounts.stringify(tipRecord.tipAmountRaw), exchangeBaseUrl: tipRecord.exchangeBaseUrl, + merchantBaseUrl: tipRecord.merchantBaseUrl, expirationTimestamp: tipRecord.tipExpiration, tipAmountEffective: Amounts.stringify(tipRecord.tipAmountEffective), walletTipId: tipRecord.walletTipId, diff --git a/packages/taler-wallet-core/src/types/walletTypes.ts b/packages/taler-wallet-core/src/types/walletTypes.ts index 1b20d7b47..7940497a3 100644 --- a/packages/taler-wallet-core/src/types/walletTypes.ts +++ b/packages/taler-wallet-core/src/types/walletTypes.ts @@ -360,9 +360,33 @@ export interface PrepareTipResult { * Has the tip already been accepted? */ accepted: boolean; + + /** + * Amount that the merchant gave. + */ tipAmountRaw: AmountString; + + /** + * Amount that arrived at the wallet. + * Might be lower than the raw amount due to fees. + */ tipAmountEffective: AmountString; + + /** + * Base URL of the merchant backend giving then tip. + */ + merchantBaseUrl: string; + + /** + * Base URL of the exchange that is used to withdraw the tip. + * Determined by the merchant, the wallet/user has no choice here. + */ exchangeBaseUrl: string; + + /** + * Time when the tip will expire. After it expired, it can't be picked + * up anymore. + */ expirationTimestamp: Timestamp; } @@ -372,6 +396,7 @@ export const codecForPrepareTipResult = (): Codec => .property("tipAmountRaw", codecForAmountString()) .property("tipAmountEffective", codecForAmountString()) .property("exchangeBaseUrl", codecForString()) + .property("merchantBaseUrl", codecForString()) .property("expirationTimestamp", codecForTimestamp) .property("walletTipId", codecForString()) .build("PrepareTipResult"); -- cgit v1.2.3