Exemplo n.º 1
0
 public CashController(ILogger <CashController> logger, ICashWithdrawalRepository orclRepo
                       , IAntiforgery antiforgery)
 {
     _logger      = logger;
     _orclRepo    = orclRepo;
     _antiforgery = antiforgery;
 }
        public CashWithDrawalRequestValidator(ICashWithdrawalRepository orclRepo)
        {
            _orclRepo = orclRepo;
            RuleFor(req => req.debitAccount)
            .NotNull()
            .NotEmpty()
            .MaximumLength(20);
            RuleFor(req => req.amount)
            .NotNull()
            .NotEmpty()
            .GreaterThan(0);

            RuleFor(req => req.narration)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.chargeRate)
            .NotNull()
            .NotEmpty()
            .GreaterThan(0);

            RuleFor(req => req.branchCode)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.userName)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100);

            RuleFor(req => req.requestId)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100)
            .SetValidator(new RequestIdValidator(_orclRepo));

            RuleFor(req => req.creditAccount)
            .NotNull()
            .NotEmpty()
            .MaximumLength(20);

            RuleFor(req => req.currency)
            .NotNull()
            .NotEmpty()
            .MaximumLength(100)
            .SetValidator(new CurrencyEnumValidator());
        }
Exemplo n.º 3
0
 public RequestIdValidator(ICashWithdrawalRepository orclRepo)
     : base("Invalid or Duplicate {PropertyName}, {IdValue}.")
 {
     _orclRepo = orclRepo;
 }
Exemplo n.º 4
0
 public Handler(ICashWithdrawalRepository repository)
 {
     _repository = repository;
 }