fix: exibição do plano
Some checks failed
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Blocked by required conditions
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Blocked by required conditions
BCards Deployment Pipeline / Cleanup Old Resources (push) Blocked by required conditions
BCards Deployment Pipeline / Deployment Summary (push) Blocked by required conditions
BCards Deployment Pipeline / Run Tests (push) Successful in 1s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Has been cancelled
Some checks failed
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Blocked by required conditions
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Blocked by required conditions
BCards Deployment Pipeline / Cleanup Old Resources (push) Blocked by required conditions
BCards Deployment Pipeline / Deployment Summary (push) Blocked by required conditions
BCards Deployment Pipeline / Run Tests (push) Successful in 1s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Has been cancelled
This commit is contained in:
parent
dde67df72f
commit
90a1ee2bfb
@ -60,7 +60,13 @@ public class AdminController : Controller
|
||||
if (user == null)
|
||||
return RedirectToAction("Login", "Auth");
|
||||
|
||||
_logger.LogInformation("[DASHBOARD DEBUG] User {UserId} ({Email}) - CurrentPlan: '{CurrentPlan}'",
|
||||
user.Id, user.Email, user.CurrentPlan ?? "NULL");
|
||||
|
||||
var userPlanType = Enum.TryParse<PlanType>(user.CurrentPlan, true, out var planType) ? planType : PlanType.Trial;
|
||||
|
||||
_logger.LogInformation("[DASHBOARD DEBUG] Parsed PlanType: {PlanType} (from '{CurrentPlan}')",
|
||||
userPlanType, user.CurrentPlan ?? "NULL");
|
||||
var userPages = await _userPageService.GetUserPagesAsync(user.Id);
|
||||
|
||||
var listCounts = new Dictionary<string, dynamic>();
|
||||
|
||||
@ -443,6 +443,15 @@ public class StripeWebhookController : ControllerBase
|
||||
await _subscriptionRepository.CreateAsync(newSubscription);
|
||||
_logger.LogInformation($"[TID: {traceId}] - Created new subscription {newSubscription.Id} for user {user.Id}");
|
||||
|
||||
// 🔥 CORREÇÃO: Update user's CurrentPlan
|
||||
_logger.LogInformation($"[TID: {traceId}] - Updating user {user.Id} CurrentPlan from '{user.CurrentPlan}' to '{planType}'");
|
||||
user.CurrentPlan = planType;
|
||||
user.UpdatedAt = DateTime.UtcNow;
|
||||
|
||||
var usersCollection = mongoDatabase.GetCollection<Models.User>("users");
|
||||
await usersCollection.ReplaceOneAsync(u => u.Id == user.Id, user);
|
||||
_logger.LogInformation($"[TID: {traceId}] - User {user.Id} CurrentPlan updated to '{planType}'");
|
||||
|
||||
// Activate user pages that were pending payment or expired
|
||||
var userPages = await _userPageService.GetUserPagesAsync(user.Id);
|
||||
foreach (var page in userPages.Where(p =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user