up
This commit is contained in:
@@ -118,8 +118,9 @@ func BoldWebhook(c *fiber.Ctx) error {
|
||||
log.Printf("[BOLD] Webhook: error marcando contrato %d como pagado: %v", contratoID, err)
|
||||
} else {
|
||||
log.Printf("[BOLD] Webhook: contrato %d marcado como pagado", contratoID)
|
||||
// Notificar SaaS externos asociados al contrato (goroutine, no bloquea respuesta)
|
||||
// Notificar SaaS externos + enviar correo de confirmación (goroutine, no bloquea respuesta)
|
||||
go services.DispatchSaasPaymentNotification(contratoID, payerEmail, "bold", float64(monto), "COP")
|
||||
go services.EnviarCorreoConfirmacionPago(contratoID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ func SeePlanes(c *fiber.Ctx) error {
|
||||
response, err := services.SeePlanes(*dlocalConfig)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": fmt.Sprintf("Error al obtener los planes", err),
|
||||
"error": fmt.Sprintf("Error al obtener los planes: %v", err),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -324,8 +324,9 @@ func DlocalWebhook(c *fiber.Ctx) error {
|
||||
log.Printf("[DLOCAL] Webhook: error marcando contrato %d como pagado: %v", contratoID, err)
|
||||
} else {
|
||||
log.Printf("[DLOCAL] Webhook: contrato %d marcado como pagado", contratoID)
|
||||
// Notificar SaaS externos asociados al contrato (goroutine, no bloquea respuesta)
|
||||
// Notificar SaaS externos + enviar correo de confirmación (goroutine, no bloquea respuesta)
|
||||
go services.DispatchSaasPaymentNotification(contratoID, payerEmail, "dlocal", monto, moneda)
|
||||
go services.EnviarCorreoConfirmacionPago(contratoID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ func verificarPago(ref string) (confirmado bool, fechaPago string) {
|
||||
if l.Estado == "PAID" || l.Estado == "AUTHORIZED" {
|
||||
log.Printf("[PAGO-ESTADO] Contrato %d confirmado via dlocal_payment_log (id=%d)", contratoID, l.ID)
|
||||
_ = models.MarcarContratoPagado(contratoID)
|
||||
go services.EnviarCorreoConfirmacionPago(contratoID)
|
||||
return true, l.CreatedAt.Format("02/01/2006 15:04")
|
||||
}
|
||||
}
|
||||
@@ -133,6 +134,7 @@ func verificarPago(ref string) (confirmado bool, fechaPago string) {
|
||||
} else if paid {
|
||||
log.Printf("[PAGO-ESTADO] Contrato %d confirmado via Bold API (payment_id=%s)", contratoID, paymentID)
|
||||
_ = models.MarcarContratoPagado(contratoID)
|
||||
go services.EnviarCorreoConfirmacionPago(contratoID)
|
||||
if paymentID != "" && !models.IsBoldNotificationDuplicate("api-check-"+paymentID) {
|
||||
_ = models.SaveBoldWebhookLog(models.BoldWebhookLog{
|
||||
NotificationID: "api-check-" + paymentID,
|
||||
@@ -156,6 +158,7 @@ func verificarPago(ref string) (confirmado bool, fechaPago string) {
|
||||
} else if paid {
|
||||
log.Printf("[PAGO-ESTADO] Contrato %d confirmado via dLocal API (payment_id=%s)", contratoID, paymentID)
|
||||
_ = models.MarcarContratoPagado(contratoID)
|
||||
go services.EnviarCorreoConfirmacionPago(contratoID)
|
||||
notifID := "api-check-" + ref
|
||||
if !models.IsDlocalNotificationDuplicate(notifID) {
|
||||
_ = models.SaveDlocalPaymentLog(models.DlocalPaymentLog{
|
||||
|
||||
Reference in New Issue
Block a user