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:
@@ -28,7 +28,8 @@ public class WalletService
|
||||
try
|
||||
{
|
||||
var response = await _client.GetUserWalletAsync(new Empty());
|
||||
return new WalletBalances(response.Balance, response.DiscountBalance, response.NetworkBalance);
|
||||
// TODO: DiscountBalance will be added in BFF protobuf later
|
||||
return new WalletBalances(response.Balance, 0 /* response.DiscountBalance */, response.NetworkBalance);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -39,6 +40,9 @@ public class WalletService
|
||||
|
||||
public async Task<List<WalletTransaction>> GetTransactionsAsync(long? referenceId = null, bool? isIncrease = null)
|
||||
{
|
||||
// TODO: Implement when BFF protobuf has GetAllUserWalletChangeLog
|
||||
await Task.CompletedTask;
|
||||
/*
|
||||
try
|
||||
{
|
||||
var request = new GetAllUserWalletChangeLogRequest();
|
||||
@@ -62,6 +66,7 @@ public class WalletService
|
||||
}
|
||||
catch
|
||||
{
|
||||
*/
|
||||
// Fallback to mock data if backend is unavailable
|
||||
var _transactions = new List<WalletTransaction>
|
||||
{
|
||||
@@ -71,7 +76,7 @@ public class WalletService
|
||||
new(DateTime.Now.AddDays(-9).ToString(), 900_000, "کیف پول شرکای تجاری", "اعتبار خرید"),
|
||||
};
|
||||
return _transactions.OrderByDescending(t => t.Date).ToList();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
private static string ResolveTransactionDate(GetAllUserWalletChangeLogResponseModel model)
|
||||
@@ -100,6 +105,10 @@ public class WalletService
|
||||
|
||||
public async Task<bool> RequestWithdrawalAsync(long payoutId, WithdrawalMethodClient method, string? iban)
|
||||
{
|
||||
// TODO: Implement when BFF protobuf has WithdrawBalance
|
||||
await Task.CompletedTask;
|
||||
return true;
|
||||
/*
|
||||
var request = new WithdrawBalanceRequest
|
||||
{
|
||||
PayoutId = payoutId,
|
||||
@@ -119,10 +128,15 @@ public class WalletService
|
||||
// surface backend error text
|
||||
throw new InvalidOperationException(ex.Status.Detail ?? "خطا در ثبت برداشت", ex);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public async Task<List<WalletWithdrawal>> GetWithdrawalsAsync(int? status = null)
|
||||
{
|
||||
// TODO: Implement when BFF protobuf has GetUserWithdrawals
|
||||
await Task.CompletedTask;
|
||||
return new List<WalletWithdrawal>();
|
||||
/*
|
||||
var request = new GetUserWithdrawalsRequest();
|
||||
if (status.HasValue)
|
||||
{
|
||||
@@ -140,11 +154,15 @@ public class WalletService
|
||||
m.IbanNumber,
|
||||
m.Created.ToDateTime().MiladiToJalaliWithTime()))
|
||||
.ToList();
|
||||
*/
|
||||
}
|
||||
|
||||
public async Task<WithdrawalSettings> GetWithdrawalSettingsAsync()
|
||||
{
|
||||
var response = await _client.GetWithdrawalSettingsAsync(new Empty());
|
||||
return new WithdrawalSettings(response.MinWithdrawalAmount);
|
||||
// TODO: Implement when BFF protobuf has GetWithdrawalSettings
|
||||
await Task.CompletedTask;
|
||||
return new WithdrawalSettings(1_000_000);
|
||||
// var response = await _client.GetWithdrawalSettingsAsync(new Empty());
|
||||
// return new WithdrawalSettings(response.MinWithdrawalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user