Skip to content

Commit

Permalink
implements checkout expire
Browse files Browse the repository at this point in the history
  • Loading branch information
reywyn committed Aug 29, 2023
1 parent a211016 commit 867a447
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions Craftgate/Response/InitCheckoutPaymentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ public class InitCheckoutPaymentResponse
{
public string Token { get; set; }
public string PageUrl { get; set; }
public DateTime TokenExpireDate { get; set; }

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 7 in Craftgate/Response/InitCheckoutPaymentResponse.cs

View workflow job for this annotation

GitHub Actions / Dotnet Build & Test

The type or namespace name 'DateTime' could not be found (are you missing a using directive or an assembly reference?)
}
}
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

0 comments on commit 867a447

Please sign in to comment.