Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/java/com/checkout/common/MarketplaceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,29 @@

import java.util.List;

/**
* The marketplace data of a payment. Not part of the API specification.
*
* @deprecated Not part of the API specification. Use {@link AmountAllocations} instead. This class will
* be removed in the next major version.
*/
@Deprecated
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class MarketplaceData {

/**
* The sub-entity that the payment is being processed on behalf of.
* [Optional]
*/
private String subEntityId;

/**
* The sub-entities that the payment is being processed on behalf of.
* [Optional]
*/
private List<MarketplaceDataSubEntity> subEntities;

}
38 changes: 38 additions & 0 deletions src/main/java/com/checkout/common/MarketplaceDataSubEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,66 @@
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* A sub-entity of the marketplace data of a payment. Not part of the API specification.
*
* @deprecated Not part of the API specification. Use {@link AmountAllocations} instead. This class will
* be removed in the next major version.
*/
@Deprecated
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class MarketplaceDataSubEntity {

/**
* The id of the sub-entity.
* [Optional]
*/
private String id;

/**
* The split amount, in the minor currency unit.
* [Optional]
*/
private Long amount;

/**
* A reference you can later use to identify this split.
* [Optional]
*/
private String reference;

/**
* The commission to collect from this split.
* [Optional]
*/
private MarketplaceCommission commission;

/**
* The commission of a marketplace sub-entity. Not part of the API specification.
*
* @deprecated Not part of the API specification. Use {@link Commission} instead. This class will be
* removed in the next major version.
*/
@Deprecated
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static final class MarketplaceCommission {

/**
* The fixed amount of commission to collect, in the minor currency unit.
* [Optional]
*/
private Long amount;

/**
* The percentage of commission to collect.
* [Optional]
*/
private Double percentage;

}
Expand Down
63 changes: 60 additions & 3 deletions src/main/java/com/checkout/payments/CaptureRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,97 @@
import java.util.List;
import java.util.Map;

/**
* Request to capture a payment (POST /payments/{id}/captures).
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class CaptureRequest {

/**
* The amount to capture. If not specified, the full payment amount will be captured.
* [Optional]
* Format: int64
* min 0
* max 9999999999
*/
private Long amount;

/**
* The type of capture. If set to Final, the remaining available-to-capture balance will be voided.
* [Optional]
*/
private CaptureType captureType;

/**
* A reference you can later use to identify this capture request. For Amex, the string limit is 30 characters.
* [Optional]
* max 80 characters
*/
private String reference;

/**
* The customer's details. Required if source.type is tamara.
* [Optional]
*/
private PaymentCustomerRequest customer;

/**
* A description of the payment.
* [Optional]
* max 100 characters
*/
private String description;

/**
* An optional description that is displayed on the customer's statement identifying a purchase.
* [Optional]
*/
private BillingDescriptor billingDescriptor;

/**
* The shipping details.
* [Optional]
*/
private ShippingDetails shipping;

/**
* The order's line items.
* [Optional]
*/
private List<ProductRequest> items;

/**
* @deprecated This property will be removed in the future, and should be used
* {@link CaptureRequest#amountAllocations} instead
* The marketplace data of the capture. Not part of the API specification.
* [Optional]
*
* @deprecated Not part of the API specification. Use {@link CaptureRequest#amountAllocations}
* instead. This property will be removed in the next major version.
*/
@Deprecated
private MarketplaceData marketplace;

/**
* The sub-entities that the payment is being processed on behalf of.
* [Optional]
*/
private List<AmountAllocations> amountAllocations;

/**
* Use the processing object to influence or override the data sent during card processing.
* [Optional]
*/
private ProcessingSettings processing;

/**
* A set of key-value pairs to attach to the authorization request. You can use this to store additional
* information in a structured format. The metadata object only supports primitive data types. Objects and
* arrays are not supported.
* [Optional]
*/
@Builder.Default
private Map<String, Object> metadata = new HashMap<>();

}
}
74 changes: 71 additions & 3 deletions src/main/java/com/checkout/payments/PaymentAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,110 @@
import java.util.List;
import java.util.Map;

/**
* An action of a payment, as returned by GET /payments/{id}/actions.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public final class PaymentAction extends Resource {

/**
* The unique identifier of the payment action.
* [Required]
* Pattern: ^(act)_(\w{26})$
* max 30 characters
* min 30 characters
*/
private String id;

