commit 516ae509b978eb0b6fb1647c094d37d012e498a6
parent 9ce574ae31377730d6edbd5b299cc1d0e85b3534
Author: Florian Dold <florian@dold.me>
Date: Wed, 1 Jul 2026 12:20:08 +0200
wallet-core: introduce working flag on transaction states
The working flag will eventually become its own major state, but that
requires support in the UI and will be done via a feature flag.
See https://bugs.taler.net/n/11592
Diffstat:
10 files changed, 59 insertions(+), 8 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts b/packages/taler-util/src/types-taler-wallet-transactions.ts
@@ -176,8 +176,23 @@ export interface GetTransactionsV2Request {
}
export interface TransactionState {
+ /**
+ * Major state component of the transaction state.
+ */
major: TransactionMajorState;
+ /**
+ * Minor state component of the transaction.
+ */
minor?: TransactionMinorState;
+ /**
+ * Indicator of whether the wallet is currently
+ * actively processing the transaction or waiting
+ * for a counterparty.
+ *
+ * Will eventually be folded into a new major state,
+ * first via a feature flag and then permanently.
+ */
+ working?: boolean;
}
export type TransactionStateWildcard = "*";
diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts
@@ -624,6 +624,7 @@ export function computeDepositTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Deposit,
+ working: true,
};
case DepositOperationStatus.PendingAggregateKyc:
if (dg.kycInfo?.accessToken != null) {
@@ -635,6 +636,7 @@ export function computeDepositTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case DepositOperationStatus.LegacyPendingTrack:
@@ -696,6 +698,7 @@ export function computeDepositTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case DepositOperationStatus.SuspendedDepositKyc:
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts
@@ -1329,7 +1329,9 @@ async function generateSlate(
choiceIndex,
outputIndex,
]);
- if (s) return;
+ if (s) {
+ return;
+ }
await tx.slates.put(newSlate);
});
}
@@ -3764,31 +3766,37 @@ export function computePayMerchantTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.ClaimProposal,
+ working: true,
};
case PurchaseStatus.PendingPaying:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.SubmitPayment,
+ working: true,
};
case PurchaseStatus.PendingPayingReplay:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.RebindSession,
+ working: true,
};
case PurchaseStatus.PendingQueryingAutoRefund:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.AutoRefund,
+ working: true,
};
case PurchaseStatus.PendingQueryingRefund:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.CheckRefund,
+ working: true,
};
case PurchaseStatus.PendingAcceptRefund:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.AcceptRefund,
+ working: true,
};
// Suspended Pending States
case PurchaseStatus.SuspendedDownloadingProposal:
@@ -3805,6 +3813,7 @@ export function computePayMerchantTransactionState(
return {
major: TransactionMajorState.Suspended,
minor: TransactionMinorState.RebindSession,
+ working: true,
};
case PurchaseStatus.SuspendedQueryingAutoRefund:
return {
@@ -3825,6 +3834,7 @@ export function computePayMerchantTransactionState(
case PurchaseStatus.AbortingWithRefund:
return {
major: TransactionMajorState.Aborting,
+ working: true,
};
// Suspended Aborting States
case PurchaseStatus.SuspendedAbortingWithRefund:
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-credit.ts b/packages/taler-wallet-core/src/pay-peer-pull-credit.ts
@@ -1254,6 +1254,7 @@ export function computePeerPullCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.CreatePurse,
+ working: true,
};
case PeerPullPaymentCreditStatus.PendingMergeKycRequired:
if (pullCreditRecord.kycAccessToken != null) {
@@ -1265,6 +1266,7 @@ export function computePeerPullCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case PeerPullPaymentCreditStatus.SuspendedMergeKycRequired:
@@ -1277,6 +1279,7 @@ export function computePeerPullCreditTransactionState(
return {
major: TransactionMajorState.Suspended,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case PeerPullPaymentCreditStatus.PendingReady:
@@ -1292,6 +1295,7 @@ export function computePeerPullCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Withdraw,
+ working: true,
};
case PeerPullPaymentCreditStatus.SuspendedCreatePurse:
return {
@@ -1344,6 +1348,7 @@ export function computePeerPullCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
case PeerPullPaymentCreditStatus.SuspendedBalanceKycInit:
return {
diff --git a/packages/taler-wallet-core/src/pay-peer-pull-debit.ts b/packages/taler-wallet-core/src/pay-peer-pull-debit.ts
@@ -30,7 +30,6 @@ import {
HttpStatusCode,
Logger,
ObservabilityEventType,
- TalerPayPullUri,
PeerContractTerms,
PreparePeerPullDebitRequest,
PreparePeerPullDebitResponse,
@@ -42,6 +41,7 @@ import {
TalerError,
TalerErrorCode,
TalerErrorDetail,
+ TalerPayPullUri,
TalerPreciseTimestamp,
TalerUriAction,
TalerUris,
@@ -1045,6 +1045,7 @@ export function computePeerPullDebitTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Deposit,
+ working: true,
};
case PeerPullDebitRecordStatus.Done:
return {
@@ -1063,6 +1064,7 @@ export function computePeerPullDebitTransactionState(
return {
major: TransactionMajorState.Aborting,
minor: TransactionMinorState.Refresh,
+ working: true,
};
case PeerPullDebitRecordStatus.Failed:
return {
diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
@@ -1308,6 +1308,7 @@ export function computePeerPushCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Merge,
+ working: true,
};
case PeerPushCreditStatus.Done:
return {
@@ -1323,6 +1324,7 @@ export function computePeerPushCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case PeerPushCreditStatus.SuspendedMergeKycRequired:
@@ -1341,6 +1343,7 @@ export function computePeerPushCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Withdraw,
+ working: true,
};
case PeerPushCreditStatus.SuspendedMerge:
return {
@@ -1374,6 +1377,7 @@ export function computePeerPushCreditTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
case PeerPushCreditStatus.SuspendedBalanceKycInit:
return {
diff --git a/packages/taler-wallet-core/src/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/pay-peer-push-debit.ts
@@ -1255,6 +1255,7 @@ export function computePeerPushDebitTransactionState(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.CreatePurse,
+ working: true,
};
case PeerPushDebitStatus.PendingReady:
return {
@@ -1269,6 +1270,7 @@ export function computePeerPushDebitTransactionState(
return {
major: TransactionMajorState.Aborting,
minor: TransactionMinorState.DeletePurse,
+ working: true,
};
case PeerPushDebitStatus.SuspendedAbortingDeletePurse:
return {
diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts
@@ -1791,10 +1791,12 @@ export function computeRefreshTransactionState(
// Internal state, not shown to UI.
return {
major: TransactionMajorState.Pending,
+ working: true,
};
case RefreshOperationStatus.Pending:
return {
major: TransactionMajorState.Pending,
+ working: true,
};
case RefreshOperationStatus.SuspendedRedenominate:
// Internal state, not shown to UI.
diff --git a/packages/taler-wallet-core/src/tokenFamilies.ts b/packages/taler-wallet-core/src/tokenFamilies.ts
@@ -29,10 +29,10 @@ import {
MerchantInfo,
SubscriptionListDetail,
} from "@gnu-taler/taler-util";
-import { WalletExecutionContext } from "./index.js";
import { TokenRecord } from "./db.js";
-import { isTokenInUse, isTokenValid } from "./tokenSelection.js";
+import { WalletExecutionContext } from "./index.js";
import { expectProposalDownloadInTx } from "./pay-merchant.js";
+import { isTokenInUse, isTokenValid } from "./tokenSelection.js";
const logger = new Logger("tokenFamilies.ts");
@@ -166,8 +166,7 @@ export async function listDiscounts(
}
return {
- discounts: groupDiscounts(tokens,
- await getMerchantInfos(wex, tokens)),
+ discounts: groupDiscounts(tokens, await getMerchantInfos(wex, tokens)),
};
}
@@ -191,8 +190,10 @@ export async function listSubscriptions(
}
return {
- subscriptions: groupSubscriptions(tokens,
- await getMerchantInfos(wex, tokens)),
+ subscriptions: groupSubscriptions(
+ tokens,
+ await getMerchantInfos(wex, tokens),
+ ),
};
}
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
@@ -694,6 +694,7 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Withdraw,
+ working: true,
};
}
case WithdrawalGroupStatus.SuspendedRedenominate: {
@@ -711,11 +712,13 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.BankRegisterReserve,
+ working: true,
};
case WithdrawalGroupStatus.PendingReady:
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.Withdraw,
+ working: true,
};
case WithdrawalGroupStatus.PendingQueryingStatus:
return {
@@ -731,6 +734,7 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Aborting,
minor: TransactionMinorState.Bank,
+ working: true,
};
case WithdrawalGroupStatus.SuspendedAbortingBank:
return {
@@ -767,6 +771,7 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case WithdrawalGroupStatus.SuspendedKyc:
@@ -779,6 +784,7 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Suspended,
minor: TransactionMinorState.KycInit,
+ working: true,
};
}
case WithdrawalGroupStatus.FailedAbortingBank:
@@ -825,6 +831,7 @@ export function computeWithdrawalTransactionStatus(
return {
major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycInit,
+ working: true,
};
case WithdrawalGroupStatus.SuspendedBalanceKycInit:
return {