feat: 实现受控真实下单安全边界 (#99)
This commit is contained in:
@@ -21,6 +21,8 @@ class PurchasePageState:
|
||||
quantity: int = 0
|
||||
price_cent: int = 0
|
||||
candidate_count: int = 1
|
||||
in_stock: bool = True
|
||||
submit_candidate_count: int = 0
|
||||
|
||||
|
||||
class PddPurchaseError(RuntimeError):
|
||||
@@ -73,3 +75,11 @@ class PddPurchaseAdapter(ABC):
|
||||
@abstractmethod
|
||||
def close(self) -> None:
|
||||
"""释放设备会话;不得在此方法中产生页面点击。"""
|
||||
|
||||
|
||||
class PddLivePurchaseAdapter(PddPurchaseAdapter):
|
||||
"""受控真实采购接口;只增加一次性提交,不提供付款或取消。"""
|
||||
|
||||
@abstractmethod
|
||||
def submit_order_once(self) -> None:
|
||||
"""用最新页面状态确认唯一按钮并单击一次;调用后禁止重试。"""
|
||||
|
||||
Reference in New Issue
Block a user