Only refuse when the bank is actually named

This commit is contained in:
ai-bot committed 2026-11-16 19:56:20 +00:00
1 parent 9f42c41673
commit 186ca16950
1 file changed
+5 -2
+5 -2
View File
@@ -700,14 +700,17 @@ class SkuldHandler(BaseHTTPRequestHandler):
raise ApiError(
400, "Forvaltningskostnad rører ingen parti.", "lot_picks"
)
if tx["type"] != "admin_cost" and not _may_name_bank(tx, _bank_market_id(conn)):
bank_id = _bank_market_id(conn)
names_bank = bank_id in (tx["market_id"], tx["to_market_id"])
if (tx["type"] != "admin_cost" and names_bank
and not _may_name_bank(tx, bank_id)):
# The bank is the counterparty of a cost, and a side of a kroner
# transfer, and nothing else (docs/spec.md section 3.11).
raise ApiError(
400,
"Bankkontoen kan berre brukast av forvaltningskostnad og av ei "
"overføring i kroner.",
"market_id",
"market_id" if tx["market_id"] == bank_id else "to_market_id",
)
previous = None
if tx_id is not None: