Yimaru-BackEnd/internal/web_server/handlers/currency.go

53 lines
1.7 KiB
Go

package handlers
// @Summary Get supported currencies
// @Description Returns list of supported currencies
// @Tags Multi-Currency
// @Produce json
// @Success 200 {object} domain.Response{data=[]domain.Currency}
// @Router /api/v1/currencies [get]
// func (h *Handler) GetSupportedCurrencies(c *fiber.Ctx) error {
// currencies, err := h.currSvc.GetSupportedCurrencies(c.Context())
// if err != nil {
// return domain.UnExpectedErrorResponse(c)
// }
// return c.Status(fiber.StatusOK).JSON(domain.Response{
// Success: true,
// Message: "Supported currencies retrieved successfully",
// Data: currencies,
// StatusCode: fiber.StatusOK,
// })
// }
// @Summary Convert currency
// @Description Converts amount from one currency to another
// @Tags Multi-Currency
// @Produce json
// @Param from query string true "Source currency code (e.g., USD)"
// @Param to query string true "Target currency code (e.g., ETB)"
// @Param amount query number true "Amount to convert"
// @Success 200 {object} domain.Response{data=float64}
// @Failure 400 {object} domain.ErrorResponse
// @Router /api/v1/currencies/convert [get]
// func (h *Handler) ConvertCurrency(c *fiber.Ctx) error {
// from := domain.IntCurrency(c.Query("from"))
// to := domain.IntCurrency(c.Query("to"))
// amount := c.QueryFloat("amount", 0)
// // if err != nil {
// // return domain.BadRequestResponse(c)
// // }
// converted, err := h.currSvc.Convert(c.Context(), amount, from, to)
// if err != nil {
// return domain.UnExpectedErrorResponse(c)
// }
// return c.Status(fiber.StatusOK).JSON(domain.Response{
// Success: true,
// Message: "Currency converted successfully",
// Data: converted,
// StatusCode: fiber.StatusOK,
// })
// }