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 type error due to new re


From: gnunet
Subject: [taler-wallet-core] branch master updated: -fix type error due to new recoup tx type
Date: Mon, 29 Jan 2024 21:58:04 +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 7b83d8f8d -fix type error due to new recoup tx type
7b83d8f8d is described below

commit 7b83d8f8dd220e04a26b33b03afc5f989cc5d1fb
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Jan 29 21:58:03 2024 +0100

    -fix type error due to new recoup tx type
---
 .../src/components/HistoryItem.tsx                 |   6 +-
 .../src/wallet/Transaction.tsx                     | 113 +++++++++++++--------
 2 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx 
b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
index 72881c746..f65535a3d 100644
--- a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx
@@ -253,6 +253,8 @@ export function HistoryItem(props: { tx: Transaction }): 
VNode {
           }
         />
       );
+    case TransactionType.Recoup:
+      throw Error("recoup transaction not implemented");
     default: {
       assertUnreachable(tx);
     }
@@ -267,12 +269,12 @@ function Layout(props: LayoutProps): VNode {
       style={{
         backgroundColor:
           props.currentState === TransactionMajorState.Pending ||
-            props.currentState === TransactionMajorState.Dialog
+          props.currentState === TransactionMajorState.Dialog
             ? "lightcyan"
             : props.currentState === TransactionMajorState.Failed
               ? "#ff000040"
               : props.currentState === TransactionMajorState.Aborted ||
-                props.currentState === TransactionMajorState.Aborting
+                  props.currentState === TransactionMajorState.Aborting
                 ? "#00000010"
                 : "inherit",
         alignItems: "center",
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx 
b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index d8ed38aa1..f6c98952e 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -37,7 +37,7 @@ import {
   TransactionType,
   TransactionWithdrawal,
   TranslatedString,
-  WithdrawalType
+  WithdrawalType,
 } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { useTranslationContext } from "@gnu-taler/web-util/browser";
@@ -62,7 +62,7 @@ import {
   SmallLightText,
   SubTitle,
   SvgIcon,
-  WarningBox
+  WarningBox,
 } from "../components/styled/index.js";
 import { Time } from "../components/Time.js";
 import { alertFromError, useAlertContext } from "../context/alert.js";
@@ -229,8 +229,8 @@ function TransactionTemplate({
     <Fragment>
       <section style={{ padding: 8, textAlign: "center" }}>
         {transaction?.error &&
-          // FIXME: wallet core should stop sending this error on KYC
-          transaction.error.code !==
+        // FIXME: wallet core should stop sending this error on KYC
+        transaction.error.code !==
           TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED ? (
           <ErrorAlertView
             error={alertFromError(
@@ -249,7 +249,13 @@ function TransactionTemplate({
                   <div>
                     <i18n.Translate>
                       Follow this link to the{` `}
-                      <a rel="noreferrer" target="_bank" 
href={transaction.kycUrl}>KYC verifier</a>
+                      <a
+                        rel="noreferrer"
+                        target="_bank"
+                        href={transaction.kycUrl}
+                      >
+                        KYC verifier
+                      </a>
                     </i18n.Translate>
                   </div>
                 ) : (
@@ -435,8 +441,10 @@ export function TransactionView({
     transaction.type === TransactionType.Withdrawal ||
     transaction.type === TransactionType.InternalWithdrawal
   ) {
-    const conversion = transaction.withdrawalDetails.type === 
WithdrawalType.ManualTransfer ?
-      transaction.withdrawalDetails.exchangeCreditAccountDetails ?? [] : []
+    const conversion =
+      transaction.withdrawalDetails.type === WithdrawalType.ManualTransfer
+        ? transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []
+        : [];
     return (
       <TransactionTemplate
         transaction={transaction}
@@ -457,21 +465,23 @@ export function TransactionView({
         </Header>
 
         {transaction.txState.major !==
-          TransactionMajorState.Pending ? undefined :
-          transaction.txState.minor === TransactionMinorState.KycRequired ||
-            transaction.txState.minor === TransactionMinorState.AmlRequired ? 
undefined :
-            transaction
-              .withdrawalDetails.type === WithdrawalType.ManualTransfer ? (
-              //manual withdrawal
-              <BankDetailsByPaytoType
-                amount={raw}
-                
accounts={transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []}
-                subject={transaction.withdrawalDetails.reservePub}
-              />
-            ) : (
-              //integrated bank withdrawal
-              <ShowWithdrawalDetailForBankIntegrated transaction={transaction} 
/>
-            )}
+        TransactionMajorState.Pending ? undefined : transaction.txState
+            .minor === TransactionMinorState.KycRequired ||
+          transaction.txState.minor ===
+            TransactionMinorState.AmlRequired ? undefined : transaction
+            .withdrawalDetails.type === WithdrawalType.ManualTransfer ? (
+          //manual withdrawal
+          <BankDetailsByPaytoType
+            amount={raw}
+            accounts={
+              transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []
+            }
+            subject={transaction.withdrawalDetails.reservePub}
+          />
+        ) : (
+          //integrated bank withdrawal
+          <ShowWithdrawalDetailForBankIntegrated transaction={transaction} />
+        )}
         <Part
           title={i18n.str`Details`}
           text={
@@ -1028,6 +1038,10 @@ export function TransactionView({
       </TransactionTemplate>
     );
   }
+
+  if (transaction.type === TransactionType.Recoup) {
+    throw Error("recoup transaction not implemented");
+  }
   assertUnreachable(transaction);
 }
 
@@ -1411,7 +1425,13 @@ export function TransferPickupDetails({
     </PurchaseDetailsTable>
   );
 }
-export function WithdrawDetails({ conversion, amount }: { conversion?: 
AmountJson, amount: AmountWithFee }): VNode {
+export function WithdrawDetails({
+  conversion,
+  amount,
+}: {
+  conversion?: AmountJson;
+  amount: AmountWithFee;
+}): VNode {
   const { i18n } = useTranslationContext();
 
   const maxFrac = [amount.fee, amount.fee]
@@ -1422,7 +1442,7 @@ export function WithdrawDetails({ conversion, amount }: { 
conversion?: AmountJso
 
   return (
     <PurchaseDetailsTable>
-      {conversion ?
+      {conversion ? (
         <Fragment>
           <tr>
             <td>
@@ -1432,7 +1452,8 @@ export function WithdrawDetails({ conversion, amount }: { 
conversion?: AmountJso
               <Amount value={conversion} maxFracSize={amount.maxFrac} />
             </td>
           </tr>
-          {conversion.fraction === amount.value.fraction && conversion.value 
=== amount.value.value ? undefined :
+          {conversion.fraction === amount.value.fraction &&
+          conversion.value === amount.value.value ? undefined : (
             <tr>
               <td>
                 <i18n.Translate>Converted</i18n.Translate>
@@ -1441,9 +1462,10 @@ export function WithdrawDetails({ conversion, amount }: 
{ conversion?: AmountJso
                 <Amount value={amount.value} maxFracSize={amount.maxFrac} />
               </td>
             </tr>
-          }
+          )}
         </Fragment>
-        : <tr>
+      ) : (
+        <tr>
           <td>
             <i18n.Translate>Transfer</i18n.Translate>
           </td>
@@ -1451,7 +1473,7 @@ export function WithdrawDetails({ conversion, amount }: { 
conversion?: AmountJso
             <Amount value={amount.value} maxFracSize={amount.maxFrac} />
           </td>
         </tr>
-      }
+      )}
       {Amounts.isNonZero(amount.fee) && (
         <tr>
           <td>
@@ -1683,19 +1705,22 @@ function calculateAmountByWireTransfer(
   const allTracking = Object.values(state ?? {});
 
   //group tracking by wtid, sum amounts
-  const trackByWtid = allTracking.reduce((prev, cur) => {
-    const fee = Amounts.parseOrThrow(cur.wireFee);
-    const raw = Amounts.parseOrThrow(cur.amountRaw);
-    const total = !prev[cur.wireTransferId]
-      ? raw
-      : Amounts.add(prev[cur.wireTransferId].total, raw).amount;
-
-    prev[cur.wireTransferId] = {
-      total,
-      fee,
-    };
-    return prev;
-  }, {} as Record<string, { total: AmountJson; fee: AmountJson }>);
+  const trackByWtid = allTracking.reduce(
+    (prev, cur) => {
+      const fee = Amounts.parseOrThrow(cur.wireFee);
+      const raw = Amounts.parseOrThrow(cur.amountRaw);
+      const total = !prev[cur.wireTransferId]
+        ? raw
+        : Amounts.add(prev[cur.wireTransferId].total, raw).amount;
+
+      prev[cur.wireTransferId] = {
+        total,
+        fee,
+      };
+      return prev;
+    },
+    {} as Record<string, { total: AmountJson; fee: AmountJson }>,
+  );
 
   //remove wire fee from total amount
   return Object.entries(trackByWtid).map(([id, info]) => ({
@@ -2022,12 +2047,14 @@ function ShowWithdrawalDetailForBankIntegrated({
       {showDetails && (
         <BankDetailsByPaytoType
           amount={raw}
-          accounts={transaction.withdrawalDetails.exchangeCreditAccountDetails 
?? []}
+          accounts={
+            transaction.withdrawalDetails.exchangeCreditAccountDetails ?? []
+          }
           subject={transaction.withdrawalDetails.reservePub}
         />
       )}
       {!transaction.withdrawalDetails.confirmed &&
-        transaction.withdrawalDetails.bankConfirmationUrl ? (
+      transaction.withdrawalDetails.bankConfirmationUrl ? (
         <InfoBox>
           <div style={{ display: "block" }}>
             <i18n.Translate>

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