better-auth-mercadopago 0.1.5 → 0.1.6
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/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +52 -85
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +52 -85
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +81 -340
- package/dist/index.d.ts +81 -340
- package/dist/index.js +53 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -222,21 +222,18 @@ var ValidationRules = {
|
|
|
222
222
|
// client.ts
|
|
223
223
|
var mercadoPagoClient = () => {
|
|
224
224
|
return {
|
|
225
|
-
id: "
|
|
225
|
+
id: "mercadoPago",
|
|
226
226
|
$InferServerPlugin: {},
|
|
227
227
|
getActions: ($fetch) => ({
|
|
228
228
|
/**
|
|
229
229
|
* Get or create a Mercado Pago customer for the authenticated user
|
|
230
230
|
*/
|
|
231
231
|
getOrCreateCustomer: async (data, fetchOptions) => {
|
|
232
|
-
return await $fetch(
|
|
233
|
-
"
|
|
234
|
-
{
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
...fetchOptions
|
|
238
|
-
}
|
|
239
|
-
);
|
|
232
|
+
return await $fetch("/mercado-pago/customer", {
|
|
233
|
+
method: "POST",
|
|
234
|
+
body: data || {},
|
|
235
|
+
...fetchOptions
|
|
236
|
+
});
|
|
240
237
|
},
|
|
241
238
|
/**
|
|
242
239
|
* Create a payment and get checkout URL
|
|
@@ -257,14 +254,11 @@ var mercadoPagoClient = () => {
|
|
|
257
254
|
* ```
|
|
258
255
|
*/
|
|
259
256
|
createPayment: async (data, fetchOptions) => {
|
|
260
|
-
return await $fetch(
|
|
261
|
-
"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
...fetchOptions
|
|
266
|
-
}
|
|
267
|
-
);
|
|
257
|
+
return await $fetch("/mercado-pago/payment/create", {
|
|
258
|
+
method: "POST",
|
|
259
|
+
body: data,
|
|
260
|
+
...fetchOptions
|
|
261
|
+
});
|
|
268
262
|
},
|
|
269
263
|
/**
|
|
270
264
|
* Create a marketplace payment with automatic split
|
|
@@ -288,14 +282,11 @@ var mercadoPagoClient = () => {
|
|
|
288
282
|
* ```
|
|
289
283
|
*/
|
|
290
284
|
createMarketplacePayment: async (data, fetchOptions) => {
|
|
291
|
-
return await $fetch(
|
|
292
|
-
"
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
...fetchOptions
|
|
297
|
-
}
|
|
298
|
-
);
|
|
285
|
+
return await $fetch("/mercado-pago/payment/create", {
|
|
286
|
+
method: "POST",
|
|
287
|
+
body: data,
|
|
288
|
+
...fetchOptions
|
|
289
|
+
});
|
|
299
290
|
},
|
|
300
291
|
/**
|
|
301
292
|
* Create a subscription with recurring payments
|
|
@@ -325,14 +316,11 @@ var mercadoPagoClient = () => {
|
|
|
325
316
|
* ```
|
|
326
317
|
*/
|
|
327
318
|
createSubscription: async (data, fetchOptions) => {
|
|
328
|
-
return await $fetch(
|
|
329
|
-
"
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
...fetchOptions
|
|
334
|
-
}
|
|
335
|
-
);
|
|
319
|
+
return await $fetch("/mercado-pago/subscription/create", {
|
|
320
|
+
method: "POST",
|
|
321
|
+
body: data,
|
|
322
|
+
...fetchOptions
|
|
323
|
+
});
|
|
336
324
|
},
|
|
337
325
|
/**
|
|
338
326
|
* Cancel a subscription
|
|
@@ -345,14 +333,11 @@ var mercadoPagoClient = () => {
|
|
|
345
333
|
* ```
|
|
346
334
|
*/
|
|
347
335
|
cancelSubscription: async (data, fetchOptions) => {
|
|
348
|
-
return await $fetch(
|
|
349
|
-
"
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
...fetchOptions
|
|
354
|
-
}
|
|
355
|
-
);
|
|
336
|
+
return await $fetch("/mercado-pago/subscription/cancel", {
|
|
337
|
+
method: "POST",
|
|
338
|
+
body: data,
|
|
339
|
+
...fetchOptions
|
|
340
|
+
});
|
|
356
341
|
},
|
|
357
342
|
/**
|
|
358
343
|
* Create a reusable preapproval plan (subscription template)
|
|
@@ -381,14 +366,11 @@ var mercadoPagoClient = () => {
|
|
|
381
366
|
* ```
|
|
382
367
|
*/
|
|
383
368
|
createPreapprovalPlan: async (data, fetchOptions) => {
|
|
384
|
-
return await $fetch(
|
|
385
|
-
"
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
...fetchOptions
|
|
390
|
-
}
|
|
391
|
-
);
|
|
369
|
+
return await $fetch("/mercado-pago/plan/create", {
|
|
370
|
+
method: "POST",
|
|
371
|
+
body: data,
|
|
372
|
+
...fetchOptions
|
|
373
|
+
});
|
|
392
374
|
},
|
|
393
375
|
/**
|
|
394
376
|
* List all preapproval plans
|
|
@@ -404,25 +386,19 @@ var mercadoPagoClient = () => {
|
|
|
404
386
|
* ```
|
|
405
387
|
*/
|
|
406
388
|
listPreapprovalPlans: async (fetchOptions) => {
|
|
407
|
-
return await $fetch(
|
|
408
|
-
"
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
...fetchOptions
|
|
412
|
-
}
|
|
413
|
-
);
|
|
389
|
+
return await $fetch("/mercado-pago/plans", {
|
|
390
|
+
method: "GET",
|
|
391
|
+
...fetchOptions
|
|
392
|
+
});
|
|
414
393
|
},
|
|
415
394
|
/**
|
|
416
395
|
* Get payment by ID
|
|
417
396
|
*/
|
|
418
397
|
getPayment: async (paymentId, fetchOptions) => {
|
|
419
|
-
return await $fetch(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
...fetchOptions
|
|
424
|
-
}
|
|
425
|
-
);
|
|
398
|
+
return await $fetch(`/mercado-pago/payment/${paymentId}`, {
|
|
399
|
+
method: "GET",
|
|
400
|
+
...fetchOptions
|
|
401
|
+
});
|
|
426
402
|
},
|
|
427
403
|
/**
|
|
428
404
|
* List all payments for the authenticated user
|
|
@@ -439,13 +415,10 @@ var mercadoPagoClient = () => {
|
|
|
439
415
|
const query = new URLSearchParams();
|
|
440
416
|
if (params?.limit) query.set("limit", params.limit.toString());
|
|
441
417
|
if (params?.offset) query.set("offset", params.offset.toString());
|
|
442
|
-
return await $fetch(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
...fetchOptions
|
|
447
|
-
}
|
|
448
|
-
);
|
|
418
|
+
return await $fetch(`/mercado-pago/payments?${query.toString()}`, {
|
|
419
|
+
method: "GET",
|
|
420
|
+
...fetchOptions
|
|
421
|
+
});
|
|
449
422
|
},
|
|
450
423
|
/**
|
|
451
424
|
* List all subscriptions for the authenticated user
|
|
@@ -456,13 +429,10 @@ var mercadoPagoClient = () => {
|
|
|
456
429
|
* ```
|
|
457
430
|
*/
|
|
458
431
|
listSubscriptions: async (fetchOptions) => {
|
|
459
|
-
return await $fetch(
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
...fetchOptions
|
|
464
|
-
}
|
|
465
|
-
);
|
|
432
|
+
return await $fetch(`/mercado-pago/subscriptions`, {
|
|
433
|
+
method: "GET",
|
|
434
|
+
...fetchOptions
|
|
435
|
+
});
|
|
466
436
|
},
|
|
467
437
|
/**
|
|
468
438
|
* Get OAuth authorization URL for marketplace sellers
|
|
@@ -512,14 +482,11 @@ var mercadoPagoClient = () => {
|
|
|
512
482
|
* ```
|
|
513
483
|
*/
|
|
514
484
|
exchangeOAuthCode: async (data, fetchOptions) => {
|
|
515
|
-
return await $fetch(
|
|
516
|
-
"
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
...fetchOptions
|
|
521
|
-
}
|
|
522
|
-
);
|
|
485
|
+
return await $fetch("/mercado-pago/oauth/callback", {
|
|
486
|
+
method: "POST",
|
|
487
|
+
body: data,
|
|
488
|
+
...fetchOptions
|
|
489
|
+
});
|
|
523
490
|
}
|
|
524
491
|
})
|
|
525
492
|
};
|
|
@@ -536,7 +503,7 @@ var mercadoPagoPlugin = (options) => {
|
|
|
536
503
|
const preApprovalClient = new PreApproval(client);
|
|
537
504
|
const preApprovalPlanClient = new PreApprovalPlan(client);
|
|
538
505
|
return {
|
|
539
|
-
id: "
|
|
506
|
+
id: "mercadoPago",
|
|
540
507
|
schema: {
|
|
541
508
|
// Customer table - stores MP customer info
|
|
542
509
|
mercadoPagoCustomer: {
|