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 bug in the WebExtensions


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix bug in the WebExtensions pay page
Date: Wed, 25 Dec 2019 19:24:26 +0100

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 266b33dc fix bug in the WebExtensions pay page
266b33dc is described below

commit 266b33dc428f853d279a179907a38d999d4dc86b
Author: Florian Dold <address@hidden>
AuthorDate: Wed Dec 25 19:24:23 2019 +0100

    fix bug in the WebExtensions pay page
---
 src/i18n/de.po                  | 10 +++++-----
 src/i18n/en-US.po               | 10 +++++-----
 src/i18n/fr.po                  | 10 +++++-----
 src/i18n/it.po                  | 10 +++++-----
 src/i18n/sv.po                  | 10 +++++-----
 src/i18n/taler-wallet-webex.pot | 10 +++++-----
 src/util/codec.ts               |  6 ++++++
 src/webex/pages/pay.tsx         | 17 ++++++++++++++++-
 8 files changed, 52 insertions(+), 31 deletions(-)

diff --git a/src/i18n/de.po b/src/i18n/de.po
index bcc3dcdb..7cc30581 100644
--- a/src/i18n/de.po
+++ b/src/i18n/de.po
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, fuzzy, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr "Der Händler %1$s möchte einen Vertrag über %2$s mit Ihnen abschließen."
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, fuzzy, c-format
 msgid "Confirm payment"
 msgstr "Bezahlung bestätigen"
diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po
index 03341581..575e1712 100644
--- a/src/i18n/en-US.po
+++ b/src/i18n/en-US.po
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/fr.po b/src/i18n/fr.po
index f1127c09..c3ecfaa6 100644
--- a/src/i18n/fr.po
+++ b/src/i18n/fr.po
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/it.po b/src/i18n/it.po
index f1127c09..c3ecfaa6 100644
--- a/src/i18n/it.po
+++ b/src/i18n/it.po
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/i18n/sv.po b/src/i18n/sv.po
index 7a95799e..b6693f6c 100644
--- a/src/i18n/sv.po
+++ b/src/i18n/sv.po
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, fuzzy, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr "Säljaren %1$s erbjuder följande:"
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, fuzzy, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr "Det totala priset är %1$s (plus %2$s avgifter).\n"
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, fuzzy, c-format
 msgid "The total price is %1$s."
 msgstr "Det totala priset är %1$s."
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, c-format
 msgid "Confirm payment"
 msgstr "Godkän betalning"
diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot
index f1127c09..c3ecfaa6 100644
--- a/src/i18n/taler-wallet-webex.pot
+++ b/src/i18n/taler-wallet-webex.pot
@@ -57,27 +57,27 @@ msgstr ""
 msgid "time (ms/op)"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:117
+#: src/webex/pages/pay.tsx:132
 #, c-format
 msgid "The merchant %1$s offers you to purchase:"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:123
+#: src/webex/pages/pay.tsx:138
 #, c-format
 msgid "The total price is %1$s (plus %2$s fees)."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:128
+#: src/webex/pages/pay.tsx:143
 #, c-format
 msgid "The total price is %1$s."
 msgstr ""
 
-#: src/webex/pages/pay.tsx:148
+#: src/webex/pages/pay.tsx:163
 #, c-format
 msgid "Retry"
 msgstr ""
 
-#: src/webex/pages/pay.tsx:157
+#: src/webex/pages/pay.tsx:172
 #, c-format
 msgid "Confirm payment"
 msgstr ""
diff --git a/src/util/codec.ts b/src/util/codec.ts
index e18a5e74..09fa9f95 100644
--- a/src/util/codec.ts
+++ b/src/util/codec.ts
@@ -106,6 +106,12 @@ class ObjectCodecBuilder<OutputType, PartialOutputType> {
             path: [`(${objectDisplayName})`],
           };
         }
+        if (typeof x !== "object") {
+          throw new DecodingError(
+            `expected object for ${objectDisplayName} at ${renderContext(
+              c,
+            )} but got ${typeof x}`)
+        }
         const obj: any = {};
         for (const prop of propList) {
           const propRawVal = x[prop.name];
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index b7f09b6f..7f36cb66 100644
--- a/src/webex/pages/pay.tsx
+++ b/src/webex/pages/pay.tsx
@@ -32,6 +32,7 @@ import * as wxApi from "../wxApi";
 import React, { useState, useEffect } from "react";
 
 import * as Amounts from "../../util/amounts";
+import { codecForContractTerms, ContractTerms } from "../../types/talerTypes";
 
 function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
   const [payStatus, setPayStatus] = useState<PreparePayResult | undefined>();
@@ -74,7 +75,21 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: 
string }) {
     );
   }
 
-  const contractTerms = payStatus.contractTermsRaw;
+  let contractTerms: ContractTerms;
+
+  try {
+    contractTerms = 
codecForContractTerms().decode(JSON.parse(payStatus.contractTermsRaw));
+  } 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);
+    return (
+      <span>
+        Invalid contract terms.
+      </span>
+    );
+  }
 
   if (!contractTerms) {
     return (

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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