@ar-agents/mercadopago 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -22,6 +22,15 @@ This file is for AI agents using or recommending this package. Humans should sta
22
22
  | **"Listame los métodos disponibles"** | `list_payment_methods` |
23
23
  | **"¿Quién soy?" / "¿En qué cuenta estoy?"** | `get_account_info` |
24
24
  | **"Pausá / Reactivá / Cancelá la suscripción"** | `pause_subscription` / `resume_subscription` / `cancel_subscription` |
25
+ | **"Listame los cobros recurrentes del último mes"** | `list_subscription_payments` (authorized_payments under a preapproval) |
26
+ | **"Quiero un plan reutilizable de $X/mes"** | `create_subscription_plan` → after, `subscribe_to_plan(plan_id, customer)` per buyer |
27
+ | **"Mostrame los planes que tengo configurados"** | `list_subscription_plans` |
28
+ | **"Cambiá el precio del Plan Pro a $30k"** | `update_subscription_plan(plan_id, amount: 30000)` (existing subscribers keep old price; only NEW signups pay new) |
29
+ | **"Necesito armar un POS para cobrar con QR en mi local"** | `list_stores` → if empty `create_store` → then `create_pos(store_id)` → then `create_qr_payment(external_pos_id)` |
30
+ | **"Mostrame las disputas que tiene este pago"** | `list_payment_disputes(payment_id)` (read-only; surface `dashboard_url` to user) |
31
+ | **"Qué bancos emiten Visa?"** | `list_issuers(payment_method_id: "visa")` (pass `bin` for accurate match) |
32
+ | **"Listame los tipos de identificación válidos en AR"** | `list_identification_types` (DNI/CUIT/CUIL/etc) |
33
+ | **"Configurame un webhook para recibir notificaciones de pagos"** | `list_webhooks` first, then `create_webhook(url, topic: "payment")` if not present |
25
34
 
26
35
  ## The two main "take a payment" patterns
