authmiddleware fix
This commit is contained in:
parent
9dd566417e
commit
9793854596
63
docs/docs.go
63
docs/docs.go
|
|
@ -200,33 +200,6 @@ const docTemplate = `{
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Invalid request parameters",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"401": {
|
|
||||||
"description": "Unauthorized",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal server error",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -465,42 +438,6 @@ const docTemplate = `{
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Invalid callback format",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"401": {
|
|
||||||
"description": "Invalid signature",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"409": {
|
|
||||||
"description": "Duplicate transaction",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal processing error",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,33 +192,6 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Invalid request parameters",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"401": {
|
|
||||||
"description": "Unauthorized",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal server error",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -457,42 +430,6 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "Invalid callback format",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"401": {
|
|
||||||
"description": "Invalid signature",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"409": {
|
|
||||||
"description": "Duplicate transaction",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "Internal processing error",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1440,24 +1440,6 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
"400":
|
|
||||||
description: Invalid request parameters
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
"401":
|
|
||||||
description: Unauthorized
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
"500":
|
|
||||||
description: Internal server error
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
security:
|
security:
|
||||||
- BearerAuth: []
|
- BearerAuth: []
|
||||||
summary: Launch an Alea Play virtual game
|
summary: Launch an Alea Play virtual game
|
||||||
|
|
@ -1613,30 +1595,6 @@ paths:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
"400":
|
|
||||||
description: Invalid callback format
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
"401":
|
|
||||||
description: Invalid signature
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
"409":
|
|
||||||
description: Duplicate transaction
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
"500":
|
|
||||||
description: Internal processing error
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
summary: Process Alea Play game callback
|
summary: Process Alea Play game callback
|
||||||
tags:
|
tags:
|
||||||
- Alea Virtual Games
|
- Alea Virtual Games
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,9 @@ import (
|
||||||
// @Param currency query string false "Currency code (ISO 4217)" Enums(USD, EUR, GBP) default(USD)
|
// @Param currency query string false "Currency code (ISO 4217)" Enums(USD, EUR, GBP) default(USD)
|
||||||
// @Param mode query string false "Game mode" Enums(real, demo) default(real)
|
// @Param mode query string false "Game mode" Enums(real, demo) default(real)
|
||||||
// @Success 200 {object} map[string]string{launch_url=string} "Returns authenticated game launch URL"
|
// @Success 200 {object} map[string]string{launch_url=string} "Returns authenticated game launch URL"
|
||||||
// @Failure 400 {object} map[string]string "Invalid request parameters"
|
|
||||||
// @Failure 401 {object} map[string]string "Unauthorized"
|
|
||||||
// @Failure 500 {object} map[string]string "Internal server error"
|
|
||||||
// @Router /api/v1/alea-games/launch [get]
|
// @Router /api/v1/alea-games/launch [get]
|
||||||
func (h *Handler) LaunchAleaGame(c *fiber.Ctx) error {
|
func (h *Handler) LaunchAleaGame(c *fiber.Ctx) error {
|
||||||
userID := c.Locals("userID").(int64)
|
userID := c.Locals("user_id").(int64)
|
||||||
gameID := c.Query("game_id")
|
gameID := c.Query("game_id")
|
||||||
currency := c.Query("currency", "USD")
|
currency := c.Query("currency", "USD")
|
||||||
mode := c.Query("mode", "real") // real or demo
|
mode := c.Query("mode", "real") // real or demo
|
||||||
|
|
@ -36,6 +33,7 @@ func (h *Handler) LaunchAleaGame(c *fiber.Ctx) error {
|
||||||
|
|
||||||
return c.JSON(fiber.Map{
|
return c.JSON(fiber.Map{
|
||||||
"launch_url": launchURL,
|
"launch_url": launchURL,
|
||||||
|
"message": "Game launched successfully",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,10 +45,6 @@ func (h *Handler) LaunchAleaGame(c *fiber.Ctx) error {
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param callback body domain.AleaPlayCallback true "Callback payload"
|
// @Param callback body domain.AleaPlayCallback true "Callback payload"
|
||||||
// @Success 200 {object} map[string]string{status=string} "Callback processed successfully"
|
// @Success 200 {object} map[string]string{status=string} "Callback processed successfully"
|
||||||
// @Failure 400 {object} map[string]string "Invalid callback format"
|
|
||||||
// @Failure 401 {object} map[string]string "Invalid signature"
|
|
||||||
// @Failure 409 {object} map[string]string "Duplicate transaction"
|
|
||||||
// @Failure 500 {object} map[string]string "Internal processing error"
|
|
||||||
// @Router /api/v1/webhooks/alea [post]
|
// @Router /api/v1/webhooks/alea [post]
|
||||||
func (h *Handler) HandleAleaCallback(c *fiber.Ctx) error {
|
func (h *Handler) HandleAleaCallback(c *fiber.Ctx) error {
|
||||||
var cb domain.AleaPlayCallback
|
var cb domain.AleaPlayCallback
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ func (a *App) initAppRoutes() {
|
||||||
a.fiber.Get("/api/v1/chapa/transfers/verify/:transfer_ref", h.VerifyTransfer)
|
a.fiber.Get("/api/v1/chapa/transfers/verify/:transfer_ref", h.VerifyTransfer)
|
||||||
|
|
||||||
//Alea Play Virtual Game Routes
|
//Alea Play Virtual Game Routes
|
||||||
a.fiber.Get("/api/v1/alea-games/launch", h.LaunchAleaGame)
|
a.fiber.Get("/api/v1/alea-games/launch", a.authMiddleware, h.LaunchAleaGame)
|
||||||
a.fiber.Post("/api/v1/webhooks/alea", h.HandleAleaCallback)
|
a.fiber.Post("/api/v1/webhooks/alea", a.authMiddleware, h.HandleAleaCallback)
|
||||||
// a.fiber.Post("/webhooks/alea", middleware.AleaWebhookMiddleware(a.cfg.AleaPlay.SecretKey), h.HandleAleaCallback)
|
// a.fiber.Post("/webhooks/alea", middleware.AleaWebhookMiddleware(a.cfg.AleaPlay.SecretKey), h.HandleAleaCallback)
|
||||||
|
|
||||||
// Transactions /transactions
|
// Transactions /transactions
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user