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 some transaction list iss


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix some transaction list issues
Date: Fri, 15 May 2020 19:24:44 +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 49f362ba fix some transaction list issues
49f362ba is described below

commit 49f362ba6d3f3b99be1dba9ba1fe50fe49856d75
Author: Florian Dold <address@hidden>
AuthorDate: Fri May 15 22:54:39 2020 +0530

    fix some transaction list issues
---
 src/operations/refresh.ts      |  7 +++----
 src/operations/refund.ts       | 13 +++++++++++--
 src/operations/transactions.ts |  9 ++++-----
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/operations/refresh.ts b/src/operations/refresh.ts
index 5563d94d..2d7ffad2 100644
--- a/src/operations/refresh.ts
+++ b/src/operations/refresh.ts
@@ -73,10 +73,9 @@ export function getTotalRefreshCost(
   ).amount;
   const totalCost = Amounts.sub(amountLeft, resultingAmount).amount;
   logger.trace(
-    "total refresh cost for",
-    amountToPretty(amountLeft),
-    "is",
-    amountToPretty(totalCost),
+    `total refresh cost for ${amountToPretty(amountLeft)} is ${amountToPretty(
+      totalCost,
+    )}`,
   );
   return totalCost;
 }
diff --git a/src/operations/refund.ts b/src/operations/refund.ts
index b5d611b0..5f6ccf9d 100644
--- a/src/operations/refund.ts
+++ b/src/operations/refund.ts
@@ -125,7 +125,7 @@ export async function getFullRefundFees(
 }
 
 function getRefundKey(d: MerchantRefundDetails): string {
-  return `{d.coin_pub}-{d.rtransaction_id}`;
+  return `${d.coin_pub}-${d.rtransaction_id}`;
 }
 
 async function acceptRefundResponse(
@@ -144,9 +144,14 @@ async function acceptRefundResponse(
   const unfinishedRefunds: MerchantRefundDetails[] = [];
   const failedRefunds: MerchantRefundDetails[] = [];
 
+  console.log("handling refund response", refundResponse);
+
   const refundsRefreshCost: { [refundKey: string]: AmountJson } = {};
 
   for (const rd of refunds) {
+    logger.trace(
+      `Refund ${rd.rtransaction_id} has HTTP status 
${rd.exchange_http_status}`,
+    );
     if (rd.exchange_http_status === 200) {
       // FIXME: also verify signature if necessary.
       finishedRefunds.push(rd);
@@ -160,6 +165,8 @@ async function acceptRefundResponse(
     }
   }
 
+  // Compute cost.
+  // FIXME: Optimize, don't always recompute.
   for (const rd of [...finishedRefunds, ...unfinishedRefunds]) {
     const key = getRefundKey(rd);
     const coin = await ws.db.get(Stores.coins, rd.coin_pub);
@@ -280,6 +287,8 @@ async function acceptRefundResponse(
       // after a retry delay?
       let queryDone = true;
 
+      logger.trace(`got ${numNewRefunds} new refund permissions`);
+
       if (numNewRefunds === 0) {
         if (p.autoRefundDeadline && p.autoRefundDeadline.t_ms > now.t_ms) {
           queryDone = false;
@@ -311,7 +320,7 @@ async function acceptRefundResponse(
         console.log("refund query not done");
       }
 
-      p.refundsRefreshCost = {...p.refundsRefreshCost, ...refundsRefreshCost };
+      p.refundsRefreshCost = { ...p.refundsRefreshCost, ...refundsRefreshCost 
};
 
       await tx.put(Stores.purchases, p);
 
diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts
index 5602c6b0..c9d48fc0 100644
--- a/src/operations/transactions.ts
+++ b/src/operations/transactions.ts
@@ -254,8 +254,7 @@ export async function getTransactions(
         });
 
         for (const rg of pr.refundGroups) {
-          const pending = Object.keys(pr.refundsDone).length > 0;
-
+          const pending = Object.keys(pr.refundsPending).length > 0;
           const stats = getRefundStats(pr, rg.refundGroupId);
 
           transactions.push({
@@ -263,11 +262,11 @@ export async function getTransactions(
             pending,
             info: {
               fulfillmentUrl: pr.contractData.fulfillmentUrl,
-              merchant: {},
+              merchant: pr.contractData.merchant,
               orderId: pr.contractData.orderId,
-              products: [],
+              products: pr.contractData.products,
               summary: pr.contractData.summary,
-              summary_i18n: {},
+              summary_i18n: pr.contractData.summaryI18n,
             },
             timestamp: rg.timestampQueried,
             transactionId: makeEventId(

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



reply via email to

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