feat: Update payment processing and callback mechanisms
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m22s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m22s
- Refactor ActivateClubMembershipCommandHandler to use UserPackagePurchases instead of UserOrders for package activation. - Modify PlaceOrderCommandHandler to redirect payment callbacks to the front office. - Update ChargeDiscountWalletCommandHandler and ChargeMagicWalletCommandHandler to direct payment callbacks to the front office. - Remove PaymentCallbackController and integrate payment verification directly into DiscountOrderService and UserWalletService. - Add CustomerVerifyDiscountOrderPayment RPC to DiscountOrderService for verifying discount order payments. - Implement VerifyMagicCharge and VerifyDiscountCharge methods in UserWalletService for wallet charge verifications. - Update appsettings.json to use local URLs for development. - Remove appsettings.Development.json as it is no longer needed. - Comment out history tracking methods in ClubMembershipCycle and Package classes. - Update PackageService to automatically activate club membership after successful payment verification. - Adjust UserService to generate JWT tokens with user details.
This commit is contained in:
@@ -35,6 +35,7 @@ public class UserService : UserContract.UserContractBase
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
private readonly IHashService _hashService;
|
||||
private readonly CMSMicroservice.Application.Common.FileManager.IFileManager _fileManager;
|
||||
private readonly IGenerateJwtToken _generateJwt;
|
||||
|
||||
public UserService(
|
||||
IDispatchRequestToCQRS dispatchRequestToCQRS,
|
||||
@@ -42,7 +43,8 @@ public class UserService : UserContract.UserContractBase
|
||||
IApplicationDbContext context,
|
||||
ICurrentUserService currentUserService,
|
||||
IHashService hashService,
|
||||
CMSMicroservice.Application.Common.FileManager.IFileManager fileManager)
|
||||
CMSMicroservice.Application.Common.FileManager.IFileManager fileManager,
|
||||
IGenerateJwtToken generateJwt)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
_sender = sender;
|
||||
@@ -50,6 +52,7 @@ public class UserService : UserContract.UserContractBase
|
||||
_currentUserService = currentUserService;
|
||||
_hashService = hashService;
|
||||
_fileManager = fileManager;
|
||||
_generateJwt = generateJwt;
|
||||
}
|
||||
public override async Task<CreateNewUserResponse> CreateNewUser(CreateNewUserRequest request, ServerCallContext context)
|
||||
{
|
||||
@@ -115,12 +118,20 @@ public class UserService : UserContract.UserContractBase
|
||||
|
||||
var user = await _context.Users
|
||||
.AsNoTracking()
|
||||
.Include(u => u.UserContracts)
|
||||
.ThenInclude(uc => uc.Contract)
|
||||
.Include(u => u.UserRoles)
|
||||
.ThenInclude(ur => ur.Role)
|
||||
.Include(u => u.ClubMembership)
|
||||
.Where(u => u.Id == userId && !u.IsDeleted)
|
||||
.FirstOrDefaultAsync(context.CancellationToken);
|
||||
|
||||
if (user == null)
|
||||
throw new RpcException(new Status(StatusCode.NotFound, "کاربر یافت نشد"));
|
||||
|
||||
// تولید توکن JWT با آخرین اطلاعات کاربر
|
||||
var token = await _generateJwt.GenerateJwtToken(user);
|
||||
|
||||
return new GetUserForCustomerResponse
|
||||
{
|
||||
Id = user.Id,
|
||||
@@ -141,7 +152,8 @@ public class UserService : UserContract.UserContractBase
|
||||
PushNotifications = user.PushNotifications,
|
||||
BirthDate = user.BirthDate.HasValue
|
||||
? Timestamp.FromDateTime(DateTime.SpecifyKind(user.BirthDate.Value, DateTimeKind.Utc))
|
||||
: null
|
||||
: null,
|
||||
Token = token
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user