Example #1
0
 public PersonalTransferCommandValidator(
     CardTransferSettings settings,
     IRepository <UserCard> userCardRepository) :
     base(settings, userCardRepository)
 {
     RuleFor(x => x.ToCardId).NotEqual(Guid.Empty).NotEqual(x => x.FromCardId);
 }
Example #2
0
        public CardTransferCommandValidator(CardTransferSettings settings, IRepository <UserCard> userCardRepository)
        {
            _settings           = settings;
            _userCardRepository = userCardRepository;
            Argument.NotNull(settings, "settings");
            Argument.NotNull(userCardRepository, "userCardRepository");

            RuleFor(x => x.FromCardId).NotEqual(Guid.Empty);
            RuleFor(x => x.Amount)
            .Must(GreaterThanOrEqualToMinimumAmount).WithLocalizedMessage(() => Messages.CardTransferSmallAmount)
            .Must(LessThanOrEqualToAccountBalance).WithLocalizedMessage(() => Messages.InsufficientFunds);
        }
Example #3
0
        public InterbankTransferCommandValidator(CardTransferSettings settings,
                                                 IRepository <UserCard> userCardRepository,
                                                 IQueryRepository <UserCard> userCards)
            : base(settings, userCardRepository)
        {
            Argument.NotNull(userCards, "userCards");
            _userCards = userCards;

            RuleFor(x => x.ToCardNo).NotEmpty();
            RuleFor(x => x.ToCardExpirationDateUtc)
            .Must(IsValidExpirationDate);
            RuleFor(x => x.ToCardNo)
            .Must(DestinationCardExists)
            .WithLocalizedMessage(() => Messages.DestinationCardNotFound)
            .Must(NotEqualToFromCardNo)
            .WithLocalizedMessage(() => Messages.DestinationCardNotEqualToSource);
        }