Beispiel #1
0
        public void ExecuteVendaTest()
        {
            VendaResponse response;
            var           term    = factory.NewInstance();
            VendaAction   action  = new VendaAction(term);
            VendaRequest  request = new VendaRequest(
                null, //new DataFiscal(DateTime.Now.AddDays(2)),
                null, //new HoraFiscal(DateTime.Now),
                null, //new NumeroDeParcelas(1),
                null, //new TipoDeFinanciamento(2),
                new NumeroDoCartao("4024007122405250"),
                new DataDeVencimento(12, 15),
                new CodigoDeSeguranca("123"),
                new Valor(100.00)
                );

            response = action.Execute(request);

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }

            //Confirmando em outro terminal
            if (!response.Failure())
            {
                new FinalizaTransacaoAction(term).Execute(new CancelaVenda(response.DadosDeConfirmacao));
            }

            Assert.IsFalse(response.Failure());
        }
Beispiel #2
0
        public void ExecuteConsultaValeCulturaTest()
        {
            var term = factory.NewInstance();
            ConsultaTicketCulturaAction action = new ConsultaTicketCulturaAction(term);

            ConsultaTicketCulturaResponse response = action.Execute(
                new ConsultaTicketCulturaRequest(new NumeroDoCartao("5899111111312697"))
                );

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
Beispiel #3
0
        public void ExecutaCapturaTest()
        {
            PreAutorizacaoResponse autorizacao;

            var term        = factory.NewInstance();
            var preautoriza = new PreAutorizacaoAction(term);

            autorizacao = preautoriza.Execute(new PreAutorizacaoRequest(
                                                  null,
                                                  new DataFiscal(new DateTime()),
                                                  null,
                                                  // MASTER 5486906003474434B
                                                  new NumeroDoCartao("4485022036287910"),
                                                  new DataDeVencimento(12, 15),
                                                  new Valor(100.00),
                                                  null,
                                                  new CodigoDeSeguranca("1234")
                                                  ));

            Console.WriteLine("-------------------------");
            foreach (var field in autorizacao.GetFields())
            {
                Console.WriteLine(field);
            }



            var captura = new CapturaPreAutorizacaoAction(term);
            var result  = captura.Execute(new CapturaRequest(
                                              new NumeroDoCartao("4929208425739710"),
                                              new DataDeVencimento(12, 15),
                                              new Valor(100.00),
                                              new DataDaTransacao(new DateTime()),
                                              autorizacao.NumeroAutorizacao,
                                              autorizacao.NsuHost,
                                              null,
                                              new TipoDeFinanciamento(1),
                                              null,
                                              new CodigoDeSeguranca("123")
                                              ));

            Console.WriteLine("-------------------------");
            foreach (var field in result.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
Beispiel #4
0
        public void ExecuteConsultaCartaoTest()
        {
            var term = factory.NewInstance();
            ConsultaCartaoAction action = new ConsultaCartaoAction(term);

            ConsultaCartaoResponse response = action.Execute(
                new ConsultaCartaoRequest(
                    new NumeroDoCartao("4024007122405250"),
                    new DataDeVencimento(12, 15)
                    )
                );

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
Beispiel #5
0
        public void ExecutePreAutorizacao()
        {
            var term     = factory.NewInstance();
            var action   = new PreAutorizacaoAction(term);
            var response = action.Execute(new PreAutorizacaoRequest(
                                              null,
                                              new DataFiscal(new DateTime()),
                                              null,
                                              new NumeroDoCartao("4929208425739710"),
                                              new DataDeVencimento(12, 15),
                                              new Valor(100.00),
                                              null,
                                              new CodigoDeSeguranca("123")
                                              ));

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
Beispiel #6
0
        public void ExecuteVendaTicketCulturaTest()
        {
            var term = factory.NewInstance();
            VendaTicketCulturaAction   action   = new VendaTicketCulturaAction(term);
            VendaTicketCulturaResponse response = action.Execute(
                new VendaTicketCulturaRequest(
                    new NumeroDoCartao("4024007122405250"),
                    new DataDeVencimento(12, 15),
                    null,
                    null, //CodigoDoRoteamento
                    null, //CodigoDoProduto
                    null, //CodigoLinhaDeCredito
                    new Valor(100)
                    )
                );

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
        public void ExecuteEstornoTest()
        {
            var cartao     = new NumeroDoCartao("4929208425739710");
            var vencimento = new DataDeVencimento(12, 15);
            var valor      = new Valor(100.00);
            var cvv        = new CodigoDeSeguranca("123");

            PreAutorizacaoResponse autorizacao;
            var term        = factory.NewInstance();
            var preautoriza = new PreAutorizacaoAction(term);

            autorizacao = preautoriza.Execute(new PreAutorizacaoRequest(
                                                  null,
                                                  new DataFiscal(DateTime.Now),
                                                  null,
                                                  cartao,
                                                  vencimento,
                                                  valor,
                                                  null,
                                                  cvv
                                                  ));

            var estorno  = new EstornoPreAutorizacaoAction(term);
            var response = estorno.Execute(
                new EstornoRequest(
                    cartao,
                    vencimento,
                    valor,
                    new DataDaTransacao(DateTime.Now),
                    autorizacao.NumeroAutorizacao,
                    autorizacao.NsuHost,
                    cvv
                    ));

            foreach (var field in response.GetFields())
            {
                System.Console.WriteLine(field);
            }
        }
Beispiel #8
0
        public void ExecuteCancelaVendaTest()
        {
            decimal valor = new Random().Next(20, 120) * 100;

            // Primeiro executa uma venda

            VendaResponse venda;
            var           term    = factory.NewInstance();
            VendaAction   action  = new VendaAction(term);
            VendaRequest  request = new VendaRequest(
                null, //new DataFiscal(DateTime.Now.AddDays(2)),
                null, //new HoraFiscal(DateTime.Now),
                null, //new NumeroDeParcelas(1),
                null, //new TipoDeFinanciamento(2),
                new NumeroDoCartao("4024007122405250"),
                new DataDeVencimento(12, 15),
                new CodigoDeSeguranca("123"),
                new Valor(valor)
                );

            venda = action.Execute(request);

            foreach (var field in venda.GetFields())
            {
                System.Console.WriteLine(field);
            }

            if (!venda.Failure())
            {
                new FinalizaTransacaoAction(term).Execute(new  ConfirmaVenda(venda.DadosDeConfirmacao));
            }

            Assert.IsFalse(venda.Failure());

            System.Console.WriteLine("\n-----------------------------------------\n");

            var nsuHost = venda.NSUHost.Value;

            CancelaVendaResponse cancelResponse;
            CancelaVendaAction   cancelAction  = new CancelaVendaAction(term);
            CancelaVendaRequest  cancelRequest = new CancelaVendaRequest
                                                 (
                Rede.CIELO,
                new NumeroDoCartao("402400******5250"),
                new NSUHost(nsuHost),
                venda.Data,
                new Valor(valor - 10)
                                                 );

            cancelResponse = cancelAction.Execute(cancelRequest);


            foreach (var field in cancelResponse.GetFields())
            {
                System.Console.WriteLine(field);
            }

            if (!cancelResponse.Failure())
            {
                new FinalizaTransacaoAction(term).Execute(new ConfirmaVenda(cancelResponse.DadosDeConfirmacao));
            }

            Assert.IsFalse(cancelResponse.Failure());
        }