cobroya 1.0.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/LICENSE +21 -0
- package/README.md +231 -0
- package/bin/mcp-server.mjs +2 -0
- package/bin/telegram-bot.mjs +2 -0
- package/dist/actions.d.ts +7 -0
- package/dist/actions.js +74 -0
- package/dist/actions.js.map +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +49 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +28 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/landing.d.ts +1 -0
- package/dist/landing.js +256 -0
- package/dist/landing.js.map +1 -0
- package/dist/mcp-server.d.ts +1 -0
- package/dist/mcp-server.js +95 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/schemas.d.ts +258 -0
- package/dist/schemas.js +80 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +181 -0
- package/dist/server.js.map +1 -0
- package/dist/shared/formatting.d.ts +4 -0
- package/dist/shared/formatting.js +51 -0
- package/dist/shared/formatting.js.map +1 -0
- package/dist/telegram-bot.d.ts +3 -0
- package/dist/telegram-bot.js +194 -0
- package/dist/telegram-bot.js.map +1 -0
- package/dist/webhook.d.ts +6 -0
- package/dist/webhook.js +77 -0
- package/dist/webhook.js.map +1 -0
- package/dist/whatsapp/client.d.ts +10 -0
- package/dist/whatsapp/client.js +47 -0
- package/dist/whatsapp/client.js.map +1 -0
- package/dist/whatsapp/handlers.d.ts +11 -0
- package/dist/whatsapp/handlers.js +138 -0
- package/dist/whatsapp/handlers.js.map +1 -0
- package/dist/whatsapp/message-parser.d.ts +33 -0
- package/dist/whatsapp/message-parser.js +44 -0
- package/dist/whatsapp/message-parser.js.map +1 -0
- package/dist/whatsapp/webhook.d.ts +16 -0
- package/dist/whatsapp/webhook.js +70 -0
- package/dist/whatsapp/webhook.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CobroYa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# mercadopago-tool
|
|
2
|
+
|
|
3
|
+
Mercado Pago tool connector for AI agents. Exposes Mercado Pago API actions through a simple, typed interface that AI agents can call via MCP-style tool registries.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm run build
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
cp .env.example .env
|
|
14
|
+
# Edit .env with your real token
|
|
15
|
+
export MERCADO_PAGO_ACCESS_TOKEN="APP_USR-..."
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Get your token from [Mercado Pago Developers](https://www.mercadopago.com/developers/en/docs/checkout-pro/additional-content/your-integrations/credentials).
|
|
19
|
+
|
|
20
|
+
## Actions
|
|
21
|
+
|
|
22
|
+
| Action | Description |
|
|
23
|
+
|--------|-------------|
|
|
24
|
+
| `create_payment_preference` | Create a checkout payment link with optional back_urls and notification_url |
|
|
25
|
+
| `get_payment` | Retrieve a payment by ID |
|
|
26
|
+
| `create_refund` | Full or partial refund of a payment |
|
|
27
|
+
| `search_payments` | Search payments with filters (status, sort, pagination) |
|
|
28
|
+
| `get_merchant_info` | Get merchant user profile |
|
|
29
|
+
|
|
30
|
+
## Agent Usage
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { createMercadoPagoTools } from "mercadopago-tool";
|
|
34
|
+
|
|
35
|
+
const mp = createMercadoPagoTools(process.env.MERCADO_PAGO_ACCESS_TOKEN!);
|
|
36
|
+
|
|
37
|
+
// Create a payment link
|
|
38
|
+
const pref = await mp.tools.create_payment_preference({
|
|
39
|
+
title: "Premium Plan",
|
|
40
|
+
quantity: 1,
|
|
41
|
+
currency: "ARS",
|
|
42
|
+
unit_price: 5000,
|
|
43
|
+
back_urls: {
|
|
44
|
+
success: "https://myapp.com/success",
|
|
45
|
+
failure: "https://myapp.com/failure",
|
|
46
|
+
},
|
|
47
|
+
notification_url: "https://myapp.com/webhooks/mp",
|
|
48
|
+
});
|
|
49
|
+
// pref.init_point -> checkout URL to share with the buyer
|
|
50
|
+
|
|
51
|
+
// Search approved payments
|
|
52
|
+
const payments = await mp.tools.search_payments({ status: "approved", limit: 10 });
|
|
53
|
+
|
|
54
|
+
// Refund a payment
|
|
55
|
+
const refund = await mp.tools.create_refund({ payment_id: "123456789" });
|
|
56
|
+
|
|
57
|
+
// Partial refund
|
|
58
|
+
const partial = await mp.tools.create_refund({ payment_id: "123456789", amount: 500 });
|
|
59
|
+
|
|
60
|
+
// Get payment details
|
|
61
|
+
const payment = await mp.tools.get_payment({ payment_id: "123456789" });
|
|
62
|
+
|
|
63
|
+
// List schemas for AI agent tool registration
|
|
64
|
+
console.log(mp.schemas);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Error Handling
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { MercadoPagoError } from "mercadopago-tool";
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
await mp.tools.get_payment({ payment_id: "invalid" });
|
|
74
|
+
} catch (err) {
|
|
75
|
+
if (err instanceof MercadoPagoError) {
|
|
76
|
+
console.log(err.status); // 404
|
|
77
|
+
console.log(err.isNotFound); // true
|
|
78
|
+
console.log(err.isUnauthorized); // false
|
|
79
|
+
console.log(err.isRateLimited); // false
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Integration Test
|
|
85
|
+
|
|
86
|
+
Test against the real API:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
MERCADO_PAGO_ACCESS_TOKEN=APP_USR-... npm run integration
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Curl Examples
|
|
93
|
+
|
|
94
|
+
**Create preference:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
curl -X POST https://api.mercadopago.com/checkout/preferences \
|
|
98
|
+
-H "Authorization: Bearer $MERCADO_PAGO_ACCESS_TOKEN" \
|
|
99
|
+
-H "Content-Type: application/json" \
|
|
100
|
+
-d '{"items":[{"title":"Test","quantity":1,"currency_id":"ARS","unit_price":1000}],"back_urls":{"success":"https://myapp.com/ok"},"notification_url":"https://myapp.com/webhooks/mp"}'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Get payment:**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
curl https://api.mercadopago.com/v1/payments/123456789 \
|
|
107
|
+
-H "Authorization: Bearer $MERCADO_PAGO_ACCESS_TOKEN"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Refund payment:**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
curl -X POST https://api.mercadopago.com/v1/payments/123456789/refunds \
|
|
114
|
+
-H "Authorization: Bearer $MERCADO_PAGO_ACCESS_TOKEN" \
|
|
115
|
+
-H "Content-Type: application/json" \
|
|
116
|
+
-d '{}'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Search payments:**
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
curl "https://api.mercadopago.com/v1/payments/search?status=approved&limit=10" \
|
|
123
|
+
-H "Authorization: Bearer $MERCADO_PAGO_ACCESS_TOKEN"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Merchant info:**
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
curl https://api.mercadopago.com/users/me \
|
|
130
|
+
-H "Authorization: Bearer $MERCADO_PAGO_ACCESS_TOKEN"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## WhatsApp Business Integration
|
|
134
|
+
|
|
135
|
+
### Setup
|
|
136
|
+
|
|
137
|
+
1. Create a Meta app at [Meta for Developers](https://developers.facebook.com/)
|
|
138
|
+
2. Enable WhatsApp Business API
|
|
139
|
+
3. Get your access token, phone number ID, and set a verify token
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Add to .env
|
|
143
|
+
WHATSAPP_ACCESS_TOKEN=your-meta-graph-api-token
|
|
144
|
+
WHATSAPP_PHONE_NUMBER_ID=your-phone-number-id
|
|
145
|
+
WHATSAPP_VERIFY_TOKEN=your-webhook-verify-token
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Run the WhatsApp server
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npm run whatsapp
|
|
152
|
+
# Server starts on http://localhost:3000/webhook
|
|
153
|
+
# Use ngrok to expose: ngrok http 3000
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Then configure the webhook URL in Meta Dashboard: `https://your-ngrok-url/webhook`
|
|
157
|
+
|
|
158
|
+
### Supported commands
|
|
159
|
+
|
|
160
|
+
Users send plain text messages to your WhatsApp number:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
cobrar 5000 curso python
|
|
164
|
+
→ 💳 Link de pago generado
|
|
165
|
+
https://www.mercadopago.com/checkout/v1/redirect?pref_id=...
|
|
166
|
+
|
|
167
|
+
pagos
|
|
168
|
+
→ ✅ Aprobado
|
|
169
|
+
$5000
|
|
170
|
+
ID: 123456
|
|
171
|
+
|
|
172
|
+
estado 123456
|
|
173
|
+
→ Pago #123456
|
|
174
|
+
Estado: ✅ Aprobado
|
|
175
|
+
Monto: $5000
|
|
176
|
+
|
|
177
|
+
devolver 123456
|
|
178
|
+
→ Devolucion total realizada
|
|
179
|
+
Monto devuelto: $5000
|
|
180
|
+
|
|
181
|
+
devolver 123456 2000
|
|
182
|
+
→ Devolucion parcial realizada
|
|
183
|
+
Monto devuelto: $2000
|
|
184
|
+
|
|
185
|
+
ayuda
|
|
186
|
+
→ Lista de comandos
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Payment notifications
|
|
190
|
+
|
|
191
|
+
When a payment is confirmed via the Mercado Pago webhook, you can forward it to WhatsApp:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { createWhatsAppWebhookHandler, WhatsAppClient, createPaymentNotifier, createWebhookHandler } from "mercadopago-tool";
|
|
195
|
+
|
|
196
|
+
const wa = new WhatsAppClient({
|
|
197
|
+
accessToken: process.env.WHATSAPP_ACCESS_TOKEN!,
|
|
198
|
+
phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID!,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Notify merchant on WhatsApp when payment is approved
|
|
202
|
+
const notifier = createPaymentNotifier(wa, "5491155551234");
|
|
203
|
+
|
|
204
|
+
const mpWebhook = createWebhookHandler({
|
|
205
|
+
accessToken: process.env.MERCADO_PAGO_ACCESS_TOKEN!,
|
|
206
|
+
onPayment: notifier,
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Programmatic usage
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import { WhatsAppClient } from "mercadopago-tool";
|
|
214
|
+
|
|
215
|
+
const wa = new WhatsAppClient({
|
|
216
|
+
accessToken: process.env.WHATSAPP_ACCESS_TOKEN!,
|
|
217
|
+
phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID!,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
await wa.sendMessage("5491155551234", "Tu pago fue recibido!");
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Testing
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
npm test
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MercadoPagoClient } from "./client.js";
|
|
2
|
+
import type { CreatePaymentPreferenceParams, GetPaymentParams, CreateRefundParams, SearchPaymentsParams } from "./schemas.js";
|
|
3
|
+
export declare function createPaymentPreference(client: MercadoPagoClient, params: CreatePaymentPreferenceParams): Promise<unknown>;
|
|
4
|
+
export declare function getPayment(client: MercadoPagoClient, params: GetPaymentParams): Promise<unknown>;
|
|
5
|
+
export declare function createRefund(client: MercadoPagoClient, params: CreateRefundParams): Promise<unknown>;
|
|
6
|
+
export declare function searchPayments(client: MercadoPagoClient, params?: SearchPaymentsParams): Promise<unknown>;
|
|
7
|
+
export declare function getMerchantInfo(client: MercadoPagoClient): Promise<unknown>;
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPaymentPreference = createPaymentPreference;
|
|
4
|
+
exports.getPayment = getPayment;
|
|
5
|
+
exports.createRefund = createRefund;
|
|
6
|
+
exports.searchPayments = searchPayments;
|
|
7
|
+
exports.getMerchantInfo = getMerchantInfo;
|
|
8
|
+
async function createPaymentPreference(client, params) {
|
|
9
|
+
if (!params.title || typeof params.title !== "string") {
|
|
10
|
+
throw new Error("title is required and must be a string");
|
|
11
|
+
}
|
|
12
|
+
if (typeof params.quantity !== "number" || params.quantity < 1) {
|
|
13
|
+
throw new Error("quantity must be a positive number");
|
|
14
|
+
}
|
|
15
|
+
if (!params.currency || typeof params.currency !== "string") {
|
|
16
|
+
throw new Error("currency is required and must be a string");
|
|
17
|
+
}
|
|
18
|
+
if (typeof params.unit_price !== "number" || params.unit_price <= 0) {
|
|
19
|
+
throw new Error("unit_price must be a positive number");
|
|
20
|
+
}
|
|
21
|
+
const payload = {
|
|
22
|
+
items: [
|
|
23
|
+
{
|
|
24
|
+
title: params.title,
|
|
25
|
+
quantity: params.quantity,
|
|
26
|
+
currency_id: params.currency,
|
|
27
|
+
unit_price: params.unit_price,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
if (params.back_urls) {
|
|
32
|
+
payload.back_urls = params.back_urls;
|
|
33
|
+
payload.auto_return = "approved";
|
|
34
|
+
}
|
|
35
|
+
if (params.notification_url) {
|
|
36
|
+
payload.notification_url = params.notification_url;
|
|
37
|
+
}
|
|
38
|
+
return client.post("/checkout/preferences", payload);
|
|
39
|
+
}
|
|
40
|
+
async function getPayment(client, params) {
|
|
41
|
+
if (!params.payment_id || typeof params.payment_id !== "string") {
|
|
42
|
+
throw new Error("payment_id is required and must be a string");
|
|
43
|
+
}
|
|
44
|
+
return client.get(`/v1/payments/${encodeURIComponent(params.payment_id)}`);
|
|
45
|
+
}
|
|
46
|
+
async function createRefund(client, params) {
|
|
47
|
+
if (!params.payment_id || typeof params.payment_id !== "string") {
|
|
48
|
+
throw new Error("payment_id is required and must be a string");
|
|
49
|
+
}
|
|
50
|
+
if (params.amount !== undefined && (typeof params.amount !== "number" || params.amount <= 0)) {
|
|
51
|
+
throw new Error("amount must be a positive number when provided");
|
|
52
|
+
}
|
|
53
|
+
const body = params.amount !== undefined ? { amount: params.amount } : {};
|
|
54
|
+
return client.post(`/v1/payments/${encodeURIComponent(params.payment_id)}/refunds`, body);
|
|
55
|
+
}
|
|
56
|
+
async function searchPayments(client, params) {
|
|
57
|
+
const query = new URLSearchParams();
|
|
58
|
+
if (params?.status)
|
|
59
|
+
query.set("status", params.status);
|
|
60
|
+
if (params?.sort)
|
|
61
|
+
query.set("sort", params.sort);
|
|
62
|
+
if (params?.criteria)
|
|
63
|
+
query.set("criteria", params.criteria);
|
|
64
|
+
if (params?.limit)
|
|
65
|
+
query.set("limit", String(params.limit));
|
|
66
|
+
if (params?.offset)
|
|
67
|
+
query.set("offset", String(params.offset));
|
|
68
|
+
const qs = query.toString();
|
|
69
|
+
return client.get(`/v1/payments/search${qs ? `?${qs}` : ""}`);
|
|
70
|
+
}
|
|
71
|
+
async function getMerchantInfo(client) {
|
|
72
|
+
return client.get("/users/me");
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;AAQA,0DAsCC;AAED,gCAQC;AAED,oCAgBC;AAED,wCAaC;AAED,0CAEC;AArFM,KAAK,UAAU,uBAAuB,CAC3C,MAAyB,EACzB,MAAqC;IAErC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;QAC/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C,CAAC,CAAC;IAC5D,IAAI,MAAM,EAAE,MAAM;QAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAE/D,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC5B,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC;AAEM,KAAK,UAAU,eAAe,CAAC,MAAyB;IAC7D,OAAO,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ClientOptions {
|
|
2
|
+
idempotencyKey?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class MercadoPagoClient {
|
|
5
|
+
private accessToken;
|
|
6
|
+
constructor(accessToken: string);
|
|
7
|
+
private headers;
|
|
8
|
+
get<T = unknown>(path: string): Promise<T>;
|
|
9
|
+
post<T = unknown>(path: string, body: unknown, opts?: ClientOptions): Promise<T>;
|
|
10
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MercadoPagoClient = void 0;
|
|
4
|
+
const errors_js_1 = require("./errors.js");
|
|
5
|
+
const BASE_URL = "https://api.mercadopago.com";
|
|
6
|
+
class MercadoPagoClient {
|
|
7
|
+
accessToken;
|
|
8
|
+
constructor(accessToken) {
|
|
9
|
+
if (!accessToken) {
|
|
10
|
+
throw new Error("MERCADO_PAGO_ACCESS_TOKEN is required");
|
|
11
|
+
}
|
|
12
|
+
this.accessToken = accessToken;
|
|
13
|
+
}
|
|
14
|
+
headers(opts) {
|
|
15
|
+
const h = {
|
|
16
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
17
|
+
"Content-Type": "application/json",
|
|
18
|
+
};
|
|
19
|
+
if (opts?.idempotencyKey) {
|
|
20
|
+
h["X-Idempotency-Key"] = opts.idempotencyKey;
|
|
21
|
+
}
|
|
22
|
+
return h;
|
|
23
|
+
}
|
|
24
|
+
async get(path) {
|
|
25
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
26
|
+
method: "GET",
|
|
27
|
+
headers: this.headers(),
|
|
28
|
+
});
|
|
29
|
+
if (!res.ok) {
|
|
30
|
+
const body = await res.text();
|
|
31
|
+
throw new errors_js_1.MercadoPagoError("GET", path, res.status, body);
|
|
32
|
+
}
|
|
33
|
+
return res.json();
|
|
34
|
+
}
|
|
35
|
+
async post(path, body, opts) {
|
|
36
|
+
const res = await fetch(`${BASE_URL}${path}`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: this.headers(opts),
|
|
39
|
+
body: JSON.stringify(body),
|
|
40
|
+
});
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
const text = await res.text();
|
|
43
|
+
throw new errors_js_1.MercadoPagoError("POST", path, res.status, text);
|
|
44
|
+
}
|
|
45
|
+
return res.json();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.MercadoPagoClient = MercadoPagoClient;
|
|
49
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAE/C,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAM/C,MAAa,iBAAiB;IACpB,WAAW,CAAS;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEO,OAAO,CAAC,IAAoB;QAClC,M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7D,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,EAAgB,CAAC;IAClC,CAAC;CACF;AA7CD,8CA6CC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class MercadoPagoError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
readonly method: string;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly body: string;
|
|
6
|
+
constructor(method: string, path: string, status: number, body: string);
|
|
7
|
+
get isUnauthorized(): boolean;
|
|
8
|
+
get isNotFound(): boolean;
|
|
9
|
+
get isRateLimited(): boolean;
|
|
10
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MercadoPagoError = void 0;
|
|
4
|
+
class MercadoPagoError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
method;
|
|
7
|
+
path;
|
|
8
|
+
body;
|
|
9
|
+
constructor(method, path, status, body) {
|
|
10
|
+
super(`${method} ${path} failed (${status}): ${body}`);
|
|
11
|
+
this.name = "MercadoPagoError";
|
|
12
|
+
this.method = method;
|
|
13
|
+
this.path = path;
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.body = body;
|
|
16
|
+
}
|
|
17
|
+
get isUnauthorized() {
|
|
18
|
+
return this.status === 401;
|
|
19
|
+
}
|
|
20
|
+
get isNotFound() {
|
|
21
|
+
return this.status === 404;
|
|
22
|
+
}
|
|
23
|
+
get isRateLimited() {
|
|
24
|
+
return this.status === 429;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.MercadoPagoError = MercadoPagoError;
|
|
28
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAiB,SAAQ,KAAK;IAChC,MAAM,CAAS;IACf,MAAM,CAAS;IACf,IAAI,CAAS;IACb,IAAI,CAAS;IAEtB,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,IAAY;QACpE,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI,YAAY,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC;IAC7B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,CAAC;IAC7B,CAAC;CACF;AA1BD,4CA0BC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { CreatePaymentPreferenceParams, GetPaymentParams, CreateRefundParams, SearchPaymentsParams } from "./schemas.js";
|
|
2
|
+
export declare function createMercadoPagoTools(accessToken: string): {
|
|
3
|
+
schemas: ({
|
|
4
|
+
readonly name: "create_payment_preference";
|
|
5
|
+
readonly description: "Creates a Mercado Pago checkout payment preference (payment link). Returns init_point URL for redirecting buyers.";
|
|
6
|
+
readonly parameters: {
|
|
7
|
+
readonly type: "object";
|
|
8
|
+
readonly required: readonly ["title", "quantity", "currency", "unit_price"];
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly title: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Product or service title";
|
|
13
|
+
};
|
|
14
|
+
readonly quantity: {
|
|
15
|
+
readonly type: "number";
|
|
16
|
+
readonly description: "Quantity of items";
|
|
17
|
+
};
|
|
18
|
+
readonly currency: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Currency ID (e.g. ARS, BRL, MXN, CLP, COP, UYU, PEN)";
|
|
21
|
+
};
|
|
22
|
+
readonly unit_price: {
|
|
23
|
+
readonly type: "number";
|
|
24
|
+
readonly description: "Unit price of the item";
|
|
25
|
+
};
|
|
26
|
+
readonly back_urls: {
|
|
27
|
+
readonly type: "object";
|
|
28
|
+
readonly description: "URLs to redirect the buyer after payment";
|
|
29
|
+
readonly properties: {
|
|
30
|
+
readonly success: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly description: "URL on approved payment";
|
|
33
|
+
};
|
|
34
|
+
readonly failure: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly description: "URL on rejected payment";
|
|
37
|
+
};
|
|
38
|
+
readonly pending: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly description: "URL on pending payment";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly notification_url: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
readonly description: "Webhook URL for payment notifications (IPN)";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
readonly name: "get_payment";
|
|
52
|
+
readonly description: "Retrieve a payment by its ID. Returns full payment details including status, amount, payer info.";
|
|
53
|
+
readonly parameters: {
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly required: readonly ["payment_id"];
|
|
56
|
+
readonly properties: {
|
|
57
|
+
readonly payment_id: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly description: "The payment ID to look up";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
readonly name: "create_refund";
|
|
65
|
+
readonly description: "Refund a payment fully or partially. Omit amount for full refund.";
|
|
66
|
+
readonly parameters: {
|
|
67
|
+
readonly type: "object";
|
|
68
|
+
readonly required: readonly ["payment_id"];
|
|
69
|
+
readonly properties: {
|
|
70
|
+
readonly payment_id: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly description: "The payment ID to refund";
|
|
73
|
+
};
|
|
74
|
+
readonly amount: {
|
|
75
|
+
readonly type: "number";
|
|
76
|
+
readonly description: "Partial refund amount. Omit for full refund.";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
readonly name: "search_payments";
|
|
82
|
+
readonly description: "Search recent payments for the authenticated merchant. Supports filtering by status.";
|
|
83
|
+
readonly parameters: {
|
|
84
|
+
readonly type: "object";
|
|
85
|
+
readonly properties: {
|
|
86
|
+
readonly status: {
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
readonly description: "Filter by status: approved, pending, rejected, refunded, cancelled";
|
|
89
|
+
};
|
|
90
|
+
readonly sort: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly description: "Sort field (e.g. date_created)";
|
|
93
|
+
};
|
|
94
|
+
readonly criteria: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly description: "Sort order: asc or desc";
|
|
97
|
+
};
|
|
98
|
+
readonly limit: {
|
|
99
|
+
readonly type: "number";
|
|
100
|
+
readonly description: "Max results (default 30, max 100)";
|
|
101
|
+
};
|
|
102
|
+
readonly offset: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
readonly description: "Pagination offset";
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
109
|
+
readonly name: "get_merchant_info";
|
|
110
|
+
readonly description: "Retrieve the authenticated merchant's user profile including ID, nickname, and site.";
|
|
111
|
+
readonly parameters: {
|
|
112
|
+
readonly type: "object";
|
|
113
|
+
readonly properties: {};
|
|
114
|
+
};
|
|
115
|
+
})[];
|
|
116
|
+
tools: {
|
|
117
|
+
create_payment_preference: (params: CreatePaymentPreferenceParams) => Promise<unknown>;
|
|
118
|
+
get_payment: (params: GetPaymentParams) => Promise<unknown>;
|
|
119
|
+
create_refund: (params: CreateRefundParams) => Promise<unknown>;
|
|
120
|
+
search_payments: (params?: SearchPaymentsParams) => Promise<unknown>;
|
|
121
|
+
get_merchant_info: () => Promise<unknown>;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
export { MercadoPagoClient } from "./client.js";
|
|
125
|
+
export type { ClientOptions } from "./client.js";
|
|
126
|
+
export { MercadoPagoError } from "./errors.js";
|
|
127
|
+
export { createPaymentPreference, getPayment, createRefund, searchPayments, getMerchantInfo, } from "./actions.js";
|
|
128
|
+
export { allSchemas } from "./schemas.js";
|
|
129
|
+
export type { CreatePaymentPreferenceParams, GetPaymentParams, CreateRefundParams, SearchPaymentsParams, BackUrls, } from "./schemas.js";
|
|
130
|
+
export { createWebhookHandler } from "./webhook.js";
|
|
131
|
+
export type { WebhookConfig } from "./webhook.js";
|
|
132
|
+
export { createWhatsAppWebhookHandler, WhatsAppClient, createCommandHandlers, createPaymentNotifier, parseMessage, extractMessages } from "./whatsapp/webhook.js";
|
|
133
|
+
export type { WhatsAppWebhookConfig, WhatsAppClientConfig, HandlersConfig, ParsedCommand, IncomingWhatsAppMessage, CommandName } from "./whatsapp/webhook.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractMessages = exports.parseMessage = exports.createPaymentNotifier = exports.createCommandHandlers = exports.WhatsAppClient = exports.createWhatsAppWebhookHandler = exports.createWebhookHandler = exports.allSchemas = exports.getMerchantInfo = exports.searchPayments = exports.createRefund = exports.getPayment = exports.createPaymentPreference = exports.MercadoPagoError = exports.MercadoPagoClient = void 0;
|
|
4
|
+
exports.createMercadoPagoTools = createMercadoPagoTools;
|
|
5
|
+
const client_js_1 = require("./client.js");
|
|
6
|
+
const actions_js_1 = require("./actions.js");
|
|
7
|
+
const schemas_js_1 = require("./schemas.js");
|
|
8
|
+
function createMercadoPagoTools(accessToken) {
|
|
9
|
+
const client = new client_js_1.MercadoPagoClient(accessToken);
|
|
10
|
+
return {
|
|
11
|
+
schemas: schemas_js_1.allSchemas,
|
|
12
|
+
tools: {
|
|
13
|
+
create_payment_preference: (params) => (0, actions_js_1.createPaymentPreference)(client, params),
|
|
14
|
+
get_payment: (params) => (0, actions_js_1.getPayment)(client, params),
|
|
15
|
+
create_refund: (params) => (0, actions_js_1.createRefund)(client, params),
|
|
16
|
+
search_payments: (params) => (0, actions_js_1.searchPayments)(client, params),
|
|
17
|
+
get_merchant_info: () => (0, actions_js_1.getMerchantInfo)(client),
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var client_js_2 = require("./client.js");
|
|
22
|
+
Object.defineProperty(exports, "MercadoPagoClient", { enumerable: true, get: function () { return client_js_2.MercadoPagoClient; } });
|
|
23
|
+
var errors_js_1 = require("./errors.js");
|
|
24
|
+
Object.defineProperty(exports, "MercadoPagoError", { enumerable: true, get: function () { return errors_js_1.MercadoPagoError; } });
|
|
25
|
+
var actions_js_2 = require("./actions.js");
|
|
26
|
+
Object.defineProperty(exports, "createPaymentPreference", { enumerable: true, get: function () { return actions_js_2.createPaymentPreference; } });
|
|
27
|
+
Object.defineProperty(exports, "getPayment", { enumerable: true, get: function () { return actions_js_2.getPayment; } });
|
|
28
|
+
Object.defineProperty(exports, "createRefund", { enumerable: true, get: function () { return actions_js_2.createRefund; } });
|
|
29
|
+
Object.defineProperty(exports, "searchPayments", { enumerable: true, get: function () { return actions_js_2.searchPayments; } });
|
|
30
|
+
Object.defineProperty(exports, "getMerchantInfo", { enumerable: true, get: function () { return actions_js_2.getMerchantInfo; } });
|
|
31
|
+
var schemas_js_2 = require("./schemas.js");
|
|
32
|
+
Object.defineProperty(exports, "allSchemas", { enumerable: true, get: function () { return schemas_js_2.allSchemas; } });
|
|
33
|
+
var webhook_js_1 = require("./webhook.js");
|
|
34
|
+
Object.defineProperty(exports, "createWebhookHandler", { enumerable: true, get: function () { return webhook_js_1.createWebhookHandler; } });
|
|
35
|
+
var webhook_js_2 = require("./whatsapp/webhook.js");
|
|
36
|
+
Object.defineProperty(exports, "createWhatsAppWebhookHandler", { enumerable: true, get: function () { return webhook_js_2.createWhatsAppWebhookHandler; } });
|
|
37
|
+
Object.defineProperty(exports, "WhatsAppClient", { enumerable: true, get: function () { return webhook_js_2.WhatsAppClient; } });
|
|
38
|
+
Object.defineProperty(exports, "createCommandHandlers", { enumerable: true, get: function () { return webhook_js_2.createCommandHandlers; } });
|
|
39
|
+
Object.defineProperty(exports, "createPaymentNotifier", { enumerable: true, get: function () { return webhook_js_2.createPaymentNotifier; } });
|
|
40
|
+
Object.defineProperty(exports, "parseMessage", { enumerable: true, get: function () { return webhook_js_2.parseMessage; } });
|
|
41
|
+
Object.defineProperty(exports, "extractMessages", { enumerable: true, get: function () { return webhook_js_2.extractMessages; } });
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAgBA,wDAuBC;AAvCD,2CAAgD;AAChD,6CAMsB;AACtB,6CAA0C;AAQ1C,SAAgB,sBAAsB,CAAC,WAAmB;IACxD,MAAM,MAAM,GAAG,IAAI,6BAAiB,CAAC,WAAW,CAAC,CAAC;IAElD,OAAO;QACL,OAAO,EAAE,uBAAU;QAEnB,KAAK,EAAE;YACL,yBAAyB,EAAE,CAAC,MAAqC,EAAE,EAAE,CACnE,IAAA,oCAAuB,EAAC,MAAM,EAAE,MAAM,CAAC;YAEzC,WAAW,EAAE,CAAC,MAAwB,EAAE,EAAE,CACxC,IAAA,uBAAU,EAAC,MAAM,EAAE,MAAM,CAAC;YAE5B,aAAa,EAAE,CAAC,MAA0B,EAAE,EAAE,CAC5C,IAAA,yBAAY,EAAC,MAAM,EAAE,MAAM,CAAC;YAE9B,e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