Skip to content

Commit

Permalink
Update Aft and Googlepay and Applepay in payment sessions and Payment…
Browse files Browse the repository at this point in the history
… Request (#452)
  • Loading branch information
armando-rodriguez-cko authored Dec 3, 2024
1 parent c6cf94e commit dba3e72
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/com/checkout/payments/PaymentProcessing.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,9 @@ public final class PaymentProcessing {
@SerializedName("merchant_category_code")
private String merchantCategoryCode;

@SerializedName("scheme_merchant_id")
private Long schemeMerchantId;

private Boolean aft;

}
13 changes: 13 additions & 0 deletions src/main/java/com/checkout/payments/PreferredExperiences.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.checkout.payments;

import com.google.gson.annotations.SerializedName;

public enum PreferredExperiences {

@SerializedName("google_spa")
GOOGLE_SPA,

@SerializedName("3ds")
THREE_DS

}
19 changes: 19 additions & 0 deletions src/main/java/com/checkout/payments/request/Authentication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.checkout.payments.request;

import com.checkout.payments.PreferredExperiences;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class Authentication {

private List<PreferredExperiences> preferredExperiences;

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public final class PaymentRequest {

private String description;

private Authentication authentication;

@SerializedName("authorization_type")
private AuthorizationType authorizationType;

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/checkout/payments/sessions/Applepay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.checkout.payments.sessions;

import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class Applepay {

@SerializedName("store_payment_details")
private StorePaymentDetailsType storePaymentDetails;

}
17 changes: 17 additions & 0 deletions src/main/java/com/checkout/payments/sessions/Googlepay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.checkout.payments.sessions;

import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class Googlepay {

@SerializedName("store_payment_details")
private StorePaymentDetailsType storePaymentDetails;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
@AllArgsConstructor
public final class PaymentMethodConfiguration {

private Applepay applepay;

private Card card;

private Googlepay googlepay;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public final class ReconciliationQueryPaymentsFilter {

private String reference;

@Builder.Default
@Size(max = 500)
private Integer limit;
private Integer limit = 500;

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.checkout.common.Address;
import com.checkout.common.CountryCode;
import com.checkout.common.Currency;
import com.checkout.payments.request.Authentication;
import com.checkout.payments.request.AuthorizationRequest;
import com.checkout.payments.request.PartialAuthorization;
import com.checkout.payments.request.PaymentRequest;
Expand All @@ -17,6 +18,8 @@
import com.checkout.payments.sender.PaymentIndividualSender;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -107,6 +110,15 @@ private PaymentResponse makeIncrementalAuthorizationPayment() {
.enabled(true)
.build();

final List<PreferredExperiences> experiences = Arrays.asList(
PreferredExperiences.GOOGLE_SPA,
PreferredExperiences.THREE_DS
);

final Authentication authentication = Authentication.builder()
.preferredExperiences(experiences)
.build();

final PaymentRequest request = PaymentRequest.builder()
.source(source)
.sender(sender)
Expand All @@ -119,6 +131,7 @@ private PaymentResponse makeIncrementalAuthorizationPayment() {
.successUrl(null)
.failureUrl(null)
.partialAuthorization(partialAuthorization)
.authentication(authentication)
.build();

return blocking(() -> checkoutApi.paymentsClient().requestPayment(request));
Expand Down

0 comments on commit dba3e72

Please sign in to comment.