gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fix fee discrepancy


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix fee discrepancy
Date: Mon, 28 Mar 2022 16:13:12 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 2ba6692c fix fee discrepancy
2ba6692c is described below

commit 2ba6692c6ad97285e852fb0b74a650e067817003
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Mar 28 16:11:58 2022 +0200

    fix fee discrepancy
    
    The withdrawal call-to-action and withdrawal transaction details dialog
    showed different fees, as the "overhead" for unwithdrawable amounts in a
    reserve was not included in the withdrawal CTA.
    
    The withdrawal CTA now shows the same fees as the transaction details.
---
 packages/taler-util/src/walletTypes.ts             |  4 +++
 .../taler-wallet-core/src/operations/withdraw.ts   | 31 ++++++++++++----------
 .../taler-wallet-webextension/src/cta/Withdraw.tsx |  7 ++++-
 3 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/packages/taler-util/src/walletTypes.ts 
b/packages/taler-util/src/walletTypes.ts
index 1f88c39e..552087fb 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -1133,3 +1133,7 @@ export const codecForImportDbRequest = (): 
Codec<ImportDb> =>
   buildCodecForObject<ImportDb>()
     .property("dump", codecForAny())
     .build("ImportDbRequest");
+
+
+
+    
\ No newline at end of file
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index 7685ede7..7997ab5b 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -43,6 +43,7 @@ import {
   Duration,
   TalerProtocolTimestamp,
   TransactionType,
+  AmountString,
 } from "@gnu-taler/taler-util";
 import {
   CoinRecord,
@@ -103,6 +104,8 @@ interface DenominationSelectionInfo {
 export interface ExchangeWithdrawDetails {
   /**
    * Exchange that the reserve will be created at.
+   *
+   * FIXME: Should be its own record.
    */
   exchangeInfo: ExchangeRecord;
 
@@ -118,16 +121,6 @@ export interface ExchangeWithdrawDetails {
    */
   selectedDenoms: DenominationSelectionInfo;
 
-  /**
-   * Fees for withdraw.
-   */
-  withdrawFee: AmountJson;
-
-  /**
-   * Remaining balance that is too small to be withdrawn.
-   */
-  overhead: AmountJson;
-
   /**
    * Does the wallet know about an auditor for
    * the exchange that the reserve.
@@ -177,6 +170,13 @@ export interface ExchangeWithdrawDetails {
    * Libtool-style version string for the wallet.
    */
   walletVersion: string;
+
+  withdrawalAmountRaw: AmountString;
+
+  /**
+   * Amount that will actually be added to the wallet's balance.
+   */
+  withdrawalAmountEffective: AmountString;
 }
 
 /**
@@ -976,13 +976,16 @@ async function processWithdrawGroupImpl(
 export async function getExchangeWithdrawalInfo(
   ws: InternalWalletState,
   exchangeBaseUrl: string,
-  amount: AmountJson,
+  instructedAmount: AmountJson,
 ): Promise<ExchangeWithdrawDetails> {
   const { exchange, exchangeDetails } =
     await ws.exchangeOps.updateExchangeFromUrl(ws, exchangeBaseUrl);
   await updateWithdrawalDenoms(ws, exchangeBaseUrl);
   const denoms = await getCandidateWithdrawalDenoms(ws, exchangeBaseUrl);
-  const selectedDenoms = selectWithdrawalDenominations(amount, denoms);
+  const selectedDenoms = selectWithdrawalDenominations(
+    instructedAmount,
+    denoms,
+  );
   const exchangeWireAccounts: string[] = [];
   for (const account of exchangeDetails.wireInfo.accounts) {
     exchangeWireAccounts.push(account.payto_uri);
@@ -1061,14 +1064,14 @@ export async function getExchangeWithdrawalInfo(
     isAudited,
     isTrusted,
     numOfferedDenoms: possibleDenoms.length,
-    overhead: Amounts.sub(amount, selectedDenoms.totalWithdrawCost).amount,
     selectedDenoms,
     // FIXME: delete this field / replace by something we can display to the 
user
     trustedAuditorPubs: [],
     versionMatch,
     walletVersion: WALLET_EXCHANGE_PROTOCOL_VERSION,
-    withdrawFee,
     termsOfServiceAccepted: tosAccepted,
+    withdrawalAmountEffective: 
Amounts.stringify(selectedDenoms.totalCoinValue),
+    withdrawalAmountRaw: Amounts.stringify(instructedAmount),
   };
   return ret;
 }
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx 
b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index d58e2ec8..bef33dce 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -318,12 +318,17 @@ export function WithdrawPageWithParsedURI({
     }
   };
 
+  const withdrawalFee = Amounts.sub(
+    Amounts.parseOrThrow(details.info.withdrawalAmountRaw),
+    Amounts.parseOrThrow(details.info.withdrawalAmountEffective),
+  ).amount;
+
   return (
     <View
       onWithdraw={onWithdraw}
       amount={withdrawAmount}
       exchangeBaseUrl={exchange}
-      withdrawalFee={details.info.withdrawFee} //FIXME
+      withdrawalFee={withdrawalFee}
       terms={detailsHook.response.tos}
       onSwitchExchange={setCustomExchange}
       knownExchanges={knownExchanges}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]