package walletapi import ( "net/http" "hyapp/services/gateway-service/internal/client" "hyapp/services/gateway-service/internal/transport/http/httproutes" ) // Handler owns wallet-facing HTTP endpoints. // It keeps wallet semantics behind wallet-service and only handles HTTP protocol conversion. type Handler struct { walletClient client.WalletClient roomGuardClient client.RoomGuardClient roomQueryClient client.RoomQueryClient userIdentityClient client.UserIdentityClient userProfileClient client.UserProfileClient userHostClient client.UserHostClient imGroupIDPrefix string } type Config struct { WalletClient client.WalletClient RoomGuardClient client.RoomGuardClient RoomQueryClient client.RoomQueryClient UserIdentityClient client.UserIdentityClient UserProfileClient client.UserProfileClient UserHostClient client.UserHostClient IMGroupIDPrefix string } func New(config Config) *Handler { return &Handler{ walletClient: config.WalletClient, roomGuardClient: config.RoomGuardClient, roomQueryClient: config.RoomQueryClient, userIdentityClient: config.UserIdentityClient, userProfileClient: config.UserProfileClient, userHostClient: config.UserHostClient, imGroupIDPrefix: config.IMGroupIDPrefix, } } func (h *Handler) WalletHandlers() httproutes.WalletHandlers { return httproutes.WalletHandlers{ GetWalletOverview: h.getWalletOverview, GetMyBalances: h.getMyBalances, ListRechargeProducts: h.listRechargeProducts, ConfirmGooglePayment: h.confirmGooglePayment, GetDiamondExchangeConfig: h.getDiamondExchangeConfig, ListCoinTransactions: h.listCoinTransactions, ListWalletTransactions: h.listWalletTransactions, ListCoinSellers: h.listCoinSellers, TransferCoinFromSeller: h.transferCoinFromSeller, GetRedPacketConfig: h.getRedPacketConfig, ListRoomRedPackets: h.listRoomRedPackets, CreateRoomRedPacket: h.createRoomRedPacket, GetRedPacket: h.getRedPacket, ClaimRedPacket: h.claimRedPacket, GetCurrentRegionIMGroup: h.getCurrentRegionIMGroup, GetRedPacketIMGroup: h.getCurrentRegionIMGroup, SendVoiceRoomRedPacket: h.sendVoiceRoomRedPacket, ListActiveRedPackets: h.listActiveRedPackets, ClaimVoiceRoomRedPacket: h.claimVoiceRoomRedPacket, GetVoiceRoomRedPacket: h.getVoiceRoomRedPacket, ListRedPacketClaims: h.listRedPacketClaims, ListSentRedPackets: h.listSentRedPackets, } } func (h *Handler) VIPHandlers() httproutes.VIPHandlers { return httproutes.VIPHandlers{ GetMyVIP: h.getMyVIP, ListVIPPackages: h.listVIPPackages, PurchaseVIP: h.purchaseVIP, } } func (h *Handler) GetMyGiftWall(writer http.ResponseWriter, request *http.Request) { h.getMyGiftWall(writer, request) }