Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RedeException: Exception of type 'eRede.Service.Error.RedeException' was thrown. #16

Open
dfml2020 opened this issue Jan 13, 2022 · 0 comments

Comments

@dfml2020
Copy link

Olá, boa tarde. Ao executar a autorização está dando o erro conforme mencionado. Para qualquer cartão de teste.

// Autoriza a transação
var response = new eRede.eRede(store).create(transaction);

// Retorna o seguinte erro.
RedeException: Exception of type 'eRede.Service.Error.RedeException' was thrown.

Segue abaixo os detalhes. Alguém pode me ajudar, por favor.

1 Está sendo preenchido dessa forma:

[HttpPost]
public async Task Checkout(CreditCard cartao)
{
string pv = "50995619";
string token = "c27bf86109b74c1f95361cbf108ff079";
var environment = Environment.Sandbox();

        // Configuração da loja
        var store = new Store(pv, token, environment);

        // Transação que será autorizada
        var transaction = new Transaction
        {
            amount = 20,
            reference = "produto0003"
        }.CreditCard(
            cartao.cardNumber,
            cartao.securityCode,
            cartao.expirationMonth,
            cartao.expirationYear,
            cartao.cardholderName
        );

        //Autoriza a transação
        var response = new eRede.eRede(store).create(transaction);

        if (response.returnCode == "00")
        {
            Console.WriteLine("Transação autorizada com sucesso: " + response.tid);
        }

        return View();
    }

2 Acontence para todos os cartões.

3 Retorno completo. Apenas copiei e colei a mensagem como ela aparece no browser.
RedeException: Exception of type 'eRede.Service.Error.RedeException' was thrown.
• eRede.Service.AbstractTransactionService.sendRequest(RestRequest request)
• eRede.Service.AbstractTransactionService.Execute(Method method)
• eRede.eRede.create(Transaction transaction)
• Site_Rede.Controllers.PagamentoController.Checkout(CreditCard cartao) in PagamentoController.cs
• •
141. cartao.expirationMonth,
142. cartao.expirationYear,
143. cartao.cardholderName
144. );
145.
146. //Autoriza a transação
147. var response = new eRede.eRede(store).create(transaction);
148.
149. if (response.returnCode == "00")
150. {
151. Console.WriteLine("Transação autorizada com sucesso: " + response.tid);
152. }
153.
• Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
• System.Threading.Tasks.ValueTask.get_Result()
• Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask actionResultValueTask)
• Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
• Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
• Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
• Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
• Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
• Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
• Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
• Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
• Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
• Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
• Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
• Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

eRede.Service.Error.RedeException: Exception of type 'eRede.Service.Error.RedeException' was thrown.

at eRede.Service.AbstractTransactionService.sendRequest(RestRequest request)

at eRede.Service.AbstractTransactionService.Execute(Method method)

at eRede.eRede.create(Transaction transaction)

at Site_Rede.Controllers.PagamentoController.Checkout(CreditCard cartao) in D:\ProjetoNetCore\Site_Rede\Site_Rede\Controllers\PagamentoController.cs:line 147

at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()

--- End of stack trace from previous location ---

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

--- End of stack trace from previous location ---

at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)

at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)

at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant