gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 02/02: wallet-core: get rid of max_wire_fee


From: gnunet
Subject: [taler-wallet-core] 02/02: wallet-core: get rid of max_wire_fee
Date: Thu, 07 Mar 2024 17:53:42 +0100

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

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

commit 727c0f3d4d92e6fe2e3d1bdf4cb2e00dca01bd52
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Mar 7 17:53:35 2024 +0100

    wallet-core: get rid of max_wire_fee
---
 packages/taler-util/src/wallet-types.ts              |  3 ---
 packages/taler-wallet-core/src/coinSelection.test.ts |  2 --
 packages/taler-wallet-core/src/coinSelection.ts      | 20 ++------------------
 packages/taler-wallet-core/src/deposits.ts           |  2 --
 packages/taler-wallet-core/src/pay-merchant.ts       | 10 ----------
 .../components/ShowFullContractTermPopup.stories.tsx |  1 -
 .../src/components/ShowFullContractTermPopup.tsx     |  8 --------
 7 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 0d2713fdd..599f65731 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -291,7 +291,6 @@ interface GetPlanForPaymentRequest extends 
GetPlanToCompleteOperation {
   wireMethod: string;
   ageRestriction: number;
   maxDepositFee: AmountString;
-  maxWireFee: AmountString;
 }
 
 // interface GetPlanForTipRequest extends GetPlanForOperationBase {
@@ -311,7 +310,6 @@ const codecForGetPlanForPaymentRequest =
   buildCodecForObject<GetPlanForPaymentRequest>()
     .property("type", codecForConstString(TransactionType.Payment))
     .property("maxDepositFee", codecForAmountString())
-    .property("maxWireFee", codecForAmountString())
     .build("GetPlanForPaymentRequest");
 
 const codecForGetPlanForPullDebitRequest =
