saving payment data
This commit is contained in:
Binary file not shown.
@@ -675,4 +675,54 @@ def update_pricing_plan_status(plan_id):
|
||||
|
||||
except Exception as e:
|
||||
db.session.rollback()
|
||||
return jsonify({'error': str(e)}), 500
|
||||
|
||||
@admin.route('/api/admin/pricing-plans', methods=['GET'])
|
||||
@login_required
|
||||
def get_pricing_plans():
|
||||
"""Get all active pricing plans for instance launch"""
|
||||
if not current_user.is_admin:
|
||||
return jsonify({'error': 'Unauthorized'}), 403
|
||||
|
||||
try:
|
||||
from models import PricingPlan
|
||||
|
||||
# Get all active pricing plans ordered by order_index
|
||||
plans = PricingPlan.query.filter_by(is_active=True).order_by(PricingPlan.order_index).all()
|
||||
|
||||
plans_data = []
|
||||
for plan in plans:
|
||||
plans_data.append({
|
||||
'id': plan.id,
|
||||
'name': plan.name,
|
||||
'description': plan.description,
|
||||
'monthly_price': plan.monthly_price,
|
||||
'annual_price': plan.annual_price,
|
||||
'features': plan.features,
|
||||
'button_text': plan.button_text,
|
||||
'button_url': plan.button_url,
|
||||
'is_popular': plan.is_popular,
|
||||
'is_custom': plan.is_custom,
|
||||
'is_active': plan.is_active,
|
||||
'order_index': plan.order_index,
|
||||
'room_quota': plan.room_quota,
|
||||
'conversation_quota': plan.conversation_quota,
|
||||
'storage_quota_gb': plan.storage_quota_gb,
|
||||
'manager_quota': plan.manager_quota,
|
||||
'admin_quota': plan.admin_quota,
|
||||
'format_quota_display': {
|
||||
'room_quota': plan.format_quota_display('room_quota'),
|
||||
'conversation_quota': plan.format_quota_display('conversation_quota'),
|
||||
'storage_quota_gb': plan.format_quota_display('storage_quota_gb'),
|
||||
'manager_quota': plan.format_quota_display('manager_quota'),
|
||||
'admin_quota': plan.format_quota_display('admin_quota')
|
||||
}
|
||||
})
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'plans': plans_data
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({'error': str(e)}), 500
|
||||
Reference in New Issue
Block a user