From 62406304d9a81a08797c09f5151de74d8ca43fe8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 1 Sep 2020 19:33:06 +0530 Subject: [PATCH] include error details in transactions list --- .../src/operations/transactions.ts | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index cc569fd24..2515415d2 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -216,6 +216,7 @@ export async function getTransactions( TransactionType.Withdrawal, r.initialWithdrawalGroupId, ), + ...(r.lastError ? { error: r.lastError } : {}), }); }); @@ -250,6 +251,7 @@ export async function getTransactions( TransactionType.Payment, pr.proposalId, ); + const err = pr.lastPayError ?? pr.lastRefundStatusError; transactions.push({ type: TransactionType.Payment, amountRaw: Amounts.stringify(pr.contractData.amount), @@ -261,6 +263,7 @@ export async function getTransactions( timestamp: pr.timestampAccept, transactionId: paymentTransactionId, info: info, + ...(err ? { error: err } : {}), }); const refundGroupKeys = new Set(); @@ -305,7 +308,6 @@ export async function getTransactions( if (!r0) { throw Error("invariant violated"); } - let ts: Timestamp; transactions.push({ type: TransactionType.Refund, info, @@ -317,37 +319,6 @@ export async function getTransactions( pending: false, }); }); - - // for (const rg of pr.refundGroups) { - // const pending = Object.keys(pr.refundsPending).length > 0; - // const stats = getRefundStats(pr, rg.refundGroupId); - - // transactions.push({ - // type: TransactionType.Refund, - // pending, - // info: { - // fulfillmentUrl: pr.contractData.fulfillmentUrl, - // merchant: pr.contractData.merchant, - // orderId: pr.contractData.orderId, - // products: pr.contractData.products, - // summary: pr.contractData.summary, - // summary_i18n: pr.contractData.summaryI18n, - // }, - // timestamp: rg.timestampQueried, - // transactionId: makeEventId( - // TransactionType.Refund, - // pr.proposalId, - // `${rg.timestampQueried.t_ms}`, - // ), - // refundedTransactionId: makeEventId( - // TransactionType.Payment, - // pr.proposalId, - // ), - // amountEffective: Amounts.stringify(stats.amountEffective), - // amountInvalid: Amounts.stringify(stats.amountInvalid), - // amountRaw: Amounts.stringify(stats.amountRaw), - // }); - // } }); }, );