Replace hardcoded subscription fields (orders_limit, products_limit,
team_members_limit) across 5 frontend pages with dynamic feature
provider APIs. Add admin convenience endpoint for store subscription
lookup. Remove legacy stubs (StoreSubscription, FeatureCode, Feature,
TIER_LIMITS, FeatureInfo, FeatureUpgradeInfo) and schema aliases.
Pages updated:
- Admin subscriptions: dynamic feature overrides editor
- Admin tiers: correct feature catalog/limits API URLs
- Store billing: usage metrics from /store/billing/usage
- Merchant subscription detail: tier.feature_limits rendering
- Admin store detail: new GET /admin/subscriptions/store/{id} endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
106 lines
3.2 KiB
Python
106 lines
3.2 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.subscription import (
|
|
# Tier schemas
|
|
TierFeatureLimitResponse,
|
|
TierInfo,
|
|
# Subscription schemas
|
|
MerchantSubscriptionCreate,
|
|
MerchantSubscriptionUpdate,
|
|
MerchantSubscriptionResponse,
|
|
MerchantSubscriptionStatusResponse,
|
|
# Feature summary schemas
|
|
FeatureSummaryResponse,
|
|
# Limit check schemas
|
|
LimitCheckResult,
|
|
FeatureCheckResponse,
|
|
)
|
|
from app.modules.billing.schemas.billing import (
|
|
# Subscription Tier Admin schemas
|
|
TierFeatureLimitEntry,
|
|
SubscriptionTierBase,
|
|
SubscriptionTierCreate,
|
|
SubscriptionTierUpdate,
|
|
SubscriptionTierResponse,
|
|
SubscriptionTierListResponse,
|
|
# Merchant Subscription Admin schemas
|
|
MerchantSubscriptionAdminResponse,
|
|
MerchantSubscriptionWithMerchant,
|
|
MerchantSubscriptionListResponse,
|
|
MerchantSubscriptionAdminCreate,
|
|
MerchantSubscriptionAdminUpdate,
|
|
# Merchant Feature Override schemas
|
|
MerchantFeatureOverrideEntry,
|
|
MerchantFeatureOverrideResponse,
|
|
# Billing History schemas
|
|
BillingHistoryResponse,
|
|
BillingHistoryWithMerchant,
|
|
BillingHistoryListResponse,
|
|
# Checkout & Portal schemas
|
|
CheckoutRequest,
|
|
CheckoutResponse,
|
|
PortalSessionResponse,
|
|
# Stats schemas
|
|
SubscriptionStatsResponse,
|
|
# Feature Catalog schemas
|
|
FeatureDeclarationResponse,
|
|
FeatureCatalogResponse,
|
|
)
|
|
|
|
__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",
|
|
# 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",
|
|
# Stats schemas (billing.py)
|
|
"SubscriptionStatsResponse",
|
|
# Feature Catalog schemas (billing.py)
|
|
"FeatureDeclarationResponse",
|
|
"FeatureCatalogResponse",
|
|
]
|