gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (5dc9bc1e -> bff5b3f5)


From: gnunet
Subject: [taler-wallet-core] branch master updated (5dc9bc1e -> bff5b3f5)
Date: Fri, 01 Oct 2021 18:35:35 +0200

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

sebasjm pushed a change to branch master
in repository wallet-core.

    from 5dc9bc1e testing 404 from Sandbox
     new 398bd066 add error message
     new bff5b3f5 FIX: skip checking noncePriv eq if the URI doesn't specify a 
noncePriv value

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-wallet-core/src/operations/pay.ts   |  2 +-
 .../src/components/styled/index.tsx                |  3 +-
 packages/taler-wallet-webextension/src/cta/Pay.tsx | 49 +++++++++++-----------
 3 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/pay.ts 
b/packages/taler-wallet-core/src/operations/pay.ts
index c524f4c9..91268400 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -893,7 +893,7 @@ async function startDownloadProposal(
    */
   if (oldProposal && 
       oldProposal.downloadSessionId === sessionId &&
-      oldProposal.noncePriv === noncePriv &&
+      (!noncePriv || oldProposal.noncePriv === noncePriv) &&
       oldProposal.claimToken === claimToken) {
     await processDownloadProposal(ws, oldProposal.proposalId);
     return oldProposal.proposalId;
diff --git a/packages/taler-wallet-webextension/src/components/styled/index.tsx 
b/packages/taler-wallet-webextension/src/components/styled/index.tsx
index 0537621b..e77e7d54 100644
--- a/packages/taler-wallet-webextension/src/components/styled/index.tsx
+++ b/packages/taler-wallet-webextension/src/components/styled/index.tsx
@@ -27,13 +27,12 @@ export const PaymentStatus = styled.div<{ color: string }>`
   background-color: ${p => p.color};
 `
 
-export const WalletAction = styled.section`
+export const WalletAction = styled.div`
   display: flex;
   text-align: center;
   flex-direction: column;
   justify-content: space-between;
   align-items: center;
-  /* max-width: 50%; */
 
   margin: auto;
   height: 100%;
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx 
b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index e7a3415a..8e02cf6b 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -30,7 +30,7 @@ import { useEffect, useState } from "preact/hooks";
 import { LogoHeader } from "../components/LogoHeader";
 import { Part } from "../components/Part";
 import { QR } from "../components/QR";
-import { ButtonSuccess, LinkSuccess, SuccessBox, WalletAction, WarningBox } 
from "../components/styled";
+import { ButtonSuccess, ErrorBox, LinkSuccess, SuccessBox, WalletAction, 
WarningBox } from "../components/styled";
 import { useBalances } from "../hooks/useBalances";
 import * as wxApi from "../wxApi";
 
@@ -85,7 +85,7 @@ const doPayment = async (payStatus: PreparePayResult): 
Promise<ConfirmPayResultD
 export function PayPage({ talerPayUri }: Props): JSX.Element {
   const [payStatus, setPayStatus] = useState<PreparePayResult | 
undefined>(undefined);
   const [payResult, setPayResult] = useState<ConfirmPayResult | 
undefined>(undefined);
-  const [payErrMsg, setPayErrMsg] = useState<string | undefined>("");
+  const [payErrMsg, setPayErrMsg] = useState<string | undefined>(undefined);
 
   const balance = useBalances()
   const balanceWithoutError = balance?.error ? [] : 
(balance?.response.balances || [])
@@ -96,8 +96,14 @@ export function PayPage({ talerPayUri }: Props): JSX.Element 
{
   useEffect(() => {
     if (!talerPayUri) return;
     const doFetch = async (): Promise<void> => {
-      const p = await wxApi.preparePay(talerPayUri);
-      setPayStatus(p);
+      try {
+        const p = await wxApi.preparePay(talerPayUri);
+        setPayStatus(p);
+      } catch (e) {
+        if (e instanceof Error) {
+          setPayErrMsg(e.message)
+        }
+      }
     };
     doFetch();
   }, [talerPayUri]);
@@ -107,28 +113,23 @@ export function PayPage({ talerPayUri }: Props): 
JSX.Element {
   }
 
   if (!payStatus) {
+    if (payErrMsg) {
+      return <WalletAction>
+        <LogoHeader />
+        <h2>
+          {i18n.str`Digital cash payment`}
+        </h2>
+        <section>
+          <p>Could not get the payment information for this order</p>
+          <ErrorBox>
+            {payErrMsg}
+          </ErrorBox>
+        </section>
+      </WalletAction>
+    }
     return <span>Loading payment information ...</span>;
   }
 
-  // if (payResult && payResult.type === ConfirmPayResultType.Done) {
-  //   if (payResult.contractTerms.fulfillment_message) {
-  //     const obj = {
-  //       fulfillment_message: payResult.contractTerms.fulfillment_message,
-  //       fulfillment_message_i18n:
-  //         payResult.contractTerms.fulfillment_message_i18n,
-  //     };
-  //     const msg = getJsonI18n(obj, "fulfillment_message");
-  //     return (
-  //       <div>
-  //         <p>Payment succeeded.</p>
-  //         <p>{msg}</p>
-  //       </div>
-  //     );
-  //   } else {
-  //     return <span>Redirecting ...</span>;
-  //   }
-  // }
-
   const onClick = async () => {
     try {
       const res = await doPayment(payStatus)
@@ -249,7 +250,7 @@ export function PaymentRequestView({ uri, payStatus, 
onClick, payErrMsg, balance
       {i18n.str`Digital cash payment`}
     </h2>
     {payStatus.status === PreparePayResultType.AlreadyConfirmed &&
-      (payStatus.paid ? <SuccessBox> Already paid </SuccessBox> : <WarningBox> 
Already confirmed </WarningBox>)
+      (payStatus.paid ? <SuccessBox> Already paid </SuccessBox> : <WarningBox> 
Already claimed </WarningBox>)
     }
     <section>
       {payStatus.status !== PreparePayResultType.InsufficientBalance && 
Amounts.isNonZero(totalFees) &&

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