Set CRM order status to PACKED after Checkbox accepts the receipt
- ExoCrmClient.set_status: live SetStatus needs {Orders: [id], Status} and
replies per order, unlike the documented {ID, Status}
- receipts.crm_status_set_at (migration 0006); set right after creation,
retried by cron, row-locked to avoid a repeat PACKED overwriting a newer status
- CRM errors under capitalized 'Errors' and non-JSON replies are reported
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,11 @@ _FIXTURE_ORDERS: list[dict] = [
|
||||
class StubCrmClient:
|
||||
def __init__(self, orders: list[dict] | None = None) -> None:
|
||||
self._orders = orders if orders is not None else _FIXTURE_ORDERS
|
||||
# order_id → статус, выставленный через set_status (для проверок в тестах).
|
||||
self.statuses: dict[str, str] = {}
|
||||
|
||||
async def set_status(self, *, order_id: str, status: str) -> None:
|
||||
self.statuses[order_id] = status
|
||||
|
||||
async def get_orders(self, *, status: str) -> list[OrderOut]:
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user