commit 40db92d514984cfa62ce08096eb3569833ab641c
parent 80b8df965686ffcbbec2cfa09c6c48ee1756ff73
Author: Florian Dold <florian@dold.me>
Date: Thu, 4 Dec 2025 11:42:58 +0100
wallet-core: add new getTransactionsV2 filters
Diffstat:
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts b/packages/taler-util/src/types-taler-wallet-transactions.ts
@@ -158,8 +158,19 @@ export interface GetTransactionsV2Request {
* Filter transactions by their state / state category.
*
* If not specified, all transactions are returned.
- */
- filterByState?: "final" | "nonfinal" | "done";
+ *
+ * final: Transactions in any final state
+ * nonfinal: Transactions in any state but the final states
+ * nonfinal-dialog: nonfinal transactions that confirmation / some choice by the user
+ * nonfinal-approved: nonfinal transactions that need no further user approval
+ * done: Transactions in the "done" major state
+ */
+ filterByState?:
+ | "final"
+ | "nonfinal"
+ | "done"
+ | "nonfinal-approved"
+ | "nonfinal-dialog";
}
export interface TransactionState {
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
@@ -290,6 +290,9 @@ export const OPERATION_STATUS_NONFINAL_FIRST = 0x0100_0000;
*/
export const OPERATION_STATUS_NONFINAL_LAST = 0x0210_ffff;
+export const OPERATION_STATUS_DIALOG_FIRST = 0x0101_0000;
+export const OPERATION_STATUS_DIALOG_LAST = 0x0101_ffff;
+
export const OPERATION_STATUS_DONE_FIRST = 0x0500_0000;
export const OPERATION_STATUS_DONE_LAST = 0x0500_ffff;
diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts
@@ -51,6 +51,8 @@ import {
} from "./common.js";
import {
DbPreciseTimestamp,
+ OPERATION_STATUS_DIALOG_FIRST,
+ OPERATION_STATUS_DIALOG_LAST,
OPERATION_STATUS_DONE_FIRST,
OPERATION_STATUS_DONE_LAST,
OPERATION_STATUS_NONFINAL_FIRST,
@@ -222,10 +224,25 @@ function checkFilterIncludes(
mtx.status <= OPERATION_STATUS_NONFINAL_LAST
);
break;
+ case "nonfinal-approved":
+ case "nonfinal-dialog":
case "nonfinal":
included =
mtx.status >= OPERATION_STATUS_NONFINAL_FIRST &&
mtx.status <= OPERATION_STATUS_NONFINAL_LAST;
+ if (filter === "nonfinal-approved") {
+ included =
+ included &&
+ !(
+ mtx.status >= OPERATION_STATUS_DIALOG_FIRST &&
+ mtx.status <= OPERATION_STATUS_DIALOG_LAST
+ );
+ } else if (filter === "nonfinal-dialog") {
+ included =
+ included &&
+ mtx.status >= OPERATION_STATUS_DIALOG_FIRST &&
+ mtx.status <= OPERATION_STATUS_DIALOG_LAST;
+ }
break;
case undefined:
included = true;