This commit is contained in:
Lizandro Guarnizo
2026-05-12 21:33:54 -05:00
parent fbd75d8cc6
commit 9ca202b3bd
2 changed files with 80 additions and 3 deletions
+18
View File
@@ -61,6 +61,24 @@ func PagoExitosoPage(c *fiber.Ctx) error {
}, "layouts/landing")
}
// Bold confirmó el pago directamente en la URL de retorno
if boldTxStatus == "approved" {
_ = models.SaveBoldCallbackLog(models.BoldCallbackLog{
Referencia: ref, PaymentLink: paymentLink, Params: paramsJSON,
Estado: "pagado", IP: c.IP(), UserAgent: string(c.Request().Header.UserAgent()),
})
// Marcar contrato si aún no está confirmado
var contratoID uint
if _, err := fmt.Sscanf(ref, "contrato-%d", &contratoID); err == nil && contratoID > 0 {
_ = models.MarcarContratoPagado(contratoID)
go services.EnviarCorreoConfirmacionPago(contratoID)
}
estado, fechaPago := verificarPago(ref)
return c.Render("pago_exitoso", fiber.Map{
"Ref": ref, "Estado": estado, "FechaPago": fechaPago,
}, "layouts/landing")
}
// Registrar el intento de pago en la tabla de callbacks
if ref != "" || paymentLink != "" {
entry := models.BoldCallbackLog{