Let a kroner transfer name the bank
This commit is contained in:
1 parent
9d306aca2a
commit
c382e3c278
1 file changed
+12
-11
@@ -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,16 +692,15 @@ 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"):
|
raise ApiError(
|
||||||
if tx[field] == bank_id:
|
400,
|
||||||
raise ApiError(
|
"Bankkontoen kan berre brukast av forvaltningskostnad og av ei "
|
||||||
400,
|
"overføring i kroner.",
|
||||||
"Bankkontoen kan berre brukast av forvaltningskostnad.",
|
"market_id",
|
||||||
field,
|
)
|
||||||
)
|
|
||||||
previous = None
|
previous = None
|
||||||
if tx_id is not None:
|
if tx_id is not None:
|
||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
|
|||||||
Reference in new issue
Block a user