Files
orion/app/modules/checkout/definition.py
Samir Boulahtit f20266167d
Some checks failed
CI / ruff (push) Failing after 7s
CI / pytest (push) Failing after 1s
CI / architecture (push) Failing after 9s
CI / dependency-scanning (push) Successful in 27s
CI / audit (push) Successful in 8s
CI / docs (push) Has been skipped
fix(lint): auto-fix ruff violations and tune lint rules
- Auto-fixed 4,496 lint issues (import sorting, modern syntax, etc.)
- Added ignore rules for patterns intentional in this codebase:
  E402 (late imports), E712 (SQLAlchemy filters), B904 (raise from),
  SIM108/SIM105/SIM117 (readability preferences)
- Added per-file ignores for tests and scripts
- Excluded broken scripts/rename_terminology.py (has curly quotes)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 23:10:42 +01:00

71 lines
2.3 KiB
Python

# app/modules/checkout/definition.py
"""
Checkout module definition.
This module handles the checkout flow, converting cart contents into orders.
Orchestrates payment processing and order creation.
"""
from app.modules.base import ModuleDefinition, PermissionDefinition
# =============================================================================
# Router Lazy Imports
# =============================================================================
def _get_storefront_router():
"""Lazy import of storefront router to avoid circular imports."""
from app.modules.checkout.routes.api.storefront import router
return router
# Checkout module definition
checkout_module = ModuleDefinition(
code="checkout",
name="Checkout",
description="Checkout and order creation for storefronts",
version="1.0.0",
is_self_contained=True,
requires=["cart", "orders", "payments", "customers"],
features=[
"checkout_flow", # Multi-step checkout process
"order_creation", # Create orders from cart
"payment_processing", # Payment integration during checkout
"checkout_validation", # Address, inventory, payment validation
"guest_checkout", # Allow checkout without account
],
# Note: Checkout is primarily storefront functionality.
# These permissions are for admin access to checkout settings.
permissions=[
PermissionDefinition(
id="checkout.view_settings",
label_key="checkout.permissions.view_settings",
description_key="checkout.permissions.view_settings_desc",
category="checkout",
),
PermissionDefinition(
id="checkout.manage_settings",
label_key="checkout.permissions.manage_settings",
description_key="checkout.permissions.manage_settings_desc",
category="checkout",
),
],
# Checkout is storefront-only - no admin/store menus needed
menu_items={},
)
def get_checkout_module_with_routers() -> ModuleDefinition:
"""
Get checkout module with routers attached.
This function attaches the routers lazily to avoid circular imports
during module initialization.
"""
checkout_module.storefront_router = _get_storefront_router()
return checkout_module
__all__ = ["checkout_module", "get_checkout_module_with_routers"]