feat: admin force activation — skip order/wallet checks for BackOffice
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m12s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m12s
- Proto: add force_activation field to ActivateClubMembershipRequest - Command: add ForceActivation property - Handler: wrap steps 2-5 in ForceActivation guard - Skip PackagePurchaseMethod check (set to DirectPurchase if None) - Skip wallet balance check - Skip Magic wallet mode check - Skip UserOrder/Transaction validation - Proto NuGet bumped to 0.0.184
This commit is contained in:
+5
@@ -12,4 +12,9 @@ public record ActivateClubMembershipCommand : IRequest<bool>
|
||||
/// شناسه کاربر
|
||||
/// </summary>
|
||||
public long UserId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// فعالسازی اجباری توسط ادمین — بدون بررسی سفارش و کیفپول
|
||||
/// </summary>
|
||||
public bool ForceActivation { get; init; }
|
||||
}
|
||||
|
||||
+19
@@ -54,6 +54,9 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler<ActivateClub
|
||||
throw new NotFoundException(nameof(User), request.UserId);
|
||||
}
|
||||
|
||||
// 2-5: بررسیهای مالی — در حالت ForceActivation (ادمین) رد میشود
|
||||
if (!request.ForceActivation)
|
||||
{
|
||||
// 2. بررسی اینکه پکیج خریده باشد
|
||||
if (user.PackagePurchaseMethod == PackagePurchaseMethod.None)
|
||||
{
|
||||
@@ -143,6 +146,22 @@ public class ActivateClubMembershipCommandHandler : IRequestHandler<ActivateClub
|
||||
"تراکنش معتبر برای فعالسازی باشگاه یافت نشد"
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Force activation by admin for UserId: {UserId} — skipping order/wallet validation",
|
||||
request.UserId
|
||||
);
|
||||
|
||||
// در فعالسازی اجباری، اگر PackagePurchaseMethod تنظیم نشده، مقدار DirectPurchase بگذار
|
||||
if (user.PackagePurchaseMethod == PackagePurchaseMethod.None)
|
||||
{
|
||||
user.PackagePurchaseMethod = PackagePurchaseMethod.DirectPurchase;
|
||||
_context.Users.Update(user);
|
||||
await _context.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. بررسی عضویت فعلی
|
||||
var existingMembership = await _context.ClubMemberships
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.0.183</Version>
|
||||
<Version>0.0.184</Version>
|
||||
<DebugType>None</DebugType>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
|
||||
@@ -80,6 +80,7 @@ message ActivateClubMembershipRequest
|
||||
int64 package_id = 2;
|
||||
google.protobuf.StringValue activation_code = 3;
|
||||
int32 duration_months = 4;
|
||||
bool force_activation = 5;
|
||||
}
|
||||
|
||||
// Deactivate Command
|
||||
|
||||
Reference in New Issue
Block a user