pub fn ensure_status_one_of(
tx: &TransactionRepoModel,
expected: &[TransactionStatus],
operation: Option<&str>,
) -> Result<(), TransactionError>Expand description
Validates that a transaction is in one of the expected states.
This enforces state machine invariants for operations that are valid in multiple states (e.g., cancel, replace).
§Arguments
tx- The transaction to validateexpected- Slice of acceptable statusesoperation- Optional operation name for better error messages (e.g., “cancel_transaction”)
§Returns
Ok(()) if the status is one of the expected values, Err(TransactionError) otherwise