From edc15952c8575b3230a58367c03968b750556d83 Mon Sep 17 00:00:00 2001 From: Samuel Tariku Date: Wed, 3 Sep 2025 09:55:25 +0300 Subject: [PATCH] hotfix: commenting out providers for demo --- internal/services/virtualGame/veli/service.go | 16 ++++++------ internal/web_server/app.go | 20 +++++++------- internal/web_server/cron.go | 8 +++--- internal/web_server/handlers/auth_handler.go | 26 +++++++++---------- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/internal/services/virtualGame/veli/service.go b/internal/services/virtualGame/veli/service.go index 2de2eb4..347c608 100644 --- a/internal/services/virtualGame/veli/service.go +++ b/internal/services/virtualGame/veli/service.go @@ -66,15 +66,15 @@ func (s *Service) GetProviders(ctx context.Context, req domain.ProviderRequest) func (s *Service) GetGames(ctx context.Context, req domain.GameListRequest) ([]domain.GameEntity, error) { // 1. Check if provider is enabled in DB - provider, err := s.repo.GetVirtualGameProviderByID(ctx, req.ProviderID) - if err != nil { - return nil, fmt.Errorf("failed to check provider %s: %w", req.ProviderID, err) - } + // provider, err := s.repo.GetVirtualGameProviderByID(ctx, req.ProviderID) + // if err != nil { + // return nil, fmt.Errorf("failed to check provider %s: %w", req.ProviderID, err) + // } - if !provider.Enabled { - // Provider exists but is disabled → return empty list (or error if you prefer) - return nil, fmt.Errorf("provider %s is disabled", req.ProviderID) - } + // if !provider.Enabled { + // // Provider exists but is disabled → return empty list (or error if you prefer) + // return nil, fmt.Errorf("provider %s is disabled", req.ProviderID) + // } // 2. Prepare signature params sigParams := map[string]any{ diff --git a/internal/web_server/app.go b/internal/web_server/app.go index fa016c0..02e84e1 100644 --- a/internal/web_server/app.go +++ b/internal/web_server/app.go @@ -126,21 +126,21 @@ func NewApp( app.Use(cors.New(cors.Config{ AllowOrigins: "*", - AllowMethods: "GET,POST,PUT,DELETE,OPTIONS", + AllowMethods: "GET,POST,PUT,PATCH,DELETE,OPTIONS", AllowHeaders: "Content-Type,Authorization,platform", // AllowCredentials: true, })) s := &App{ - veliVirtualGameService: veliVirtualGameService, - telebirrSvc: telebirrSvc, - arifpaySvc: arifpaySvc, - santimpaySvc: santimpaySvc, - issueReportingSvc: issueReportingSvc, - instSvc: instSvc, - currSvc: currSvc, - fiber: app, - port: port, + veliVirtualGameService: veliVirtualGameService, + telebirrSvc: telebirrSvc, + arifpaySvc: arifpaySvc, + santimpaySvc: santimpaySvc, + issueReportingSvc: issueReportingSvc, + instSvc: instSvc, + currSvc: currSvc, + fiber: app, + port: port, settingSvc: settingSvc, authSvc: authSvc, diff --git a/internal/web_server/cron.go b/internal/web_server/cron.go index 8946f17..53acbb1 100644 --- a/internal/web_server/cron.go +++ b/internal/web_server/cron.go @@ -154,10 +154,10 @@ func SetupReportandVirtualGameCronJobs( spec string period string }{ - // { - // spec: "*/60 * * * * *", // Every 1 minute for testing - // period: "test", - // }, + { + spec: "*/60 * * * * *", // Every 1 minute for testing + period: "test", + }, { spec: "0 0 0 * * *", // Daily at midnight period: "daily", diff --git a/internal/web_server/handlers/auth_handler.go b/internal/web_server/handlers/auth_handler.go index 0ee2f01..a64f285 100644 --- a/internal/web_server/handlers/auth_handler.go +++ b/internal/web_server/handlers/auth_handler.go @@ -108,12 +108,12 @@ func (h *Handler) LoginCustomer(c *fiber.Ctx) error { } accessToken, err := jwtutil.CreateJwt( - successRes.UserId, - successRes.Role, - successRes.CompanyID, - h.jwtConfig.JwtAccessKey, + successRes.UserId, + successRes.Role, + successRes.CompanyID, + h.jwtConfig.JwtAccessKey, h.jwtConfig.JwtAccessExpiry, - ); + ) if err != nil { h.mongoLoggerSvc.Error("Failed to create access token", zap.Int("status_code", fiber.StatusInternalServerError), @@ -195,22 +195,22 @@ func (h *Handler) LoginAdmin(c *fiber.Ctx) error { switch { case errors.Is(err, authentication.ErrInvalidPassword), errors.Is(err, authentication.ErrUserNotFound): h.mongoLoggerSvc.Info("Login attempt failed: Invalid credentials", - zap.Int("status_code", fiber.StatusUnauthorized), + zap.Int("status_code", fiber.StatusBadRequest), zap.String("email", req.Email), zap.String("phone", req.PhoneNumber), zap.Error(err), zap.Time("timestamp", time.Now()), ) - return fiber.NewError(fiber.StatusUnauthorized, "Invalid credentials") + return fiber.NewError(fiber.StatusBadRequest, "Invalid credentials") case errors.Is(err, authentication.ErrUserSuspended): h.mongoLoggerSvc.Info("Login attempt failed: User login has been locked", - zap.Int("status_code", fiber.StatusUnauthorized), + zap.Int("status_code", fiber.StatusForbidden), zap.String("email", req.Email), zap.String("phone", req.PhoneNumber), zap.Error(err), zap.Time("timestamp", time.Now()), ) - return fiber.NewError(fiber.StatusUnauthorized, "User login has been locked") + return fiber.NewError(fiber.StatusForbidden, "User login has been locked") default: h.mongoLoggerSvc.Error("Login failed", zap.Int("status_code", fiber.StatusInternalServerError), @@ -296,22 +296,22 @@ func (h *Handler) LoginSuper(c *fiber.Ctx) error { switch { case errors.Is(err, authentication.ErrInvalidPassword), errors.Is(err, authentication.ErrUserNotFound): h.mongoLoggerSvc.Info("Login attempt failed: Invalid credentials", - zap.Int("status_code", fiber.StatusUnauthorized), + zap.Int("status_code", fiber.StatusBadRequest), zap.String("email", req.Email), zap.String("phone", req.PhoneNumber), zap.Error(err), zap.Time("timestamp", time.Now()), ) - return fiber.NewError(fiber.StatusUnauthorized, "Invalid credentials") + return fiber.NewError(fiber.StatusBadRequest, "Invalid credentials") case errors.Is(err, authentication.ErrUserSuspended): h.mongoLoggerSvc.Info("Login attempt failed: User login has been locked", - zap.Int("status_code", fiber.StatusUnauthorized), + zap.Int("status_code", fiber.StatusForbidden), zap.String("email", req.Email), zap.String("phone", req.PhoneNumber), zap.Error(err), zap.Time("timestamp", time.Now()), ) - return fiber.NewError(fiber.StatusUnauthorized, "User login has been locked") + return fiber.NewError(fiber.StatusForbidden, "User login has been locked") default: h.mongoLoggerSvc.Error("Login failed", zap.Int("status_code", fiber.StatusInternalServerError),