feat: add kyc service http handler and docs
This commit is contained in:
@@ -153,6 +153,37 @@ func (h *AuthHandler) VerifyOTP(c *fiber.Ctx) error {
|
||||
})
|
||||
}
|
||||
|
||||
// VerifyKYC verifies user KYC information
|
||||
// @Summary Verify user KYC
|
||||
// @Description Verify user KYC with national ID and birth date
|
||||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body dto.KYCVerifyRequest true "KYC Verify Request"
|
||||
// @Success 200 {object} dto.KYCVerifyResponse
|
||||
// @Failure 400 {object} map[string]string
|
||||
// @Failure 500 {object} map[string]string
|
||||
// @Router /auth/verify-kyc [post]
|
||||
func (h *AuthHandler) VerifyKYC(c *fiber.Ctx) error {
|
||||
var req dto.KYCVerifyRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||
"error": "invalid request body",
|
||||
})
|
||||
}
|
||||
|
||||
err := h.authService.VerifyKYC(c.Context(), req.UserID, req.NationalID, req.BirthDate)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
return c.Status(fiber.StatusOK).JSON(dto.KYCVerifyResponse{
|
||||
Message: "KYC verified successfully",
|
||||
})
|
||||
}
|
||||
|
||||
func (h *AuthHandler) HelloWorld(c *fiber.Ctx) error {
|
||||
return c.Status(fiber.StatusOK).JSON(fiber.Map{
|
||||
"message": "Hello, World!",
|
||||
|
||||
@@ -49,4 +49,6 @@ func registerPublicRoutes(router fiber.Router, app *app.AppContainer) {
|
||||
authgroup.Post("/authenticate", authHandler.Authenticate)
|
||||
authgroup.Post("/send-otp", authHandler.SendOTP)
|
||||
authgroup.Post("/verify-otp", authHandler.VerifyOTP)
|
||||
// add JWT middleware for KYC
|
||||
authgroup.Post("/verify-kyc", authHandler.VerifyKYC)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user