437 lines
20 KiB
Go
437 lines
20 KiB
Go
package httpserver
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strconv"
|
|
|
|
_ "github.com/SamuelTariku/FortuneBet-Backend/docs"
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
|
|
// "github.com/SamuelTariku/FortuneBet-Backend/internal/logger/mongoLogger"
|
|
|
|
// "github.com/SamuelTariku/FortuneBet-Backend/internal/services/wallet/monitor"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/web_server/handlers"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
fiberSwagger "github.com/swaggo/fiber-swagger"
|
|
)
|
|
|
|
func (a *App) initAppRoutes() {
|
|
h := handlers.New(
|
|
a.telebirrSvc,
|
|
a.arifpaySvc,
|
|
a.santimpaySvc,
|
|
a.issueReportingSvc,
|
|
a.instSvc,
|
|
a.currSvc,
|
|
a.logger,
|
|
a.settingSvc,
|
|
a.NotidicationStore,
|
|
a.validator,
|
|
a.reportSvc,
|
|
a.chapaSvc,
|
|
a.walletSvc,
|
|
a.referralSvc,
|
|
a.raffleSvc,
|
|
a.bonusSvc,
|
|
a.virtualGameSvc,
|
|
a.aleaVirtualGameService,
|
|
a.veliVirtualGameService,
|
|
a.recommendationSvc,
|
|
a.userSvc,
|
|
a.transactionSvc,
|
|
a.ticketSvc,
|
|
a.betSvc,
|
|
a.authSvc,
|
|
a.JwtConfig,
|
|
a.branchSvc,
|
|
a.companySvc,
|
|
a.prematchSvc,
|
|
a.eventSvc,
|
|
a.leagueSvc,
|
|
*a.resultSvc,
|
|
a.cfg,
|
|
a.mongoLoggerSvc,
|
|
)
|
|
|
|
a.fiber.Get("/", func(c *fiber.Ctx) error {
|
|
return c.JSON(fiber.Map{
|
|
"message": "Welcome to the FortuneBet API",
|
|
"version": "1.0.dev13.1",
|
|
})
|
|
})
|
|
|
|
a.fiber.Get("/routes", func(c *fiber.Ctx) error {
|
|
return c.JSON(a.fiber.Stack()) // prints all registered routes
|
|
})
|
|
|
|
// Groups
|
|
groupV1 := a.fiber.Group("/api/v1")
|
|
tenant := groupV1.Group("/tenant/:tenant_slug", a.TenantMiddleware)
|
|
tenant.Get("/test", a.authMiddleware, a.authMiddleware, func(c *fiber.Ctx) error {
|
|
fmt.Printf("\nTest Route %v\n", c.Route().Path)
|
|
companyID := c.Locals("company_id").(domain.ValidInt64)
|
|
if !companyID.Valid {
|
|
h.BadRequestLogger().Error("invalid company id")
|
|
return fiber.NewError(fiber.StatusBadRequest, "invalid company id")
|
|
}
|
|
|
|
fmt.Printf("In the tenant auth test \n")
|
|
return c.JSON(fiber.Map{
|
|
"message": "Is is fine",
|
|
})
|
|
})
|
|
tenant.Get("/", func(c *fiber.Ctx) error {
|
|
fmt.Printf("\nTenant Route %v\n", c.Route().Path)
|
|
companyID := c.Locals("company_id").(domain.ValidInt64)
|
|
if !companyID.Valid {
|
|
h.BadRequestLogger().Error("invalid company id")
|
|
return fiber.NewError(fiber.StatusBadRequest, "invalid company id")
|
|
}
|
|
return c.JSON(fiber.Map{
|
|
"message": "Company Tenant Active",
|
|
})
|
|
})
|
|
//Direct_deposit
|
|
groupV1.Post("/direct_deposit", a.authMiddleware, h.InitiateDirectDeposit)
|
|
groupV1.Post("/direct_deposit/verify", a.authMiddleware, h.VerifyDirectDeposit)
|
|
groupV1.Get("/direct_deposit/pending", a.authMiddleware, h.GetPendingDirectDeposits)
|
|
|
|
// Swagger
|
|
a.fiber.Get("/swagger/*", fiberSwagger.FiberWrapHandler())
|
|
|
|
groupV1.Get("/", func(c *fiber.Ctx) error {
|
|
return c.JSON(fiber.Map{
|
|
"message": "FortuneBet API V1 pre-alpha",
|
|
"version": "1.0dev11",
|
|
})
|
|
})
|
|
|
|
// Auth Routes
|
|
tenant.Post("/auth/customer-login", h.LoginCustomer)
|
|
tenant.Post("/auth/admin-login", h.LoginAdmin)
|
|
groupV1.Post("/auth/super-login", h.LoginSuper)
|
|
groupV1.Post("/auth/refresh", h.RefreshToken)
|
|
groupV1.Post("/auth/logout", a.authMiddleware, h.LogOutCustomer)
|
|
groupV1.Get("/auth/test", a.authMiddleware, func(c *fiber.Ctx) error {
|
|
userID, ok := c.Locals("user_id").(int64)
|
|
if !ok {
|
|
return fiber.NewError(fiber.StatusUnauthorized, "Invalid user ID")
|
|
}
|
|
role, ok := c.Locals("role").(domain.Role)
|
|
if !ok {
|
|
return fiber.NewError(fiber.StatusUnauthorized, "Invalid role")
|
|
}
|
|
refreshToken, ok := c.Locals("refresh_token").(string)
|
|
if !ok {
|
|
return fiber.NewError(fiber.StatusUnauthorized, "Invalid refresh token")
|
|
}
|
|
companyID, err := strconv.ParseInt(c.Get("company_id"), 10, 64)
|
|
if err != nil {
|
|
return fiber.NewError(fiber.StatusBadRequest, "Invalid company_id")
|
|
}
|
|
|
|
a.logger.Info("User ID: " + strconv.FormatInt(userID, 10))
|
|
fmt.Printf("User ID: %d\n", userID)
|
|
a.logger.Info("Role: " + string(role))
|
|
a.logger.Info("Refresh Token: " + refreshToken)
|
|
a.logger.Info("Company ID: " + strconv.FormatInt(companyID, 10))
|
|
return c.SendString("Test endpoint")
|
|
})
|
|
|
|
//Arifpay
|
|
groupV1.Post("/arifpay/checkout", a.authMiddleware, h.CreateCheckoutSessionHandler)
|
|
groupV1.Post("/arifpay/checkout/cancel/:session_id", a.authMiddleware, h.CancelCheckoutSessionHandler)
|
|
groupV1.Post("/api/v1/arifpay/c2b-webhook", a.authMiddleware, h.HandleArifpayC2BWebhook)
|
|
groupV1.Post("/api/v1/arifpay/b2c-webhook", a.authMiddleware, h.HandleArifpayB2CWebhook)
|
|
groupV1.Post("/arifpay/b2c/transfer", a.authMiddleware, h.ExecuteArifpayB2CTransfer)
|
|
groupV1.Post("/arifpay/transaction-id/verify-transaction", a.authMiddleware, h.ArifpayVerifyByTransactionIDHandler)
|
|
groupV1.Get("/arifpay/session-id/verify-transaction/:session_id", a.authMiddleware, h.ArifpayVerifyBySessionIDHandler)
|
|
groupV1.Get("/arifpay/payment-methods", a.authMiddleware, h.GetArifpayPaymentMethodsHandler)
|
|
|
|
//Telebirr
|
|
groupV1.Post("/telebirr/init-payment", a.authMiddleware, h.CreateTelebirrPaymentHandler)
|
|
groupV1.Post("/telebirr/callback", h.HandleTelebirrCallback)
|
|
|
|
//Santimpay
|
|
groupV1.Post("/santimpay/init-payment", a.authMiddleware, h.InititateSantimPayPaymentHandler)
|
|
groupV1.Post("/santimpay/callback", h.ProcessSantimPayCallbackHandler)
|
|
groupV1.Post("/santimpay/direct-payment", a.authMiddleware, h.ProcessSantimPayDirectPaymentHandler)
|
|
groupV1.Get("/santimpay/b2c/partners", h.GetSantimPayB2CPartnersHandler)
|
|
groupV1.Post("/santimpay/b2c/withdraw", a.authMiddleware, h.ProcessSantimPayB2CWithdrawalHandler)
|
|
groupV1.Post("/santimpay/transaction/verify", a.authMiddleware, h.CheckSantimPayTransactionStatusHandler)
|
|
|
|
// groupV1.Post("/arifpay/b2c/transfer", a.authMiddleware, h.B2CTransferHandler)
|
|
// groupV1.Post("/arifpay/transaction-id/verify-transaction", a.authMiddleware, h.ArifpayVerifyByTransactionIDHandler)
|
|
// groupV1.Get("/arifpay/session-id/verify-transaction/:session_id", a.authMiddleware, h.ArifpayVerifyBySessionIDHandler)
|
|
|
|
// User Routes
|
|
groupV1.Post("/user/resetPassword", h.ResetPassword)
|
|
groupV1.Post("/user/sendResetCode", h.SendResetCode)
|
|
|
|
tenant.Post("/user/resetPassword", h.ResetTenantPassword)
|
|
tenant.Post("/user/sendResetCode", h.SendTenantResetCode)
|
|
tenant.Post("/user/register", h.RegisterUser)
|
|
tenant.Post("/user/sendRegisterCode", h.SendRegisterCode)
|
|
tenant.Post("/user/checkPhoneEmailExist", h.CheckPhoneEmailExist)
|
|
|
|
tenant.Get("/user/customer-profile", a.authMiddleware, h.CustomerProfile)
|
|
tenant.Get("/user/admin-profile", a.authMiddleware, h.AdminProfile)
|
|
tenant.Get("/user/bets", a.authMiddleware, h.GetBetByUserID)
|
|
|
|
groupV1.Get("/user/single/:id", a.authMiddleware, h.GetUserByID)
|
|
groupV1.Post("/user/suspend", a.authMiddleware, h.UpdateUserSuspend)
|
|
groupV1.Delete("/user/delete/:id", a.authMiddleware, h.DeleteUser)
|
|
tenant.Get("/user/wallet", a.authMiddleware, h.GetCustomerWallet)
|
|
tenant.Post("/user/search", a.authMiddleware, h.SearchUserByNameOrPhone)
|
|
|
|
// Referral Routes
|
|
tenant.Post("/referral/create", a.authMiddleware, h.CreateReferralCode)
|
|
tenant.Get("/referral/stats", a.authMiddleware, h.GetReferralStats)
|
|
groupV1.Post("/referral/settings", a.authMiddleware, h.CreateReferralSettings)
|
|
groupV1.Get("/referral/settings", a.authMiddleware, h.GetReferralSettings)
|
|
groupV1.Patch("/referral/settings", a.authMiddleware, h.UpdateReferralSettings)
|
|
|
|
// Raffle Routes
|
|
a.fiber.Post("/raffle/create", a.authMiddleware, h.CreateRaffle)
|
|
a.fiber.Get("/raffle/delete/:id", a.authMiddleware, h.DeleteRaffle)
|
|
a.fiber.Get("/raffle/company/:id", a.authMiddleware, h.GetRafflesOfCompany)
|
|
a.fiber.Post("/raffle-ticket/create", a.authMiddleware, h.CreateRaffleTicket)
|
|
a.fiber.Get("/raffle-ticket/:id", a.authMiddleware, h.GetUserRaffleTickets)
|
|
a.fiber.Get("/raffle-ticket/suspend/:id", a.authMiddleware, h.SuspendRaffleTicket)
|
|
a.fiber.Get("/raffle-ticket/unsuspend/:id", a.authMiddleware, h.UnSuspendRaffleTicket)
|
|
|
|
// Bonus Routes
|
|
groupV1.Get("/bonus", a.authMiddleware, h.GetBonusMultiplier)
|
|
groupV1.Post("/bonus/create", a.authMiddleware, h.CreateBonusMultiplier)
|
|
groupV1.Put("/bonus/update", a.authMiddleware, h.UpdateBonusMultiplier)
|
|
|
|
groupV1.Get("/cashiers", a.authMiddleware, h.GetAllCashiers)
|
|
groupV1.Get("/cashiers/:id", a.authMiddleware, h.GetCashierByID)
|
|
groupV1.Post("/cashiers", a.authMiddleware, h.CreateCashier)
|
|
groupV1.Put("/cashiers/:id", a.authMiddleware, h.UpdateCashier)
|
|
|
|
tenant.Get("/customer", a.authMiddleware, h.GetAllTenantCustomers)
|
|
tenant.Get("/customer/:id", a.authMiddleware, h.GetTenantCustomerByID)
|
|
tenant.Put("/customer/:id", a.authMiddleware, h.UpdateTenantCustomer)
|
|
tenant.Get("/customer/:id/bets", a.authMiddleware, h.GetTenantCustomerBets)
|
|
|
|
groupV1.Get("/customer", a.authMiddleware, a.SuperAdminOnly, h.GetAllCustomers)
|
|
groupV1.Get("/customer/:id", a.authMiddleware, a.SuperAdminOnly, h.GetCustomerByID)
|
|
groupV1.Put("/customer/:id", a.authMiddleware, a.SuperAdminOnly, h.UpdateCustomer)
|
|
tenant.Get("/customer/:id/bets", a.authMiddleware, h.GetCustomerBets)
|
|
|
|
groupV1.Get("/admin", a.authMiddleware, h.GetAllAdmins)
|
|
groupV1.Get("/admin/:id", a.authMiddleware, h.GetAdminByID)
|
|
groupV1.Post("/admin", a.authMiddleware, h.CreateAdmin)
|
|
groupV1.Put("/admin/:id", a.authMiddleware, h.UpdateAdmin)
|
|
|
|
groupV1.Get("/t-approver", a.authMiddleware, h.GetAllTransactionApprovers)
|
|
groupV1.Get("/t-approver/:id", a.authMiddleware, h.GetTransactionApproverByID)
|
|
groupV1.Post("/t-approver", a.authMiddleware, h.CreateTransactionApprover)
|
|
groupV1.Put("/t-approver/:id", a.authMiddleware, h.UpdateTransactionApprover)
|
|
|
|
groupV1.Get("/managers", a.authMiddleware, h.GetAllManagers)
|
|
groupV1.Get("/managers/:id", a.authMiddleware, h.GetManagerByID)
|
|
groupV1.Post("/managers", a.authMiddleware, h.CreateManager)
|
|
groupV1.Put("/managers/:id", a.authMiddleware, h.UpdateManagers)
|
|
groupV1.Get("/manager/:id/branch", a.authMiddleware, h.GetBranchByManagerID)
|
|
|
|
groupV1.Get("/odds", a.authMiddleware, a.SuperAdminOnly, h.GetAllOdds)
|
|
groupV1.Get("/odds/upcoming/:upcoming_id", a.authMiddleware, a.SuperAdminOnly, h.GetOddsByUpcomingID)
|
|
groupV1.Get("/odds/upcoming/:upcoming_id/market/:market_id", a.authMiddleware, a.SuperAdminOnly, h.GetOddsByMarketID)
|
|
|
|
tenant.Get("/odds", h.GetAllTenantOdds)
|
|
tenant.Get("/odds/upcoming/:upcoming_id", h.GetTenantOddsByUpcomingID)
|
|
tenant.Get("/odds/upcoming/:upcoming_id/market/:market_id", h.GetTenantOddsByMarketID)
|
|
tenant.Post("/odds/settings", a.CompanyOnly, h.SaveOddsSetting)
|
|
|
|
groupV1.Get("/events", a.authMiddleware, h.GetAllUpcomingEvents)
|
|
groupV1.Get("/events/:id", a.authMiddleware, h.GetUpcomingEventByID)
|
|
groupV1.Delete("/events/:id", a.authMiddleware, a.SuperAdminOnly, h.SetEventStatusToRemoved)
|
|
groupV1.Patch("/events/:id/is_monitored", a.authMiddleware, a.SuperAdminOnly, h.SetEventIsMonitored)
|
|
|
|
tenant.Get("/events", h.GetTenantUpcomingEvents)
|
|
tenant.Get("/events/:id", h.GetTenantEventByID)
|
|
tenant.Get("/top-leagues", h.GetTopLeagues)
|
|
tenant.Put("/events/:id/settings", h.UpdateEventSettings)
|
|
|
|
// Leagues
|
|
tenant.Get("/leagues", h.GetAllLeagues)
|
|
tenant.Put("/leagues/:id/set-active", h.SetLeagueActive)
|
|
tenant.Put("/leagues/:id/featured", h.SetLeagueFeatured)
|
|
groupV1.Get("/leagues", a.authMiddleware, a.SuperAdminOnly, h.GetAllLeagues)
|
|
|
|
groupV1.Get("/result/:id", h.GetResultsByEventID)
|
|
|
|
// Branch
|
|
groupV1.Post("/branch", a.authMiddleware, h.CreateBranch)
|
|
groupV1.Get("/branch", a.authMiddleware, h.GetAllBranches)
|
|
groupV1.Get("/branch/:id", a.authMiddleware, h.GetBranchByID)
|
|
groupV1.Post("/branch/:id/return", a.authMiddleware, h.ReturnBranchWallet)
|
|
groupV1.Get("/branch/:id/bets", a.authMiddleware, h.GetBetByBranchID)
|
|
groupV1.Put("/branch/:id", a.authMiddleware, h.UpdateBranch)
|
|
groupV1.Put("/branch/:id/set-active", a.authMiddleware, h.UpdateBranchStatus)
|
|
groupV1.Put("/branch/:id/set-inactive", a.authMiddleware, h.UpdateBranchStatus)
|
|
groupV1.Delete("/branch/:id", a.authMiddleware, h.DeleteBranch)
|
|
|
|
groupV1.Get("/search/branch", a.authMiddleware, h.SearchBranch)
|
|
|
|
groupV1.Get("/branchLocation", a.authMiddleware, h.GetAllBranchLocations)
|
|
|
|
groupV1.Get("/branch/:id/cashiers", a.authMiddleware, h.GetBranchCashiers)
|
|
groupV1.Get("/branchCashier", a.authMiddleware, h.GetBranchForCashier)
|
|
|
|
// Branch Operation
|
|
groupV1.Get("/supportedOperation", a.authMiddleware, a.SuperAdminOnly, h.GetAllSupportedOperations)
|
|
groupV1.Post("/supportedOperation", a.authMiddleware, a.SuperAdminOnly, h.CreateSupportedOperation)
|
|
groupV1.Post("/operation", a.authMiddleware, h.CreateBranchOperation)
|
|
groupV1.Get("/branch/:id/operation", a.authMiddleware, h.GetBranchOperations)
|
|
|
|
groupV1.Delete("/branch/:id/operation/:opID", a.authMiddleware, h.DeleteBranchOperation)
|
|
|
|
// Company
|
|
groupV1.Post("/company", a.authMiddleware, a.SuperAdminOnly, h.CreateCompany)
|
|
groupV1.Get("/company", a.authMiddleware, a.SuperAdminOnly, h.GetAllCompanies)
|
|
groupV1.Get("/company/:id", a.authMiddleware, a.SuperAdminOnly, h.GetCompanyByID)
|
|
groupV1.Put("/company/:id", a.authMiddleware, a.SuperAdminOnly, h.UpdateCompany)
|
|
groupV1.Delete("/company/:id", a.authMiddleware, a.SuperAdminOnly, h.DeleteCompany)
|
|
groupV1.Get("/company/:id/branch", a.authMiddleware, h.GetBranchByCompanyID)
|
|
groupV1.Get("/search/company", a.authMiddleware, h.SearchCompany)
|
|
groupV1.Get("/admin-company", a.authMiddleware, h.GetCompanyForAdmin)
|
|
|
|
// Ticket Routes
|
|
tenant.Post("/ticket", h.CreateTicket)
|
|
tenant.Get("/ticket", h.GetAllTickets)
|
|
tenant.Get("/ticket/:id", h.GetTicketByID)
|
|
|
|
// Bet Routes
|
|
tenant.Post("/sport/bet", a.authMiddleware, h.CreateBet)
|
|
tenant.Post("/sport/bet/fastcode", a.authMiddleware, h.CreateBetWithFastCode)
|
|
tenant.Get("/sport/bet/fastcode/:fast_code", h.GetBetByFastCode)
|
|
tenant.Get("/sport/bet", a.authMiddleware, h.GetAllTenantBets)
|
|
tenant.Get("/sport/bet/:id", a.authMiddleware, h.GetTenantBetByID)
|
|
tenant.Patch("/sport/bet/:id", a.authMiddleware, h.UpdateCashOut)
|
|
tenant.Delete("/sport/bet/:id", a.authMiddleware, h.DeleteTenantBet)
|
|
|
|
groupV1.Get("/sport/bet", a.authMiddleware, a.SuperAdminOnly, h.GetAllBet)
|
|
groupV1.Get("/sport/bet/:id", a.authMiddleware, a.SuperAdminOnly, h.GetBetByID)
|
|
groupV1.Delete("/sport/bet/:id", a.authMiddleware, a.SuperAdminOnly, h.DeleteBet)
|
|
|
|
tenant.Post("/sport/random/bet", a.authMiddleware, h.RandomBet)
|
|
|
|
// Wallet
|
|
groupV1.Get("/wallet", h.GetAllWallets)
|
|
groupV1.Get("/wallet/:id", h.GetWalletByID)
|
|
groupV1.Put("/wallet/:id", h.UpdateWalletActive)
|
|
groupV1.Get("/branchWallet", a.authMiddleware, h.GetAllBranchWallets)
|
|
groupV1.Get("/customerWallet", a.authMiddleware, h.GetAllCustomerWallets)
|
|
groupV1.Get("/cashierWallet", a.authMiddleware, h.GetWalletForCashier)
|
|
|
|
// Transfer
|
|
// /transfer/wallet - transfer from one wallet to another wallet
|
|
groupV1.Post("/transfer/wallet/:id", a.authMiddleware, h.TransferToWallet)
|
|
groupV1.Get("/transfer/wallet/:id", a.authMiddleware, h.GetTransfersByWallet)
|
|
groupV1.Post("/transfer/refill/:id", a.authMiddleware, h.RefillWallet)
|
|
|
|
//Chapa Routes
|
|
groupV1.Post("/chapa/payments/webhook/verify", h.WebhookCallback)
|
|
groupV1.Get("/chapa/payments/manual/verify/:tx_ref", h.ManualVerifyTransaction)
|
|
groupV1.Post("/chapa/payments/deposit", a.authMiddleware, h.InitiateDeposit)
|
|
groupV1.Post("/chapa/payments/withdraw", a.authMiddleware, h.InitiateWithdrawal)
|
|
groupV1.Get("/chapa/banks", h.GetSupportedBanks)
|
|
|
|
// Currencies
|
|
groupV1.Get("/currencies", h.GetSupportedCurrencies)
|
|
groupV1.Get("/currencies/convert", h.ConvertCurrency)
|
|
|
|
//Report Routes
|
|
groupV1.Get("/reports/dashboard", a.authMiddleware, a.OnlyAdminAndAbove, h.GetDashboardReport)
|
|
groupV1.Get("/report-files/download/:filename", h.DownloadReportFile)
|
|
groupV1.Get("/report-files/list", a.authMiddleware, a.OnlyAdminAndAbove, h.ListReportFiles)
|
|
|
|
//Alea Play Virtual Game Routes
|
|
groupV1.Get("/alea-play/launch", a.authMiddleware, h.LaunchAleaGame)
|
|
groupV1.Post("/webhooks/alea-play", a.authMiddleware, h.HandleAleaCallback)
|
|
|
|
//Veli Virtual Game Routes
|
|
groupV1.Post("/veli/providers", a.authMiddleware, h.GetProviders)
|
|
groupV1.Post("/veli/games-list", a.authMiddleware, h.GetGamesByProvider)
|
|
groupV1.Post("/veli/start-game", a.authMiddleware, h.StartGame)
|
|
groupV1.Post("/veli/start-demo-game", h.StartDemoGame)
|
|
a.fiber.Post("/balance", h.GetBalance)
|
|
groupV1.Post("/veli/gaming-activity", a.authMiddleware, h.GetGamingActivity)
|
|
groupV1.Post("/veli/huge-wins", a.authMiddleware, h.GetHugeWins)
|
|
|
|
//mongoDB logs
|
|
groupV1.Get("/logs", a.authMiddleware, a.SuperAdminOnly, handlers.GetLogsHandler(context.Background()))
|
|
|
|
// Recommendation Routes
|
|
// group.Get("/virtual-games/recommendations/:userID", h.GetRecommendations)
|
|
|
|
// Transactions /shop/transactions
|
|
groupV1.Post("/shop/bet", a.authMiddleware, a.CompanyOnly, h.CreateShopBet)
|
|
groupV1.Get("/shop/bet", a.authMiddleware, a.CompanyOnly, h.GetAllShopBets)
|
|
groupV1.Get("/shop/bet/:id", a.authMiddleware, a.CompanyOnly, h.GetShopBetByBetID)
|
|
groupV1.Post("/shop/bet/:id/cashout", a.authMiddleware, a.CompanyOnly, h.CashoutBet)
|
|
groupV1.Post("/shop/bet/:id/generate", a.authMiddleware, a.CompanyOnly, h.CashoutBet)
|
|
groupV1.Get("/shop/cashout/:id", a.authMiddleware, a.CompanyOnly, h.GetShopBetByCashoutID)
|
|
groupV1.Post("/shop/cashout", a.authMiddleware, a.CompanyOnly, h.CashoutByCashoutID)
|
|
groupV1.Post("/shop/deposit", a.authMiddleware, a.CompanyOnly, h.DepositForCustomer)
|
|
// groupV1.Get("/shop/deposit", a.authMiddleware, a.CompanyOnly, h.DepositForCustomer)
|
|
|
|
groupV1.Get("/shop/transaction", a.authMiddleware, a.CompanyOnly, h.GetAllTransactions)
|
|
groupV1.Get("/shop/transaction/:id", a.authMiddleware, a.CompanyOnly, h.GetTransactionByID)
|
|
groupV1.Get("/shop/transaction/:id/bet", a.authMiddleware, a.CompanyOnly, h.GetShopBetByTransactionID)
|
|
groupV1.Put("/shop/transaction/:id", a.authMiddleware, a.CompanyOnly, h.UpdateTransactionVerified)
|
|
|
|
// Notification Routes
|
|
groupV1.Get("/ws/connect", a.WebsocketAuthMiddleware, h.ConnectSocket)
|
|
groupV1.Get("/notifications", a.authMiddleware, h.GetNotifications)
|
|
groupV1.Get("/notifications/all", a.authMiddleware, h.GetAllNotifications)
|
|
groupV1.Post("/notifications/mark-as-read", a.authMiddleware, h.MarkNotificationAsRead)
|
|
groupV1.Get("/notifications/unread", a.authMiddleware, h.CountUnreadNotifications)
|
|
groupV1.Post("/notifications/create", a.authMiddleware, h.CreateAndSendNotification)
|
|
|
|
// Virtual Game Routes
|
|
a.fiber.Post("/virtual-game/launch", a.authMiddleware, h.LaunchVirtualGame)
|
|
a.fiber.Post("/virtual-game/callback", h.HandleVirtualGameCallback)
|
|
a.fiber.Post("/playerInfo", h.HandlePlayerInfo)
|
|
a.fiber.Post("/bet", h.HandleBet)
|
|
a.fiber.Post("/win", h.HandleWin)
|
|
a.fiber.Post("/cancel", h.HandleCancel)
|
|
a.fiber.Post("/promoWin ", h.HandlePromoWin)
|
|
a.fiber.Post("/tournamentWin ", h.HandleTournamentWin)
|
|
a.fiber.Get("/popok/games", h.GetGameList)
|
|
a.fiber.Get("/popok/games/recommend", a.authMiddleware, h.RecommendGames)
|
|
groupV1.Post("/virtual-game/favorites", a.authMiddleware, h.AddFavorite)
|
|
groupV1.Delete("/virtual-game/favorites/:gameID", a.authMiddleware, h.RemoveFavorite)
|
|
groupV1.Get("/virtual-game/favorites", a.authMiddleware, h.ListFavorites)
|
|
|
|
groupV1.Delete("/virtual-game/orchestrator/providers/:provideID", a.authMiddleware, h.RemoveProvider)
|
|
groupV1.Get("/virtual-game/orchestrator/providers/:provideID", a.authMiddleware, h.GetProviderByID)
|
|
groupV1.Get("/virtual-game/orchestrator/games", h.ListVirtualGames)
|
|
groupV1.Get("/virtual-game/orchestrator/providers", h.ListProviders)
|
|
groupV1.Patch("/virtual-game/orchestrator/providers/:provideID/status", a.authMiddleware, h.SetProviderEnabled)
|
|
|
|
//Issue Reporting Routes
|
|
groupV1.Post("/issues", a.authMiddleware, h.CreateIssue) //anyone who has logged can report a
|
|
groupV1.Get("/issues/customer/:customer_id", a.authMiddleware, a.OnlyAdminAndAbove, h.GetUserIssues)
|
|
groupV1.Get("/issues", a.authMiddleware, a.OnlyAdminAndAbove, h.GetAllIssues)
|
|
groupV1.Patch("/issues/:issue_id/status", a.authMiddleware, a.OnlyAdminAndAbove, h.UpdateIssueStatus)
|
|
groupV1.Delete("/issues/:issue_id", a.authMiddleware, a.OnlyAdminAndAbove, h.DeleteIssue)
|
|
|
|
// Settings
|
|
groupV1.Get("/settings", a.authMiddleware, a.SuperAdminOnly, h.GetGlobalSettingList)
|
|
groupV1.Get("/settings/:key", a.authMiddleware, a.SuperAdminOnly, h.GetGlobalSettingByKey)
|
|
groupV1.Put("/settings", a.authMiddleware, a.SuperAdminOnly, h.UpdateGlobalSettingList)
|
|
|
|
tenant.Post("/settings", a.authMiddleware, h.SaveCompanySettingList)
|
|
tenant.Get("/settings", a.authMiddleware, h.GetCompanySettingList)
|
|
tenant.Delete("/settings/:key", a.authMiddleware, h.DeleteCompanySetting)
|
|
tenant.Delete("/settings", a.authMiddleware, h.DeleteAllCompanySetting)
|
|
|
|
}
|