@@ -2965,7 +2963,6 @@ export interface WalletContractData {
   summary: string;
   summaryI18n: { [lang_tag: string]: string } | undefined;
   autoRefund: TalerProtocolDuration | undefined;
-  maxWireFee: AmountString;
   wireFeeAmortization: number;
   payDeadline: TalerProtocolTimestamp;
   refundDeadline: TalerProtocolTimestamp;
diff --git a/packages/taler-wallet-core/src/coinSelection.test.ts 
b/packages/taler-wallet-core/src/coinSelection.test.ts
index 3d8e24b0c..67cd08652 100644
--- a/packages/taler-wallet-core/src/coinSelection.test.ts
+++ b/packages/taler-wallet-core/src/coinSelection.test.ts
@@ -140,7 +140,6 @@ test("pay: select one coin to pay with fee", (t) => {
   const zero = Amounts.zeroOfCurrency(payment.currency);
   const tally = {
     amountPayRemaining: payment,
-    amountWireFeeLimitRemaining: zero,
     amountDepositFeeLimitRemaining: zero,
     customerDepositFees: zero,
     customerWireFees: zero,
@@ -176,7 +175,6 @@ test("pay: select one coin to pay with fee", (t) => {
 
   t.deepEqual(tally, {
     amountPayRemaining: Amounts.parseOrThrow("LOCAL:0"),
-    amountWireFeeLimitRemaining: zero,
     amountDepositFeeLimitRemaining: zero,
     customerDepositFees: Amounts.parse("LOCAL:0.1"),
     customerWireFees: Amounts.parse("LOCAL:0.1"),
diff --git a/packages/taler-wallet-core/src/coinSelection.ts 
b/packages/taler-wallet-core/src/coinSelection.ts
index 672d0ee79..7c22f63db 100644
--- a/packages/taler-wallet-core/src/coinSelection.ts
+++ b/packages/taler-wallet-core/src/coinSelection.ts
@@ -75,11 +75,6 @@ export interface CoinSelectionTally {
    */
   amountPayRemaining: AmountJson;
 
-  /**
-   * Allowance given by the merchant towards wire fees
-   */
-  amountWireFeeLimitRemaining: AmountJson;
-
   /**
    * Allowance given by the merchant towards deposit fees
    * (and wire fees after wire fee limit is exhausted)
@@ -110,17 +105,9 @@ function tallyFees(
   if (!tally.wireFeeCoveredForExchange.has(exchangeBaseUrl)) {
     const wf =
       wireFeesPerExchange[exchangeBaseUrl] ?? Amounts.zeroOfCurrency(currency);
-    const wfForgiven = Amounts.min(tally.amountWireFeeLimitRemaining, wf);
-    tally.amountWireFeeLimitRemaining = Amounts.sub(
-      tally.amountWireFeeLimitRemaining,
-      wfForgiven,
-    ).amount;
     // The remaining, amortized amount needs to be paid by the
     // wallet or covered by the deposit fee allowance.
-    let wfRemaining = Amounts.divide(
-      Amounts.sub(wf, wfForgiven).amount,
-      wireFeeAmortization,
-    );
+    let wfRemaining = Amounts.divide(wf, wireFeeAmortization);
     // This is the amount forgiven via the deposit fee allowance.
     const wfDepositForgiven = Amounts.min(
       tally.amountDepositFeeLimitRemaining,
@@ -183,7 +170,7 @@ export async function selectPayCoins(
   wex: WalletExecutionContext,
   req: SelectPayCoinRequestNg,
 ): Promise<SelectPayCoinsResult> {
-  const { contractTermsAmount, depositFeeLimit, wireFeeLimit } = req;
+  const { contractTermsAmount, depositFeeLimit } = req;
 
   if (logger.shouldLogTrace()) {
     logger.trace(`selecting coins for ${j2s(req)}`);
@@ -218,7 +205,6 @@ export async function selectPayCoins(
 
       let tally: CoinSelectionTally = {
         amountPayRemaining: contractTermsAmount,
-        amountWireFeeLimitRemaining: wireFeeLimit,
         amountDepositFeeLimitRemaining: depositFeeLimit,
         customerDepositFees: Amounts.zeroOfCurrency(currency),
         customerWireFees: Amounts.zeroOfCurrency(currency),
@@ -640,7 +626,6 @@ export interface SelectPayCoinRequestNg {
   restrictWireMethod: string;
   contractTermsAmount: AmountJson;
   depositFeeLimit: AmountJson;
-  wireFeeLimit: AmountJson;
   wireFeeAmortization: number;
   prevPayCoins?: PreviousPayCoins;
   requiredMinimumAge?: number;
@@ -910,7 +895,6 @@ export function emptyTallyForPeerPayment(
     customerDepositFees: zero,
     lastDepositFee: zero,
     amountDepositFeeLimitRemaining: zero,
-    amountWireFeeLimitRemaining: zero,
     customerWireFees: zero,
     wireFeeCoveredForExchange: new Set(),
   };
diff --git a/packages/taler-wallet-core/src/deposits.ts 
b/packages/taler-wallet-core/src/deposits.ts
index 2c7ee3596..2ee452de7 100644
--- a/packages/taler-wallet-core/src/deposits.ts
+++ b/packages/taler-wallet-core/src/deposits.ts
@@ -1228,7 +1228,6 @@ export async function prepareDepositGroup(
     contractTermsAmount: Amounts.parseOrThrow(contractData.amount),
     depositFeeLimit: Amounts.parseOrThrow(contractData.maxDepositFee),
     wireFeeAmortization: contractData.wireFeeAmortization ?? 1,
-    wireFeeLimit: Amounts.parseOrThrow(contractData.maxWireFee),
     prevPayCoins: [],
   });
 
@@ -1349,7 +1348,6 @@ export async function createDepositGroup(
     contractTermsAmount: Amounts.parseOrThrow(contractData.amount),
     depositFeeLimit: Amounts.parseOrThrow(contractData.maxDepositFee),
     wireFeeAmortization: contractData.wireFeeAmortization ?? 1,
-    wireFeeLimit: Amounts.parseOrThrow(contractData.maxWireFee),
     prevPayCoins: [],
   });
 
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts 
b/packages/taler-wallet-core/src/pay-merchant.ts
index a155d6298..4f9c20c9e 100644
--- a/packages/taler-wallet-core/src/pay-merchant.ts
+++ b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -568,12 +568,6 @@ export function extractContractData(
   merchantSig: string,
 ): WalletContractData {
   const amount = Amounts.parseOrThrow(parsedContractTerms.amount);
-  let maxWireFee: AmountJson;
-  if (parsedContractTerms.max_wire_fee) {
-    maxWireFee = Amounts.parseOrThrow(parsedContractTerms.max_wire_fee);
-  } else {
-    maxWireFee = Amounts.zeroOfCurrency(amount.currency);
-  }
   return {
     amount: Amounts.stringify(amount),
     contractTermsHash: contractTermsHash,
@@ -584,7 +578,6 @@ export function extractContractData(
     orderId: parsedContractTerms.order_id,
     summary: parsedContractTerms.summary,
     autoRefund: parsedContractTerms.auto_refund,
-    maxWireFee: Amounts.stringify(maxWireFee),
     payDeadline: parsedContractTerms.pay_deadline,
     refundDeadline: parsedContractTerms.refund_deadline,
     wireFeeAmortization: parsedContractTerms.wire_fee_amortization || 1,
@@ -1157,7 +1150,6 @@ async function handleInsufficientFunds(
     contractTermsAmount: Amounts.parseOrThrow(contractData.amount),
     depositFeeLimit: Amounts.parseOrThrow(contractData.maxDepositFee),
     wireFeeAmortization: contractData.wireFeeAmortization ?? 1,
-    wireFeeLimit: Amounts.parseOrThrow(contractData.maxWireFee),
     prevPayCoins,
     requiredMinimumAge: contractData.minimumAge,
   });
@@ -1287,7 +1279,6 @@ async function checkPaymentByProposalId(
       contractTermsAmount: instructedAmount,
       depositFeeLimit: Amounts.parseOrThrow(contractData.maxDepositFee),
       wireFeeAmortization: contractData.wireFeeAmortization ?? 1,
-      wireFeeLimit: Amounts.parseOrThrow(contractData.maxWireFee),
       prevPayCoins: [],
       requiredMinimumAge: contractData.minimumAge,
       restrictWireMethod: contractData.wireMethod,
@@ -1825,7 +1816,6 @@ export async function confirmPay(
     contractTermsAmount: Amounts.parseOrThrow(contractData.amount),
     depositFeeLimit: Amounts.parseOrThrow(contractData.maxDepositFee),
     wireFeeAmortization: contractData.wireFeeAmortization ?? 1,
-    wireFeeLimit: Amounts.parseOrThrow(contractData.maxWireFee),
     prevPayCoins: [],
     requiredMinimumAge: contractData.minimumAge,
     forcedSelection: forcedCoinSel,
diff --git 
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
 
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
index 555b300c2..7142089cb 100644
--- 
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
+++ 
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.stories.tsx
@@ -42,7 +42,6 @@ const cd: WalletContractData = {
     
"0YA1WETV15R6K8QKS79QA3QMT16010F42Q49VSKYQ71HVQKAG0A4ZJCA4YTKHE9EA5SP156TJSKZEJJJ87305N6PS80PC48RNKYZE08",
   orderId: "2022.220-0281XKKB8W7YE",
   summary: "w",
-  maxWireFee: "ARS:1" as AmountString,
   payDeadline: {
     t_s: 1660002673,
   },
diff --git 
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
 
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
index 953e93b4e..6346b475a 100644
--- 
a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
+++ 
b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx
@@ -384,14 +384,6 @@ export function ShowView({ contractTerms, hideHandler }: 
States.Show): VNode {
               <Amount value={contractTerms.maxDepositFee} />
             </td>
           </tr>
-          <tr>
-            <td>
-              <i18n.Translate>Max fee</i18n.Translate>
-            </td>
-            <td>
-              <Amount value={contractTerms.maxWireFee} />
-            </td>
-          </tr>
           <tr>
             <td>
               <i18n.Translate>Minimum age</i18n.Translate>

-- 
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]