From 03b12d2b27e9d4038e2b02b303a0401160ebc632 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 20 Jan 2023 15:44:53 -0300
Subject: fix wrong fee calculation

---
 .../src/cta/Payment/views.tsx                         | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/cta/Payment/views.tsx')

diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
index 244ac5886..53bc0c95f 100644
--- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx
@@ -27,7 +27,11 @@ import { PaymentButtons } from "../../components/PaymentButtons.js";
 import { SuccessBox, WarningBox } from "../../components/styled/index.js";
 import { Time } from "../../components/Time.js";
 import { useTranslationContext } from "../../context/translation.js";
-import { MerchantDetails, PurchaseDetails } from "../../wallet/Transaction.js";
+import {
+  getAmountWithFee,
+  MerchantDetails,
+  PurchaseDetails,
+} from "../../wallet/Transaction.js";
 import { State } from "./index.js";
 
 type SupportedStates =
@@ -41,13 +45,10 @@ export function BaseView(state: SupportedStates): VNode {
 
   const contractTerms: ContractTerms = state.payStatus.contractTerms;
 
-  const price = {
-    raw: state.amount,
-    effective:
-      "amountEffective" in state.payStatus
-        ? Amounts.parseOrThrow(state.payStatus.amountEffective)
-        : state.amount,
-  };
+  const effective =
+    "amountEffective" in state.payStatus
+      ? Amounts.parseOrThrow(state.payStatus.amountEffective)
+      : state.amount;
 
   return (
     <Fragment>
@@ -68,7 +69,7 @@ export function BaseView(state: SupportedStates): VNode {
           title={i18n.str`Details`}
           text={
             <PurchaseDetails
-              price={price}
+              price={getAmountWithFee(effective, state.amount, "debit")}
               info={{
                 ...contractTerms,
                 orderId: contractTerms.order_id,
-- 
cgit v1.2.3

