This commit is contained in:
lizandrogd
2025-05-08 20:14:58 -05:00
parent beb50ad892
commit 81af8269d6
4 changed files with 95 additions and 15 deletions
+25 -2
View File
@@ -112,8 +112,6 @@ func DeactivatePlan(c *fiber.Ctx) error {
planID := c.Params("planID")
subscriptionId := c.Params("subscriptionId")
// Obtener la configuración activa de DlocalApi
dlocalConfig, err := models.GetLastActiveDlocalApi()
if err != nil {
@@ -136,3 +134,28 @@ func DeactivatePlan(c *fiber.Ctx) error {
"response": string(response),
})
}
func SeePlanes(c *fiber.Ctx) error {
// Obtener la configuración activa de DlocalApi
dlocalConfig, err := models.GetLastActiveDlocalApi()
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
"error": "Error al obtener la configuración activa de DlocalApi.",
})
}
// Llamar al servicio para ver el plan
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),
})
}
// Devolver la respuesta exitosa
return c.Status(fiber.StatusOK).JSON(fiber.Map{
"message": "Planes obtenido exitosamente.",
"response": string(response),
})
}
+1 -1
View File
@@ -18,7 +18,7 @@ func v1AuthRoutes(api fiber.Router) {
api.Get("/dlocal/subscription/ver-plan/:planID", apiControllers.SeePlan)
api.Patch("/dlocal/subscription/actualizar-plan/:planID", apiControllers.UpdatedPlan)
api.Patch("/dlocal/subscription/plan/:planId/subscription/:subscriptionId/deactivate", apiControllers.DeactivatePlan)
api.Get("/dlocal/subscription/plan/all", apiControllers.SeePlanes)
}
func v1Routes(api fiber.Router) {