aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/transactions.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-05-05 10:56:42 +0200
committerFlorian Dold <florian@dold.me>2023-05-05 13:21:58 +0200
commit60805f3ff88d7ecd149a88ec7cea846384155c5b (patch)
tree0767a7ed20c4879ab35447039fd7e3be8fdecb94 /packages/taler-wallet-core/src/operations/transactions.ts
parent1b0bec0363793996eff6483d36b844cfa2381404 (diff)
downloadwallet-core-60805f3ff88d7ecd149a88ec7cea846384155c5b.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.ts32
1 files changed, 16 insertions, 16 deletions
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts
index c122bb651..02f11d82d 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -87,14 +87,14 @@ import {
} from "./deposits.js";
import { getExchangeDetails } from "./exchanges.js";
import {
- abortPay,
+ abortPayMerchant,
computePayMerchantTransactionState,
expectProposalDownload,
extractContractData,
processPurchasePay,
} from "./pay-merchant.js";
-import { processPeerPullCredit } from "./pay-peer.js";
-import { processRefreshGroup } from "./refresh.js";
+import { computePeerPullCreditTransactionState, computePeerPullDebitTransactionState, computePeerPushCreditTransactionState, computePeerPushDebitTransactionState, processPeerPullCredit } from "./pay-peer.js";
+import { computeRefreshTransactionState, processRefreshGroup } from "./refresh.js";
import { computeTipTransactionStatus, processTip } from "./tip.js";
import {
abortWithdrawalTransaction,
@@ -445,7 +445,7 @@ function buildTransactionForPushPaymentDebit(
): Transaction {
return {
type: TransactionType.PeerPushDebit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPushDebitTransactionState(pi),
amountEffective: pi.totalCost,
amountRaw: pi.amount,
exchangeBaseUrl: pi.exchangeBaseUrl,
@@ -455,10 +455,10 @@ function buildTransactionForPushPaymentDebit(
},
frozen: false,
extendedStatus:
- pi.status != PeerPushPaymentInitiationStatus.PurseCreated
+ pi.status != PeerPushPaymentInitiationStatus.Done
? ExtendedStatus.Pending
: ExtendedStatus.Done,
- pending: pi.status != PeerPushPaymentInitiationStatus.PurseCreated,
+ pending: pi.status != PeerPushPaymentInitiationStatus.Done,
timestamp: pi.timestampCreated,
talerUri: constructPayPushUri({
exchangeBaseUrl: pi.exchangeBaseUrl,
@@ -478,7 +478,7 @@ function buildTransactionForPullPaymentDebit(
): Transaction {
return {
type: TransactionType.PeerPullDebit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPullDebitTransactionState(pi),
amountEffective: pi.coinSel?.totalCost
? pi.coinSel?.totalCost
: Amounts.stringify(pi.contractTerms.amount),
@@ -528,7 +528,7 @@ function buildTransactionForPeerPullCredit(
});
return {
type: TransactionType.PeerPullCredit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPullCreditTransactionState(pullCredit),
amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
amountRaw: Amounts.stringify(wsr.instructedAmount),
exchangeBaseUrl: wsr.exchangeBaseUrl,
@@ -563,7 +563,7 @@ function buildTransactionForPeerPullCredit(
return {
type: TransactionType.PeerPullCredit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPullCreditTransactionState(pullCredit),
amountEffective: Amounts.stringify(pullCredit.estimatedAmountEffective),
amountRaw: Amounts.stringify(peerContractTerms.amount),
exchangeBaseUrl: pullCredit.exchangeBaseUrl,
@@ -602,7 +602,7 @@ function buildTransactionForPeerPushCredit(
return {
type: TransactionType.PeerPushCredit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPushCreditTransactionState(pushInc),
amountEffective: Amounts.stringify(wsr.denomsSel.totalCoinValue),
amountRaw: Amounts.stringify(wsr.instructedAmount),
exchangeBaseUrl: wsr.exchangeBaseUrl,
@@ -626,7 +626,7 @@ function buildTransactionForPeerPushCredit(
return {
type: TransactionType.PeerPushCredit,
- txState: mkTxStateUnknown(),
+ txState: computePeerPushCreditTransactionState(pushInc),
// FIXME: This is wrong, needs to consider fees!
amountEffective: Amounts.stringify(peerContractTerms.amount),
amountRaw: Amounts.stringify(peerContractTerms.amount),
@@ -666,7 +666,7 @@ function buildTransactionForBankIntegratedWithdraw(
bankConfirmationUrl: wgRecord.wgInfo.bankInfo.confirmUrl,
reserveIsReady:
wgRecord.status === WithdrawalGroupStatus.Finished ||
- wgRecord.status === WithdrawalGroupStatus.Ready,
+ wgRecord.status === WithdrawalGroupStatus.PendingReady,
},
exchangeBaseUrl: wgRecord.exchangeBaseUrl,
extendedStatus: wgRecord.timestampFinish
@@ -713,7 +713,7 @@ function buildTransactionForManualWithdraw(
exchangePaytoUris,
reserveIsReady:
withdrawalGroup.status === WithdrawalGroupStatus.Finished ||
- withdrawalGroup.status === WithdrawalGroupStatus.Ready,
+ withdrawalGroup.status === WithdrawalGroupStatus.PendingReady,
},
exchangeBaseUrl: withdrawalGroup.exchangeBaseUrl,
extendedStatus: withdrawalGroup.timestampFinish
@@ -753,7 +753,7 @@ function buildTransactionForRefresh(
).amount;
return {
type: TransactionType.Refresh,
- txState: mkTxStateUnknown(),
+ txState: computeRefreshTransactionState(refreshGroupRecord),
refreshReason: refreshGroupRecord.reason,
amountEffective: Amounts.stringify(
Amounts.zeroOfCurrency(refreshGroupRecord.currency),
@@ -1538,7 +1538,7 @@ export async function retryTransaction(
switch (parsedTx.tag) {
case TransactionType.PeerPullCredit: {
const taskId = constructTaskIdentifier({
- tag: PendingTaskType.PeerPullInitiation,
+ tag: PendingTaskType.PeerPullCredit,
pursePub: parsedTx.pursePub,
});
await resetOperationTimeout(ws, taskId);
@@ -1866,7 +1866,7 @@ export async function abortTransaction(
switch (txId.tag) {
case TransactionType.Payment: {
- await abortPay(ws, txId.proposalId);
+ await abortPayMerchant(ws, txId.proposalId);
break;
}
case TransactionType.Withdrawal: {