summaryrefslogtreecommitdiff
path: root/src/webex/pages
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-25 19:24:23 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-25 19:24:23 +0100
commit266b33dc428f853d279a179907a38d999d4dc86b (patch)
treedd8b3b2d175c5381bce71a1367ea988062e49aa0 /src/webex/pages
parentadebfab94e76ee5d34a4f22d15fc085daef9ae00 (diff)
downloadwallet-core-266b33dc428f853d279a179907a38d999d4dc86b.tar.gz
wallet-core-266b33dc428f853d279a179907a38d999d4dc86b.tar.bz2
wallet-core-266b33dc428f853d279a179907a38d999d4dc86b.zip
fix bug in the WebExtensions pay page
Diffstat (limited to 'src/webex/pages')
-rw-r--r--src/webex/pages/pay.tsx17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index b7f09b6f6..7f36cb66e 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 (