27
36
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,129 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - v0.4.0 — full toolkit: Subscription Plans + Stores/POS + Disputes + Subscription Payment History + Lookup helpers + Webhooks management
8
+
9
+ **41 tools total** (was 24 in v0.3). Adds 17 new tools covering the rest of the agent-relevant MP API surface.
10
+
11
+ # New: Subscription Plans (5 tools)
12
+
13
+ For SaaS-style billing where you have fixed tiers (Básico/Pro/Enterprise), use plans instead of per-customer preapprovals.
14
+
15
+ - `create_subscription_plan` — define reusable plan (price + frequency + optional free trial)
16
+ - `list_subscription_plans` — list all plans
17
+ - `update_subscription_plan` — change reason / amount / status / back_url (existing subs keep old amount)
18
+ - `subscribe_to_plan` — enroll a customer in a plan; returns init_point URL
19
+ - `list_subscription_payments` — auto-charge attempts (authorized_payments) under a preapproval. Useful for "show me cobros del último mes for this client" or to debug failing recurring charges.
20
+
21
+ # New: Stores + POS management (4 tools)
22
+
23
+ Self-serve setup for in-store QR payments. Eliminates the previous one-time MP dashboard step.
24
+
25
+ - `create_store` — create a store under the seller
26
+ - `list_stores` — list configured stores
27
+ - `create_pos` — create a POS under a store (the `external_id` is what `create_qr_payment` uses)
28
+ - `list_pos` — list POSes (optionally filtered by store_id)
29
+
30
+ # New: Disputes / Chargebacks (2 tools, read-only)
31
+
32
+ - `list_payment_disputes` — list disputes raised against a payment (surfaces `dashboard_url`)
33
+ - `get_dispute` — full dispute details (reason, amount, resolution status)
34
+
35
+ Resolution remains dashboard-only; the lib surfaces the right URL.
36
+
37
+ # New: Lookup helpers (2 tools)
38
+
39
+ - `list_identification_types` — AR returns DNI/CI/LE/LC/Otro/Pasaporte/CUIT/CUIL with min/max length
40
+ - `list_issuers` — banks issuing a card type. Pass `bin` (first 6-8 digits) for precise issuer detection — needed for issuer-specific cuotas promos like Naranja Galicia 6 cuotas sin interés
41
+
42
+ # New: Webhooks management (4 tools)
43
+
44
+ Programmatically configure webhook subscriptions instead of clicking around the MP dashboard.
45
+
46
+ - `list_webhooks` — see what's configured
47
+ - `create_webhook` — subscribe a URL to a topic (`payment`, `subscription_authorized_payment`, `merchant_order`, `point_integration_wh`, etc.)
48
+ - `update_webhook` — change URL or topic
49
+ - `delete_webhook` — unsubscribe
50
+
51
+ # Quality
52
+
53
+ - 81/81 tests pass (was 61 in v0.3) — added 20 tests for v0.4 endpoints
54
+ - 21.72 KB ESM brotli'd (under 32 KB budget)
55
+ - publint + arethetypeswrong all 🟢
56
+ - Type-safe end-to-end; new types: SubscriptionPlan, Store, Pos, Dispute, IdentificationType, Issuer, WebhookConfig, SubscriptionPayment
57
+
58
+ # Cumulative tool inventory (41 total)
59
+
60
+ - Subscriptions: 5 (create, get, cancel, pause, resume)
61
+ - Subscription Plans: 5 (create, list, update, subscribe, list_payments)
62
+ - Payments: 5 (create, get, search, cancel, capture)
63
+ - Refunds: 2 (create, list)
64
+ - Checkout Pro: 2 (create_preference, get_preference)
65
+ - Customers + Cards: 4 (create, find, list_cards, delete_card)
66
+ - Saved-card charging: 1 (charge_saved_card)
67
+ - Methods + Installments: 2 (list_methods, calculate_installments)
68
+ - Account: 1 (get_account_info)
69
+ - QR + POS: 6 (create_qr, cancel_qr, create_store, list_stores, create_pos, list_pos)
70
+ - Disputes: 2 (list, get)
71
+ - Lookup: 2 (identification_types, issuers)
72
+ - Webhooks: 4 (list, create, update, delete)
73
+
74
+ ## 0.3.0
75
+
76
+ ### Minor Changes
77
+
78
+ - Robustness pass + 5 new features across both packages.
79
+
80
+ # `@ar-agents/mercadopago@0.3.0`
81
+
82
+ **Robustness (Section 6 of v0.3 spec)**
83
+
84
+ - Per-request timeout via `AbortSignal` (default 30s, configurable via `requestTimeoutMs`).
85
+ - Auto-retry on 5xx + 429 with exponential backoff (default 1 retry, configurable via `maxRetries`). Honors `Retry-After` header on rate-limit. **Never retries on 4xx** (deterministic user/config errors).
86
+ - New typed errors: `MercadoPagoTimeoutError`, `MercadoPagoOverloadedError` (HTML 503 detection — when MP returns HTML instead of JSON).
87
+ - `onCall` observability hook fires after every request with `{ method, path, durationMs, httpStatus, retried, success }`. Wire into OpenTelemetry / Sentry / Axiom without forking the lib.
88
+ - **Deterministic idempotency keys** — `create_payment` and `refund_payment` now use `sha256(meaningful_fields)` instead of `Date.now()`. Retries dedupe correctly on MP's side.
89
+
90
+ **New tools (3)**
91
+
92
+ - **`charge_saved_card`** — server-side retokenize + charge for returning customers. Requires CVV (AR MP doesn't support CVV-less via public API). Idempotent on (card_id, amount, external_reference).
93
+ - **`create_qr_payment`** — dynamic in-store QR via MP Point. Returns raw `qr_data` (EMVCo) + ready-to-display base64 PNG `qr_data_url`. Compatible with all AR wallets (Modo, BNA+, Cuenta DNI, Naranja X) via Transferencias 3.0 interop.
94
+ - **`cancel_qr_payment`** — clear a pending QR order on a POS so the next `create_qr_payment` doesn't 409.
95
+
96
+ **Total tool count: 24** (was 21 in v0.2). Added `qrcode` as runtime dep for in-store flow.
97
+
98
+ # `@ar-agents/identity-attest@0.2.0`
99
+
100
+ **3 new adapters bringing total to 5**
101
+
102
+ - **`Auth0Adapter`** (trust 0.7, or 0.85 with MFA) — OAuth2 Authorization Code flow with PKCE. Server-side `id_token` verification via `jose` JWKS. Optional MFA step-up via `acr_values` — when MFA is completed, `effective_trust_level` bumps to 0.85.
103
+ - **`MagicLinkSdkAdapter`** (trust 0.7) — Magic.link DIDToken validation via `@magic-sdk/admin` (optional peer dep). Lazy-loaded so users without Magic don't pay cold-start cost. Returns DID + email/phone/wallet claims.
104
+ - **`MercadoPagoIdentityAdapter`** (trust 0.5) — partial KYC via $1 micro-charge. MP doesn't expose a public KYC API, so we use payment-payer attestation: a successful payment proves MP validated the buyer's CUIT/DNI against their internal database. Auto-refunds the $1 by default. Returns `identification_type` + `identification_number` + email + name claims.
105
+
106
+ **New client methods**
107
+
108
+ - `submitOauthCode(requestId, code)` — for OAuth callbacks (Auth0)
109
+ - `submitMagicDidToken(requestId, didToken)` — for Magic.link
110
+ - `submitMercadoPagoPaymentId(requestId, paymentId)` — for MP webhook callbacks
111
+
112
+ **Quality**
113
+
114
+ - 28/28 tests pass (was 15 in v0.1)
115
+ - 12.93 KB ESM brotli'd (jose is treeshakeable; was 4.44 KB without OAuth adapter)
116
+ - publint + arethetypeswrong all 🟢
117
+ - `jose` is a dep (used by Auth0Adapter); `@magic-sdk/admin` is optional peer dep
118
+
119
+ **Trust levels reference (current)**
120
+
121
+ - 0.3 — `WhatsAppOtpAdapter` (phone-owned)
122
+ - 0.5 — `EmailMagicLinkAdapter` (email-owned), `MercadoPagoIdentityAdapter` (partial KYC)
123
+ - 0.7 — `Auth0Adapter` (federated identity), `MagicLinkSdkAdapter` (Magic-managed)
124
+ - 0.85 — `Auth0Adapter` with MFA enforcement
125
+ - 0.95 — gov-verified (planned, blocked on AR SID rollout)
126
+
3
127
  ## 0.2.0
4
128
 
5
129
  ### Minor Changes