Count transactions grouped by method, scoped to the given statuses
(e.g. ["PROCESSING"] for in-flight / stuck transactions). Returns
one entry per method that has at least one matching row; methods
with zero matches are omitted. Order is unspecified — callers sort.
Fetch a single transaction, optionally pinned to a specific leg. Delegates
to search (a pageSize: 1 lookup) instead of running its own query,
so the UNION, enrichment JOINs, and row mapper stay defined in exactly one
place.
A transaction id is NOT unique on its own — one id spans CREDIT/DEBIT
legs, fee/return sub-rows, and (admin-wide) multiple customer audiences (a
card txn's cardholder leg and issuer leg share id+type but belong to
different customers; see Transaction.id). The read model's unique
key is the (id, type, subType, customerId) tuple — pass whichever parts
the caller knows to land on the exact row. With only id, returns whichever
leg sorts first (default newest createdAt), which is enough for id-scoped
state checks like on-chain settlement (per-transaction, leg-agnostic).
OptionalcustomerId?: stringNarrow to a single customer audience of the transaction.
Optionalid?: stringTransaction id; optional when pinning by the exact Transaction.key.
Optionalkey?: stringExact unique-identity Transaction.key (id-type-subType). When
set it resolves the single matching row directly via
search({ keys: [key] }), superseding the tuple params below.
OptionalsubType?: "RETURN" | "FEE" | "CLEARING" | nullSub-row selector, mirroring search's subtypes tri-state: a
value matches that sub-row (FEE / RETURN), null matches the main
(non-subtyped) leg, and undefined doesn't filter on sub-row.
Optionaltype?: "CREDIT" | "DEBIT"Narrow to the CREDIT or DEBIT leg.
Returns the base UNION query (all selects enabled) as a SQL string with params. Debug aid for reproducing prod search behaviour by hand.
Read-only query services to fetch normalised transactions across all products
If you need more info about a transaction, fetch it using its specific service. Transaction Service will remain generic and high-level.