Exemplo n.º 1
0
        public void ConsigoRetornarUmPagmentoNaoAutorizao()
        {
            IPaymentService cieloService = new CieloPaymentService();
            var             input        = new PagamentoCieloInput {
                Tipo            = PagamentoProvider.CARTAO_CREDITO.ToDescriptionString(),
                NomeCliente     = "Rafael V Araujo",
                NumeroPedido    = 20201007001,
                ValorCompra     = 100f,
                NumeroParcelas  = 1,
                NumeroCartao    = "4024007153763192",
                ValidadeCartao  = "12/2021",
                CodigoSeguranca = "087"
            };
            var result = cieloService.Process(JsonConvert.SerializeObject(input)).Result;


            Assert.False(result.Aprovado);
        }
Exemplo n.º 2
0
 public static PaymentRequest ToPaymentRequest(this PagamentoCieloInput infoPagamento)
 {
     return(new PaymentRequest {
         MerchantOrderId = infoPagamento.NumeroPedido.ToString(),
         Customer = new CustomerPayment {
             Name = infoPagamento.NomeCliente
         },
         Payment = new Payment {
             Type = "CreditCard",
             Amount = infoPagamento.ValorCompra.FormatCieloValue(),
             Installments = infoPagamento.NumeroParcelas,
             CreditCard = new CreditCardInfo {
                 CardNumber = infoPagamento.NumeroCartao,
                 Holder = infoPagamento.NomeCliente,
                 ExpirationDate = infoPagamento.ValidadeCartao,
                 SecurityCode = infoPagamento.CodigoSeguranca,
                 Brand = "Visa"//dadosCartao.Bandeira
             }
         }
     });
 }