Skip to content

Commit

Permalink
Add init checkout payments for deposit (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
beratallahverdi authored Jul 4, 2024
1 parent d8b61e6 commit 6d091e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class InitCheckoutPaymentRequest {
protected boolean allowInstallmentOnlyCommercialCards;
protected boolean forceThreeDS;
protected boolean forceAuthForNonCreditCards;
protected boolean depositPayment;
protected Long ttl;
protected List<CustomInstallment> customInstallments;
protected List<PaymentItem> items;
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/io/craftgate/sample/PaymentSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 6d091e6

Please sign in to comment.