Skip to content

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

@dfml2020

Description

@dfml2020

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions