feat: Add discount balance and change value to wallet change log
- Added CurrentDiscountBalance and ChangeDiscountValue properties to GetCustomerWalletChangeLogResponseDto. - Updated userwallet.proto to include current_discount_balance and change_discount_value fields. - Enhanced CommissionProfile mapping to support GetMyCommissionPayouts requests and responses. - Implemented GetMyCommissionPayouts query and handler to retrieve user commission payouts. - Added validation for GetMyCommissionPayouts query. - Updated UserOrderService to handle user orders, including VAT calculations and wallet transactions. - Enhanced UserWalletService to include new properties in wallet change log responses.
This commit is contained in:
@@ -5,14 +5,19 @@ using CMSMicroservice.Application.CategoryCQ.Commands.UpdateCategory;
|
||||
using CMSMicroservice.Application.CategoryCQ.Commands.DeleteCategory;
|
||||
using CMSMicroservice.Application.CategoryCQ.Queries.GetCategory;
|
||||
using CMSMicroservice.Application.CategoryCQ.Queries.GetAllCategoryByFilter;
|
||||
using MediatR;
|
||||
using AppModels = CMSMicroservice.Application.Common.Models;
|
||||
|
||||
namespace CMSMicroservice.WebApi.Services;
|
||||
public class CategoryService : CategoryContract.CategoryContractBase
|
||||
{
|
||||
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
||||
private readonly ISender _sender;
|
||||
|
||||
public CategoryService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
||||
public CategoryService(IDispatchRequestToCQRS dispatchRequestToCQRS, ISender sender)
|
||||
{
|
||||
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
||||
_sender = sender;
|
||||
}
|
||||
public override async Task<CreateNewCategoryResponse> CreateNewCategory(CreateNewCategoryRequest request, ServerCallContext context)
|
||||
{
|
||||
@@ -45,20 +50,52 @@ public class CategoryService : CategoryContract.CategoryContractBase
|
||||
|
||||
public override async Task<GetAllCategoriesForCustomerResponse> GetAllCategoriesForCustomer(GetAllCategoriesForCustomerRequest request, ServerCallContext context)
|
||||
{
|
||||
// TODO: Implement using existing CMS Category Application layer
|
||||
// For now, return empty response
|
||||
return new GetAllCategoriesForCustomerResponse
|
||||
// Use GetAllCategoryByFilter to get all active categories
|
||||
var query = new GetAllCategoryByFilterQuery
|
||||
{
|
||||
Filter = new CMSMicroservice.Application.CategoryCQ.Queries.GetAllCategoryByFilter.GetAllCategoryByFilterFilter
|
||||
{
|
||||
IsActive = true // Only active categories for customers
|
||||
},
|
||||
PaginationState = new AppModels.PaginationState
|
||||
{
|
||||
PageNumber = request.PageNumber > 0 ? request.PageNumber : 1,
|
||||
PageSize = request.PageSize > 0 ? request.PageSize : 100 // Default to large page size to get all
|
||||
},
|
||||
SortBy = "SortOrder" // Sort by display order
|
||||
};
|
||||
|
||||
var result = await _sender.Send(query, context.CancellationToken);
|
||||
|
||||
var response = new GetAllCategoriesForCustomerResponse
|
||||
{
|
||||
MetaData = new CMSMicroservice.Protobuf.Protos.MetaData
|
||||
{
|
||||
CurrentPage = request.PageNumber,
|
||||
PageSize = request.PageSize,
|
||||
TotalCount = 0,
|
||||
TotalPage = 0,
|
||||
HasNext = false,
|
||||
HasPrevious = false
|
||||
CurrentPage = result.MetaData.CurrentPage,
|
||||
PageSize = result.MetaData.PageSize,
|
||||
TotalCount = result.MetaData.TotalCount,
|
||||
TotalPage = result.MetaData.TotalPage,
|
||||
HasNext = result.MetaData.HasNext,
|
||||
HasPrevious = result.MetaData.HasPrevious
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var cat in result.Models)
|
||||
{
|
||||
response.Models.Add(new GetAllCategoryFilterResponseModel
|
||||
{
|
||||
Id = cat.Id,
|
||||
Name = cat.Name,
|
||||
Title = cat.Title,
|
||||
Description = cat.Description ?? string.Empty,
|
||||
ImagePath = cat.ImagePath ?? string.Empty,
|
||||
ParentId = cat.ParentId ?? 0,
|
||||
IsActive = cat.IsActive,
|
||||
SortOrder = cat.SortOrder
|
||||
});
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public override async Task<GetCategoryByIdForCustomerResponse> GetCategoryByIdForCustomer(GetCategoryByIdForCustomerRequest request, ServerCallContext context)
|
||||
|
||||
Reference in New Issue
Block a user