Add response DTOs for withdrawal and club activation commands
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public record ApproveWithdrawalCommand : IRequest<ApproveWithdrawalResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه درخواست برداشت
|
||||
/// </summary>
|
||||
public long WithdrawalId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// یادداشت مدیر (اختیاری)
|
||||
/// </summary>
|
||||
public string? AdminNote { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using BackOffice.BFF.Commission.Protobuf;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public class ApproveWithdrawalCommandHandler : IRequestHandler<ApproveWithdrawalCommand, ApproveWithdrawalResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public ApproveWithdrawalCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<ApproveWithdrawalResponseDto> Handle(ApproveWithdrawalCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var grpcRequest = new ApproveWithdrawalRequest
|
||||
{
|
||||
WithdrawalId = request.WithdrawalId,
|
||||
AdminNote = request.AdminNote ?? string.Empty
|
||||
};
|
||||
|
||||
var response = await _context.Commissions.ApproveWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return new ApproveWithdrawalResponseDto
|
||||
{
|
||||
Success = response.Success,
|
||||
Message = response.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ApproveWithdrawal;
|
||||
|
||||
public record ApproveWithdrawalResponseDto
|
||||
{
|
||||
public bool Success { get; init; }
|
||||
public string Message { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
|
||||
|
||||
public record ProcessWithdrawalCommand : IRequest<ProcessWithdrawalResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه درخواست برداشت
|
||||
/// </summary>
|
||||
public long WithdrawalId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// شناسه تراکنش بانکی (اختیاری)
|
||||
/// </summary>
|
||||
public string? TransactionId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// یادداشت مدیر (اختیاری)
|
||||
/// </summary>
|
||||
public string? AdminNote { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using BackOffice.BFF.Commission.Protobuf;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
|
||||
|
||||
public class ProcessWithdrawalCommandHandler : IRequestHandler<ProcessWithdrawalCommand, ProcessWithdrawalResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public ProcessWithdrawalCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<ProcessWithdrawalResponseDto> Handle(ProcessWithdrawalCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var grpcRequest = new ProcessWithdrawalRequest
|
||||
{
|
||||
WithdrawalId = request.WithdrawalId,
|
||||
TransactionId = request.TransactionId ?? string.Empty,
|
||||
AdminNote = request.AdminNote ?? string.Empty
|
||||
};
|
||||
|
||||
var response = await _context.Commissions.ProcessWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return new ProcessWithdrawalResponseDto
|
||||
{
|
||||
Success = response.Success,
|
||||
Message = response.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.ProcessWithdrawal;
|
||||
|
||||
public record ProcessWithdrawalResponseDto
|
||||
{
|
||||
public bool Success { get; init; }
|
||||
public string Message { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
|
||||
|
||||
public record RejectWithdrawalCommand : IRequest<RejectWithdrawalResponseDto>
|
||||
{
|
||||
/// <summary>
|
||||
/// شناسه درخواست برداشت
|
||||
/// </summary>
|
||||
public long WithdrawalId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// دلیل رد (الزامی)
|
||||
/// </summary>
|
||||
public string RejectReason { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using BackOffice.BFF.Commission.Protobuf;
|
||||
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
|
||||
|
||||
public class RejectWithdrawalCommandHandler : IRequestHandler<RejectWithdrawalCommand, RejectWithdrawalResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public RejectWithdrawalCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<RejectWithdrawalResponseDto> Handle(RejectWithdrawalCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var grpcRequest = new RejectWithdrawalRequest
|
||||
{
|
||||
WithdrawalId = request.WithdrawalId,
|
||||
RejectReason = request.RejectReason
|
||||
};
|
||||
|
||||
var response = await _context.Commissions.RejectWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
|
||||
|
||||
return new RejectWithdrawalResponseDto
|
||||
{
|
||||
Success = response.Success,
|
||||
Message = response.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace BackOffice.BFF.Application.CommissionCQ.Commands.RejectWithdrawal;
|
||||
|
||||
public record RejectWithdrawalResponseDto
|
||||
{
|
||||
public bool Success { get; init; }
|
||||
public string Message { get; init; } = string.Empty;
|
||||
}
|
||||
Reference in New Issue
Block a user