diff --git a/src/main/java/io/craftgate/adapter/PaymentAdapter.java b/src/main/java/io/craftgate/adapter/PaymentAdapter.java index 41726aee..1a45b3f4 100644 --- a/src/main/java/io/craftgate/adapter/PaymentAdapter.java +++ b/src/main/java/io/craftgate/adapter/PaymentAdapter.java @@ -55,6 +55,11 @@ public PaymentResponse retrieveCheckoutPayment(String token) { return HttpClient.get(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions), PaymentResponse.class); } + public void expireCheckoutPayment(String token) { + String path = "/payment/v1/checkout-payments/" + token; + HttpClient.delete(requestOptions.getBaseUrl() + path, createHeaders(path, requestOptions)); + } + public DepositPaymentResponse createDepositPayment(CreateDepositPaymentRequest createDepositPaymentRequest) { String path = "/payment/v1/deposits"; return HttpClient.post(requestOptions.getBaseUrl() + path, createHeaders(createDepositPaymentRequest, path, requestOptions), diff --git a/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java b/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java index 67ace0af..58668169 100644 --- a/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java +++ b/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java @@ -44,6 +44,7 @@ public class InitCheckoutPaymentRequest { protected boolean allowInstallmentOnlyCommercialCards; protected boolean forceThreeDS; protected boolean forceAuthForNonCreditCards; + protected Long ttl; protected List customInstallments; protected List items; } \ No newline at end of file diff --git a/src/main/java/io/craftgate/response/InitCheckoutPaymentResponse.java b/src/main/java/io/craftgate/response/InitCheckoutPaymentResponse.java index 10cefe73..da53b96b 100644 --- a/src/main/java/io/craftgate/response/InitCheckoutPaymentResponse.java +++ b/src/main/java/io/craftgate/response/InitCheckoutPaymentResponse.java @@ -2,9 +2,12 @@ import lombok.Data; +import java.time.LocalDateTime; + @Data public class InitCheckoutPaymentResponse { protected String token; protected String pageUrl; + protected LocalDateTime tokenExpireDate; } diff --git a/src/test/java/io/craftgate/sample/PaymentSample.java b/src/test/java/io/craftgate/sample/PaymentSample.java index 5ebf9515..535020dc 100644 --- a/src/test/java/io/craftgate/sample/PaymentSample.java +++ b/src/test/java/io/craftgate/sample/PaymentSample.java @@ -730,6 +730,7 @@ void init_checkout_payment() { assertNotNull(response); assertNotNull(response.getPageUrl()); assertNotNull(response.getToken()); + assertNotNull(response.getTokenExpireDate()); } @Test @@ -741,6 +742,13 @@ void retrieve_checkout_payment() { assertNotNull(response); } + @Test + void expire_checkout_payment() { + String token = "456d1297-908e-4bd6-a13b-4be31a6e47d5"; + + craftgate.payment().expireCheckoutPayment(token); + } + @Test void create_deposit_payment() { CreateDepositPaymentRequest request = CreateDepositPaymentRequest.builder()