notification

package
v1.15.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package notification is the facade of the notification module. It starts with the Telegram bot: update handling (webhook and polling), the unbind notice and the message templates other domains render. Additional channels (email, SMS broadcast) join as migration proceeds (ADR-001 step 4).

Index

Constants

View Source
const (
	PurchaseNotify     = telegram.PurchaseNotify
	RenewalNotify      = telegram.RenewalNotify
	ResetTrafficNotify = telegram.ResetTrafficNotify
	RechargeNotify     = telegram.RechargeNotify
	AdminOrderNotify   = telegram.AdminOrderNotify
)

Message templates other domains render before handing the text to the bot.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	// Bot returns the current bot client; the initialize subsystem recreates
	// it when the Telegram configuration changes, so it is read per call.
	// nil means the bot is not configured.
	Bot           func() *tgbotapi.BotAPI
	Redis         *redis.Client
	Users         repository.UserRepo
	UserAuth      repository.UserAuthRepo
	UserCache     repository.UserCacheRepo
	Tickets       repository.TicketRepo
	Orders        repository.OrderRepo
	Subscriptions repository.UserSubscriptionRepo
	Plans         repository.SubscribeRepo
	Logs          repository.LogRepo
	// Wallet is the billing-domain read port for balance display.
	Wallet repository.WalletRepo
}

Deps declares everything the module needs; the composition root (internal/svc) provides them.

type Service

type Service interface {
	// HandleTelegramUpdate processes one bot update (command dispatch,
	// binding, admin actions). Both the webhook handler and the polling
	// loop call it.
	HandleTelegramUpdate(ctx context.Context, update *tgbotapi.Update)
	// NotifyTelegramUnbind sends the best-effort unbind notice to the chat.
	NotifyTelegramUnbind(userID, chatID int64) error
}

Service is the only surface other code may depend on; the implementation lives under internal/ where the compiler seals it off.

func New

func New(deps Deps) Service

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL