refactor: migrate vendor billing, invoices, payments to module auto-discovery
Billing module: - Create vendor_checkout.py (checkout, portal, cancel, reactivate, change-tier) - Create vendor_addons.py (addon management routes) - Update vendor.py to aggregate new routers Orders module: - Create vendor_invoices.py (invoice settings, CRUD, PDF generation) - Update vendor.py to aggregate invoices router Payments module: - Restructure routes from routes/ to routes/api/ - Add require_module_access dependency - Set is_self_contained=True for auto-discovery Remove legacy files: - app/api/v1/vendor/billing.py - app/api/v1/vendor/invoices.py - app/api/v1/vendor/payments.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
18
app/api/v1/vendor/__init__.py
vendored
18
app/api/v1/vendor/__init__.py
vendored
@@ -15,13 +15,14 @@ For multi-tenant apps, module enablement is checked at request time
|
||||
based on platform context (not at route registration time).
|
||||
|
||||
Self-contained modules (auto-discovered from app/modules/{module}/routes/api/vendor.py):
|
||||
- billing: Subscription tiers, vendor billing, invoices
|
||||
- billing: Subscription tiers, vendor billing, checkout, add-ons, features
|
||||
- inventory: Stock management, inventory tracking
|
||||
- orders: Order management, fulfillment, exceptions
|
||||
- orders: Order management, fulfillment, exceptions, invoices
|
||||
- marketplace: Letzshop integration, product sync
|
||||
- catalog: Vendor product catalog management
|
||||
- cms: Content pages management
|
||||
- customers: Customer management
|
||||
- payments: Payment configuration, Stripe connect, transactions
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
@@ -30,18 +31,14 @@ from fastapi import APIRouter
|
||||
from . import (
|
||||
analytics,
|
||||
auth,
|
||||
billing,
|
||||
dashboard,
|
||||
email_settings,
|
||||
email_templates,
|
||||
features,
|
||||
info,
|
||||
invoices,
|
||||
media,
|
||||
messages,
|
||||
notifications,
|
||||
onboarding,
|
||||
payments,
|
||||
profile,
|
||||
settings,
|
||||
team,
|
||||
@@ -71,17 +68,14 @@ router.include_router(email_templates.router, tags=["vendor-email-templates"])
|
||||
router.include_router(email_settings.router, tags=["vendor-email-settings"])
|
||||
router.include_router(onboarding.router, tags=["vendor-onboarding"])
|
||||
|
||||
# Business operations (with prefixes: /invoices/*, /team/*)
|
||||
router.include_router(invoices.router, tags=["vendor-invoices"])
|
||||
# Business operations (with prefixes: /team/*)
|
||||
router.include_router(team.router, tags=["vendor-team"])
|
||||
|
||||
# Services (with prefixes: /payments/*, /media/*, etc.)
|
||||
router.include_router(payments.router, tags=["vendor-payments"])
|
||||
# Services (with prefixes: /media/*, etc.)
|
||||
router.include_router(media.router, tags=["vendor-media"])
|
||||
router.include_router(notifications.router, tags=["vendor-notifications"])
|
||||
router.include_router(messages.router, tags=["vendor-messages"])
|
||||
router.include_router(analytics.router, tags=["vendor-analytics"])
|
||||
router.include_router(features.router, tags=["vendor-features"])
|
||||
router.include_router(usage.router, tags=["vendor-usage"])
|
||||
|
||||
|
||||
@@ -89,7 +83,7 @@ router.include_router(usage.router, tags=["vendor-usage"])
|
||||
# Auto-discovered Module Routes
|
||||
# ============================================================================
|
||||
# Routes from self-contained modules are auto-discovered and registered.
|
||||
# Modules include: billing, inventory, orders, marketplace, cms, customers
|
||||
# Modules include: billing, inventory, orders, marketplace, cms, customers, payments
|
||||
# Routes are sorted by priority, so catch-all routes (CMS) come last.
|
||||
|
||||
from app.modules.routes import get_vendor_api_routes
|
||||
|
||||
Reference in New Issue
Block a user