- 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>
63 lines
1.9 KiB
Python
63 lines
1.9 KiB
Python
# app/modules/billing/routes/pages/store.py
|
|
"""
|
|
Billing Store Page Routes (HTML rendering).
|
|
|
|
Store pages for billing management:
|
|
- Billing dashboard
|
|
- Invoices
|
|
"""
|
|
|
|
from fastapi import APIRouter, Depends, Path, Request
|
|
from fastapi.responses import HTMLResponse
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.api.deps import get_current_store_from_cookie_or_header, get_db
|
|
from app.modules.core.utils.page_context import get_store_context
|
|
from app.modules.tenancy.models import User
|
|
from app.templates_config import templates
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
# ============================================================================
|
|
# BILLING ROUTES
|
|
# ============================================================================
|
|
|
|
|
|
@router.get(
|
|
"/{store_code}/billing", response_class=HTMLResponse, include_in_schema=False
|
|
)
|
|
async def store_billing_page(
|
|
request: Request,
|
|
store_code: str = Path(..., description="Store code"),
|
|
current_user: User = Depends(get_current_store_from_cookie_or_header),
|
|
db: Session = Depends(get_db),
|
|
):
|
|
"""
|
|
Render billing and subscription management page.
|
|
JavaScript loads subscription status, tiers, and invoices via API.
|
|
"""
|
|
return templates.TemplateResponse(
|
|
"billing/store/billing.html",
|
|
get_store_context(request, db, current_user, store_code),
|
|
)
|
|
|
|
|
|
@router.get(
|
|
"/{store_code}/invoices", response_class=HTMLResponse, include_in_schema=False
|
|
)
|
|
async def store_invoices_page(
|
|
request: Request,
|
|
store_code: str = Path(..., description="Store code"),
|
|
current_user: User = Depends(get_current_store_from_cookie_or_header),
|
|
db: Session = Depends(get_db),
|
|
):
|
|
"""
|
|
Render invoices management page.
|
|
JavaScript loads invoices via API.
|
|
"""
|
|
return templates.TemplateResponse(
|
|
"orders/store/invoices.html",
|
|
get_store_context(request, db, current_user, store_code),
|
|
)
|