feat: Implement Commission and Network Statistics Pages with DTOs and Services
- Added CommissionDashboardPage and CommissionHistoryPage for displaying commission payouts and history. - Implemented WeeklyBalancePage to show weekly balance details. - Created NetworkStatisticsPage to display network statistics and tree structure. - Developed corresponding services (CommissionService, NetworkMembershipService) for data retrieval. - Introduced DTOs for Commission and Network data structures (CommissionPayoutDto, WeeklyBalanceDto, NetworkStatisticsDto). - Added mock data generation for testing purposes in services. - Enhanced UI with MudBlazor components for better user experience.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
namespace FrontOffice.Main.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Service for Club Membership operations
|
||||
/// TODO: Connect to FrontOffice.BFF gRPC ClubMembershipCQ
|
||||
/// </summary>
|
||||
public class ClubMembershipService
|
||||
{
|
||||
// TODO: Inject gRPC client when FrontOffice connects to BFF
|
||||
// private readonly ClubMembershipContract.ClubMembershipContractClient _client;
|
||||
|
||||
public ClubMembershipService()
|
||||
{
|
||||
// TODO: Initialize gRPC client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current user's club membership status
|
||||
/// Maps to: ClubMembershipCQ.GetMyClubMembership
|
||||
/// </summary>
|
||||
public async Task<ClubMembershipDto> GetMyMembershipAsync()
|
||||
{
|
||||
// TODO: Replace with actual gRPC call to BFF
|
||||
// var request = new GetMyClubMembershipRequest();
|
||||
// var response = await _client.GetMyClubMembershipAsync(request);
|
||||
// return MapToDto(response);
|
||||
|
||||
await Task.Delay(500); // Simulate network delay
|
||||
|
||||
// Mock data for now
|
||||
return new ClubMembershipDto
|
||||
{
|
||||
UserId = 1,
|
||||
IsActive = false,
|
||||
Status = "Inactive",
|
||||
DaysRemaining = null
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activate or renew club membership
|
||||
/// Maps to: ClubMembershipCQ.ActivateMyClubMembership
|
||||
/// </summary>
|
||||
public async Task<ClubActivationResponseDto> ActivateMembershipAsync(
|
||||
long packageId,
|
||||
string? activationCode,
|
||||
int durationMonths)
|
||||
{
|
||||
// TODO: Replace with actual gRPC call to BFF
|
||||
// var request = new ActivateMyClubMembershipRequest
|
||||
// {
|
||||
// PackageId = packageId,
|
||||
// ActivationCode = activationCode ?? string.Empty,
|
||||
// DurationMonths = durationMonths
|
||||
// };
|
||||
// var response = await _client.ActivateMyClubMembershipAsync(request);
|
||||
// return MapToDto(response);
|
||||
|
||||
await Task.Delay(1000); // Simulate network delay
|
||||
|
||||
// Mock successful activation
|
||||
return new ClubActivationResponseDto
|
||||
{
|
||||
Success = true,
|
||||
Message = "عضویت با موفقیت فعال شد",
|
||||
ActivationDate = DateTime.Now,
|
||||
AmountPaid = 56_000_000 * durationMonths
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user