People: human wallets, signup grant, payments between people and agents #7
@ -10,6 +10,13 @@ from coffer.units import ACCOUNT_COFFER, agent_account, human_account, to_subuni
|
||||
ACCOUNT_ESCROW = "company:coffer-escrow" # held credit for orders waiting for review
|
||||
MAX_PENDING_ORDERS_PER_ACCOUNT = 2
|
||||
ORDER_REVIEWERS = frozenset({"agent:leora"}) # the operator; only it accepts or rejects orders
|
||||
|
||||
|
||||
def order_reviewers() -> frozenset[str]:
|
||||
"""The operator account(s). A deployment with a different operator sets COFFER_ORDER_REVIEWERS."""
|
||||
import os
|
||||
extra = {a.strip() for a in os.environ.get("COFFER_ORDER_REVIEWERS", "").split(",") if a.strip()}
|
||||
return frozenset(extra) if extra else ORDER_REVIEWERS
|
||||
ORDER_REVIEW_NOTICE = ("Your order is waiting for confirmation. We review every order and accept or reject it "
|
||||
"based on stock and volume. If it's rejected, your credits are released in full.")
|
||||
|
||||
@ -181,7 +188,7 @@ class Store:
|
||||
return sum(o.held for o in self.pending_orders(buyer_id))
|
||||
|
||||
def _review(self, order_id: str, actor: str) -> Order:
|
||||
if actor not in ORDER_REVIEWERS:
|
||||
if actor not in order_reviewers():
|
||||
raise NotAReviewer(actor)
|
||||
order = self.orders.get(order_id)
|
||||
if order is None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user