-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds request and get payment contexts endpoints
- Loading branch information
1 parent
aa2b545
commit 5bc3f5a
Showing
28 changed files
with
699 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/checkout/payments/contexts/PaymentContextDetailsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.checkout.HttpMetadata; | ||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
Check notice Code scanning / CodeQL Missing Override annotation Note
This method overrides
HttpMetadata.canEqual Error loading related location Loading |
||
@ToString(callSuper = true) | ||
public final class PaymentContextDetailsResponse extends HttpMetadata { | ||
|
||
@SerializedName("payment_request") | ||
private PaymentContextsResponse paymentRequest; | ||
|
||
@SerializedName("partner_metadata") | ||
private PaymentContextsPartnerMetadata partnerMetadata; | ||
|
||
private Object customer; | ||
|
||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/checkout/payments/contexts/PaymentContexts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.checkout.common.Currency; | ||
import com.checkout.payments.PaymentType; | ||
import com.checkout.payments.ShippingDetails; | ||
import com.google.gson.annotations.SerializedName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class PaymentContexts { | ||
|
||
public Long amount; | ||
|
||
public Currency currency; | ||
|
||
@SerializedName("payment_type") | ||
public PaymentType paymentType; | ||
|
||
public boolean capture; | ||
|
||
public ShippingDetails shipping; | ||
|
||
public PaymentContextsProcessing processing; | ||
|
||
@SerializedName("processing_channel_id") | ||
public String processingChannelId; | ||
|
||
public String reference; | ||
|
||
public String description; | ||
|
||
@SerializedName("success_url") | ||
public String successUrl; | ||
|
||
@SerializedName("failure_url") | ||
public String failureUrl; | ||
|
||
public List<PaymentContextsItems> items; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/checkout/payments/contexts/PaymentContextsAirlineData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public final class PaymentContextsAirlineData { | ||
|
||
private List<PaymentContextsTicket> ticket; | ||
|
||
private List<PaymentContextsPassenger> passenger; | ||
|
||
@SerializedName("flight_leg_details") | ||
private List<PaymentContextsFlightLegDetails> flightLegDetails; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/checkout/payments/contexts/PaymentContextsClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public interface PaymentContextsClient { | ||
|
||
CompletableFuture<PaymentContextsRequestResponse> requestPaymentContexts(PaymentContextsRequest paymentContextsRequest); | ||
|
||
CompletableFuture<PaymentContextDetailsResponse> getPaymentContextDetails(String paymentContextId); | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/checkout/payments/contexts/PaymentContextsClientImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.checkout.AbstractClient; | ||
import com.checkout.ApiClient; | ||
import com.checkout.CheckoutConfiguration; | ||
import com.checkout.SdkAuthorizationType; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import static com.checkout.common.CheckoutUtils.validateParams; | ||
|
||
public class PaymentContextsClientImpl extends AbstractClient implements PaymentContextsClient { | ||
|
||
private static final String PAYMENT_CONTEXTS_PATH = "payment-contexts"; | ||
|
||
public PaymentContextsClientImpl(final ApiClient apiClient, final CheckoutConfiguration configuration) { | ||
super(apiClient, configuration, SdkAuthorizationType.SECRET_KEY_OR_OAUTH); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<PaymentContextsRequestResponse> requestPaymentContexts(final PaymentContextsRequest paymentContextsRequest) { | ||
validateParams("paymentContextsRequest", paymentContextsRequest); | ||
return apiClient.postAsync(PAYMENT_CONTEXTS_PATH, sdkAuthorization(), PaymentContextsRequestResponse.class, paymentContextsRequest, null); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<PaymentContextDetailsResponse> getPaymentContextDetails(final String paymentContextId) { | ||
validateParams("paymentContextId", paymentContextId); | ||
return apiClient.getAsync(buildPath(PAYMENT_CONTEXTS_PATH, paymentContextId), sdkAuthorization(), PaymentContextDetailsResponse.class); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/checkout/payments/contexts/PaymentContextsFlightLegDetails.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.Instant; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public final class PaymentContextsFlightLegDetails { | ||
|
||
@SerializedName("flight_number") | ||
private String flightNumber; | ||
|
||
@SerializedName("carrier_code") | ||
private String carrierCode; | ||
|
||
@SerializedName("class_of_travelling") | ||
private String classOfTravelling; | ||
|
||
@SerializedName("departure_airport") | ||
private String departureAirport; | ||
|
||
@SerializedName("departure_date") | ||
private Instant departureDate; | ||
|
||
@SerializedName("departure_time") | ||
private String departureTime; | ||
|
||
@SerializedName("arrival_airport") | ||
private String arrivalAirport; | ||
|
||
@SerializedName("stop_over_code") | ||
private String stopOverCode; | ||
|
||
@SerializedName("fare_basis_code") | ||
private String fareBasisCode; | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/checkout/payments/contexts/PaymentContextsItems.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
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 PaymentContextsItems { | ||
|
||
private String name; | ||
|
||
private Integer quantity; | ||
|
||
@SerializedName("unit_price") | ||
private Integer unitPrice; | ||
|
||
private String reference; | ||
|
||
@SerializedName("total_amount") | ||
private Integer totalAmount; | ||
|
||
@SerializedName("tax_amount") | ||
private Integer taxAmount; | ||
|
||
@SerializedName("discount_amount") | ||
private Integer discountAmount; | ||
|
||
private String url; | ||
|
||
@SerializedName("image_url") | ||
private String imageUrl; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/checkout/payments/contexts/PaymentContextsPartnerCustomerRiskData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public final class PaymentContextsPartnerCustomerRiskData { | ||
|
||
private String key; | ||
|
||
private String value; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/checkout/payments/contexts/PaymentContextsPartnerMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
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 PaymentContextsPartnerMetadata { | ||
|
||
@SerializedName("order_id") | ||
private String orderId; | ||
|
||
@SerializedName("customer_id") | ||
private String customerId; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/checkout/payments/contexts/PaymentContextsPassenger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.checkout.common.Address; | ||
import com.google.gson.annotations.SerializedName; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.Instant; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public final class PaymentContextsPassenger { | ||
|
||
@SerializedName("first_name") | ||
private String firstName; | ||
|
||
@SerializedName("last_name") | ||
private String lastName; | ||
|
||
@SerializedName("date_of_birth") | ||
private Instant dateOfBirth; | ||
|
||
private Address address; | ||
} |
Oops, something went wrong.