gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: show reserve amount for reser


From: gnunet
Subject: [taler-wallet-core] branch master updated: show reserve amount for reserve withdrawal via bank
Date: Fri, 15 May 2020 20:11:53 +0200

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 cf3aaee2 show reserve amount for reserve withdrawal via bank
cf3aaee2 is described below

commit cf3aaee28acaa8d6aba8e0b1fe6dbcba5e4e67ae
Author: Florian Dold <address@hidden>
AuthorDate: Fri May 15 23:41:47 2020 +0530

    show reserve amount for reserve withdrawal via bank
---
 src/operations/transactions.ts | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts
index c9d48fc0..f016fb8c 100644
--- a/src/operations/transactions.ts
+++ b/src/operations/transactions.ts
@@ -18,7 +18,7 @@
  * Imports.
  */
 import { InternalWalletState } from "./state";
-import { Stores, ReserveRecordStatus, PurchaseRecord } from "../types/dbTypes";
+import { Stores, ReserveRecordStatus, PurchaseRecord, WithdrawalSourceType } 
from "../types/dbTypes";
 import { Amounts, AmountJson } from "../util/amounts";
 import { timestampCmp } from "../util/time";
 import {
@@ -152,7 +152,7 @@ export async function getTransactions(
       Stores.recoupGroups,
     ],
     async (tx) => {
-      tx.iter(Stores.withdrawalGroups).forEach((wsr) => {
+      tx.iter(Stores.withdrawalGroups).forEachAsync(async (wsr) => {
         if (
           shouldSkipCurrency(
             transactionsRequest,
@@ -166,10 +166,22 @@ export async function getTransactions(
           return;
         }
 
+        let amountRaw: AmountJson | undefined = undefined;
+
+        if (wsr.source.type === WithdrawalSourceType.Reserve) {
+          const r = await tx.get(Stores.reserves, wsr.source.reservePub);
+          if (r?.bankInfo?.amount) {
+            amountRaw = r.bankInfo.amount;
+          }
+        }
+        if (!amountRaw) {
+          amountRaw = wsr.denomsSel.totalWithdrawCost;
+        }
+
         transactions.push({
           type: TransactionType.Withdrawal,
           amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
-          amountRaw: Amounts.stringify(wsr.denomsSel.totalWithdrawCost),
+          amountRaw: Amounts.stringify(amountRaw),
           confirmed: true,
           exchangeBaseUrl: wsr.exchangeBaseUrl,
           pending: !wsr.timestampFinish,
@@ -202,7 +214,7 @@ export async function getTransactions(
         transactions.push({
           type: TransactionType.Withdrawal,
           confirmed: false,
-          amountRaw: Amounts.stringify(r.bankInfo.denomSel.totalWithdrawCost),
+          amountRaw: Amounts.stringify(r.bankInfo.amount),
           amountEffective: Amounts.stringify(
             r.bankInfo.denomSel.totalCoinValue,
           ),

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



reply via email to

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