Parbad icon indicating copy to clipboard operation
Parbad copied to clipboard

JsonSerializationException when using ZarinPal gateway

Open WatchDogsDev opened this issue 2 years ago • 3 comments

Bug description (wIthout specifiing the sensitive data) When I updated Parbad.Gateway.ZarinPal to latest version (1.3.0), I got this error in Parbad library without changing any code.

POST https://api.zarinpal.com/pg/v4/payment/request.json [200]

Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Parbad.Gateway.ZarinPal.Internal.ZarinPalRequestResultModel' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path 'data', line 1, position 9.

Package name and version

  • Parbad: 3.8.3
  • Parbad.AspNetCore: 1.2.0
  • Parbad.Gateway.ZarinPal: 1.3.0
  • Parbad.Storage.EntityFrameworkCore: 1.3.1

Web application type:

  • ASP.NET CORE

WatchDogsDev avatar Jun 20 '22 08:06 WatchDogsDev

I'll take a look at it soon

Sina-Soltani avatar Jun 20 '22 17:06 Sina-Soltani

same error here : Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Parbad.Gateway.ZarinPal.Internal.ZarinPalRequestResultModel' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath 'data', line 1, position 9.

amirreza58 avatar Jun 30 '22 11:06 amirreza58

I debugged the Parbad library and caught the reason of error
the error thrown from Zarinpal api as internal server error (500) I will try to contact Zarinpal support

Helius01 avatar Jul 17 '22 13:07 Helius01