Added shared projects
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
namespace LiteCharms.Features.Customers.Commands;
|
||||
|
||||
public class RefundCustomerCommand : IRequest<Result<Guid>>
|
||||
{
|
||||
public Guid OrderId { get; set; }
|
||||
|
||||
public Guid CustomerId { get; set; }
|
||||
|
||||
public string? Reason { get; set; }
|
||||
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
private RefundCustomerCommand(Guid orderId, Guid customerId, string? reason, decimal amount)
|
||||
{
|
||||
OrderId = orderId;
|
||||
CustomerId = customerId;
|
||||
Reason = reason;
|
||||
Amount = amount;
|
||||
CustomerId = customerId;
|
||||
}
|
||||
|
||||
public static RefundCustomerCommand Create(Guid orderId, Guid customerId, string? reason, decimal amount)
|
||||
{
|
||||
if (orderId == Guid.Empty)
|
||||
throw new ArgumentException("OrderId is required", nameof(orderId));
|
||||
|
||||
if (customerId == Guid.Empty)
|
||||
throw new ArgumentException("CustomerId is required", nameof(customerId));
|
||||
|
||||
if (amount <= 0)
|
||||
throw new ArgumentException("Amount must be greater than zero", nameof(amount));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(reason))
|
||||
throw new ArgumentException("Reason is required", nameof(reason));
|
||||
|
||||
return new(orderId, customerId, reason, amount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user