From 90f0da6a95740c85eb051db13d1e40feaeee5f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertu=C4=9Frul=20Berat=20ALLAHVERD=C4=B0?= Date: Thu, 4 Jul 2024 14:06:14 +0300 Subject: [PATCH] Add init checkout payments for deposit --- .../request/InitCheckoutPaymentRequest.java | 1 + .../io/craftgate/sample/PaymentSample.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java b/src/main/java/io/craftgate/request/InitCheckoutPaymentRequest.java index 58668169..0e9ff06f 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 boolean depositPayment; protected Long ttl; protected List customInstallments; protected List items; diff --git a/src/test/java/io/craftgate/sample/PaymentSample.java b/src/test/java/io/craftgate/sample/PaymentSample.java index b6abd110..80cd381d 100644 --- a/src/test/java/io/craftgate/sample/PaymentSample.java +++ b/src/test/java/io/craftgate/sample/PaymentSample.java @@ -737,6 +737,28 @@ void init_checkout_payment() { assertNotNull(response.getTokenExpireDate()); } + @Test + void init_checkout_payment_for_deposit() { + InitCheckoutPaymentRequest request = InitCheckoutPaymentRequest.builder() + .price(BigDecimal.valueOf(100)) + .paidPrice(BigDecimal.valueOf(100)) + .buyerMemberId(1L) + .callbackUrl("https://www.your-website.com/craftgate-checkout-callback") + .currency(Currency.TRY) + .conversationId("456d1297-908e-4bd6-a13b-4be31a6e47d5") + .paymentGroup(PaymentGroup.PRODUCT) + .paymentPhase(PaymentPhase.AUTH) + .depositPayment(true) + .build(); + + InitCheckoutPaymentResponse response = craftgate.payment().initCheckoutPayment(request); + + assertNotNull(response); + assertNotNull(response.getPageUrl()); + assertNotNull(response.getToken()); + assertNotNull(response.getTokenExpireDate()); + } + @Test void retrieve_checkout_payment() { String token = "456d1297-908e-4bd6-a13b-4be31a6e47d5";