You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: the data returned from Quickpay containing data from aquirer cannot always be serialized. This results in an error that cannot be handled in my own code.
Solution: change type for field callback_duration from "string" to "int?".
Details:
Looking at the part of the JSON returned for an operaion looks like this:
private string JsonOperation = @"{
""id"": 2,
""type"": ""authorize"",
""amount"": 148,
""pending"": false,
""qp_status_code"": ""20000"",
""qp_status_msg"": ""Approved"",
""aq_status_code"": ""0"",
""aq_status_msg"": ""Accepted, The agreement has been accepted."",
""data"": { },
""callback_url"": ""https://13f5-147-78-28-145.ngrok-free.app/subscriptions/callback"",
""callback_success"": false,
""callback_response_code"": null,
""callback_duration"": 30002,
""acquirer"": ""mobilepaysubscriptions"",
""3d_secure_status"": null,
""callback_at"": ""2023-09-06T11:54:00Z"",
""created_at"": ""2023-09-06T11:50:58Z""
}";
[TestMethod]
public void ParseOperation_OneOperation_Fail()
{
try
{
var operation = System.Text.Json.JsonSerializer.Deserialize<Quickpay.Models.Payments.Operation>(JsonOperation);
}
catch (Exception e)
{
Assert.Fail(e.Message);
}
}
public class OperationFixed : Quickpay.Models.Payments.Operation
{
public new int? callback_duration { get; set; }
}
[TestMethod]
public void ParseOperation_OneOperation_Success()
{
try
{
var operation = System.Text.Json.JsonSerializer.Deserialize<OperationFixed>(JsonOperation);
}
catch (Exception e)
{
Assert.Fail(e.Message);
}
Assert.IsTrue(true);
}
The text was updated successfully, but these errors were encountered:
immeo-rru
changed the title
Wong fieldtype for callback_duration in class "Operation"
Wong type for field 'callback_duration' in class 'Operation'
Sep 6, 2023
immeo-rru
changed the title
Wong type for field 'callback_duration' in class 'Operation'
Wrong type for field 'callback_duration' in class 'Operation'
Sep 6, 2023
Problem: the data returned from Quickpay containing data from aquirer cannot always be serialized. This results in an error that cannot be handled in my own code.
Solution: change type for field callback_duration from "string" to "int?".
Details:
Looking at the part of the JSON returned for an operaion looks like this:
Test:
The text was updated successfully, but these errors were encountered: