Commit Graph
46 Commits
Author SHA1 Message Date
nutcas3 dd15ecdb93 feat: Replace placeholder data with database queries in charging service methods
- Update GetSystemStats to query active sessions, total accounts, blocked users, and low balance alerts from database
- Update GetHealthStatus to check database connectivity and set ActiveSync status
- Update GetUsageStats to query usage events by IMSI and period with trend calculation comparing to previous period
- Update GetRealTimeUsage to query current session and today's usage from database
- Update ListUsageEvents to query usage events with
2026-04-17 15:55:41 +03:00
nutcas3 cea79ef825 feat: Add PaymentMethodDetails struct for token-based payment method retrieval
- Add PaymentMethodDetails with payment method ID, type, card details (last4, brand, expiry), fingerprint, and creation timestamp
- Support structured response for payment method token processing
2026-04-17 15:55:32 +03:00
nutcas3 04846c8564 feat: Add chaos engineering service with experiment execution and HTTP middleware
- Add ChaosService with experiment management and concurrent execution tracking
- Add experiment types: latency, kill, crash, partition, flush, and load with configurable duration/probability
- Add experiment status tracking: idle, running, completed, and failed states
- Add RunExperiment to start chaos experiments in background goroutines with automatic cleanup
- Add experiment executors: injectLatency, killConnections, crashService
2026-04-17 15:55:21 +03:00
nutcas3 3332edf9ca feat: Add payment webhook handler with Stripe integration and transaction processing
- Add WebhookHandler with Stripe webhook validation and event processing
- Add webhook event handlers: payment succeeded, failed, canceled, and dispute created
- Update transaction status and subscriber balance on successful payments
- Create alerts for failed payments and disputes with appropriate severity levels
- Add sendTopUpNotification to create notifications for successful top-ups
- Add PaymentController
2026-04-17 15:53:57 +03:00
nutcas3 ed04533db6 feat: Add Balance field to Subscriber model with default value of 0
- Add Balance float64 field to Subscriber struct with JSON and GORM tags
- Set default value to 0 in database schema
- Align PlanID and Status field formatting
2026-04-17 15:53:29 +03:00
nutcas3 d5ca53030c feat: Replace placeholder card details with Stripe API integration in AddPaymentMethod
- Add stripeGW field to SubscriberService and initialize in NewSubscriberService with API key and webhook secret
- Add processPaymentToken to call Stripe API and retrieve payment method details from token
- Update AddPaymentMethod to call processPaymentToken and use real card details (last4, brand, expiry dates) from Stripe
- Update AddPaymentMethod to use req.IsDefault instead of hardcoded false value
- Import
2026-04-17 15:53:20 +03:00
nutcas3 2fa56f0d83 feat: Add InfluxDB time-series storage with usage, system, and charging metrics tracking
- Add TimeSeriesStorage with InfluxDB client, write API, and query API for org/bucket
- Add metric types: MetricPoint, UsageMetrics, SystemMetrics, ChargingMetrics with subscriber/IMSI/transaction fields
- Add StoreUsageMetrics, StoreSystemMetrics, StoreChargingMetrics, and StorePacketMetrics to write metrics to InfluxDB
- Add GetUsageStats to query subscriber usage statistics for time range with last aggreg
2026-04-17 15:53:06 +03:00
nutcas3 a1222025e0 feat: Add Prometheus metrics collector with comprehensive telecom system monitoring
- Add MetricsCollector with HTTP middleware, subscriber tracking, and system uptime monitoring
- Add HTTP request metrics: total requests counter and duration histogram by method/endpoint/status
- Add subscriber metrics: total, active, and suspended subscriber gauges
- Add usage metrics: data bytes, voice seconds, and SMS count counters by subscriber
- Add charging metrics: credit balance gauge and payment transaction counter by
2026-04-17 15:52:53 +03:00
nutcas3 547abf1889 feat: Add database methods for transactions, payment methods, alerts, and notifications
- Add CreateTransaction to insert new transaction records
- Add UpdateSubscriberBalance to increment/decrement balance using SQL expression
- Add CreatePaymentMethod, GetPaymentMethod, DeletePaymentMethod, and ListPaymentMethods for payment method CRUD
- Add GetTransaction, GetTransactionByGatewayID, GetTransactionByChargeID to query transactions by different IDs
- Add UpdateTransaction to save transaction changes
- Add List
2026-04-17 15:52:41 +03:00
nutcas3 d24aa2cef0 feat: Add RetrievePaymentMethodFromToken to extract card details from Stripe tokens
- Add RetrievePaymentMethodFromToken to create payment method from token and extract card details
- Import paymentmethod package from stripe-go/v82
- Import payment package for PaymentMethodDetails type
- Return PaymentMethodDetails with ID, type, last4, brand, expiry dates, fingerprint, and creation timestamp
- Add error handling for payment method creation and missing card details
2026-04-17 15:51:50 +03:00
nutcas3 3d0f0188fb feat: Add Stripe payment gateway with customer management, invoicing, and webhook validation
- Add StripeGateway with secret key, webhook secret, and HTTP client with 30s timeout
- Add ProcessPayment to create payment intents with amount conversion to cents and metadata
- Add CreateCustomer to create Stripe customers with subscriber details and IMSI metadata
- Add ProcessRefund to process full or partial refunds via payment intent ID
- Add GetPaymentStatus to retrieve payment intent status and details
2026-04-17 15:50:03 +03:00
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 9d2e5b7175 feat: Remove comment separators and fix AlertUpdates severity parameter conversion
- Remove comment separators for mutations, subscriptions, filter helpers, and GraphQL handler sections
- Update AlertUpdates to convert AlertSeverity enum to string pointer for service call
- Add inline comment explaining severity conversion in AlertUpdates resolver
2026-04-17 15:46:55 +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 7cbd3b89b6 feat: Add payment gateway with Stripe integration, transaction processing, and webhook validation
- Add PaymentGateway interface with ProcessPayment, RefundPayment, GetPaymentStatus, CreatePaymentMethod, DeletePaymentMethod, and ValidateWebhook methods
- Add payment request/response types: PaymentRequest, PaymentResponse, RefundResponse, PaymentStatus, CreatePaymentMethodRequest, PaymentMethod
- Add payment status types: PENDING, PROCESSING, COMPLETED, FAILED, REFUNDED, CANCELLED
- Add payment method types
2026-04-17 15:44:41 +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 72d5a9c8e0 feat: Add account management models with billing, payments, alerts, and system monitoring types
- Add SubscriberAccount with balance, usage limits (data/voice/SMS), and status tracking
- Add UsageEvent for tracking usage sessions with volume, rate, and cost
- Add Invoice with line items and status (DRAFT, PENDING, PAID, OVERDUE, CANCELLED)
- Add RatingPlan with rate definitions for data/voice/SMS and monthly fees
- Add Alert with types (LOW_BALANCE, HIGH_USAGE, PAYMENT_FAILED, SYSTEM_ERROR) and severity levels
- Add Pay
2026-04-17 15:38:47 +03:00
nutcas3 565052e406 feat: Add configuration for payment processing, charging engine, metrics, and time-series storage
- Add PaymentConfig with Stripe API key and webhook secret fields
- Add ChargingEngineConfig with base URL and timeout settings
- Add InfluxDBConfig with URL, token, org, and bucket fields
- Add MetricsPort field to ServerConfig for Prometheus metrics endpoint
- Set default values: MetricsPort 9090, ChargingEngine localhost:3001, InfluxDB localhost:8086
- Update Config struct to include Payment, ChargingEngine, and Infl
2026-04-17 15:36:44 +03:00
nutcas3 764e95619b feat: Add GraphQL, Prometheus, InfluxDB, and Stripe dependencies to API server
- Add gqlgen v0.17.89 for GraphQL server implementation
- Add prometheus/client_golang v1.23.2 for metrics collection
- Add influxdata/influxdb-client-go/v2 v2.14.0 for time-series metrics storage
- Add stripe/stripe-go/v82 v82.5.1 for payment processing
- Update go.mongodb.org/mongo-driver/v2 from v2.5.0 to v2.5.1
- Add supporting dependencies: gqlparser, oapi-codegen/runtime, line-protocol, prometheus client_model/
2026-04-17 15:36:14 +03:00
nutcas3 ccd50ac79e feat: Add API server main entry point with GraphQL, metrics collection, and system monitoring
- Add main server setup with Gin router, GraphQL handler, and graceful shutdown
- Initialize database connection and metrics collectors (Prometheus and InfluxDB time-series)
- Add HTTP middleware for Prometheus metrics collection
- Add /metrics endpoint for Prometheus scraping and /health endpoint for health checks
- Implement periodic metrics collection (30s interval) for subscribers, sessions, and system
2026-04-17 15:35:33 +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 129a61c826 test: Add unit tests for GraphQL resolver helper functions
- Add parseID tests for valid IDs, invalid format, and zero values
- Add encodeCursor/decodeCursor tests for base64 cursor encoding/decoding with valid and invalid inputs
- Add buildUsageFilterWhere tests for empty filters, usage type filtering, and cost range filtering
- Add ResolverRoot method tests to verify Query/Mutation/Subscription return receiver
- Include helper function implementations (encodeCursor, decodeCursor, buildUsageFilterWhere)
2026-04-17 15:21:38 +03:00
nutcas3 eef5f21717 feat: Add GraphQL code generation scaffolding with comprehensive type definitions and resolver interfaces
- Add custom GraphQL types and enums: SubscriberStatus, ProfileStatus, UsageType, SessionStatus, PaymentMethodType, InvoiceStatus, AlertType, AlertSeverity, SubscriberSort, UsagePeriod, TrendDirection
- Define input types: SubscriberFilter, UsageEventFilter, CreateSubscriberInput, UpdateSubscriberInput, TopUpInput, UsageStatsInput, PaymentMethodInput, CreateAlertInput
- Define output types: Page
2026-04-17 15:21:21 +03:00
nutcas3 1383e08645 feat: Implement GraphQL resolvers for subscriber management, charging operations, and real-time monitoring
- Add Resolver struct with database, subscriber, charging, and ES2 service dependencies
- Implement query resolvers: Subscriber, SubscriberByImsi, Subscribers, SubscriberAccount, UsageEvents, UsageStats, RealTimeUsage, Invoices, Invoice, RatingPlans, RatingPlan, Alerts, SystemStats, HealthStatus, SearchSubscribers, SearchUsageEvents
- Implement mutation resolvers: CreateSubscriber, UpdateSubscriber, DeleteSubscriber, TopUpBalance, Suspend
2026-04-17 15:21:03 +03:00
nutcas3 86141062fe feat: Add comprehensive GraphQL schema for subscriber management and charging operations
- Add custom scalars (DateTime, JSON) for complex data types
- Define enums for subscriber status, profile status, usage types, session status, payment methods, invoice status, and alert types
- Add core types: Subscriber, SubscriberAccount, UsageEvent, RatingPlan, ChargingSession, PaymentMethod, Invoice, Alert
- Add system monitoring types: SystemStats, HealthStatus
- Implement Relay-style pagination with Connection
2026-04-17 15:18:06 +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 745ebe3bb4 chore: Update Go dependencies to latest versions
- Update bytedance/gopkg from v0.1.3 to v0.1.4
- Update bytedance/sonic/loader from v0.5.0 to v0.5.1
- Update gabriel-vasile/mimetype from v1.4.12 to v1.4.13
- Update gin-contrib/sse from v1.1.0 to v1.1.1
- Update go-playground/validator/v10 from v10.30.1 to v10.30.2
- Update goccy/go-json from v0.10.5 to v0.10.6
- Update golang/snappy from v0.0.4 to v1.0.0
- Update jackc/pgx/v5 from v5.6.0 to v5.9.1
- Update klauspost/compress from v1.17.6 to v1.18.5
2026-04-14 16:04:19 +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 92ed80fec6 style: Format subscriber models with consistent spacing and add inactive status
- Reformat struct field alignment for improved readability
- Add SubscriberStatusInactive to SubscriberStatus enum
- Add blank lines after type declarations for consistency
- Adjust whitespace and alignment across all model structs
2026-04-14 16:00:33 +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
nutcas3 5c4281f01a feat: Add subscriber data models with GORM integration and 5G network support
- Add Subscriber model with IMSI, MSISDN, IMEI, and authentication fields
- Add ServicePlan model with data/voice/SMS limits and QoS settings
- Add Session model with PDU address, DNN, SNSSAI, and usage tracking
- Add UsageRecord model for billing with usage type, volume, rate, and cost
- Add SubscriberStatus enum (active, suspended, terminated, provisioning)
- Add ProfileStatus enum for eSIM profile state tracking
- Add SessionStatus enum (active, inactive, terminating)
- Add UsageType enum (data, voice, sms)
- Add PLMN struct with
2026-04-14 15:52:10 +03:00
nutcas3 a2021f64af feat: Add subscriber HTTP handlers with CRUD operations and lifecycle management
- Add SubscriberHandler struct with SubscriberService dependency
- Add NewSubscriberHandler constructor
- Add CreateSubscriber endpoint for subscriber creation with IMSI allocation
- Add GetSubscriber endpoint for ID-based retrieval
- Add GetSubscriberByIMSI endpoint for IMSI-based lookup
- Add UpdateSubscriber endpoint for subscriber information updates
- Add ListSubscribers endpoint with pagination, filtering (status, organization_id), and search
- Add SuspendSubscriber endpoint for subscriber suspension and session
2026-04-14 15:50:43 +03:00
nutcas3 8366e0011d feat: Add database layer with GORM integration and subscriber management
- Add Database struct with GORM PostgreSQL connection
- Add IMSIAllocation model for IMSI range tracking and allocation
- Add NewDatabase function with connection pooling (10 idle, 100 max connections, 1h lifetime)
- Add AutoMigrate for Subscriber, ServicePlan, Session, UsageRecord, and IMSIAllocation models
- Add InitializeIMSIAllocation with default IMSI range (1-999999999)
- Add CRUD operations for subscribers (Create, Get, GetByIMSI, Update, List)
- Add ListSubscribers with pagination, filtering by status/
2026-04-14 15:50:18 +03:00
nutcas3 5b8c5d81d5 feat: Add configuration management for api-server
- Add Config struct with server, database, Redis, IMSI, and ES2+ settings
- Add ServerConfig with port and timeout settings (30s read/write)
- Add DatabaseConfig for PostgreSQL connection parameters
- Add RedisConfig for cache connection settings
- Add IMSIConfig with France MCC+MNC prefix (20893) and IMSI range
- Add ES2Config for eSIM provisioning with SMDP connection parameters
- Add LoadConfig function with default configuration values
- Include JSON
2026-04-14 15:50:08 +03:00
nutcas3 f6effbf6d1 chore: Remove unused log import and normalize variable alignment in api-server
- Remove unused standard library log import
- Normalize variable declaration spacing in var block
2026-04-14 03:39:52 +03:00
nutcas3 fd08e73ef7 chore: Update module paths and dependencies across api-server and carrier-connector
- Change module path from taas-platform to nutcas3 organization
- Remove golang-jwt/jwt dependency from api-server
- Add GORM PostgreSQL driver and GORM v1.31.1 to api-server
- Update go-resty/resty from v2.15.3 to v2.17.2 in carrier-connector
- Update rs/zerolog from v1.33.0 to v1.35.0 in carrier-connector
- Add go.sum files with complete dependency trees for both applications
- Include indirect dependencies
2026-04-14 03:31:37 +03:00
nutcas3 b69b7ec087 feat: Initialize telecom platform with core services and infrastructure
- Add Go-based API server and carrier connector services
- Add Rust-based charging engine and packet gateway services
- Add Docker Compose configuration for local development
- Add comprehensive documentation (API, Architecture, Deployment)
- Add development scripts for Redis, MongoDB, and environment setup
- Add workspace configuration for Go modules and pnpm
- Remove unnecessary documentation files from web-dashboard
- Add project build configuration (Makefile, Cargo.toml)

This commit establishes the foundational microservices architecture for the sovereign Telecom-as-a-Service platform.
2026-04-03 19:55:38 +03:00