- 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.
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using BackOffice.BFF.Application.Common.Interfaces;
|
|
using CMSMicroservice.Protobuf.Protos.ManualPayment;
|
|
using MediatR;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace BackOffice.BFF.Application.ManualPaymentCQ.Commands.RejectManualPayment;
|
|
|
|
public class RejectManualPaymentCommandHandler : IRequestHandler<RejectManualPaymentCommand, bool>
|
|
{
|
|
private readonly IApplicationContractContext _context;
|
|
private readonly ILogger<RejectManualPaymentCommandHandler> _logger;
|
|
|
|
public RejectManualPaymentCommandHandler(
|
|
IApplicationContractContext context,
|
|
ILogger<RejectManualPaymentCommandHandler> logger)
|
|
{
|
|
_context = context;
|
|
_logger = logger;
|
|
}
|
|
|
|
public async Task<bool> Handle(RejectManualPaymentCommand request, CancellationToken cancellationToken)
|
|
{
|
|
_logger.LogInformation("Rejecting manual payment via BFF. Id: {Id}", request.ManualPaymentId);
|
|
|
|
var grpcRequest = new RejectManualPaymentRequest
|
|
{
|
|
ManualPaymentId = request.ManualPaymentId,
|
|
RejectionReason = request.RejectionReason
|
|
};
|
|
|
|
await _context.ManualPayments.RejectManualPaymentAsync(grpcRequest, cancellationToken: cancellationToken);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|