Beispiel #1
0
 public SolicitarPagamentoGerenciadorComando(
     EFContexto contextoSql,
     PagamentoService pagamentoService)
 {
     _contextoSql      = contextoSql;
     _pagamentoService = pagamentoService;
 }
        public void TestaObtemFormaPagamentoInvalido()
        {
            IGatewayPagamento gatewayPagamentoService = new GatewayPagamentoService();

            PagamentoService pagamentoService = new PagamentoService(gatewayPagamentoService);

            pagamentoService.ObtemFormaPagamentoCartao(FormaPagamento.Dinheiro);
        }
        public void TestaObtemFormaPagamentoCartaoCredito()
        {
            IGatewayPagamento gatewayPagamentoService = new GatewayPagamentoService();

            PagamentoService pagamentoService = new PagamentoService(gatewayPagamentoService);

            Assert.AreEqual(FormaPagamentoCartao.Credito, pagamentoService.ObtemFormaPagamentoCartao(FormaPagamento.CartaoCredito));
        }
        /// <summary>
        /// Returns a list of "Formas Pagamento"
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult Listagem(int? page)
        {
            page = page ?? 1;
            var pagamentos = new PagamentoService().GetByPage(page.Value);

            var list = new MvcList<Ecommerce_FormaPagamento>(pagamentos.Item1, page.Value, pagamentos.Item2, EnumerableExtensions.QuantityRegistersPerPage);

            return PartialView(list);
        }
Beispiel #5
0
        public void VerificarPagamento()
        {
            var pagamentoService = new PagamentoService(this.PagamentoDataBase);

            var pagamento = pagamentoService.Listar().Last();

            pagamento = pagamentoService.Verificar(pagamento.Id);

            Assert.IsTrue(!string.IsNullOrEmpty(pagamento.NumeroConfirmacao));
        }
        /// <summary>
        /// Returns a view for Edit an "Forma Pagamento" record
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Editar(int id)
        {
            var pagamento = new PagamentoService().GetListById(id);

            ViewBag.ListaParametros = pagamento;
            ViewBag.IdFormaPagamento = id;
            ViewBag.IsAtivo = pagamento.FirstOrDefault().Ecommerce_FormaPagamento.IsAtivo;

            return View();
        }
Beispiel #7
0
 public void FctGerarComissoes()
 {
     try
     {
         eventLog1.WriteEntry($"Gerando Comissoes.", EventLogEntryType.Information, 1);
         var service = new PagamentoService();
         service.GerarComissoes();
     }
     catch (Exception ex)
     {
         eventLog1.WriteEntry($"Erro ao Gerar Comissoes.\n\n{ex}", EventLogEntryType.Error, 1);
     }
 }
 public JsonResult Editar(int IdFormaPagamento, bool? IsAtivo, List<Parametro> listParam)
 {
     foreach (var l in listParam)
     {
         new PagamentoService().UpdateObject(l);
     }
     
     //update payment method
     var pgto = new PagamentoService().GetRecords(x => x.IdFormaPagamento == IdFormaPagamento).FirstOrDefault();
     pgto.IsAtivo = IsAtivo.HasValue ? IsAtivo.Value : false;
     new PagamentoService().UpdateObject(pgto);
     
     return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Constants._msgUpdateSuccess, ReturnUrl = Url.Content("~/Admin/Pagamento/") }, JsonRequestBehavior.AllowGet);
 }
Beispiel #9
0
        public void RealizarPagamentoMercadopago()
        {
            var pagamento = new Pagamento()
            {
                NomeCliente    = "Diego",
                TipoPagamento  = TipoPagamento.Mercadopago,
                ValorTransacao = 1000
            };

            var pagamentoService = new PagamentoService(this.PagamentoDataBase);

            pagamento = pagamentoService.Inserir(pagamento);

            Assert.IsTrue(!string.IsNullOrEmpty(pagamento.Id));
            Assert.IsTrue(!string.IsNullOrEmpty(pagamento.Transacao));
        }
Beispiel #10
0
        public async void PagamentoService_ReceberPagamento_DeveFalhar(decimal valorPagamento, decimal valorPagoCliente)
        {
            // Arrange
            var pagamentoDapperRepository = new Mock <IPagamentoDapperRepository>();
            var trocoItemDapperRepository = new Mock <ITrocoItemDapperRepository>();
            var pagamentoEFCoreRepository = new Mock <IPagamentoEFCoreRepository>();
            var trocoItemEFCoreRepository = new Mock <ITrocoItemEFCoreRepository>();
            var notificador = new Mock <INotificador>();

            var pagamentoService = new PagamentoService(pagamentoDapperRepository.Object,
                                                        trocoItemDapperRepository.Object, pagamentoEFCoreRepository.Object, trocoItemEFCoreRepository.Object, notificador.Object);

            // Act
            var pagamento = await pagamentoService.ReceberPagamento(valorPagamento, valorPagoCliente);

            // Assert
            Assert.Null(pagamento);
            pagamentoEFCoreRepository.Verify(r => r.Adicionar(pagamento), Times.Never);
        }
        public void TestaEfetuarPagamentoPedidoCartaoDinheiro()
        {
            decimal valorTotalPedido = 1000.00M;

            IGatewayPagamento gatewayPagamentoService = new GatewayPagamentoService();

            PagamentoService pagamentoService = new PagamentoService(gatewayPagamentoService);

            DetalhePagamento detalhePagamento = new DetalhePagamento
            {
                FormaPagamento     = FormaPagamento.Dinheiro,
                NumeroCartao       = "12453",
                MesExpiracao       = 4,
                AnoExpiracao       = 2022,
                NomeImpressoCartao = "ADRIAN"
            };

            Assert.IsTrue(pagamentoService.EfetuarPagamentoPedido(detalhePagamento, valorTotalPedido));
        }
        private void FctGerarFaturas()
        {
            var date          = DateTime.Now;
            var foraFimSemana = date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday;

            if (date.Hour > 8 && date.Hour < 10 && foraFimSemana)
            {
                try
                {
                    eventLog.WriteEntry($"Gerando Faturas.", EventLogEntryType.Information, 1);
                    var service = new PagamentoService();
                    service.GerarFaturas();
                }
                catch (Exception ex)
                {
                    eventLog.WriteEntry($"Erro ao Gerar Faturas.\n\n{ex}", EventLogEntryType.Error, 1);
                }
            }
        }
