This commit is contained in:
Lizandro Guarnizo
2026-05-12 21:22:30 -05:00
parent 553fc25473
commit fbd75d8cc6
11 changed files with 188 additions and 48 deletions
+12 -2
View File
@@ -13,11 +13,11 @@ type BoldConfig struct {
ApiKeyProd string `json:"api_key_prod" gorm:"column:api_key_prod;type:text"`
SecretKeyProd string `json:"secret_key_prod" gorm:"column:secret_key_prod;type:text"`
// Claves de prueba / test
ApiKeyTest string `json:"api_key_test" gorm:"column:api_key_test;type:text"`
ApiKeyTest string `json:"api_key_test" gorm:"column:api_key_test;type:text"`
// En modo test la secret key es cadena vacía según la doc oficial
SecretKeyTest string `json:"secret_key_test" gorm:"column:secret_key_test;type:text"`
// Modo activo: "test" | "production"
Modo string `json:"modo" gorm:"column:modo;default:'test'"`
Modo string `json:"modo" gorm:"column:modo;default:'test'"`
// URL a la que Bold redirige al usuario tras el pago
CallbackUrl string `json:"callback_url" gorm:"column:callback_url;type:text"`
// Nota interna
@@ -186,6 +186,16 @@ func UpdateBoldCallbackEstado(referencia, estado string) {
Update("estado", estado)
}
// GetBoldCallbackLogByID carga un intento de pago por su PK.
func GetBoldCallbackLogByID(id uint, out *BoldCallbackLog) error {
return app.Http.Database.DB.First(out, id).Error
}
// UpdateBoldCallbackEstadoByID actualiza el estado de un intento de pago específico por su PK.
func UpdateBoldCallbackEstadoByID(id uint, estado string) error {
return app.Http.Database.DB.Model(&BoldCallbackLog{}).Where("id = ?", id).Update("estado", estado).Error
}
// GetBoldCallbackLogsPaginated devuelve los intentos de pago con paginación y filtro.
func GetBoldCallbackLogsPaginated(page, limit int, estado string) ([]BoldCallbackLog, int64, error) {
var logs []BoldCallbackLog