Skip to content

feat(order): add typed request dataclasses for items, shipment, payer, integration_data and transaction_security - #137

Open
Diego Barajas (barajas-d) wants to merge 5 commits into
masterfrom
feature/order-fields-sdk
Open

feat(order): add typed request dataclasses for items, shipment, payer, integration_data and transaction_security#137
Diego Barajas (barajas-d) wants to merge 5 commits into
masterfrom
feature/order-fields-sdk

Conversation

@barajas-d

Copy link
Copy Markdown

Descripción

Agrega dataclasses tipadas para el Orders API. Order.create() acepta tanto dict (ruta existente) como instancias de OrderCreateRequest.

Campos agregados (39)

Raíz del Order

description, marketplace, marketplace_fee, expiration_time, checkout_available_at, integration_data

transactions.payments[]

expiration_time, date_of_expiration, payment_method.statement_descriptor

payer

phone.area_code, phone.number, address.zip_code, address.street_name, address.street_number, address.neighborhood, address.state, address.city, address.complement

items[] (completo)

title, unit_price, quantity, description, external_code, picture_url, category_id, type, warranty, event_date

shipment.address

street_name, street_number, zip_code, city, state

integration_data

integrator_id, platform_id, corporation_id, sponsor.id

config.transaction_security

validation, liability_shift

Nuevas clases

OrderItemRequest, OrderPayerPhone, OrderPayerAddress, OrderShipmentRequest, OrderShipmentAddress, OrderShipmentFreeMethod, OrderIntegrationData, OrderSponsor, OrderTransactionSecurity

Compatibilidad

Order.create(dict) funciona igual. Todos los campos Optional con default None.

…er address/phone, transaction_security)

Additive changes; dict path unchanged (backward compatible):
- New dataclasses: OrderItemRequest, OrderShipmentRequest (+OrderShipmentAddress, OrderShipmentFreeMethod),
  OrderPayerPhone, OrderPayerAddress, OrderTransactionSecurity (nested under config.online)
- OrderCreateRequest: adds missing root fields (description, marketplace, marketplace_fee,
  expiration_time, checkout_available_at) and completes payer with phone + address
- order_request_to_dict() helper: recursive asdict() with None-filtering (DD-3)
- order.create() dual-accepts dict or dataclass (converts via order_request_to_dict)
- README: promotes Orders API and references AP example; legacy Payments demoted

All snake_case keys per canonical reference (sdk-go + sdk-dotnet).
16 new offline tests; existing dict path unaffected.

Closes: orders-sdk-typed-request-classes
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…lasses

Order request dataclasses (OrderCreateRequest, OrderPayerRequest,
OrderPayerAddress, OrderShipmentAddress, OrderItemRequest) model
the Orders API contract verbatim — their attribute count is
determined by the API, not by internal design. Added inline
pylint disable with explanatory comment on each affected class.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Line 52 exceeded the 100-char pylint limit enforced by tests/.pylintrc.
Wrapped the parameter list across two lines; no logic change.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ete typed AP chain

Introduces OrderPaymentMethodRequest, OrderPaymentRequest, and
OrderTransactionRequest dataclasses so the full typed chain
OrderCreateRequest → OrderTransactionRequest → OrderPaymentRequest →
automatic_payments / stored_credential / subscription_data is available
without raw dicts.

OrderCreateRequest.transactions now accepts Union[OrderTransactionRequest, dict]
— existing dict-based callers are unaffected.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant