gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: return refund list in purchas


From: gnunet
Subject: [taler-wallet-core] branch master updated: return refund list in purchase tx details
Date: Fri, 15 Dec 2023 17:27:12 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new dfea6a75a return refund list in purchase tx details
dfea6a75a is described below

commit dfea6a75a5d2491422fa377c3a495e8dd1df3bd6
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Dec 15 13:27:05 2023 -0300

    return refund list in purchase tx details
---
 .../src/operations/transactions.ts                  | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index ee8c90407..9deb050d8 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -31,6 +31,7 @@ import {
   stringifyPayPullUri,
   stringifyPayPushUri,
   TalerErrorCode,
+  TalerPreciseTimestamp,
   Transaction,
   TransactionByIdRequest,
   TransactionIdStr,
@@ -278,6 +279,7 @@ export async function getTransactionById(
           x.purchases,
           x.tombstones,
           x.operationRetries,
+          x.refundGroups,
           x.contractTerms,
         ])
         .runReadWrite(async (tx) => {
@@ -288,10 +290,12 @@ export async function getTransactionById(
           const payOpId = TaskIdentifiers.forPay(purchase);
           const payRetryRecord = await tx.operationRetries.get(payOpId);
 
+          const refunds = await 
tx.refundGroups.indexes.byProposalId.getAll(purchase.proposalId)
+
           return buildTransactionForPurchase(
             purchase,
             contractData,
-            [], // FIXME: Add refunds from refund group records here.
+            refunds,
             payRetryRecord,
           );
         });
@@ -924,7 +928,15 @@ async function buildTransactionForPurchase(
     info.fulfillmentUrl = contractData.fulfillmentUrl;
   }
 
-  const refunds: RefundInfoShort[] = [];
+  const refunds: RefundInfoShort[] = refundsInfo.map(r => ({
+    amountEffective: r.amountEffective,
+    amountRaw: r.amountRaw,
+    timestamp: 
TalerPreciseTimestamp.round(timestampPreciseFromDb(r.timestampCreated)),
+    transactionId: constructTransactionIdentifier({
+      tag: TransactionType.Refund,
+      refundGroupId: r.refundGroupId,
+    })
+  }));
 
   const timestamp = purchaseRecord.timestampAccept;
   checkDbInvariant(!!timestamp);
@@ -1245,11 +1257,14 @@ export async function getTransactions(
 
         const payOpId = TaskIdentifiers.forPay(purchase);
         const payRetryRecord = await tx.operationRetries.get(payOpId);
+
+        const refunds = await 
tx.refundGroups.indexes.byProposalId.getAll(purchase.proposalId)
+
         transactions.push(
           await buildTransactionForPurchase(
             purchase,
             contractData,
-            [], // FIXME!
+            refunds,
             payRetryRecord,
           ),
         );

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