This commit is contained in:
masoodafar-web
2025-12-02 03:32:26 +03:30
parent 6cd29e8b26
commit c9dab944fa
56 changed files with 1181 additions and 710 deletions

View File

@@ -15,16 +15,16 @@ public class ApproveWithdrawalCommandHandler : IRequestHandler<ApproveWithdrawal
{
var grpcRequest = new ApproveWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
AdminNote = request.AdminNote ?? string.Empty
PayoutId = request.WithdrawalId,
Notes = request.AdminNote ?? string.Empty
};
var response = await _context.Commissions.ApproveWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
await _context.Commissions.ApproveWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
return new ApproveWithdrawalResponseDto
{
Success = response.Success,
Message = response.Message
Success = true,
Message = "درخواست برداشت با موفقیت تایید شد"
};
}
}

View File

@@ -13,6 +13,16 @@ public class ProcessWithdrawalCommandHandler : IRequestHandler<ProcessWithdrawal
public async Task<ProcessWithdrawalResponseDto> Handle(ProcessWithdrawalCommand request, CancellationToken cancellationToken)
{
// TODO: Implement when CMS ProcessWithdrawal endpoint is ready
await Task.CompletedTask;
return new ProcessWithdrawalResponseDto
{
Success = true,
Message = "Withdrawal processing pending CMS implementation"
};
/* Uncomment when CMS endpoint is ready:
var grpcRequest = new ProcessWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
@@ -27,5 +37,6 @@ public class ProcessWithdrawalCommandHandler : IRequestHandler<ProcessWithdrawal
Success = response.Success,
Message = response.Message
};
*/
}
}

View File

@@ -15,16 +15,16 @@ public class RejectWithdrawalCommandHandler : IRequestHandler<RejectWithdrawalCo
{
var grpcRequest = new RejectWithdrawalRequest
{
WithdrawalId = request.WithdrawalId,
RejectReason = request.RejectReason
PayoutId = request.WithdrawalId,
Reason = request.RejectReason
};
var response = await _context.Commissions.RejectWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
await _context.Commissions.RejectWithdrawalAsync(grpcRequest, cancellationToken: cancellationToken);
return new RejectWithdrawalResponseDto
{
Success = response.Success,
Message = response.Message
Success = true,
Message = "درخواست برداشت رد شد"
};
}
}

View File

@@ -0,0 +1,10 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.TriggerWeeklyCalculation;
public class TriggerWeeklyCalculationCommand : IRequest<TriggerWeeklyCalculationResponseDto>
{
public string WeekNumber { get; set; } = string.Empty;
public bool ForceRecalculate { get; set; }
public bool SkipBalances { get; set; }
public bool SkipPool { get; set; }
public bool SkipPayouts { get; set; }
}

View File

@@ -0,0 +1,29 @@
using BackOffice.BFF.Commission.Protobuf;
namespace BackOffice.BFF.Application.CommissionCQ.Commands.TriggerWeeklyCalculation;
public class TriggerWeeklyCalculationCommandHandler : IRequestHandler<TriggerWeeklyCalculationCommand, TriggerWeeklyCalculationResponseDto>
{
private readonly IApplicationContractContext _context;
public TriggerWeeklyCalculationCommandHandler(IApplicationContractContext context)
{
_context = context;
}
public async Task<TriggerWeeklyCalculationResponseDto> Handle(TriggerWeeklyCalculationCommand request, CancellationToken cancellationToken)
{
var grpcRequest = new TriggerWeeklyCalculationRequest
{
WeekNumber = request.WeekNumber,
ForceRecalculate = request.ForceRecalculate,
SkipBalances = request.SkipBalances,
SkipPool = request.SkipPool,
SkipPayouts = request.SkipPayouts
};
var response = await _context.Commissions.TriggerWeeklyCalculationAsync(grpcRequest, cancellationToken: cancellationToken);
return response.Adapt<TriggerWeeklyCalculationResponseDto>();
}
}

View File

@@ -0,0 +1,9 @@
namespace BackOffice.BFF.Application.CommissionCQ.Commands.TriggerWeeklyCalculation;
public class TriggerWeeklyCalculationResponseDto
{
public bool Success { get; set; }
public string Message { get; set; } = string.Empty;
public string ExecutionId { get; set; } = string.Empty;
public DateTime StartedAt { get; set; }
}