diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-05-15 16:03:52 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-05-15 16:03:52 +0530 |
commit | 3eb88574bcf327672c34120becfb511eac4e06cd (patch) | |
tree | 9d54748adef52dc9a21c8ea97c7d034cd773277a /src/operations/transactions.ts | |
parent | 35c83414f9e0af11012c1a2e00672d2a7c1856ae (diff) | |
download | wallet-core-3eb88574bcf327672c34120becfb511eac4e06cd.tar.xz |
address first batch of transaction list issues
Diffstat (limited to 'src/operations/transactions.ts')
-rw-r--r-- | src/operations/transactions.ts | 55 |
1 files changed, 11 insertions, 44 deletions
diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts index 4cc6154b5..fd7679621 100644 --- a/src/operations/transactions.ts +++ b/src/operations/transactions.ts @@ -18,7 +18,7 @@ * Imports. */ import { InternalWalletState } from "./state"; -import { Stores, ReserveRecordStatus, PurchaseRecord, ProposalStatus } from "../types/dbTypes"; +import { Stores, ReserveRecordStatus, PurchaseRecord } from "../types/dbTypes"; import { Amounts, AmountJson } from "../util/amounts"; import { timestampCmp } from "../util/time"; import { @@ -131,10 +131,8 @@ export async function getTransactions( if (wsr.timestampFinish) { transactions.push({ type: TransactionType.Withdrawal, - amountEffective: Amounts.stringify( - wsr.denomsSel.totalWithdrawCost, - ), - amountRaw: Amounts.stringify(wsr.denomsSel.totalCoinValue), + amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue), + amountRaw: Amounts.stringify(wsr.denomsSel.totalWithdrawCost), confirmed: true, exchangeBaseUrl: wsr.exchangeBaseUrl, pending: !wsr.timestampFinish, @@ -163,9 +161,9 @@ export async function getTransactions( transactions.push({ type: TransactionType.Withdrawal, confirmed: false, - amountRaw: Amounts.stringify(r.bankInfo.amount), - amountEffective: undefined, - exchangeBaseUrl: undefined, + amountRaw: Amounts.stringify(r.bankInfo.denomSel.totalWithdrawCost), + amountEffective: Amounts.stringify(r.bankInfo.denomSel.totalCoinValue), + exchangeBaseUrl: r.exchangeBaseUrl, pending: true, timestamp: r.timestampCreated, bankConfirmationUrl: r.bankInfo.confirmUrl, @@ -176,38 +174,6 @@ export async function getTransactions( }); }); - tx.iter(Stores.proposals).forEachAsync(async (proposal) => { - if (!proposal.download) { - return; - } - if (proposal.proposalStatus !== ProposalStatus.PROPOSED) { - return; - } - const dl = proposal.download; - const purchase = await tx.get(Stores.purchases, proposal.proposalId); - if (purchase) { - return; - } - - transactions.push({ - type: TransactionType.Payment, - amountRaw: Amounts.stringify(dl.contractData.amount), - amountEffective: undefined, - status: PaymentStatus.Offered, - pending: true, - timestamp: proposal.timestamp, - transactionId: makeEventId(TransactionType.Payment, proposal.proposalId), - info: { - fulfillmentUrl: dl.contractData.fulfillmentUrl, - merchant: {}, - orderId: dl.contractData.orderId, - products: [], - summary: dl.contractData.summary, - summary_i18n: {}, - }, - }); - }); - tx.iter(Stores.purchases).forEachAsync(async (pr) => { if ( transactionsRequest?.currency && @@ -231,11 +197,11 @@ export async function getTransactions( transactionId: makeEventId(TransactionType.Payment, pr.proposalId), 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, }, }); @@ -258,7 +224,8 @@ export async function getTransactions( timestamp: rg.timestampQueried, transactionId: makeEventId( TransactionType.Refund, - `{rg.timestampQueried.t_ms}`, + pr.proposalId, + `${rg.timestampQueried.t_ms}`, ), refundedTransactionId: makeEventId( TransactionType.Payment, |