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
Open
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
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.