aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-12-15 13:27:05 -0300
committerSebastian <sebasjm@gmail.com>2023-12-15 13:27:05 -0300
commitdfea6a75a5d2491422fa377c3a495e8dd1df3bd6 (patch)
tree812431ff739b23b895a5247a37437b24dabef7fa /packages/taler-wallet-core
parentb52b260fb74062085a9a280db2775d2e7c18b1a3 (diff)
downloadwallet-core-dfea6a75a5d2491422fa377c3a495e8dd1df3bd6.tar.xz
return refund list in purchase tx details
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts21
1 files 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,
),
);