diff options
author | Florian Dold <florian@dold.me> | 2023-04-05 17:38:34 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-04-05 17:38:41 +0200 |
commit | 2823b1cdf4b6e9a6c4dbdb752c7c7259775e18f5 (patch) | |
tree | 9d6fe1e025f89cea0e044f8bba53f67e7d04a77f /packages/taler-wallet-core/src/operations/transactions.ts | |
parent | 8eee38d55936c194637ecead302dde69ec0b9897 (diff) | |
download | wallet-core-2823b1cdf4b6e9a6c4dbdb752c7c7259775e18f5.tar.xz |
wallet-core: towards DD37 for deposits
Diffstat (limited to 'packages/taler-wallet-core/src/operations/transactions.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index 133675aa1..02c726449 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -36,6 +36,8 @@ import { TransactionByIdRequest, TransactionsRequest, TransactionsResponse, + TransactionState, + TransactionSubstate, TransactionType, WithdrawalType, } from "@gnu-taler/taler-util"; @@ -429,6 +431,8 @@ function buildTransactionForPushPaymentDebit( ): Transaction { return { type: TransactionType.PeerPushDebit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: pi.totalCost, amountRaw: pi.amount, exchangeBaseUrl: pi.exchangeBaseUrl, @@ -461,6 +465,8 @@ function buildTransactionForPullPaymentDebit( ): Transaction { return { type: TransactionType.PeerPullDebit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: pi.coinSel?.totalCost ? pi.coinSel?.totalCost : Amounts.stringify(pi.contractTerms.amount), @@ -510,6 +516,8 @@ function buildTransactionForPeerPullCredit( }); return { type: TransactionType.PeerPullCredit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue), amountRaw: Amounts.stringify(wsr.instructedAmount), exchangeBaseUrl: wsr.exchangeBaseUrl, @@ -543,6 +551,8 @@ function buildTransactionForPeerPullCredit( return { type: TransactionType.PeerPullCredit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify(pullCredit.estimatedAmountEffective), amountRaw: Amounts.stringify(peerContractTerms.amount), exchangeBaseUrl: pullCredit.exchangeBaseUrl, @@ -580,6 +590,8 @@ function buildTransactionForPeerPushCredit( return { type: TransactionType.PeerPushCredit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue), amountRaw: Amounts.stringify(wsr.instructedAmount), exchangeBaseUrl: wsr.exchangeBaseUrl, @@ -603,6 +615,8 @@ function buildTransactionForPeerPushCredit( return { type: TransactionType.PeerPushCredit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, // FIXME: This is wrong, needs to consider fees! amountEffective: Amounts.stringify(peerContractTerms.amount), amountRaw: Amounts.stringify(peerContractTerms.amount), @@ -632,6 +646,8 @@ function buildTransactionForBankIntegratedWithdraw( return { type: TransactionType.Withdrawal, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue), amountRaw: Amounts.stringify(wsr.instructedAmount), withdrawalDetails: { @@ -677,6 +693,8 @@ function buildTransactionForManualWithdraw( return { type: TransactionType.Withdrawal, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify( withdrawalGroup.denomsSel.totalCoinValue, ), @@ -727,6 +745,8 @@ function buildTransactionForRefresh( ).amount; return { type: TransactionType.Refresh, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, refreshReason: refreshGroupRecord.reason, amountEffective: Amounts.stringify( Amounts.zeroOfCurrency(refreshGroupRecord.currency), @@ -768,6 +788,8 @@ function buildTransactionForDeposit( return { type: TransactionType.Deposit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountRaw: Amounts.stringify(dg.effectiveDepositAmount), amountEffective: Amounts.stringify(dg.totalPayCost), extendedStatus: dg.timestampFinished @@ -804,6 +826,8 @@ function buildTransactionForTip( return { type: TransactionType.Tip, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountEffective: Amounts.stringify(tipRecord.tipAmountEffective), amountRaw: Amounts.stringify(tipRecord.tipAmountRaw), extendedStatus: tipRecord.pickedUpTimestamp @@ -899,6 +923,8 @@ async function buildTransactionForRefund( return { type: TransactionType.Refund, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, info, refundedTransactionId: makeTransactionId( TransactionType.Payment, @@ -1001,6 +1027,8 @@ async function buildTransactionForPurchase( return { type: TransactionType.Payment, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.Unknown, amountRaw: Amounts.stringify(contractData.amount), amountEffective: Amounts.stringify(purchaseRecord.payInfo.totalPayCost), totalRefundRaw: Amounts.stringify(totalRefund.raw), |