package formapago import ( "net/http" "strconv" r "repuestera_back/repositorios" "github.com/gin-gonic/gin" ) func ObtenerFormaDePago(c *gin.Context) { id, err := strconv.ParseUint(c.Param("id"), 10, 64) if err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": "ID invalido"}) return } if id < 1 { c.JSON(http.StatusBadRequest, gin.H{"error": "ID no puede ser menor que 1"}) return } fp, err := r.ObtenerRepositorios(c).FormaDePago.ObtenerPorID(uint(id)) if err != nil { c.JSON(http.StatusNotFound, gin.H{"error": "Forma de pago no encontrada"}) return } c.JSON(http.StatusOK, fp) }