public async Task <Transacao> AutorizarPagamento(Pagamento pagamento) { var nerdsPagSvc = new WebPagService(_pagamentoConfig.DefaultApiKey, _pagamentoConfig.DefaultEncryptionKey); var cardHashGen = new CardHash(nerdsPagSvc) { CardNumber = pagamento.CartaoCredito.NumeroCartao, CardHolderName = pagamento.CartaoCredito.NomeCartao, CardExpirationDate = pagamento.CartaoCredito.MesAnoVencimento, CardCvv = pagamento.CartaoCredito.CVV }; var cardHash = cardHashGen.Generate(); var transacao = new Transaction(nerdsPagSvc) { CardHash = cardHash, CardNumber = pagamento.CartaoCredito.NumeroCartao, CardHolderName = pagamento.CartaoCredito.NomeCartao, CardExpirationDate = pagamento.CartaoCredito.MesAnoVencimento, CardCvv = pagamento.CartaoCredito.CVV, PaymentMethod = PaymentMethod.CreditCard, Amount = pagamento.Valor }; return(ParaTransacao(await transacao.AuthorizeCardTransaction())); }
public async Task <Transacao> CancelarAutorizacao(Transacao transacao) { var nerdsPagSvc = new WebPagService(_pagamentoConfig.DefaultApiKey, _pagamentoConfig.DefaultEncryptionKey); var transaction = ParaTransaction(transacao, nerdsPagSvc); return(ParaTransacao(await transaction.CancelAuthorization())); }
public static Transaction ParaTransaction(Transacao transacao, WebPagService nerdsPagService) { return(new Transaction(nerdsPagService) { Status = (TransactionStatus)transacao.Status, Amount = transacao.ValorTotal, CardBrand = transacao.BandeiraCartao, AuthorizationCode = transacao.CodigoAutorizacao, Cost = transacao.CustoTransacao, Nsu = transacao.NSU, Tid = transacao.TID }); }