Enhance billing and subscription management: Added payment method checks in ProtectedRoute, improved error handling in billing components, and optimized API calls to reduce throttling. Updated user account handling in various components to ensure accurate plan and subscription data display.
This commit is contained in:
@@ -182,6 +182,16 @@ class PaymentService:
|
||||
if payment.metadata.get('credit_package_id'):
|
||||
PaymentService._add_credits_for_payment(payment)
|
||||
|
||||
# If account is inactive/suspended/trial, activate it on successful payment
|
||||
try:
|
||||
account = payment.account
|
||||
if account and account.status != 'active':
|
||||
account.status = 'active'
|
||||
account.save(update_fields=['status', 'updated_at'])
|
||||
except Exception:
|
||||
# Do not block payment approval if status update fails
|
||||
pass
|
||||
|
||||
return payment
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user