Esempio n. 1
0
        private void ExecuteRequest()
        {
            var watch = Stopwatch.StartNew();

            ConsoleHelper.WriteHeader("Capturing a Full Transaction");

            CustomConfiguration configuration = new CustomConfiguration()
            {
                DefaultEndpoint = ConfigurationManager.AppSettings["cielo.endpoint.default"],
                QueryEndpoint   = ConfigurationManager.AppSettings["cielo.endpoint.query"],
                MerchantId      = ConfigurationManager.AppSettings["cielo.customer.id"],
                MerchantKey     = ConfigurationManager.AppSettings["cielo.customer.key"],
                ReturnUrl       = ConfigurationManager.AppSettings["cielo.return.url"],
            };

            CieloService cieloService = new CieloService(configuration);

            try
            {
                var response = cieloService.CaptureTransaction(Guid.Parse("55158bb3-2bb9-4e76-a92b-708b51245f4b"));

                ConsoleHelper.WriteResult(response);
            }
            catch (ResponseException ex)
            {
                ConsoleHelper.WriteError(ex);
            }
            catch (Exception ex)
            {
                ConsoleHelper.WriteError(ex);
            }

            watch.Stop();
            ConsoleHelper.WriteFooter(watch.ElapsedMilliseconds);
        }
Esempio n. 2
0
        public override TransactionResponse Execute(bool validar = false)
        {
            base.ValidarPayment(partial: true);

            CieloService        cieloService = new CieloService(base.Cielo.Configuration);
            TransactionResponse response     = cieloService.CaptureTransaction(base.Cielo.Payment.PaymentId, base.Cielo.Payment.Amount);

            if (validar && !response.HttpResponse.Approved)
            {
                throw new Exception("ERROR: " + response.HttpResponse.ReturnMessage);
            }

            return(response);
        }
Esempio n. 3
0
        public override TransactionResponse Execute(bool validar = false)
        {
            base.ValidarPayment();

            CieloService        cieloService = new CieloService(base.Cielo.Configuration);
            TransactionResponse response     = cieloService.CaptureTransaction(base.Cielo.Payment.PaymentId);

            if (validar && !response.HttpResponse.Approved)
            {
                throw new Exception("TRANSAÇÃO NEGADA: " + response.HttpResponse.ReturnMessage);
            }

            return(response);
        }