feat(order): add typed request dataclasses for items, shipment, payer, integration_data and transaction_security - #137
Merged
Conversation
…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>
…ence in stored_credential
Diego Barajas (barajas-d)
force-pushed
the
feature/order-fields-sdk
branch
from
August 3, 2026 20:41
61911e4 to
ef33b38
Compare
luismeli10 (luismeli10)
previously approved these changes
Aug 3, 2026
Keep both feature/order-fields-sdk additions (dataclass support in create() via order_request_to_dict) and master additions (pagination iterator import for search_auto_paging_iter). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
master added retry_on and backoff_factor params to HttpClient.post() (ergonomics retry feature). The test stub was missing them, causing TypeError on all order create tests after the merge. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Matches the same disable already present on HttpClient.post in http_client.py after adding retry_on and backoff_factor params. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
When the Order API section was added, the Payment example was split into its own code block losing the request_options that was part of the original single example in master. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace order_payer.py with payer.py and move OrderPayerRequest and OrderIdentification out of order_create.py into the same module. Remove the "Order" prefix so the classes are reusable across APIs: OrderPayerPhone → PayerPhone OrderPayerAddress → PayerAddress OrderIdentification → PayerIdentification OrderPayerRequest → PayerRequest (moved from order_create.py) OrderCreateRequest.payer now types PayerRequest. Public __init__.py exports updated accordingly. No behaviour change — 79 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Replace order_item.py/order_shipment.py with item.py/shipment.py and remove the Order prefix from class names to make them reusable across APIs (items and shipments appear in Preferences API with similar schema): OrderItemRequest → ItemRequest (item.py) OrderShipmentRequest → ShipmentRequest (shipment.py) OrderShipmentAddress → ShipmentAddress OrderShipmentFreeMethod → ShipmentFreeMethod OrderCreateRequest.items and .shipment updated accordingly. order_transaction.py keeps the Order prefix — PaymentRequest would clash with the existing Payment resource and the structure is Orders-API-only. 79 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…om order_create After moving PayerRequest to payer.py, order_create.py only needs PayerRequest — the sub-classes are internal to payer.py. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
luismeli10 (luismeli10)
approved these changes
Aug 10, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descripción
Agrega dataclasses tipadas para el Orders API.
Order.create()acepta tantodict(ruta existente) como instancias deOrderCreateRequest.Campos agregados (39)
Raíz del Order
description,marketplace,marketplace_fee,expiration_time,checkout_available_at,integration_datatransactions.payments[]
expiration_time,date_of_expiration,payment_method.statement_descriptorpayer
phone.area_code,phone.number,address.zip_code,address.street_name,address.street_number,address.neighborhood,address.state,address.city,address.complementitems[] (completo)
title,unit_price,quantity,description,external_code,picture_url,category_id,type,warranty,event_dateshipment.address
street_name,street_number,zip_code,city,stateintegration_data
integrator_id,platform_id,corporation_id,sponsor.idconfig.transaction_security
validation,liability_shiftNuevas clases
OrderItemRequest,OrderPayerPhone,OrderPayerAddress,OrderShipmentRequest,OrderShipmentAddress,OrderShipmentFreeMethod,OrderIntegrationData,OrderSponsor,OrderTransactionSecurityCompatibilidad
Order.create(dict)funciona igual. Todos los camposOptionalcon defaultNone.