From c8553f3bc53064d157b56220e9d2333b8931e7a5 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Wed, 29 Jul 2020 23:10:41 +0530
Subject: tweaks to pay API

---
 src/webex/pages/pay.tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/webex/pages/pay.tsx')

diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index 87f3c83d3..d255ab6e5 100644
--- a/src/webex/pages/pay.tsx
+++ b/src/webex/pages/pay.tsx
@@ -39,7 +39,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
   const [payErrMsg, setPayErrMsg] = useState<string | undefined>("");
   const [numTries, setNumTries] = useState(0);
   const [loading, setLoading] = useState(false);
-  let totalFees: Amounts.AmountJson | undefined = undefined;
+  let amountEffective: Amounts.AmountJson | undefined = undefined;
 
   useEffect(() => {
     const doFetch = async (): Promise<void> => {
@@ -59,7 +59,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
   }
 
   if (payStatus.status === "payment-possible") {
-    totalFees = payStatus.totalFees;
+    amountEffective = Amounts.parseOrThrow(payStatus.amountEffective);
   }
 
   if (payStatus.status === PreparePayResultType.AlreadyConfirmed && numTries === 0) {
@@ -75,13 +75,13 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
 
   try {
     contractTerms = codecForContractTerms().decode(
-      JSON.parse(payStatus.contractTermsRaw),
+      JSON.parse(payStatus.contractTerms),
     );
   } catch (e) {
     // This should never happen, as the wallet is supposed to check the contract terms
     // before storing them.
     console.error(e);
-    console.log("raw contract terms were", payStatus.contractTermsRaw);
+    console.log("raw contract terms were", payStatus.contractTerms);
     return <span>Invalid contract terms.</span>;
   }
 
@@ -129,10 +129,10 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }): JSX.Element {
         <div style={{ textAlign: "center" }}>
           <strong>{contractTerms.summary}</strong>
         </div>
-        {totalFees ? (
+        {amountEffective ? (
           <i18n.Translate wrap="p">
             The total price is <span>{amount} </span>
-            (plus <span>{renderAmount(totalFees)}</span> fees).
+            (plus <span>{renderAmount(amountEffective)}</span> fees).
           </i18n.Translate>
         ) : (
           <i18n.Translate wrap="p">
-- 
cgit v1.2.3

