From fbfbbd168e39bb4de4bb91b6b2d30b990b241dec Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 14 Nov 2026 18:01:26 +0000 Subject: [PATCH] Let admin_cost have no account and check the type rules in order --- validation.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/validation.py b/validation.py index 68f6331..e67b662 100644 --- a/validation.py +++ b/validation.py @@ -231,11 +231,17 @@ def validate_transaction(payload, markets): errors["type"] = error transaction["type"] = tx_type - market_id, error = validate_market_id(data.get("market_id"), markets) - if error: - errors["market_id"] = error + market_id = None + if tx_type == "admin_cost": + # admin_cost stands on its own, so there is no account to look up. + market_id = None + else: + market_id, error = validate_market_id(data.get("market_id"), markets) + if error: + errors["market_id"] = error transaction["market_id"] = market_id + # The flag defaults from the account; admin_cost has none, so it defaults to 1. account = markets.get(market_id) if market_id is not None else None taxable = _boolean(data.get("taxable"), account["taxable"] if account else 1) if taxable is None: