aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/transactions.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-04-25 23:56:57 +0200
committerFlorian Dold <florian@dold.me>2023-04-25 23:58:17 +0200
commitfd86791e42a0651968ae58969de178dc72929ffb (patch)
treebbfeff4205ae6990ee60367b884b83a74e8b0c1a /packages/taler-wallet-core/src/operations/transactions.ts
parentf94d7bc15115753ce3c492deb72ff9fdb4a66cba (diff)
downloadwallet-core-fd86791e42a0651968ae58969de178dc72929ffb.tar.xz
-DD37 wip
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/transactions.ts35
1 files changed, 19 insertions, 16 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index 674d4959c..cacc179f2 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -95,6 +95,7 @@ import { processRefreshGroup } from "./refresh.js";
import { computeTipTransactionStatus, processTip } from "./tip.js";
import {
augmentPaytoUrisForWithdrawal,
+ computeWithdrawalTransactionStatus,
processWithdrawalGroup,
} from "./withdraw.js";
@@ -643,35 +644,35 @@ function buildTransactionForPeerPushCredit(
}
function buildTransactionForBankIntegratedWithdraw(
- wsr: WithdrawalGroupRecord,
+ wgRecord: WithdrawalGroupRecord,
ort?: OperationRetryRecord,
): Transaction {
- if (wsr.wgInfo.withdrawalType !== WithdrawalRecordType.BankIntegrated)
+ if (wgRecord.wgInfo.withdrawalType !== WithdrawalRecordType.BankIntegrated)
throw Error("");
return {
type: TransactionType.Withdrawal,
- txState: mkTxStateUnknown(),
- amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
- amountRaw: Amounts.stringify(wsr.instructedAmount),
+ txState: computeWithdrawalTransactionStatus(wgRecord),
+ amountEffective: Amounts.stringify(wgRecord.denomsSel.totalCoinValue),
+ amountRaw: Amounts.stringify(wgRecord.instructedAmount),
withdrawalDetails: {
type: WithdrawalType.TalerBankIntegrationApi,
- confirmed: wsr.wgInfo.bankInfo.timestampBankConfirmed ? true : false,
- reservePub: wsr.reservePub,
- bankConfirmationUrl: wsr.wgInfo.bankInfo.confirmUrl,
+ confirmed: wgRecord.wgInfo.bankInfo.timestampBankConfirmed ? true : false,
+ reservePub: wgRecord.reservePub,
+ bankConfirmationUrl: wgRecord.wgInfo.bankInfo.confirmUrl,
reserveIsReady:
- wsr.status === WithdrawalGroupStatus.Finished ||
- wsr.status === WithdrawalGroupStatus.Ready,
+ wgRecord.status === WithdrawalGroupStatus.Finished ||
+ wgRecord.status === WithdrawalGroupStatus.Ready,
},
- exchangeBaseUrl: wsr.exchangeBaseUrl,
- extendedStatus: wsr.timestampFinish
+ exchangeBaseUrl: wgRecord.exchangeBaseUrl,
+ extendedStatus: wgRecord.timestampFinish
? ExtendedStatus.Done
: ExtendedStatus.Pending,
- pending: !wsr.timestampFinish,
- timestamp: wsr.timestampStart,
+ pending: !wgRecord.timestampFinish,
+ timestamp: wgRecord.timestampStart,
transactionId: makeTransactionId(
TransactionType.Withdrawal,
- wsr.withdrawalGroupId,
+ wgRecord.withdrawalGroupId,
),
frozen: false,
...(ort?.lastError ? { error: ort.lastError } : {}),
@@ -697,7 +698,7 @@ function buildTransactionForManualWithdraw(
return {
type: TransactionType.Withdrawal,
- txState: mkTxStateUnknown(),
+ txState: computeWithdrawalTransactionStatus(withdrawalGroup),
amountEffective: Amounts.stringify(
withdrawalGroup.denomsSel.totalCoinValue,
),
@@ -1238,10 +1239,12 @@ export async function getTransactions(
case WithdrawalRecordType.PeerPullCredit:
// Will be reported by the corresponding p2p transaction.
// FIXME: If this is an orphan withdrawal, still report it as a withdrawal!
+ // FIXME: Still report if requested with verbose option?
return;
case WithdrawalRecordType.PeerPushCredit:
// Will be reported by the corresponding p2p transaction.
// FIXME: If this is an orphan withdrawal, still report it as a withdrawal!
+ // FIXME: Still report if requested with verbose option?
return;
case WithdrawalRecordType.BankIntegrated:
transactions.push(