/**
* The type of action.
* [Required]
*/
private ActionType type;

/**
* The date/time the action was processed.
* [Required]
* Format: date-time
*/
private Instant processedOn;

/**
* The action amount.
* [Required]
*/
private Long amount;

/**
* Whether the action was successful.
* [Optional]
*/
private Boolean approved;

/**
* The issuer authorization code for cards. Only applicable for payins.
* [Optional]
*/
private String authCode;

/**
* The Gateway response code.
* [Required]
*/
private String responseCode;

/**
* The Gateway response summary.
* [Optional]
*/
private String responseSummary;

/**
* The authorization type. Only applicable for payins.
* [Optional]
*/
private AuthorizationType authorizationType;

/**
* Your reference for the action. Only applicable for payins.
* [Optional]
*/
private String reference;

/**
* @deprecated This property will be removed in the future, and should be used
* {@link PaymentAction#amountAllocations} instead
* The marketplace data of the action. Not part of the API specification.
* [Optional]
*
* @deprecated Not part of the API specification. Use {@link PaymentAction#amountAllocations}
* instead. This property will be removed in the next major version.
*/
@Deprecated
private MarketplaceData marketplace;

/**
* The sub-entities that the payment is being processed on behalf of. Only applicable for payins.
* [Optional]
*/
private List<AmountAllocations> amountAllocations;

/**
* Returns information related to the processing of the payment. Only applicable for payins.
* [Optional]
*/
private Processing processing;

/**
* The order's line item or product that is being purchased. Only applicable for payins.
* [Optional]
*/
private List<ProductResponse> items;

/**
* A set of key-value pairs that you can attach to an action. Only applicable for payins.
* [Optional]
*/
private Map<String, Object> metadata = new HashMap<>();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ public final class PaymentRequest {
private PaymentRecipient recipient;

/**
* The marketplace data for the payment. No longer in the API specification.
* The marketplace data for the payment. Not part of the API specification: the API rejects a payment
* request that carries it (422 marketplace_not_supported).
* [Optional]
* @deprecated Use {@link PaymentRequest#amountAllocations} instead.
*
* @deprecated Not part of the API specification and rejected by the API (422 marketplace_not_supported). Use
* {@link PaymentRequest#amountAllocations} instead. This property will be removed in the next major version.
*/
@Deprecated
private MarketplaceData marketplace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ public final class GetPaymentResponse extends Resource {
private String paymentIp;

/**
* Not part of the get payment details schema in the API reference.
* The marketplace data of the payment. Not part of the API specification.
* [Optional]
*
* @deprecated This property will be removed in the future, and should be used
* {@link GetPaymentResponse#amountAllocations} instead
* @deprecated Not part of the API specification. Use {@link GetPaymentResponse#amountAllocations}
* instead. This property will be removed in the next major version.
*/
@Deprecated
private MarketplaceData marketplace;
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/com/checkout/OAuthTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
import com.checkout.common.AccountHolderIdentification;
import com.checkout.common.AccountHolderIdentificationType;
import com.checkout.common.Address;
import com.checkout.common.AmountAllocations;
import com.checkout.common.CountryCode;
import com.checkout.common.Currency;
import com.checkout.common.MarketplaceData;
import com.checkout.payments.request.PaymentRequest;
import com.checkout.payments.request.source.RequestCardSource;
import com.checkout.payments.sender.PaymentIndividualSender;
import org.junit.jupiter.api.Test;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.UUID;

import static java.net.URI.create;
Expand Down Expand Up @@ -63,7 +64,13 @@ void shouldMakeOAuthCall() {
.amount(10L)
.currency(Currency.EUR)
.processingChannelId("pc_a6dabcfa2o3ejghb3sjuotdzzy")
.marketplace(MarketplaceData.builder().subEntityId("ent_ocw5i74vowfg2edpy66izhts2u").build())
// The OAuth client's entity must allocate the payment to a sub-entity; the sandbox refuses
// the former marketplace object (marketplace_not_supported) and a payment without an
// allocation (amount_allocations_required).
.amountAllocations(Collections.singletonList(AmountAllocations.builder()
.id("ent_ocw5i74vowfg2edpy66izhts2u")
.amount(10L)
.build()))
.build();

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