diff --git a/QuickPay.IntegrationTests/PaymentsServiceTest.cs b/QuickPay.IntegrationTests/PaymentsServiceTest.cs index b53c1ee..f322955 100644 --- a/QuickPay.IntegrationTests/PaymentsServiceTest.cs +++ b/QuickPay.IntegrationTests/PaymentsServiceTest.cs @@ -101,7 +101,7 @@ public void CreatePaymentLink() var service = new PaymentsService(QpConfig.ApiKey); string randomOrderId = OrderIdGenerator.createRandomOrderId(); - var createPaymentReqParams= new CreatePaymentRequestParams("DKK", randomOrderId); + var createPaymentReqParams = new CreatePaymentRequestParams("DKK", randomOrderId); Payment payment = service.CreatePayment(createPaymentReqParams).GetAwaiter().GetResult(); var createPaymentLinkReqParams = new CreatePaymentLinkRequestParams(1000); @@ -128,7 +128,7 @@ public void DeletePaymentLink() { task.GetAwaiter().GetResult(); } - catch(Exception) + catch (Exception) { Assert.Fail("No exception should be thrown"); } @@ -161,6 +161,39 @@ public void UpdatePayment() var result = task.Result; Assert.IsNotNull(result); - } + } + + private readonly string _jsonPaymentResponseTest = @"{ + ""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 ParseJsonResponse() + { + try + { + var operation = System.Text.Json.JsonSerializer.Deserialize(_jsonPaymentResponseTest); + } + catch (Exception e) + { + Assert.Fail(e.Message); + } + } } } \ No newline at end of file diff --git a/QuickPay/Models/Payments/Operation.cs b/QuickPay/Models/Payments/Operation.cs index 3293f77..4305508 100644 --- a/QuickPay/Models/Payments/Operation.cs +++ b/QuickPay/Models/Payments/Operation.cs @@ -16,7 +16,7 @@ public class Operation public string callback_url { get; set; } public Boolean? callback_success { get; set; } public string callback_response_code { get; set; } - public string callback_duration { get; set; } + public int? callback_duration { get; set; } public string acquirer { get; set; } public string callback_at { get; set; } public string created_at { get; set; } diff --git a/QuickPay/Quickpay.csproj b/QuickPay/Quickpay.csproj index 6512192..52bf834 100644 --- a/QuickPay/Quickpay.csproj +++ b/QuickPay/Quickpay.csproj @@ -2,9 +2,9 @@ netstandard2.0 - 2.2.3 + 2.2.4 QuickPay.API.Client - 2.2.3 + 2.2.4