Boa tarde!
Desenvolvi uma API para cálculo dos impostos (tax services) e configurei a mesma
como endpoint a ser consumida no checkout de nossa loja VTEX, usando como referência o guia de integração de Tax Services.
Quando tento inserir um item no carrinho está ocorrendo erro:
Desculpe, ocorreu um erro durante o processamento da sua chamada.
ID da Operação: eee5f373-8320-40fc-9ef4-43163db92011
A API está sendo chamada, a comunicação entre a plataforma VTEX e nosso backend
está ocorrendo, recebo o payload completo da transação, o mesmo é interpretado
e a API responde conforme documentação (exemplo abaixo).
Entretanto não consigo entender o motivo do erro. Alguém teria alguma pista para me ajudar?
Resposta da API:
{
"itemTaxResponse": [
{
"id": "0",
"taxes": [
{
"name": "IPI",
"description": "",
"value": 18.77
}
]
}
],
"hooks": [
]
}
Erro da Operação (Log da VTEX)
ExtraData:
ErrorMessage: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1
[Vtex.Commerce.Checkout.Services.TaxHub.Response.ItemTaxResponse]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'hooks', line 1, position 9.
ErrorStack: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Vtex.Commerce.Checkout.Services.TaxHub.Response.ItemTaxResponse]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'hooks', line 1, position 9.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)