Improve subcription support
This commit is contained in:
@@ -133,7 +133,7 @@ class SubscriptionRepository(TenantBaseRepository):
|
||||
) -> Optional[Subscription]:
|
||||
"""Update subscription plan and pricing"""
|
||||
try:
|
||||
valid_plans = ["basic", "professional", "enterprise"]
|
||||
valid_plans = ["starter", "professional", "enterprise"]
|
||||
if new_plan not in valid_plans:
|
||||
raise ValidationError(f"Invalid plan. Must be one of: {valid_plans}")
|
||||
|
||||
@@ -147,6 +147,7 @@ class SubscriptionRepository(TenantBaseRepository):
|
||||
"max_users": plan_config["max_users"],
|
||||
"max_locations": plan_config["max_locations"],
|
||||
"max_products": plan_config["max_products"],
|
||||
"features": plan_config.get("features", {}),
|
||||
"updated_at": datetime.utcnow()
|
||||
}
|
||||
|
||||
@@ -397,24 +398,56 @@ class SubscriptionRepository(TenantBaseRepository):
|
||||
def _get_plan_configuration(self, plan: str) -> Dict[str, Any]:
|
||||
"""Get configuration for a subscription plan"""
|
||||
plan_configs = {
|
||||
"basic": {
|
||||
"monthly_price": 29.99,
|
||||
"max_users": 2,
|
||||
"starter": {
|
||||
"monthly_price": 49.0,
|
||||
"max_users": 5, # Reasonable for small bakeries
|
||||
"max_locations": 1,
|
||||
"max_products": 50
|
||||
"max_products": 50,
|
||||
"features": {
|
||||
"inventory_management": "basic",
|
||||
"demand_prediction": "basic",
|
||||
"production_reports": "basic",
|
||||
"analytics": "basic",
|
||||
"support": "email",
|
||||
"trial_days": 14,
|
||||
"locations": "1_location"
|
||||
}
|
||||
},
|
||||
"professional": {
|
||||
"monthly_price": 79.99,
|
||||
"max_users": 10,
|
||||
"max_locations": 3,
|
||||
"max_products": 200
|
||||
"monthly_price": 129.0,
|
||||
"max_users": 15, # Good for growing bakeries
|
||||
"max_locations": 2,
|
||||
"max_products": -1, # Unlimited products
|
||||
"features": {
|
||||
"inventory_management": "advanced",
|
||||
"demand_prediction": "ai_92_percent",
|
||||
"production_management": "complete",
|
||||
"pos_integrated": True,
|
||||
"logistics": "basic",
|
||||
"analytics": "advanced",
|
||||
"support": "priority_24_7",
|
||||
"trial_days": 14,
|
||||
"locations": "1_2_locations"
|
||||
}
|
||||
},
|
||||
"enterprise": {
|
||||
"monthly_price": 199.99,
|
||||
"max_users": 50,
|
||||
"max_locations": 10,
|
||||
"max_products": 1000
|
||||
"monthly_price": 399.0,
|
||||
"max_users": -1, # Unlimited users
|
||||
"max_locations": -1, # Unlimited locations
|
||||
"max_products": -1, # Unlimited products
|
||||
"features": {
|
||||
"inventory_management": "multi_location",
|
||||
"demand_prediction": "ai_personalized",
|
||||
"production_optimization": "capacity",
|
||||
"erp_integration": True,
|
||||
"logistics": "advanced",
|
||||
"analytics": "predictive",
|
||||
"api_access": "personalized",
|
||||
"account_manager": True,
|
||||
"demo": "personalized",
|
||||
"locations": "unlimited_obradores"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return plan_configs.get(plan, plan_configs["basic"])
|
||||
return plan_configs.get(plan, plan_configs["starter"])
|
||||
Reference in New Issue
Block a user