From 867a447e21ec8f3f31a47d78de6eaac7cf479907 Mon Sep 17 00:00:00 2001 From: Emre INAL Date: Tue, 29 Aug 2023 13:58:37 +0300 Subject: [PATCH 1/2] implements checkout expire --- Craftgate/Adapter/PaymentAdapter.cs | 14 ++++++++++++++ Craftgate/Request/InitCheckoutPaymentRequest.cs | 1 + Craftgate/Response/InitCheckoutPaymentResponse.cs | 1 + Samples/PaymentSample.cs | 9 +++++++++ 4 files changed, 25 insertions(+) diff --git a/Craftgate/Adapter/PaymentAdapter.cs b/Craftgate/Adapter/PaymentAdapter.cs index 51ad22c..7b70aef 100644 --- a/Craftgate/Adapter/PaymentAdapter.cs +++ b/Craftgate/Adapter/PaymentAdapter.cs @@ -123,6 +123,20 @@ public Task RetrieveCheckoutPaymentAsync(string token) CreateHeaders(path, RequestOptions)); } + public void ExpireCheckoutPayment(string token) + { + var path = "/payment/v1/checkout-payments/" + token; + RestClient.Delete(RequestOptions.BaseUrl + path, + CreateHeaders(path, RequestOptions)); + } + + public Task ExpireCheckoutPaymentAsync(string token) + { + var path = "/payment/v1/checkout-payments/" + token; + return AsyncRestClient.Delete(RequestOptions.BaseUrl + path, + CreateHeaders(path, RequestOptions)); + } + public DepositPaymentResponse CreateDepositPayment(CreateDepositPaymentRequest createDepositPaymentRequest) { var path = "/payment/v1/deposits"; diff --git a/Craftgate/Request/InitCheckoutPaymentRequest.cs b/Craftgate/Request/InitCheckoutPaymentRequest.cs index bd4b2c4..e1e5252 100644 --- a/Craftgate/Request/InitCheckoutPaymentRequest.cs +++ b/Craftgate/Request/InitCheckoutPaymentRequest.cs @@ -29,6 +29,7 @@ public class InitCheckoutPaymentRequest public bool AllowInstallmentOnlyCommercialCards { get; set; } public bool ForceThreeDS { get; set; } public bool ForceAuthForNonCreditCards { get; set; } + public long? Ttl { get; set; } public IList CustomInstallments { get; set; } public IList Items { get; set; } } diff --git a/Craftgate/Response/InitCheckoutPaymentResponse.cs b/Craftgate/Response/InitCheckoutPaymentResponse.cs index 0069c3b..9848979 100644 --- a/Craftgate/Response/InitCheckoutPaymentResponse.cs +++ b/Craftgate/Response/InitCheckoutPaymentResponse.cs @@ -4,5 +4,6 @@ public class InitCheckoutPaymentResponse { public string Token { get; set; } public string PageUrl { get; set; } + public DateTime TokenExpireDate { get; set; } } } \ No newline at end of file diff --git a/Samples/PaymentSample.cs b/Samples/PaymentSample.cs index bb6ee4c..0f34364 100644 --- a/Samples/PaymentSample.cs +++ b/Samples/PaymentSample.cs @@ -743,6 +743,7 @@ public void Init_Checkout_Payment() var response = _craftgateClient.Payment().InitCheckoutPayment(request); Assert.NotNull(response.Token); Assert.NotNull(response.PageUrl); + Assert.NotNull(response.TokenExpireDate); } [Test] @@ -1348,6 +1349,14 @@ public void Retrieve_Checkout_Payment() Assert.NotNull(response.CardToken); } + [Test] + public void Delete_Payout_Account() + { + var token = "456d1297-908e-4bd6-a13b-4be31a6e47d5"; + + _craftgateClient.Payment().ExpireCheckoutPayment(token); + } + [Test] public void Refund_Payment() { From 0f67ded12365a2e97b77736c934c88a52d8c60d3 Mon Sep 17 00:00:00 2001 From: Emre INAL Date: Tue, 29 Aug 2023 14:12:20 +0300 Subject: [PATCH 2/2] add missing import --- Craftgate/Response/InitCheckoutPaymentResponse.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Craftgate/Response/InitCheckoutPaymentResponse.cs b/Craftgate/Response/InitCheckoutPaymentResponse.cs index 9848979..aefc6c1 100644 --- a/Craftgate/Response/InitCheckoutPaymentResponse.cs +++ b/Craftgate/Response/InitCheckoutPaymentResponse.cs @@ -1,3 +1,5 @@ +using System; + namespace Craftgate.Response { public class InitCheckoutPaymentResponse