up
This commit is contained in:
@@ -248,6 +248,7 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
Icono string `json:"icono"`
|
||||
Titulo string `json:"titulo"`
|
||||
Detalle string `json:"detalle"`
|
||||
Enlace string `json:"enlace"` // URL de pago generada en este envío (opcional)
|
||||
Estado string `json:"estado"` // ok | error | info
|
||||
FechaISO string `json:"fecha"`
|
||||
}
|
||||
@@ -264,6 +265,18 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
FechaISO: contrato.CreatedAt.Format(time.RFC3339),
|
||||
})
|
||||
|
||||
// Evento: pago confirmado (directo del contrato, siempre visible si se pagó)
|
||||
if contrato.PagoConfirmado && contrato.FechaPago != nil {
|
||||
timeline = append(timeline, Evento{
|
||||
Tipo: "pago",
|
||||
Icono: "currency",
|
||||
Titulo: "Pago confirmado",
|
||||
Detalle: "Nuevo vencimiento: " + contrato.FechaVencimiento.Format("02/01/2006"),
|
||||
Estado: "ok",
|
||||
FechaISO: contrato.FechaPago.Format(time.RFC3339),
|
||||
})
|
||||
}
|
||||
|
||||
// Evento: renovaciones (updated_at con estado renovado — heurístico por estado)
|
||||
if contrato.Estado == "renovado" {
|
||||
timeline = append(timeline, Evento{
|
||||
@@ -297,6 +310,7 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
Icono: "mail",
|
||||
Titulo: "Notificación enviada" + reglaLabel,
|
||||
Detalle: detalle,
|
||||
Enlace: n.EnlacePago,
|
||||
Estado: estado,
|
||||
FechaISO: n.CreatedAt.Format(time.RFC3339),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user