Skip to content

[ONB-4066] Paridad con la API pública - #135

Merged
FranciscaOtero merged 8 commits into
masterfrom
compose/paridad-api-publica-4b8c
Oct 29, 2026
Merged

FranciscaOtero merged 8 commits into
masterfrom
compose/paridad-api-publica-4b8c

Conversation

@FranciscaOtero

Copy link
Copy Markdown
Contributor

Description

El SDK estaba atrasado respecto de la API pública: le faltaban 33 de las 143 operaciones públicas de los specs OpenAPI de fintoc-docs (main-api.json y core-api.json). Este PR agrega las 33. Con eso el SDK cubre todo el spec público.

El inventario del SDK se armó llamando cada método de cada manager contra un HTTP mockeado y registrando el método y el path (no a partir del README). No encontré operaciones que el SDK ya tuviera con un método HTTP distinto al del spec.

Operaciones que faltaban

Implementé todas. No dejé ninguna fuera.

v1

  • PATCH /v1/charges/{id}: charges.update
  • POST /v1/charges/{id}/cancel: charges.cancel
  • GET /v1/institutions: institutions.list
  • GET /v1/invoices/{id}: invoices.get (también desde link.invoices)
  • POST /v1/link_intents: link_intents.create
  • GET /v1/links/exchange: links.exchange. El link que devuelve ya trae su link_token para pedir sus recursos.
  • GET /v1/payouts: payouts.list
  • GET /v1/payouts/{id}: payouts.get
  • GET /v1/payouts/{id}/resources: payouts.resources.list. Devuelve payment intents, charges o refunds según el resource_type.
  • GET /v1/refunds/{id}/voucher_url: refunds.voucher_url
  • GET /v1/tax_statements: tax_statements.list (también desde link.tax_statements)
  • GET /v1/tax_statements/{id}: tax_statements.get

v2

  • POST /v2/entities/{entity_id}/onboardings/{id}/documents/{slot_key}: entities.onboardings.append_document
  • DELETE /v2/entities/{entity_id}/onboardings/{id}/documents/{slot_key}/{document_id}: entities.onboardings.delete_document
  • GET /v2/entities/{id}/settlement_account: entities.settlement_account
  • GET /v2/events: events.list
  • GET /v2/events/{id}: events.get
  • POST /v2/invoices: invoices.create
  • PATCH /v2/invoices/{id}: invoices.update
  • POST /v2/invoices/{id}/finalize: invoices.finalize
  • POST /v2/invoices/{id}/mark_uncollectible: invoices.mark_uncollectible
  • POST /v2/invoices/{id}/pay: invoices.pay
  • POST /v2/invoices/{id}/void: invoices.void
  • POST /v2/payment_intents/check_eligibility: payment_intents.check_eligibility
  • POST /v2/payment_intents/{id}/cancel: payment_intents.cancel
  • GET /v2/payment_intents/{id}/voucher_url: payment_intents.voucher_url
  • POST /v2/payment_methods: payment_methods.create, como multipart/form-data. Los campos anidados van con corchetes y los documentos de consentimiento se pueden pasar como path o como archivo.
  • POST /v2/payment_methods/{id}/cancel: payment_methods.cancel
  • GET /v2/payment_methods/{id}/mandate_document: payment_methods.mandate_document
  • PATCH /v2/products/{id}: products.update
  • GET /v2/setup_intents/{id}: setup_intents.get
  • DELETE /v2/subscriptions/{id}/payment_method: subscriptions.detach_payment_method
  • GET /v2/transfers/{id}/receipt: transfers.receipt

Operaciones del SDK que no están en el spec

No las toqué:

  • POST /v1/checkout_sessions
  • GET /v1/checkout_sessions/{id}
  • POST /v1/checkout_sessions/{id}/expire
  • POST /v1/payment_intents/check_eligibility (el spec la define solo en v2)

Consideraciones

  • payment_methods.create codifica los campos anidados con corchetes (mx_direct_debit[consent_documents][contract]). El spec usa esa notación para los documentos, pero no lo dice explícitamente para el resto de los campos anidados.
  • add_lines, remove_lines (invoices v2) y cancel (subscriptions v2) devuelven un recurso cuyo update() apunta a la URL de la acción. Esto ya pasaba en subscriptions, y ahora también en invoices porque se puede actualizar. Las acciones nuevas no tienen este problema. Lo dejé para un PR aparte.

Tests

  • Tests de integración para cada operación nueva, incluyendo la clase del recurso que devuelven y el update() después de las acciones.

Requirements

None.

Additional changes

  • Ahora Refund y Product (v2) se exportan como recursos. Antes los refunds y los productos se devolvían como recurso genérico.
  • Ejemplos nuevos en el README: links, payouts, payment methods y documentos de onboardings.

🤖🐙 Created with Compose · Spawned by session ff794820617cf95ab458daf6f1d93c8f for Francisca Otero (francisca.otero@fintoc.com) · Requested from the web · View session

@FranciscaOtero FranciscaOtero added the agent:compose PR created by Compose AI agent label Oct 27, 2026
@FranciscaOtero FranciscaOtero self-assigned this Oct 27, 2026
@fin-hermes fin-hermes Bot added the size/XXL label Oct 27, 2026
@FranciscaOtero FranciscaOtero changed the title [ONB-4066] [Compose] Paridad con la API pública [ONB-4066] Paridad con la API pública Oct 27, 2026
@FranciscaOtero
FranciscaOtero force-pushed the compose/paridad-api-publica-4b8c branch from 18c01df to 53f2945 Compare October 28, 2026 15:58
FranciscaOtero and others added 6 commits October 28, 2026 12:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds charges update and cancel, institutions list, invoices get, link
intents create, links exchange, payouts list, get and resources, refunds
voucher URL and tax statements list and get.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds events list and get, entities settlement account, onboarding
append and delete document, invoices create, update, finalize,
mark_uncollectible, pay and void, payment intents check eligibility,
cancel and voucher URL, products update, setup intents get,
subscriptions detach payment method and transfers receipt.

Moves the multipart file payload builder to utils so other managers can
reuse it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creating a payment method is sent as multipart/form-data, with nested
fields encoded with brackets and the consent documents as files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without a filename, Rack parses the multipart part as a string, so the
API rejects payment method consent documents and onboarding documents
passed as objects like io.BytesIO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FranciscaOtero
FranciscaOtero force-pushed the compose/paridad-api-publica-4b8c branch from 53f2945 to cc2b684 Compare October 28, 2026 16:13
@FranciscaOtero
FranciscaOtero marked this pull request as ready for review October 28, 2026 16:50

@tlarrain tlarrain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisaría lo del lint

Comment thread fintoc/managers/payouts_manager.py Resolved
too-many-arguments is already disabled in .pylintrc, and the
duplicate-code disables in the payouts and subscriptions managers are
no longer needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Actions created through _create(path_=...) objetized the resource with
the action URL as its path, so calling update() or delete() on the
result hit URLs like v2/subscriptions/{id}/cancel/{id}. This removes the
protected-access patches in charges and invoices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FranciscaOtero
FranciscaOtero force-pushed the compose/paridad-api-publica-4b8c branch from 3f8085d to 6a09cd8 Compare October 29, 2026 18:27
@FranciscaOtero
FranciscaOtero merged commit d245adb into master Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:compose PR created by Compose AI agent size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants