From f5bbf83dfe9c24bb42524e9116910155288c1892 Mon Sep 17 00:00:00 2001 From: Daniel Alfaro Date: Thu, 28 May 2026 20:06:28 -0500 Subject: [PATCH] feat(order): add missing AP fields to order request models (IXE-679) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add fields required for the Automatic Payments flow in the Orders API: - OrderStoredCredentialRequest: prevTransactionRef (String) — links each recurring charge to the original card-network authorization; required from the second charge onwards. - OrderPaymentRequest: dateOfExpiration (String, ISO 8601) — absolute payment expiry date, distinct from the relative expirationTime TTL. - OrderPayerAddressRequest: complement (String) — apartment, floor, or additional address detail; already present in Go, .NET and Node.js. - OrderIntegrationDataRequest (new class): integratorId, platformId, corporationId (String) and sponsor (OrderSponsorRequest) — integration metadata for marketplace and platform identification. - OrderSponsorRequest (new class): id (String) — MercadoPago user ID of the sponsoring marketplace owner. - OrderCreateRequest: integrationData field referencing the new class. All fields are optional additions; no existing fields were renamed or removed. Build and unit tests (25/25) pass without modification. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- .../client/order/OrderCreateRequest.java | 3 ++ .../order/OrderIntegrationDataRequest.java | 28 +++++++++++++++++++ .../order/OrderPayerAddressRequest.java | 3 ++ .../client/order/OrderPaymentRequest.java | 7 +++++ .../client/order/OrderSponsorRequest.java | 18 ++++++++++++ .../order/OrderStoredCredentialRequest.java | 7 +++++ 6 files changed, 66 insertions(+) create mode 100644 src/main/java/com/mercadopago/client/order/OrderIntegrationDataRequest.java create mode 100644 src/main/java/com/mercadopago/client/order/OrderSponsorRequest.java diff --git a/src/main/java/com/mercadopago/client/order/OrderCreateRequest.java b/src/main/java/com/mercadopago/client/order/OrderCreateRequest.java index 74dbb046..5b4ce4df 100644 --- a/src/main/java/com/mercadopago/client/order/OrderCreateRequest.java +++ b/src/main/java/com/mercadopago/client/order/OrderCreateRequest.java @@ -69,4 +69,7 @@ public class OrderCreateRequest extends MPResource { /** Shipment details for the order, including receiver address and package dimensions. */ private OrderShipmentRequest shipment; + + /** Integration metadata identifying the integrator, platform, corporation, and sponsor. */ + private OrderIntegrationDataRequest integrationData; } diff --git a/src/main/java/com/mercadopago/client/order/OrderIntegrationDataRequest.java b/src/main/java/com/mercadopago/client/order/OrderIntegrationDataRequest.java new file mode 100644 index 00000000..0589ec42 --- /dev/null +++ b/src/main/java/com/mercadopago/client/order/OrderIntegrationDataRequest.java @@ -0,0 +1,28 @@ +package com.mercadopago.client.order; + +import lombok.Builder; +import lombok.Getter; + +// API version: acd67b14-97c4-4a4a-840d-0a018c09654f + +/** + * Request object containing integration metadata for an order. Identifies the integrator, + * platform, and corporation associated with the integration, as well as any sponsoring + * marketplace owner. + */ +@Getter +@Builder +public class OrderIntegrationDataRequest { + + /** Identifier of the certified integrator. Type: String. */ + private String integratorId; + + /** Platform identifier assigned by MercadoPago. Type: String. */ + private String platformId; + + /** Corporation identifier for multi-account setups. Type: String. */ + private String corporationId; + + /** Sponsor (marketplace owner) information. */ + private OrderSponsorRequest sponsor; +} diff --git a/src/main/java/com/mercadopago/client/order/OrderPayerAddressRequest.java b/src/main/java/com/mercadopago/client/order/OrderPayerAddressRequest.java index 94119e13..5c8bb993 100644 --- a/src/main/java/com/mercadopago/client/order/OrderPayerAddressRequest.java +++ b/src/main/java/com/mercadopago/client/order/OrderPayerAddressRequest.java @@ -29,4 +29,7 @@ public class OrderPayerAddressRequest { /** Name of the state or province. */ private String state; + + /** Apartment number, floor, or other additional address information. Type: String. */ + private String complement; } diff --git a/src/main/java/com/mercadopago/client/order/OrderPaymentRequest.java b/src/main/java/com/mercadopago/client/order/OrderPaymentRequest.java index e0d0e965..a123acd1 100644 --- a/src/main/java/com/mercadopago/client/order/OrderPaymentRequest.java +++ b/src/main/java/com/mercadopago/client/order/OrderPaymentRequest.java @@ -20,6 +20,13 @@ public class OrderPaymentRequest { /** ISO 8601 duration or date-time indicating when this payment expires. */ private String expirationTime; + /** + * Absolute date and time (ISO 8601) after which this payment can no longer be collected. + * Distinct from expirationTime, which is a relative duration or TTL. + * Type: String (ISO 8601, e.g. "2026-06-01T00:00:00.000-04:00"). + */ + private String dateOfExpiration; + /** Payment method details including type, token, and installments. */ private OrderPaymentMethodRequest paymentMethod; diff --git a/src/main/java/com/mercadopago/client/order/OrderSponsorRequest.java b/src/main/java/com/mercadopago/client/order/OrderSponsorRequest.java new file mode 100644 index 00000000..2c5d9117 --- /dev/null +++ b/src/main/java/com/mercadopago/client/order/OrderSponsorRequest.java @@ -0,0 +1,18 @@ +package com.mercadopago.client.order; + +import lombok.Builder; +import lombok.Getter; + +// API version: acd67b14-97c4-4a4a-840d-0a018c09654f + +/** + * Request object representing the sponsor (marketplace owner) associated with an order's + * integration metadata. + */ +@Getter +@Builder +public class OrderSponsorRequest { + + /** MercadoPago user ID of the sponsoring marketplace owner. Type: String. */ + private String id; +} diff --git a/src/main/java/com/mercadopago/client/order/OrderStoredCredentialRequest.java b/src/main/java/com/mercadopago/client/order/OrderStoredCredentialRequest.java index fd3949df..9526d1ee 100644 --- a/src/main/java/com/mercadopago/client/order/OrderStoredCredentialRequest.java +++ b/src/main/java/com/mercadopago/client/order/OrderStoredCredentialRequest.java @@ -26,4 +26,11 @@ public class OrderStoredCredentialRequest { /** Whether this is the first payment using this stored credential. */ private Boolean firstPayment; + + /** + * Reference to the previous transaction in a recurring series. Required from the second charge + * onwards to link this payment to the original card-network authorization. + * Type: String (transaction ID). + */ + private String prevTransactionRef; }