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
+19 -2
View File
@@ -83,9 +83,26 @@ func BoldWebhook(c *fiber.Ctx) error {
return c.Status(fiber.StatusOK).JSON(fiber.Map{"ok": true})
}
// ─── 6. Solo procesar SALE_APPROVED ─────────────────────────────────────
// ─── 6. Actualizar estado en callback_log para TODOS los eventos ─────────
if referencia != "" {
estimado := "pendiente"
switch tipo {
case "SALE_APPROVED":
estimado = "pagado"
case "SALE_REJECTED":
estimado = "fallido"
case "SALE_REVERSED", "CHARGEBACK":
estimado = "revertido"
}
models.UpdateBoldCallbackEstado(referencia, estimado)
if paymentID != "" {
models.UpdateBoldCallbackEstado(paymentID, estimado)
}
}
// Solo continuar lógica de negocio para SALE_APPROVED ─────────────────────
if tipo != "SALE_APPROVED" {
log.Printf("[BOLD] Webhook: tipo '%s' ignorado", tipo)
log.Printf("[BOLD] Webhook: tipo '%s' registrado", tipo)
return c.Status(fiber.StatusOK).JSON(fiber.Map{"ok": true})
}