fix(billing): complete billing module — fix tier change, platform support, merchant portal
- Fix admin tier change: resolve tier_code→tier_id in update_subscription(), delegate to billing_service.change_tier() for Stripe-connected subs - Add platform support to admin tiers page: platform column, filter dropdown, platform selector in create/edit modal, platform_name in tier API response - Filter used platforms in create subscription modal on merchant detail page - Enrich merchant portal API responses with tier code, tier_name, platform_name - Add eager-load of platform relationship in get_merchant_subscription() - Remove stale store_name/store_code references from merchant templates - Add merchant tier change endpoint (POST /change-tier) and tier selector UI replacing broken requestUpgrade() button - Fix subscription detail link to use platform_id instead of sub.id Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,8 +59,17 @@ def list_subscription_tiers(
|
||||
"""List all subscription tiers."""
|
||||
tiers = admin_subscription_service.get_tiers(db, include_inactive=include_inactive, platform_id=platform_id)
|
||||
|
||||
from app.modules.tenancy.models import Platform
|
||||
|
||||
platforms_map = {p.id: p.name for p in db.query(Platform).all()}
|
||||
tiers_response = []
|
||||
for t in tiers:
|
||||
resp = SubscriptionTierResponse.model_validate(t)
|
||||
resp.platform_name = platforms_map.get(t.platform_id) if t.platform_id else None
|
||||
tiers_response.append(resp)
|
||||
|
||||
return SubscriptionTierListResponse(
|
||||
tiers=[SubscriptionTierResponse.model_validate(t) for t in tiers],
|
||||
tiers=tiers_response,
|
||||
total=len(tiers),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user