diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 21 |
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, ), ); |