This commit is contained in:
Lizandro Guarnizo
2026-05-01 22:55:51 -05:00
parent ddbabea23f
commit 560359173b
8 changed files with 755 additions and 80 deletions
+36 -3
View File
@@ -129,13 +129,46 @@ func GetDlocalConfigAPI(c *fiber.Ctx) error {
// ─── Logs Bold ────────────────────────────────────────────────────────────────
// BoldWebhookLogs devuelve los últimos 50 registros del log de webhooks de Bold.
// BoldWebhookLogs devuelve los logs de notificaciones con paginación y filtro por tipo.
// Query params: page (default 1), limit (default 25), tipo (SALE_APPROVED|SALE_REJECTED|...|TODOS)
func BoldWebhookLogs(c *fiber.Ctx) error {
logs, err := models.GetBoldWebhookLogs(50)
page := c.QueryInt("page", 1)
limit := c.QueryInt("limit", 25)
tipo := c.Query("tipo", "")
if page < 1 {
page = 1
}
logs, total, err := models.GetBoldWebhookLogsPaginated(page, limit, tipo)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": err.Error()})
}
return c.JSON(fiber.Map{"data": logs})
return c.JSON(fiber.Map{
"data": logs,
"total": total,
"page": page,
"limit": limit,
})
}
// BoldCallbackLogs devuelve los intentos de pago (visitas al callback) con paginación y filtro.
// Query params: page (default 1), limit (default 25), estado (pendiente|pagado|fallido|revertido|TODOS)
func BoldCallbackLogs(c *fiber.Ctx) error {
page := c.QueryInt("page", 1)
limit := c.QueryInt("limit", 25)
estado := c.Query("estado", "")
if page < 1 {
page = 1
}
logs, total, err := models.GetBoldCallbackLogsPaginated(page, limit, estado)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": err.Error()})
}
return c.JSON(fiber.Map{
"data": logs,
"total": total,
"page": page,
"limit": limit,
})
}
// ─── Logs dLocal ──────────────────────────────────────────────────────────────