Eliminate all 103 errors and 96 warnings from the architecture validator: Phase 1 - Validator rules & YAML: - Add NAM-001/NAM-002 exceptions for module-scoped router/service files - Fix API-004 to detect # public comments on decorator lines - Add module-specific exception bases to EXC-004 valid_bases - Exclude storefront files from AUTH-004 store context check - Add SVC-006 exceptions for loyalty service atomic commits - Fix _get_rule() to search naming_rules and auth_rules categories - Use plain # CODE comments instead of # noqa: CODE for custom rules Phase 2 - Billing module (5 route files): - Move _resolve_store_to_merchant to subscription_service - Move tier/feature queries to feature_service, admin_subscription_service - Extract 22 inline Pydantic schemas to billing/schemas/billing.py - Replace all HTTPException with domain exceptions Phase 3 - Loyalty module (4 routes + points_service): - Add 7 domain exceptions (Apple auth, enrollment, device registration) - Add service methods to card_service, program_service, apple_wallet_service - Move all db.query() from routes to service layer - Fix SVC-001: replace HTTPException in points_service with domain exception Phase 4 - Remaining modules: - tenancy: move store stats queries to admin_service - cms: move platform resolution to content_page_service, add NoPlatformSubscriptionException - messaging: move user/customer lookups to messaging_service - Add ConfigDict(from_attributes=True) to ContentPageResponse Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
161 lines
4.8 KiB
Python
161 lines
4.8 KiB
Python
# app/modules/billing/schemas/__init__.py
|
|
"""
|
|
Billing module Pydantic schemas for API request/response validation.
|
|
|
|
This is the canonical location for billing schemas.
|
|
|
|
Usage:
|
|
from app.modules.billing.schemas import (
|
|
MerchantSubscriptionCreate,
|
|
MerchantSubscriptionResponse,
|
|
TierInfo,
|
|
)
|
|
"""
|
|
|
|
from app.modules.billing.schemas.billing import (
|
|
BillingHistoryListResponse,
|
|
# Billing History schemas
|
|
BillingHistoryResponse,
|
|
BillingHistoryWithMerchant,
|
|
# Store Checkout schemas
|
|
CancelRequest,
|
|
CancelResponse,
|
|
CategoryListResponse,
|
|
ChangeTierRequest as BillingChangeTierRequest,
|
|
ChangeTierResponse as BillingChangeTierResponse,
|
|
# Checkout & Portal schemas
|
|
CheckoutRequest,
|
|
CheckoutResponse,
|
|
FeatureCatalogResponse,
|
|
FeatureCodeListResponse,
|
|
# Feature Catalog schemas
|
|
FeatureDeclarationResponse,
|
|
FeatureDetailResponse,
|
|
FeatureGroupedResponse,
|
|
FeatureListResponse,
|
|
FeatureResponse,
|
|
InvoiceListResponse,
|
|
InvoiceResponse,
|
|
# Merchant Feature Override schemas
|
|
MerchantFeatureOverrideEntry,
|
|
MerchantFeatureOverrideResponse,
|
|
MerchantSubscriptionAdminCreate,
|
|
# Merchant Subscription Admin schemas
|
|
MerchantSubscriptionAdminResponse,
|
|
MerchantSubscriptionAdminUpdate,
|
|
MerchantSubscriptionListResponse,
|
|
MerchantSubscriptionWithMerchant,
|
|
PortalResponse,
|
|
PortalSessionResponse,
|
|
StoreFeatureCheckResponse,
|
|
# Stats schemas
|
|
SubscriptionStatsResponse,
|
|
SubscriptionStatusResponse,
|
|
SubscriptionTierBase,
|
|
SubscriptionTierCreate,
|
|
SubscriptionTierListResponse,
|
|
SubscriptionTierResponse,
|
|
SubscriptionTierUpdate,
|
|
TierListResponse,
|
|
TierResponse,
|
|
# Subscription Tier Admin schemas
|
|
TierFeatureLimitEntry,
|
|
UpcomingInvoiceResponse,
|
|
)
|
|
from app.modules.billing.schemas.subscription import (
|
|
ChangeTierRequest,
|
|
ChangeTierResponse,
|
|
FeatureCheckResponse,
|
|
# Feature summary schemas
|
|
FeatureSummaryResponse,
|
|
# Limit check schemas
|
|
LimitCheckResult,
|
|
MerchantPortalAvailableTiersResponse,
|
|
MerchantPortalInvoiceListResponse,
|
|
MerchantPortalSubscriptionDetailResponse,
|
|
# Merchant portal schemas
|
|
MerchantPortalSubscriptionItem,
|
|
MerchantPortalSubscriptionListResponse,
|
|
# Subscription schemas
|
|
MerchantSubscriptionCreate,
|
|
MerchantSubscriptionResponse,
|
|
MerchantSubscriptionStatusResponse,
|
|
MerchantSubscriptionUpdate,
|
|
# Tier schemas
|
|
TierFeatureLimitResponse,
|
|
TierInfo,
|
|
)
|
|
|
|
__all__ = [
|
|
# Tier schemas (subscription.py)
|
|
"TierFeatureLimitResponse",
|
|
"TierInfo",
|
|
# Subscription schemas (subscription.py)
|
|
"MerchantSubscriptionCreate",
|
|
"MerchantSubscriptionUpdate",
|
|
"MerchantSubscriptionResponse",
|
|
"MerchantSubscriptionStatusResponse",
|
|
# Feature summary schemas (subscription.py)
|
|
"FeatureSummaryResponse",
|
|
# Limit check schemas (subscription.py)
|
|
"LimitCheckResult",
|
|
"FeatureCheckResponse",
|
|
# Merchant portal schemas (subscription.py)
|
|
"MerchantPortalSubscriptionItem",
|
|
"MerchantPortalSubscriptionListResponse",
|
|
"MerchantPortalSubscriptionDetailResponse",
|
|
"MerchantPortalAvailableTiersResponse",
|
|
"ChangeTierRequest",
|
|
"ChangeTierResponse",
|
|
"MerchantPortalInvoiceListResponse",
|
|
# Subscription Tier Admin schemas (billing.py)
|
|
"TierFeatureLimitEntry",
|
|
"SubscriptionTierBase",
|
|
"SubscriptionTierCreate",
|
|
"SubscriptionTierUpdate",
|
|
"SubscriptionTierResponse",
|
|
"SubscriptionTierListResponse",
|
|
# Merchant Subscription Admin schemas (billing.py)
|
|
"MerchantSubscriptionAdminResponse",
|
|
"MerchantSubscriptionWithMerchant",
|
|
"MerchantSubscriptionListResponse",
|
|
"MerchantSubscriptionAdminCreate",
|
|
"MerchantSubscriptionAdminUpdate",
|
|
# Merchant Feature Override schemas (billing.py)
|
|
"MerchantFeatureOverrideEntry",
|
|
"MerchantFeatureOverrideResponse",
|
|
# Billing History schemas (billing.py)
|
|
"BillingHistoryResponse",
|
|
"BillingHistoryWithMerchant",
|
|
"BillingHistoryListResponse",
|
|
# Checkout & Portal schemas (billing.py)
|
|
"CheckoutRequest",
|
|
"CheckoutResponse",
|
|
"PortalSessionResponse",
|
|
"PortalResponse",
|
|
"CancelRequest",
|
|
"CancelResponse",
|
|
"UpcomingInvoiceResponse",
|
|
"BillingChangeTierRequest",
|
|
"BillingChangeTierResponse",
|
|
# Store subscription schemas (billing.py)
|
|
"SubscriptionStatusResponse",
|
|
"TierResponse",
|
|
"TierListResponse",
|
|
"InvoiceResponse",
|
|
"InvoiceListResponse",
|
|
# Store feature schemas (billing.py)
|
|
"FeatureCodeListResponse",
|
|
"FeatureResponse",
|
|
"FeatureListResponse",
|
|
"FeatureDetailResponse",
|
|
"CategoryListResponse",
|
|
"FeatureGroupedResponse",
|
|
"StoreFeatureCheckResponse",
|
|
# Stats schemas (billing.py)
|
|
"SubscriptionStatsResponse",
|
|
# Feature Catalog schemas (billing.py)
|
|
"FeatureDeclarationResponse",
|
|
"FeatureCatalogResponse",
|
|
]
|