Let a kroner transfer name the bank

This commit is contained in:
ai-bot committed 2026-11-16 19:22:12 +00:00
1 parent 9d306aca2a
commit c382e3c278
1 file changed
+9 -8
+9 -8
View File
@@ -682,7 +682,9 @@ class SkuldHandler(BaseHTTPRequestHandler):
raise ApiError(400, error, "lot_picks") raise ApiError(400, error, "lot_picks")
conn = database.connect() conn = database.connect()
try: try:
tx, errors = validation.validate_transaction(body, _load_markets(conn)) tx, errors = validation.validate_transaction(
body, _load_markets(conn), _bank_market_id(conn)
)
if errors: if errors:
_raise_errors(errors) _raise_errors(errors)
if tx["type"] == "admin_cost" and picks: if tx["type"] == "admin_cost" and picks:
@@ -690,15 +692,14 @@ class SkuldHandler(BaseHTTPRequestHandler):
raise ApiError( raise ApiError(
400, "Forvaltningskostnad rører ingen parti.", "lot_picks" 400, "Forvaltningskostnad rører ingen parti.", "lot_picks"
) )
if tx["type"] != "admin_cost": if tx["type"] != "admin_cost" and not _may_name_bank(tx, _bank_market_id(conn)):
# The bank is only the counterparty of a cost (section 3.11). # The bank is the counterparty of a cost, and a side of a kroner
bank_id = _bank_market_id(conn) # transfer, and nothing else (docs/spec.md section 3.11).
for field in ("market_id", "to_market_id"):
if tx[field] == bank_id:
raise ApiError( raise ApiError(
400, 400,
"Bankkontoen kan berre brukast av forvaltningskostnad.", "Bankkontoen kan berre brukast av forvaltningskostnad og av ei "
field, "overføring i kroner.",
"market_id",
) )
previous = None previous = None
if tx_id is not None: if tx_id is not None: