Files
TakeoutSaaS.AdminApi/src/Application/TakeoutSaaS.Application/App/Payments/Validators/UpdatePaymentCommandValidator.cs

24 lines
740 B
C#

using FluentValidation;
using TakeoutSaaS.Application.App.Payments.Commands;
namespace TakeoutSaaS.Application.App.Payments.Validators;
/// <summary>
/// 更新支付记录命令验证器。
/// </summary>
public sealed class UpdatePaymentCommandValidator : AbstractValidator<UpdatePaymentCommand>
{
/// <summary>
/// 初始化验证规则。
/// </summary>
public UpdatePaymentCommandValidator()
{
RuleFor(x => x.PaymentId).GreaterThan(0);
RuleFor(x => x.OrderId).GreaterThan(0);
RuleFor(x => x.Amount).GreaterThan(0);
RuleFor(x => x.TradeNo).MaximumLength(64);
RuleFor(x => x.ChannelTransactionId).MaximumLength(64);
RuleFor(x => x.Remark).MaximumLength(256);
}
}