Example #1
0
        public void RequestPayment(RequestUserDebtorPayment requestPayment)
        {
            if (requestPayment.PaymentDate == null)
            {
                throw new Exception("Data de pagamento é obrigatória");
            }

            if (requestPayment.Evaluation == null)
            {
                throw new Exception("Avaliação é obrigatória");
            }

            var userDebtor = UserDebtorRepository.Get(requestPayment.IdUserDebtor);

            if (userDebtor == null)
            {
                throw new Exception("Débito não encontrado");
            }

            if (userDebtor.PaymentDate != null)
            {
                throw new Exception("Pagamento já baixado");
            }

            UserDebtorRepository.UpdateRequestPayment(requestPayment);
        }
Example #2
0
        public void RequestPayment(RequestUserDebtorPayment requestPayment)
        {
            if (requestPayment.PaymentDate == null)
            {
                throw new Exception("Data de pagamento é obrigatória");
            }

            var userDebtor = UserDebtorRepository.Get(requestPayment.IdUserDebtor);

            if (userDebtor == null)
            {
                throw new Exception("Débito não encontrado");
            }

            if (userDebtor.PaymentDate != null)
            {
                throw new Exception("Pagamento já baixado");
            }

            if (userDebtor.IdUser != requestPayment.IdUser)
            {
                throw new Exception("Usuário inválido para este pagamento");
            }

            UserDebtorRepository.UpdateRequestPayment(requestPayment);
        }