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

JsonSerializationException when using ZarinPal gateway #310

Closed
WatchDogsDev opened this issue Jun 20, 2022 · 3 comments · Fixed by #325
Closed

JsonSerializationException when using ZarinPal gateway #310

WatchDogsDev opened this issue Jun 20, 2022 · 3 comments · Fixed by #325
Assignees
Labels
bug Something isn't working done This task is done

Comments

@WatchDogsDev
Copy link

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
@Sina-Soltani
Copy link
Owner

I'll take a look at it soon

@amirreza58
Copy link

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.

@Helius01
Copy link

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

@Sina-Soltani Sina-Soltani mentioned this issue Nov 20, 2022
@Sina-Soltani Sina-Soltani added the done This task is done label Nov 20, 2022
@Sina-Soltani Sina-Soltani linked a pull request Jan 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done This task is done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants