feat: Implement user permission checks and manual payment functionalities

- Added CheckUserPermissionQuery and CheckUserPermissionQueryHandler for permission validation.
- Introduced GetUserRolesQuery and GetUserRolesQueryHandler to retrieve user roles.
- Created IPermissionService interface and its implementation in PermissionService.
- Defined permission and role constants in PermissionDefinitions.
- Developed SetDefaultVatPercentageCommand and its handler for VAT configuration.
- Implemented GetCurrentVatPercentageQuery and handler to fetch current VAT settings.
- Added manual payment commands: CreateManualPayment, ApproveManualPayment, and RejectManualPayment with respective handlers and validators.
- Created GetManualPaymentsQuery and handler for retrieving manual payment records.
- Integrated gRPC services for manual payments with appropriate permission checks.
- Established Protobuf definitions for manual payment operations and metadata.
This commit is contained in:
masoodafar-web
2025-12-05 17:27:38 +03:30
parent 67b43fea7a
commit 4aa9f28f6e
51 changed files with 1294 additions and 107 deletions

View File

@@ -7,6 +7,8 @@ using CmsUserOrderFilter = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserO
using CmsUserOrderRequest = CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterRequest;
using GetAllUserOrderByFilterFilter = BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter.GetAllUserOrderByFilterFilter;
using GetAllUserOrderByFilterResponseModel = BackOffice.BFF.Application.UserOrderCQ.Queries.GetAllUserOrderByFilter.GetAllUserOrderByFilterResponseModel;
using CmsGetUserOrderResponse = CMSMicroservice.Protobuf.Protos.UserOrder.GetUserOrderResponse;
using BffGetUserOrderResponseDto = BackOffice.BFF.Application.UserOrderCQ.Queries.GetUserOrder.GetUserOrderResponseDto;
namespace BackOffice.BFF.Application.Common.Mappings;
@@ -26,11 +28,13 @@ public class UserOrderProfile : IRegister
.IgnoreIf((src, dest) => src.Filter.PaymentStatus==null,dest => dest.Filter.PaymentStatus)
.Map(dest => dest.Filter, src => src.Filter == null || IsEmptyFilter(src.Filter) ? null : BuildFilter(src.Filter));
// config.NewConfig< CMSMicroservice.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel, GetAllUserOrderByFilterResponseModel>()
//
// .Map(dest => dest.p, src => src.PaymentMethod);
// Map VAT information from CMS GetUserOrderResponse (VatInfo) to flattened DTO fields
config.NewConfig<CmsGetUserOrderResponse, BffGetUserOrderResponseDto>()
.Map(dest => dest.VatBaseAmount, src => src.VatInfo != null ? src.VatInfo.BaseAmount : 0)
.Map(dest => dest.VatAmount, src => src.VatInfo != null ? src.VatInfo.VatAmount : 0)
.Map(dest => dest.VatTotalAmount,
src => src.VatInfo != null ? src.VatInfo.TotalAmount : src.Amount)
.Map(dest => dest.VatPercentage, src => src.VatInfo != null ? src.VatInfo.VatRate * 100 : 0);
}
private static bool IsEmptyFilter(GetAllUserOrderByFilterFilter src)