Beispiel #13
0
        private void FctGerarMensalidades()
        {
            var date          = DateTime.Now;
            var foraFimSemana = date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday;

            if (foraFimSemana)
            {
                try
                {
                    eventLog.WriteEntry($"Gerando mensalidades.", EventLogEntryType.Information, 1);
                    var service = new PagamentoService();
                    //service.GerarMensalidades();
                    service.ProcessarTrocasPlanosMembro();
                }
                catch (Exception ex)
                {
                    eventLog.WriteEntry($"Erro ao gerar mensalidades.\n\n{ex}", EventLogEntryType.Error, 1);
                }
            }
        }
Beispiel #14
0
 public PagamentoController(PagamentoService PagamentoService, ComandaService ComandaService)
 {
     _PagamentoService = PagamentoService;
     _ComandaService   = ComandaService;
 }
Beispiel #15
0
 public PagamentoViewModel(INavigationService serviceNavigation)
 {
     _pagamentoservice  = new PagamentoService();
     _serviceNavigation = serviceNavigation;
 }
        public ActionResult PaymentMethod()
        {
            var formasPagamento = new PagamentoService().GetFormasPagamento();
            foreach (var item in formasPagamento)
            {
                switch ((FormaPagamento)item.IdFormaPagemento)
                {
                    case FormaPagamento.Authorize:
                        item.Descricao = Resources.Resource.Label_EC_AuthorizeDesc;
                        item.CaminhoImagem = "~/Content/images/layout/img-credit-cards.png";
                        break;
                    case FormaPagamento.Paypal:
                        item.Descricao = Resources.Resource.Label_EC_PaypalDesc;
                        item.CaminhoImagem = "~/Content/images/layout/img-paypal.png";
                        break;
                    case FormaPagamento.BoletoBradesco:
                        item.Descricao = Resources.Resource.Label_EC_BoletoBradescoDesc;
                        item.CaminhoImagem = "~/Content/images/layout/img-boleto-bradesco.png";
                        break;
                }
            }

            return PartialView(formasPagamento);
        }
Beispiel #17
0
        public void TestaEfetuarPedido()
        {
            try
            {
                bool notificarClienteEmail = false;
                bool notificarClienteSms   = true;

                IProdutoImposto produtoImpostoService = new ProdutoImpostoService();
                IEstoque        estoqueService        = new EstoqueService();

                ICarrinho carrinhoService = new CarrinhoService(produtoImpostoService, estoqueService);

                IGatewayPagamento gatewayPagamentoService = new GatewayPagamentoService();

                IPagamento pagamentoService = new PagamentoService(gatewayPagamentoService);

                IMail mailService = new MailService();

                ISms smsService = new SmsService();

                IPedido pedidoService = new PedidoService(carrinhoService, pagamentoService, estoqueService,
                                                          mailService, smsService);

                Cliente cliente = new Cliente
                {
                    Cpf     = "443",
                    Nome    = "ADRIAN",
                    Email   = "*****@*****.**",
                    Celular = "900000000"
                };

                Carrinho carrinho = new Carrinho
                {
                    Produtos         = new List <Produto>(),
                    Cliente          = cliente,
                    FoiEntregue      = false,
                    FoiPago          = false,
                    ValorTotalPedido = 0M
                };

                carrinho.Produtos.Add(new Produto
                {
                    Descricao    = "",
                    Valor        = 100M,
                    Quantidade   = 3,
                    ValorImposto = 0M,
                    TipoProduto  = TipoProduto.Alimentos
                });

                carrinho.Produtos.Add(new Produto
                {
                    Descricao    = "",
                    Valor        = 100M,
                    Quantidade   = 3,
                    ValorImposto = 0M,
                    TipoProduto  = TipoProduto.Eletronico
                });

                carrinho.Produtos.Add(new Produto
                {
                    Descricao    = "",
                    Valor        = 100M,
                    Quantidade   = 3,
                    ValorImposto = 0M,
                    TipoProduto  = TipoProduto.Superfulos
                });

                DetalhePagamento detalhePagamento = new DetalhePagamento
                {
                    FormaPagamento     = FormaPagamento.CartaoDebito,
                    NumeroCartao       = "12453",
                    MesExpiracao       = 4,
                    AnoExpiracao       = 2022,
                    NomeImpressoCartao = "ADRIAN"
                };

                pedidoService.EfetuarPedido(carrinho, detalhePagamento, notificarClienteEmail, notificarClienteSms);
            }
            catch (Exception ex)
            {
                Assert.Fail("Exceção não esperada: " + ex.Message);
            }
        }