Commit Graph
16 Commits
Author SHA1 Message Date
nutcas3 cbfe5a4b9f feat: Implement real-time subscription polling for subscriber and alert updates
- Update SubscribeToSubscriberUpdates to poll database every 3 seconds for subscriber changes since last update
- Add buffered channel (size 5) to prevent blocking on subscriber updates
- Track lastUpdatedAt timestamp to query only new subscriber changes
- Add SubscribeToAlertUpdates to poll database every 2 seconds for new alerts
- Add buffered channel (size 10) for alert updates with ID-based filtering
- Support optional
2026-04-17 15:47:47 +03:00
nutcas3 9ce03cf81e feat: Replace placeholder data with database queries in subscriber service methods
- Update GetAccount to query actual usage events and balance from database instead of returning zeros
- Update ListInvoices to query invoices with filters, pagination, and preload subscriber data
- Update GetInvoice to query invoice by ID with line items and subscriber preloading
- Update ListRatingPlans to query active rating plans ordered by monthly fee
- Update GetRatingPlan to query rating plan by ID with active
2026-04-17 15:44:59 +03:00
nutcas3 adbdb40066 feat: Add charging engine HTTP client with credit management and health monitoring
- Add ChargingEngineClient with base URL and HTTP client with configurable timeout
- Add CheckCredit to verify subscriber credit availability by IP with bytes requested
- Add DeductCredit to deduct bytes from subscriber credit balance
- Add AddCredit to add bytes to subscriber credit balance
- Add GetBalance to retrieve current credit balance for subscriber by IP
- Add HealthCheck to verify charging engine availability
2026-04-17 15:43:53 +03:00
nutcas3 99bff17756 feat: Add charging service with usage tracking, system monitoring, and real-time statistics
- Add ChargingService with database and charging engine client dependencies
- Add GetSystemStats to retrieve active sessions, accounts, blocked users, and uptime metrics
- Add GetHealthStatus to check Redis connection, sync status, and memory usage
- Add GetUsageStats to get subscriber usage statistics with data/voice/SMS volumes, costs, and trends
- Add GetRealTimeUsage to track current session and today's usage metrics
2026-04-17 15:41:11 +03:00
nutcas3 d248b9b5e5 feat: Add invoice service with monthly invoice generation, payment tracking, and automated billing
- Add InvoiceService with database dependency for invoice management operations
- Add GenerateMonthlyInvoice to create invoices with plan fees and usage charges from billing period
- Add SendInvoice to update invoice status to pending (email integration TODO)
- Add MarkInvoiceAsPaid to update invoice payment status
- Add GetOverdueInvoices to query invoices past due date with pending status
- Add GetSubscriber
2026-04-17 15:40:57 +03:00
nutcas3 bcc42ae4c3 feat: Add subscriber service methods for account management, invoicing, alerts, and payment operations
- Add GetAccount to retrieve subscriber account information with balance and usage limits
- Add ListInvoices/GetInvoice for invoice management with line items
- Add ListRatingPlans/GetRatingPlan for rating plan queries
- Add ListAlerts/CreateAlert/ResolveAlert for alert management
- Add SearchSubscribers for subscriber search functionality
- Add SubscribeToSubscriberUpdates/SubscribeToAlertUpdates
2026-04-17 15:35:22 +03:00
nutcas3 a335c6754e refactor: Split subscriber service into separate files for better code organization
- Move IMSI allocation logic to subscriber_imsi.go
- Move authentication key generation (generateAuthKeys, getOperatorVariant, generateOPc) to subscriber_auth.go
- Move eSIM profile operations (provisionESIMProfile, deactivateESIMProfile) to subscriber_esim.go
- Keep core subscriber CRUD operations and session management in subscriber.go
- Remove unused crypto/aes, crypto/rand, encoding/hex, and os imports from main
2026-04-14 16:22:22 +03:00
nutcas3 3a3b4d93a0 refactor: Split ES2 client into separate files for better code organization
- Move ES2 request/response types to es2_types.go
- Move profile operations (download, activate, deactivate, delete, status, list) to es2_operations.go
- Move helper methods (send requests, validation, generateRequestID) to es2_helpers.go
- Keep core ES2Service struct and ProvisionProfile in es2_client.go
- Revert sendDeactivationRequest parameter type from any back to interface{}
2026-04-14 16:22:07 +03:00
nutcas3 62cdffee2b feat: Remove unused generateRequestID helper function from AMF client
- Remove generateRequestID function and its fmt/time imports
- Function was not being used in AMF client implementation
2026-04-14 16:21:43 +03:00
nutcas3 1ead99440e feat: Replace interface{} with any type alias for improved code clarity
- Remove omitempty from Plan field in Subscriber model
- Update NotifySubscriberUpdate to use any instead of interface{}
- Update sendDeactivationRequest parameter type from interface{} to any
2026-04-14 16:07:04 +03:00
nutcas3 13355a07e7 feat: Add environment-based operator variant configuration with padding support
- Add os import for environment variable access
- Update getOperatorVariant to read OP from OPERATOR_VARIANT env var
- Add fallback to default "TelecomOP1234567" for development
- Add zero-padding for OP values shorter than 16 bytes
- Update comments to reference environment variable configuration
2026-04-14 16:06:09 +03:00
nutcas3 e260ea3baa feat: Implement proper AES-128 OPc derivation per 3GPP specification
- Replace XOR-based OPc generation with AES-128 ECB encryption
- Add getOperatorVariant for consistent OP across subscribers
- Add AES cipher block creation with error handling
- Add OP length validation for AES-128 block size
- Update generateOPc to use crypto/aes for 3GPP-compliant OPc derivation
- Add hardcoded OP placeholder with production configuration note
2026-04-14 16:03:46 +03:00
nutcas3 a78599fa1f feat: Implement eSIM provisioning and AMF integration in subscriber service
- Add AMFClient and ES2Service dependencies to SubscriberService
- Initialize AMF client with default URL and ES2 service in NewSubscriberService
- Implement provisionESIMProfile with EID validation, profile provisioning, activation, and AMF notification
- Implement deactivateESIMProfile with profile deactivation, status updates, and session termination
- Add generateOPc helper for deriving OPc from OP and K using XOR-based
2026-04-14 16:00:46 +03:00
nutcas3 6e11d40f5e feat: Add AMF client for session termination and subscriber status notifications
- Add AMFClient struct with base URL and HTTP client
- Add NewAMFClient with 30s timeout
- Add TerminateSession for subscriber session termination with reason and timestamp
- Add NotifySubscriberUpdate for subscriber status change notifications
- Add SessionTerminationRequest and SessionTerminationResponse models
- Add generateRequestID helper for request tracking
2026-04-14 16:00:24 +03:00
nutcas3 2e1300282d feat: Add ES2Service for GSMA ES2+ eSIM profile management operations
- Add ES2Service struct with HTTP client and ES2Config
- Add NewES2Service with 30s timeout and TLS configuration
- Add ProvisionProfile for eSIM profile provisioning with metadata support
- Add ActivateProfile, DeactivateProfile, and DeleteProfile for profile lifecycle management
- Add GetProfileStatus for profile state queries
- Add ListProfiles for eUICC profile enumeration
- Add ValidateEID and ValidateICCID for identifier
2026-04-14 16:00:15 +03:00
nutcas3 24baebbf37 feat: Add subscriber service with IMSI allocation, authentication, and lifecycle management
- Add SubscriberService struct with Database and Config dependencies
- Add NewSubscriberService constructor
- Add CreateSubscriber with IMSI allocation, auth key generation, and eSIM provisioning support
- Add GetSubscriber and GetSubscriberByIMSI for subscriber retrieval
- Add UpdateSubscriber for subscriber information updates
- Add SuspendSubscriber with session termination
- Add TerminateSubscriber with session termination and eSIM profile deactivation
- Add ListSubscribers with pagination and
2026-04-14 15:52:23 +03:00