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