gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (d7fe5b0cb -> fdc7b5827)


From: gnunet
Subject: [taler-wallet-core] branch master updated (d7fe5b0cb -> fdc7b5827)
Date: Wed, 18 Jan 2023 21:33:15 +0100

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

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

    from d7fe5b0cb wallet-core: add receiver name in fakebank test
     new 733d06c8d fix: using wrong variable
     new 20b9e62aa fix: showing the current value of the coin
     new 4bd9b1ba7 fix: missing total cost in peer pull payment
     new fdc7b5827 Merge branch 'master' of git.taler.net:wallet-core

The 4 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/db.ts                   |  6 ++++++
 .../taler-wallet-core/src/operations/backup/import.ts  |  2 +-
 packages/taler-wallet-core/src/operations/pay-peer.ts  |  7 +++++++
 .../taler-wallet-core/src/operations/transactions.ts   |  4 +++-
 packages/taler-wallet-core/src/operations/withdraw.ts  |  2 +-
 .../src/wallet/DeveloperPage.tsx                       | 18 +++++++++---------
 6 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index d2d01e100..72e9aff04 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1864,6 +1864,12 @@ export interface PeerPullPaymentIncomingRecord {
    * Status of the peer push payment incoming initiation.
    */
   status: PeerPullPaymentIncomingStatus;
+
+  /**
+   * Total cost based on the coin selection.
+   * Non undefined after status === "Accepted"
+   */
+  totalCost: AmountString | undefined;
 }
 
 /**
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts 
b/packages/taler-wallet-core/src/operations/backup/import.ts
index c7afaea8e..c94eb7eb6 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -199,7 +199,7 @@ async function getDenomSelStateFromBackup(
   return {
     selectedDenoms,
     totalCoinValue: Amounts.stringify(totalCoinValue),
-    totalWithdrawCost: Amounts.stringify(totalCoinValue),
+    totalWithdrawCost: Amounts.stringify(totalWithdrawCost),
   };
 }
 
diff --git a/packages/taler-wallet-core/src/operations/pay-peer.ts 
b/packages/taler-wallet-core/src/operations/pay-peer.ts
index 48434e452..7dc7b67fe 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer.ts
@@ -882,6 +882,11 @@ export async function acceptPeerPullPayment(
 
   const sel = coinSelRes.result;
 
+  const totalAmount = await getTotalPeerPaymentCost(
+    ws,
+    coinSelRes.result.coins,
+  );
+
   await ws.db
     .mktx((x) => [
       x.exchanges,
@@ -908,6 +913,7 @@ export async function acceptPeerPullPayment(
         throw Error();
       }
       pi.status = PeerPullPaymentIncomingStatus.Accepted;
+      pi.totalCost = Amounts.stringify(totalAmount);
       await tx.peerPullPaymentIncoming.put(pi);
     });
 
@@ -995,6 +1001,7 @@ export async function checkPeerPullPayment(
         timestampCreated: TalerProtocolTimestamp.now(),
         contractTerms: dec.contractTerms,
         status: PeerPullPaymentIncomingStatus.Proposed,
+        totalCost: undefined,
       });
     });
 
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index 7fa2c075c..083b6618a 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -380,7 +380,9 @@ function buildTransactionForPullPaymentDebit(
 ): Transaction {
   return {
     type: TransactionType.PeerPullDebit,
-    amountEffective: Amounts.stringify(pi.contractTerms.amount),
+    amountEffective: pi.totalCost
+      ? pi.totalCost
+      : Amounts.stringify(pi.contractTerms.amount),
     amountRaw: Amounts.stringify(pi.contractTerms.amount),
     exchangeBaseUrl: pi.exchangeBaseUrl,
     frozen: false,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts 
b/packages/taler-wallet-core/src/operations/withdraw.ts
index f5cdde167..f7edfed91 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -225,7 +225,7 @@ export function selectWithdrawalDenominations(
   return {
     selectedDenoms,
     totalCoinValue: Amounts.stringify(totalCoinValue),
-    totalWithdrawCost: Amounts.stringify(totalCoinValue),
+    totalWithdrawCost: Amounts.stringify(totalWithdrawCost),
   };
 }
 
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx 
b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index 74e7ce611..3df3a470c 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -215,12 +215,12 @@ export function View({
           <Button
             variant="contained"
             onClick={() => {
-              return api.background.call("freeze", 5000).then(() => {
+              return api.background.call("freeze", 4000).then(() => {
                 console.log("WAIT");
               });
             }}
           >
-            <i18n.Translate>freeze 5000</i18n.Translate>
+            <i18n.Translate>freeze 4000</i18n.Translate>
           </Button>
         </Grid>
         <Grid item>
@@ -454,9 +454,6 @@ function ShowAllCoins({
             <td>
               <i18n.Translate>denom</i18n.Translate>
             </td>
-            <td>
-              <i18n.Translate>value</i18n.Translate>
-            </td>
             <td>
               <i18n.Translate>status</i18n.Translate>
             </td>
@@ -471,7 +468,13 @@ function ShowAllCoins({
             return (
               <tr key={idx}>
                 <td>{c.id.substring(0, 5)}</td>
-                <td>{c.denom_value}</td>
+                <td>
+                  {Amounts.stringifyValue({
+                    value: c.denom_value,
+                    fraction: c.denom_fraction,
+                    currency: "ANY",
+                  })}
+                </td>
                 <td>{c.status}</td>
                 <td>{c.from_refresh ? "true" : "false"}</td>
                 <td>{String(c.ageKeysCount)}</td>
@@ -496,9 +499,6 @@ function ShowAllCoins({
             <td>
               <i18n.Translate>denom</i18n.Translate>
             </td>
-            <td>
-              <i18n.Translate>value</i18n.Translate>
-            </td>
             <td>
               <i18n.Translate>status</i18n.Translate>
             </td>

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