up
This commit is contained in:
@@ -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 ──────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user