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

adds checkout token expire endpoint with new fields #131

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Craftgate/Adapter/PaymentAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ public Task<PaymentResponse> RetrieveCheckoutPaymentAsync(string token)
CreateHeaders(path, RequestOptions));
}

public void ExpireCheckoutPayment(string token)
{
var path = "/payment/v1/checkout-payments/" + token;
RestClient.Delete<object>(RequestOptions.BaseUrl + path,
CreateHeaders(path, RequestOptions));
}

public Task ExpireCheckoutPaymentAsync(string token)
{
var path = "/payment/v1/checkout-payments/" + token;
return AsyncRestClient.Delete<object>(RequestOptions.BaseUrl + path,
CreateHeaders(path, RequestOptions));
}

public DepositPaymentResponse CreateDepositPayment(CreateDepositPaymentRequest createDepositPaymentRequest)
{
var path = "/payment/v1/deposits";
Expand Down
1 change: 1 addition & 0 deletions Craftgate/Request/InitCheckoutPaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CustomInstallment> CustomInstallments { get; set; }
public IList<PaymentItem> Items { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions Craftgate/Response/InitCheckoutPaymentResponse.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System;

namespace Craftgate.Response
{
public class InitCheckoutPaymentResponse
{
public string Token { get; set; }
public string PageUrl { get; set; }
public DateTime TokenExpireDate { get; set; }
}
}
9 changes: 9 additions & 0 deletions Samples/PaymentSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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()
{
Expand Down
Loading