Commit Graph
100 Commits
Author SHA1 Message Date
nutcas3 fa7c4a1bf6 feat: Add predictive maintenance service with asset monitoring, failure prediction, ML models, and health scoring
- Add MaintenanceType constants for preventive, corrective, predictive, and emergency maintenance
- Add AssetType constants for server, database, network, storage, application, and load_balancer
- Add Asset struct with ID, Name, Type, Status, Location, HealthScore, LastMaintenance, NextMaintenance, and Metadata fields
- Add MaintenanceAlert struct with ID, AssetID, Type, Severity, Title, Description, RiskScore,
2026-05-03 11:22:16 +03:00
nutcas3 7ce809084d feat: Add fraud detection service with pattern matching, ML models, risk scoring, and automated blocking
- Add FraudType constants for account_takeover, subscription_fraud, payment_fraud, usage_anomaly, identity_fraud, and sim_swap
- Add FraudSeverity type with Low, Medium, High, and Critical levels
- Add FraudAlert struct with ID, Type, Severity, ProfileID, RiskScore, Evidence, IPAddress, UserAgent, Location, Status, Actions, and Metadata fields
- Add FraudPattern struct with pattern configuration and weight-based scoring
- Add FraudDetectionService with patterns, alerts
2026-05-03 11:22:01 +03:00
nutcas3 9239198027 feat: Add market analysis service with penetration metrics, competitor analysis, and opportunity identification
- Add MarketMetrics struct with Period, TotalMarketSize, OurSubscribers, MarketShare, GrowthRate, ByCountry, ByCarrier, ByDemographic, CompetitorAnalysis, and PenetrationOpportunities fields
- Add CountryMetrics struct with Country, TotalPopulation, ActiveSubscribers, PenetrationRate, GrowthRate, ARPU, and MarketPotential fields
- Add MarketCarrierMetrics struct with CarrierName, Subscribers
2026-05-03 11:21:26 +03:00
nutcas3 42d7f4ac86 feat: Add churn analysis service with risk prediction, metrics calculation, and retention recommendations
- Add ChurnRiskLevel type with Low, Medium, High, and Critical constants
- Add ChurnPrediction struct with ProfileID, RiskLevel, RiskScore, PredictedChurnDate, Reasons, Recommendations, and LastUpdated fields
- Add ChurnMetrics struct with Period, TotalSubscribers, ChurnedSubscribers, ChurnRate, MonthlyChurnRate, AnnualChurnRate, AverageTenure, and RiskDistribution fields
- Add ChurnFactor struct with Factor
2026-05-03 11:21:14 +03:00
nutcas3 f4780a5562 feat: Add platform routes with analytics, whitelabel, compliance, exchange rate, and infrastructure endpoints
- Add registerAnalyticsRoutes, registerWhitelabelRoutes, registerComplianceRoutes, registerExchangeRateRoutes, and registerInfraRoutes to setupRoutes
- Add routes_platform.go with analytics dashboard, revenue analytics, and scheduled report endpoints
- Add whitelabel branding, partner config, and email template endpoints
- Add compliance DSR, consent management, audit logging, and data residency endpoints
2026-05-03 10:53:26 +03:00
nutcas3 c6fccc893d feat: Fix type conversions, rename ExchangeRateProvider to RateProviderType, and improve currency integration
- Fix GetRevenueAnalytics return type by dereferencing metrics struct
- Fix getCarrierMetrics to use int64 for Count and convert to int for ActiveCarriers
- Rename ExchangeRateProvider to RateProviderType for consistency
- Change RatePlanCurrencyIntegrator.exchangeService from pointer to interface type
- Add function documentation comments for NewRatePlanCurrencyIntegrator, SubscribeToPlanWith
2026-05-03 10:52:29 +03:00
nutcas3 79fa56f25d feat: Add encryption service with AES-GCM, field-level encryption, and PBKDF2 key derivation
- Add EncryptionService struct with masterKey and gcm cipher fields
- Add EncryptionConfig with MasterKey and KeyDerivationSalt fields
- Add NewEncryptionService constructor with PBKDF2 key derivation, 100000 iterations, and AES-GCM cipher initialization
- Add Encrypt and Decrypt methods with nonce generation and validation
- Add EncryptString and DecryptString methods with base64 encoding
- Add FieldEncryptor struct
2026-05-03 10:51:47 +03:00
nutcas3 772c564a18 feat: Add whitelabel handler with branding, partner config, and email template endpoints
- Add WhitelabelHandler struct with service and logger dependencies and NewWhitelabelHandler constructor
- Add CreateBranding, GetBranding, GetBrandingByDomain, and UpdateBranding methods for branding configuration management
- Add CreatePartnerConfig and GetPartnerConfig methods for partner-specific settings
- Add CreateEmailTemplate, GetEmailTemplate, and ListEmailTemplates methods for email template management
2026-05-03 10:51:31 +03:00
nutcas3 9914ee5955 feat: Add geographic routing service with region management, IP-based routing, and endpoint selection
- Add GeoRouter struct with regions map, defaultReg, and mutex fields
- Add Region struct with ID, Name, Endpoints, Priority, IsActive, and Latency fields
- Add GeoRoutingConfig with DefaultRegion and Regions fields
- Add NewGeoRouter constructor with region initialization
- Add GetRegionForIP method with IP parsing and geo lookup
- Add lookupRegion helper with simplified IP range-based region detection
2026-05-03 10:51:11 +03:00
nutcas3 7be483dbd5 feat: Add compliance handler with DSR management, consent tracking, audit logging, and data residency endpoints
- Add ComplianceHandler struct with service and logger dependencies and NewComplianceHandler constructor
- Add CreateDSR, GetDSR, ListDSRs, and ProcessDSR methods for data subject request management
- Add RecordConsent, RevokeConsent, and GetConsents methods for consent tracking with IP and user agent capture
- Add QueryAuditLogs method with jurisdiction, actor, and action filtering
- Add SetDataRes
2026-05-03 10:50:50 +03:00
nutcas3 b2f92cc8f4 feat: Add threat detection service with brute force, rate limit abuse, SQL injection detection, and IP tracking
- Add ThreatLevel type with Low, Medium, High, and Critical constants
- Add ThreatType type with BruteForce, RateLimitAbuse, SQLInjection, XSS, Unauthorized, DataExfil, and Anomalous constants
- Add ThreatEvent struct with ID, TenantID, Type, Level, Source, Target, Description, Metadata, DetectedAt, Mitigated, and MitigatedAt fields
- Add ThreatDetector struct with logger, rules, events, ip
2026-05-03 10:50:34 +03:00
nutcas3 1e2b38d463 feat: Add analytics handler with dashboard, revenue analytics, and scheduled report endpoints
- Add AnalyticsHandler struct with service and logger dependencies and NewAnalyticsHandler constructor
- Add GetDashboard method with tenant ID extraction, date range filtering, and dashboard metrics retrieval
- Add GetRevenueAnalytics method with tenant filtering and group-by support
- Add CreateScheduledReport and ListScheduledReports methods for report management
- Add date parsing for start_date and end_date query
2026-05-03 10:50:19 +03:00
nutcas3 26bb4f97b5 feat: Add real-time exchange rate service with multi-provider support, caching, and automatic refresh
- Add ExchangeRateProvider type with OpenExchange, Fixer, XE, and Internal constants
- Add RealTimeExchangeService struct with provider, apiKey, baseCurrency, rates cache, lastUpdate, cacheTTL, mutex, logger, and httpClient fields
- Add ExchangeRateConfig with Provider, APIKey, BaseCurrency, and CacheTTL fields
- Add NewRealTimeExchangeService constructor with default 15-minute cache TTL and USD
2026-05-03 10:50:06 +03:00
nutcas3 4d0eb13cee feat: Add whitelabel service with branding, partner config, and email template management
- Add Service struct with db and logger dependencies and NewService constructor
- Add CreateBranding, GetBranding, GetBrandingByDomain, and UpdateBranding methods for branding configuration management
- Add CreatePartnerConfig and GetPartnerConfig methods for partner-specific settings
- Add CreateEmailTemplate, GetEmailTemplate, and ListEmailTemplates methods for custom email template management
- Add BrandingConfig with
2026-05-03 10:48:26 +03:00
nutcas3 52797e54fc feat: Add circuit breaker with state management, failure tracking, fallback support, and statistics
- Add CircuitState type with StateClosed, StateOpen, and StateHalfOpen constants and String method
- Add CircuitBreaker struct with name, state, failureCount, successCount, lastFailure, config, mutex, and onStateChange fields
- Add CircuitBreakerConfig with FailureThreshold, SuccessThreshold, Timeout, and HalfOpenMaxCalls fields
- Add NewCircuitBreaker constructor and DefaultCircuitBreakerConfig with
2026-05-03 10:43:06 +03:00
nutcas3 625bfb5671 feat: Add in-memory cache with TTL, LRU eviction, JSON serialization, and statistics tracking
- Add Cache struct with entries map, mutex, maxSize, defaultTTL, strategy, and stats fields
- Add CacheStrategy type with LRU, TTL, write-through, write-back, and read-through constants
- Add CacheEntry struct with Key, Value, ExpiresAt, CreatedAt, and HitCount fields
- Add NewCache constructor with CacheConfig parameter and automatic cleanup goroutine
- Add Get, Set, Delete, and Clear methods with hit
2026-05-03 10:41:33 +03:00
nutcas3 d9c2026cb9 feat: Add compliance service with DSR management, consent tracking, audit logging, and data residency
- Add Service struct with db and logger dependencies and NewService constructor
- Add CreateDSR, GetDSR, ListDSRs, and ProcessDSR methods for data subject request lifecycle management
- Add processAccessRequest, processErasureRequest, processRectificationRequest, and calculateDueDate helper methods
- Add RecordConsent, RevokeConsent, and GetConsents methods for consent management
- Add LogAudit
2026-05-03 10:41:09 +03:00
nutcas3 58e36d63ca feat: Add analytics service with dashboard metrics, revenue tracking, and scheduled reporting
- Add Service struct with GetDashboard, GetRevenueAnalytics, CreateScheduledReport, and ListScheduledReports methods
- Add getRevenueMetrics, getSubscriberStats, getUsageMetrics, getCarrierMetrics, getGeoMetrics, and getPerformanceStats helper methods
- Add DashboardMetrics, RevenueMetrics, SubscriberStats, UsageMetrics, CarrierMetrics, GeoMetrics, and PerformanceStats types
- Add CarrierStat, CountryStat, RegionStat
2026-05-03 10:40:51 +03:00
nutcas3 4205d4c2aa refactor: Replace unused context parameters with blank identifiers and fix variable references
- Replace ctx parameter with _ in provisionTenantContext, provisionDatabaseSchema, provisionStorageResources, configureCarrier, configureRatePlans, setupPaymentProcessing, and validateCompliance methods
- Fix tenant_id scope to use wrappedTx.tenantID instead of r.tenantID in TenantScopedTransaction
- Fix pricing effectiveness analytics to use ratePlanAnalytics.AverageDiscount and ratePlanAnalytics.TotalSavings instead of analytics.
2026-05-03 10:31:49 +03:00
nutcas3 7a80fb9aeb feat: Extract domain route registration from setupRoutes into separate functions in routes_domain.go
- Move rate plan, pricing, currency, tenant, and SMDP route registration from routes.go to new routes_domain.go file
- Add registerMVNORoutes, registerRatePlanRoutes, registerPricingRoutes, registerCurrencyRoutes, registerTenantRoutes, and registerSMDPRoutes functions
- Simplify setupRoutes to call domain-specific registration functions with required dependencies
- Remove nested route group blocks in favor
2026-05-03 10:22:08 +03:00
nutcas3 82ecbff62a feat: Add RatePlanAdapter with CRUD operations, subscription management, usage tracking, and analytics
- Add RatePlanAdapter struct wrapping Service to implement rateplan.Service interface
- Add NewRatePlanAdapter constructor returning rateplan.Service
- Add CreateRatePlan, GetRatePlan, UpdateRatePlan, DeleteRatePlan, ListRatePlans, SearchRatePlans, and GetPopularPlans methods with type conversions
- Add SubscribeToPlan, GetSubscription, UpdateSubscription, CancelSubscription, GetActiveSubscription
2026-05-03 10:21:46 +03:00
nutcas3 e5ccb62277 feat: Add comprehensive routing for rate plans, pricing, currency, tenants, SMDP, and selection endpoints
- Add db parameter to setupRoutes function signature and pass from main.go
- Add rate plan routes with CRUD, search, subscription, and management endpoints using RatePlanAdapter
- Add pricing routes with rule management endpoints using PricingService
- Add currency routes with conversion, exchange rates, billing operations, and analytics placeholder endpoints
- Add tenant routes with management
2026-05-03 10:14:02 +03:00
nutcas3 b69d73ade7 feat: Wire MVNO handlers with repository and service dependencies in carrier-connector routes
- Add logrus and gorm imports to main.go for MVNO infrastructure setup
- Create logger instance and separate database connection for MVNO repository in main
- Initialize GormRepository with database connection and logger
- Pass repo and logger to setupRoutes for MVNO handler initialization
- Replace placeholder MVNO endpoints with actual handler methods in routes.go
- Create OnboardingService, MVNOHandler, and ManagementHandler instances
2026-05-03 09:55:29 +03:00
nutcas3 bc5ead59c6 feat: Remove MVNO router and add placeholder endpoints to main routes
- Delete router.go with Router struct, NewRouter constructor, SetupRoutes, SetupMiddleware, HealthCheck, and RegisterHealthCheck methods
- Add /mvno route group with POST /onboarding, GET /, GET /:id, PUT /:id/status, and GET /stats placeholder endpoints
- Replace router-based MVNO setup with direct route registration returning http.StatusNotImplemented responses
2026-05-03 09:52:50 +03:00
nutcas3 88fd53a37d feat: Remove MVNO handlers, service, and repository implementations from carrier-connector
- Delete handler.go with StartOnboarding, GetMVNO, ListMVNOs, and RegisterRoutes methods
- Delete handler_management.go with GetMVNO, ListMVNOs, UpdateMVNOStatus, and GetMVNOStats endpoints
- Delete onboarding_service.go with StartOnboarding, executeOnboarding, executeStep workflow orchestration
- Delete repository.go with GormRepository CRUD operations, filtering, and statistics methods
- Update provisioner.go to use map[string]any instead of map[string]interface{}
2026-05-03 09:51:28 +03:00
nutcas3 2344ef0710 feat: Add logger dependency to SelectionService and refactor handler initialization
- Add logrus import and logger initialization in NewSelectionIntegration
- Pass logger instance to NewSelectionService constructor
- Replace selectionService.GetHandler() with direct handlers.NewSelectionHandler(manager) call
2026-05-03 09:50:51 +03:00
nutcas3 f6394e1636 feat: Reorder OnboardingProgress and OnboardingStep structs and add MVNOFilter type
- Move OnboardingProgress struct definition before OnboardingStep for logical ordering
- Add MVNOFilter struct with status, plan, business_id, limit, offset, and date range filtering fields
2026-05-03 09:50:38 +03:00
nutcas3 5cb2904c36 feat: Add MVNO repository with CRUD operations, filtering, and statistics aggregation
- Add MVNORepository implementation with CreateMVNO, GetMVNO, UpdateMVNO, ListMVNOs, DeleteMVNO, and UpdateMVNOStatus methods
- Add MVNOFilter struct with status, plan, business_id, limit, offset, and date range filtering
- Add GetMVNO and GetMVNOByBusinessID methods with record not found error handling
- Add ListMVNOs with dynamic query building, filter application, and descending created_at ordering
- Add GetMVNOStats with total count, status distribution, and plan distribution aggregation
2026-05-03 09:50:26 +03:00
nutcas3 c7ddd3c5d7 feat: Extract repository interfaces from types.go into separate interfaces.go file
- Move TenantRepository and Repository interfaces from types.go to new interfaces.go file
- Add mvno package import for MVNO-related repository methods
- Add CreateMVNO, GetMVNO, GetMVNOByBusinessID, UpdateMVNO, ListMVNOs, DeleteMVNO, UpdateMVNOStatus, and GetMVNOStats methods to Repository interface
- Remove context import from types.go after interface extraction
2026-05-03 09:49:56 +03:00
nutcas3 192b4ce7ff feat: Refactor step status checking from if-else to switch statement in GetStepSuccessRate
- Replace if-else chain with switch statement for step.Status evaluation in monitor.go
- Maintain completed and failed case handling with cleaner control flow
2026-05-03 09:49:37 +03:00
nutcas3 9296bc567b feat: Add MVNO onboarding service with step-based workflow execution and progress tracking
- Add OnboardingService struct with validator, provisioner, and monitor dependencies
- Add NewOnboardingService constructor with logger dependency injection
- Add StartOnboarding method with request validation, MVNO record creation, and async workflow execution
- Add executeOnboarding method with sequential step processing, context cancellation support, and progress updates
- Add executeStep method with switch
2026-05-02 19:50:28 +03:00
nutcas3 bf46ecda02 feat: Refactor MVNO handlers to use domain types and interface-based service dependency
- Rename Handler to MVNOHandler for clarity in handler_mvno.go
- Replace services.OnboardingService with OnboardingService interface for dependency injection
- Change monitor.OnboardingRequest, monitor.MVNOStatus, monitor.MVNOFilter, and monitor.MVNOPlan to mvno package types
- Remove monitor package import from handler_management.go and handler_mvno.go
- Add context.Context import for service method signatures
2026-05-02 19:49:39 +03:00
nutcas3 026a34fdcf feat: Add carrier-connector HTTP handlers with MVNO onboarding, management, and statistics endpoints
- Add Handler struct with StartOnboarding, GetMVNO, and ListMVNOs methods in handler_mvno.go
- Add ManagementHandler struct with GetMVNO, ListMVNOs, UpdateMVNOStatus, and GetMVNOStats methods in handler_management.go
- Add RegisterRoutes method for /mvno/onboarding, /mvno, and /mvno/:id route registration
- Add query parameter parsing for status, plan, and limit filters in ListMVNOs
- Add structured logging
2026-05-02 19:42:56 +03:00
nutcas3 358df2153b feat: Add production MVNO provisioner with tenant, carrier, billing, and API access setup
- Add ProductionProvisioner struct with tenant, carrier, billing, and storage service dependencies
- Add TenantService, CarrierManager, BillingService, and StorageService interfaces for external integrations
- Add TenantConfig and CarrierInfo structs for tenant and carrier data models
- Add NewProductionProvisioner constructor with service dependency injection
- Add ProvisionResources method with tenant context
2026-05-02 19:09:54 +03:00
nutcas3 7239bdea48 feat: Add MVNO provisioner methods with tenant setup, resource allocation, carrier configuration, and validation
- Add provisionTenantContext with tenant config creation, settings mapping, and tenant service integration
- Add provisionDatabaseSchema with dedicated schema creation for MVNO isolation
- Add provisionStorageResources with plan-based storage allocation (10GB to 10TB)
- Add selectCarriers with country-based carrier selection, active status filtering, and duplicate prevention
- Add config
2026-05-02 19:09:40 +03:00
nutcas3 afd2bd01b3 feat: Add MVNO router with route setup, middleware configuration, and health check endpoint
- Add Router struct with handler and logger dependencies for routing configuration
- Add NewRouter constructor with repository, service, and handler initialization
- Add SetupRoutes method with /api/v1 versioning, logging, and recovery middleware
- Add SetupMiddleware with CORS headers, rate limiting placeholder, and request ID tracking
- Add HealthCheck method with service status, name, and version response
2026-05-02 19:06:03 +03:00
nutcas3 04e9426aaf feat: Add MVNO provisioner with resource provisioning, carrier setup, billing, and API access configuration
- Add MVNOProvisioner struct with logger dependency for resource provisioning operations
- Add ProvisionResources method with tenant context, database schema, and storage provisioning
- Add SetupCarriers method with carrier selection, configuration, and carrier pool assignment
- Add SetupBilling method with billing ID generation, rate plan configuration, and payment processing setup
- Add SetupAPIAcc
2026-05-02 19:04:42 +03:00
nutcas3 3b10a90851 feat: Add MVNO repository with CRUD operations, filtering, and statistics aggregation
- Add Repository interface with CreateMVNO, GetMVNO, UpdateMVNO, ListMVNOs, DeleteMVNO, and UpdateMVNOStatus methods
- Add GormRepository struct with db and logger dependencies for GORM-based persistence
- Add MVNOFilter struct with status, plan, business_id, limit, offset, and date range filtering
- Add GetMVNO and GetMVNOByBusinessID methods with record not found error handling
- Add ListMVNOs with dynamic query
2026-05-02 19:04:14 +03:00
nutcas3 fd827d4ad0 feat: Add MVNO onboarding service with step-based workflow execution and progress tracking
- Add OnboardingService struct with validator, provisioner, and monitor dependencies
- Add StartOnboarding method with request validation, MVNO record creation, and async workflow execution
- Add executeOnboarding method with sequential step processing, context cancellation support, and progress updates
- Add executeStep method with switch-based routing for validation, provisioning, carrier setup, billing
2026-05-02 19:04:01 +03:00
nutcas3 afe3a79ae4 feat: Add MVNO onboarding monitor with progress tracking and metrics collection
- Add OnboardingMonitor struct with progress map and mutex for concurrent access
- Add UpdateProgress and GetProgress methods for tracking individual MVNO onboarding state
- Add GetAllProgress with map copy to prevent concurrent access issues
- Add GetActiveOnboardingCount and GetCompletedOnboardingCount for status aggregation
- Add GetAverageOnboardingTime calculation with completed onboarding duration tracking
- Add GetStepSuccess
2026-05-02 19:03:50 +03:00
nutcas3 95cd99f7ea feat: Add MVNO domain types with status, plan, config, and onboarding request models
- Add MVNO struct with ID, Name, BusinessID, Status, Plan, Config, and timestamps
- Add MVNOStatus enum with pending, review, approved, active, suspended, and terminated states
- Add MVNOPlan enum with starter, growth, scale, and enterprise tiers
- Add MVNOConfig struct with subscriber limits, country restrictions, carrier pool, and feature flags
- Add OnboardingRequest struct with business info, contact details, plan selection
2026-05-02 19:03:39 +03:00
nutcas3 695013be92 feat: Add MVNO onboarding validator with business, plan, and technical validation
- Add OnboardingValidator struct with ValidateRequest and ValidateMVNO methods in validator.go
- Add business info validation with name length, ID format, email regex, and phone length checks
- Add plan validation with subscriber limits for Starter (1000) and Growth (10000) plans
- Add technical requirements validation with country code format and use case length checks
- Add compliance validation with country-specific regulatory checks and restricted country filtering
- Add technical feasibility validation
2026-05-02 19:03:24 +03:00
nutcas3 77ca25a453 feat: Add MVNO HTTP handlers with onboarding, management, and statistics endpoints
- Add Handler struct with StartOnboarding, GetMVNO, and ListMVNOs methods in handler.go
- Add ManagementHandler struct with GetMVNO, ListMVNOs, UpdateMVNOStatus, and GetMVNOStats methods in handler_management.go
- Add RegisterRoutes method for /mvno/onboarding, /mvno, and /mvno/:id route registration
- Add query parameter parsing for status, plan, and limit filters in ListMVNOs
- Add structured logging with mvno_id, status, and error
2026-05-02 19:03:01 +03:00
nutcas3 fb1b251694 refactor: Update comments in tenant repository to reflect actual implementation
- Replace vague "separate table or log system" comment with specific tenant_events table reference in CreateEvent
- Replace "For now, update tenant settings" with clearer "Store configuration in tenant metadata field and update settings" in UpdateConfig
- Remove "For now, we'll use a simple approach" qualifier from CreateEvent comment
2026-05-02 18:45:20 +03:00
nutcas3 ef4e8a05cd refactor: Replace interface{} with any and optimize slice operations
- Replace map[string]interface{} with map[string]any in UpdateCarrierMetrics
- Replace interface{} with any for GeneratedAt field in PricingEffectiveness struct
- Replace loop-based empty string checks with slices.Contains in ValidateConditions
- Replace range loop index initialization with range-only syntax in calculateAPIPerformance
- Add slices import for standard library slice utilities
2026-05-02 17:57:20 +03:00
nutcas3 5fddd48994 feat: Implement revenue analytics calculation, resource performance tracking, and round-robin load balancing
- Add revenue calculation in GetRevenueAnalytics with active subscription base price aggregation
- Add date range filtering for revenue analytics with StartDate and EndDate support
- Add per-plan revenue, subscription count, and average revenue calculations
- Add error handling with partial result fallback for revenue queries
- Replace mock resource performance with event-based performance
2026-05-02 17:56:34 +03:00
nutcas3 4241c38389 feat: Implement MCC-based regional scoring with geographic grouping for carrier selection
- Replace neutral 50.0 score with MCC-to-region mapping logic in calculateRegionScore
- Add mccToRegion function mapping MCC first digit to region codes (EU, NA, AS, OC, AF, SA)
- Add sameRegionGroup function grouping regions into EMEA, AMER, and APAC clusters
- Add 90.0 score for exact MCC region match, 70.0 for same region group, 30.0 for distant regions
- Add MCC range documentation for Europe (2xx), North America (3xx
2026-05-02 17:55:54 +03:00
nutcas3 b1ceddd9e7 refactor: Extract CRUD operations from pricing service into separate file and improve discount extraction logic
- Move CreateRule, GetRule, UpdateRule, DeleteRule, ListRules, CalculatePrice, and ApplyRules to pricing_service_crud.go
- Remove duplicate struct and constructor comments from pricing_service.go
- Replace hardcoded discount values in extractDiscountValue with actual rule Actions field parsing
- Add AdjustmentType-based discount calculation for Percentage, Fixed, Multiply, and Override
2026-05-02 17:55:26 +03:00
nutcas3 c53faf34ad feat: Implement rate limiting and resource access validation in tenant middleware
- Add RateLimit implementation with tenant context retrieval and plan-based rate limit checking
- Add rate limit exceeded logging with tenant_id and endpoint fields
- Add HTTP 429 response with error message and endpoint when rate limit exceeded
- Add ValidateResourceAccess implementation with tenant ownership verification
- Add context injection for validated_resource, validated_resource_id, and tenant_id
2026-05-02 17:54:51 +03:00
nutcas3 76052466e1 feat: Add tenant context injection to currency service methods for downstream isolation
- Replace TODO comments with context.WithValue calls injecting tenant_id in ProcessBilling
- Add tenant context injection in ConvertAmount for tenant-specific exchange rates
- Add tenant context injection in GetBillingHistory for repository-level filtering
- Add tenant context injection in CalculateTotalBilling for scoped calculations
- Update comments to reflect context-based isolation strategy
2026-05-02 17:54:22 +03:00
nutcas3 31fefa643f feat: Implement carrier metrics persistence with dedicated metrics table and timestamp updates
- Replace mock logging with actual database persistence in UpdateCarrierMetrics
- Add carrier record timestamp update with updated_at field
- Add carrier_metrics table insertion with JSON-serialized metrics data
- Add metricsRecord struct with CarrierID, MetricsData, and RecordedAt fields
- Add zero-division protection for success rate calculation
- Update logging to use structured fields with WithField
2026-05-02 17:54:05 +03:00
nutcas3 9b37aaf224 feat: Implement refund processing and billing analytics endpoints in currency handlers
- Add ProcessRefund implementation with negative billing entry for refunds and transaction ID fallback
- Add GetBillingAnalytics implementation with date range filtering, billing summary calculation, and transaction history
- Add default 30-day date range for analytics with RFC3339 date parsing for custom ranges
- Replace NotImplemented responses with full BillingService integration
2026-05-02 17:53:15 +03:00
nutcas3 6f8b53f7da feat: Implement carrier weight updates, pricing analytics calculations, and tenant rate limiting
- Add updateCarrierWeights implementation with regional and plan-based weight adjustments in carrier_methods.go
- Add calculateRegionalWeightAdjustment helper with usage-based weight scaling and clamping
- Add calculatePlanWeightAdjustment helper with plan usage analysis and adjustment limits
- Add calculateConversionRate helper in pricing_integration.go using discount statistics and active rule ratios
2026-05-02 05:38:06 +03:00
nutcas3 6fc23dff0b feat: Implement tenant-aware currency service wrapper with billing isolation and audit logging
- Add TenantAwareCurrencyService struct with tenantID, billingService, and logger fields
- Add ProcessBilling method with tenant context logging for billing requests
- Add ConvertAmount method with tenant context logging for currency conversions
- Add GetBillingHistory method with tenant context logging for transaction retrieval
- Add CalculateTotalBilling method with tenant context logging for billing summ
2026-05-02 05:26:47 +03:00
nutcas3 16f4c4216c feat: Add tenant-aware rate limiter with sliding window counters and plan-based limits
- Add TenantRateLimiter with plan-based rate limits for Free, Basic, Pro, and Enterprise tiers
- Add RateLimit struct with RequestsPerMinute, RequestsPerHour, RequestsPerDay, and BurstSize fields
- Add TenantUsageTracker with sliding window counters for minute, hour, and day tracking
- Add SlidingWindowCounter with Allow and Count methods for time-based request tracking
- Add AllowRequest method with multi-tier rate limit
2026-05-02 05:26:01 +03:00
nutcas3 8cabf170f2 feat: Refactor ID generation to use Snowflake IDs with prefixes and add domain-specific ID generators
- Replace timestamp-based GenerateRuleID with Snowflake-based GeneratePrefixed("rule")
- Replace random string-based GenerateEventID with Snowflake-based GeneratePrefixed("evt")
- Add GenerateUsageID with resourceType and tenantID parameters for traceable usage IDs
- Add GenerateAPIID, GenerateTenantID, GenerateProfileID, GenerateSubscriptionID, GenerateCarrierID, GeneratePricingID generators
2026-05-02 05:11:19 +03:00
nutcas3 cac6db74a7 feat: Add ID generation utilities with rule ID, event ID, and random string generators
- Add GenerateRuleID function using nanosecond timestamp
- Add GetCurrentTime helper returning current time
- Add GenerateEventID function with "evt_" prefix and 16-character random string
- Add GenerateRandomString function with alphanumeric charset
2026-05-02 05:09:20 +03:00
nutcas3 b160029e30 refactor: Replace time and ID generation helpers with centralized id package utilities
- Replace getCurrentTime() calls with id.GetCurrentTime() in pricing_integration.go and pricing_service.go
- Replace generateRuleID() with id.GenerateRuleID() in pricing rule creation
- Replace generateEventID() with id.GenerateEventID() in tenant middleware
- Remove local helper functions: generateRuleID, getCurrentTime, generateEventID, generateRandomString, getCurrentTimestamp
- Remove unused time package imports
2026-05-02 05:09:12 +03:00
nutcas3 ec812835c8 refactor: Extract helper methods, fix formatting, and add TODO comments for pending implementations
- Extract generateHistoryAnalytics helper in selection_handler_methods.go
- Extract generateRecommendations helper in selection_handler_selection.go
- Extract parsePositiveInt helper in rateplan_handlers_analytics.go
- Replace hardcoded URL path with action parameter in ES2Service.sendActivationRequest
- Add TODO comments for wrapCurrencyService and updateCarrierWeights pending implementations
- Fix struct field alignment and formatting in carrier_methods.go
2026-05-02 05:08:43 +03:00
nutcas3 d2bd13eff6 feat: Add pricing repository, tenant-aware transaction support, and pricing integration service
- Add GormPricingRepository with CreateRule, GetRule, UpdateRule, DeleteRule, ListRules, CountRules methods
- Add GetActiveRules, GetRulesByType methods for retrieving active pricing rules by tenant and type
- Add TenantScopedDB wrapper with automatic tenant filtering for tenant-aware database operations
- Implement TenantScopedTransaction with tenant context propagation and automatic filtering
2026-05-02 04:44:31 +03:00
nutcas3 990f741387 refactor: Refactor tenant analytics to use repository data and extract helper methods to separate files
- Move parseAPIRequestEvents, buildResourcePerformance, parseErrorEvents, parseSlowQueryEvents from tenant_analytics_mock.go to tenant_analytics.go
- Update buildUsageByType to fetch usage statistics from repository instead of using mock data
- Add calculateResourceUsageAnalytics helper to calculate analytics from usage records
- Update buildUsageTrends to use repository data with buildUsageTrendData helper
- Update buildUsagePeaks to use repository data with buildUsagePeakData helper
2026-05-02 04:43:05 +03:00
nutcas3 5637b216f2 feat: Add pricing interfaces and types for dynamic pricing rule management
- Add Repository interface with CreateRule, GetRule, UpdateRule, DeleteRule, ListRules, CountRules methods
- Add GetActiveRules, GetRulesByType methods for rule evaluation
- Add Service interface with rule management, pricing calculations, validation, and analytics methods
- Add RuleEngine interface with EvaluateRule, ApplyRule, ValidateConditions, ExecuteActions methods
- Add PricingEventHandler interface for rule lifecycle events
- Add PricingValidator interface for rule and context validation
- Add PricingCache interface for caching pricing data
2026-05-02 04:41:50 +03:00
nutcas3 064bc3dda5 refactor: Extract tenant integration helper types to separate file and replace ID generation with id package
- Move TenantAwareServices, TenantResourceQuotaChecker, TenantEventLogger from tenant_integration.go to tenant_integration_core.go
- Move wrapCurrencyService, NewTenantResourceQuotaChecker, NewTenantEventLogger, CheckQuota, UpdateUsage methods to tenant_integration_core.go
- Move LogResourceAccess, LogQuotaViolation methods to tenant_integration_core.go
- Replace generateID helper with id.
2026-05-02 04:41:23 +03:00
nutcas3 9b9d73fed9 feat: Add Snowflake ID generator with thread-safe generation, parsing utilities, and default generator
- Add Snowflake struct with mutex, timestamp, nodeID, sequence fields
- Add NewSnowflake constructor with nodeID validation (0 to MaxNodeID range)
- Add Generate method with sequence overflow handling and millisecond-based timestamp
- Add GenerateString method for string representation of generated IDs
- Add Parse, Time, NodeID, Sequence utility functions for ID decomposition
- Add defaultGenerator
2026-05-02 04:38:10 +03:00
nutcas3 96ca53e790 feat: Add pricing handlers with CRUD operations, rule application, price calculation, and analytics endpoints
- Add PricingHandler with CreateRule, GetRule, UpdateRule, DeleteRule, ListRules methods
- Add CalculatePrice endpoint for price calculation based on active rules
- Add ApplyRules endpoint for applying specific pricing rules to context
- Add GetAnalytics endpoint for retrieving pricing analytics by tenant
- Add RegisterRoutes method to register pricing routes under /pricing group
2026-05-02 04:34:59 +03:00
nutcas3 9414a8f871 refactor: Remove unused rate plan currency integrator and tenant analytics mock helper methods
- Delete RatePlanCurrencyIntegrator implementation from rateplan_core.go
- Delete SubscribeToPlanWithCurrency, CalculatePlanCostInCurrency, calculateOverageCost methods
- Delete tenant analytics mock helper methods from tenant_analytics_mock.go
- Remove getMockResourceCount, getMockQuotaLimit, getMockQuotaUsed, parseTimeRange methods
- Remove parseAPIRequestEvent, parseErrorEvent, parseSlowQueryEvent, calculateAPI
2026-05-02 04:34:42 +03:00
nutcas3 271b43e4ac refactor: Implement tenant analytics dashboard and usage analytics with helper methods
- Implement GetTenantDashboard with usage stats, metrics, recent events, and quota status
- Implement GetUsageAnalytics with usage by type, trends, and peaks
- Implement GetPerformanceAnalytics with API performance, resource performance, errors, and slow queries
- Extract helper methods to tenant_analytics_mock.go: parseTimeRange, parseAPIRequestEvent, parseErrorEvent, parseSlowQueryEvent, calculateAPIPerformance, build
2026-05-02 04:26:35 +03:00
nutcas3 f112aa4c52 refactor: Replace map[string]interface{} with map[string]any across currency, handlers, integration, and rateplan packages
- Update BillingSummary.Breakdown field type from map[string]interface{} to map[string]any
- Update Transaction.Metadata field type from map[string]interface{} to map[string]any
- Update RatePlanCurrencyIntegrator subscription and billing metadata to use map[string]any
- Update handler request/response types to use map[string]any (CreateRatePlanRequest, UpdateRatePlanRequest,
2026-05-02 03:21:42 +03:00
nutcas3 31a8886bc0 refactor: Add rate plan currency integration service and update tenant repository with user count method
- Add RatePlanCurrencyIntegrator with SubscribeToPlanWithCurrency, CalculatePlanCostInCurrency, calculateOverageCost methods
- Add NewRatePlanCurrencyIntegrator constructor with billingService, exchangeService, ratePlanService, logger, baseCurrency fields
- Add currency conversion support for rate plan subscriptions with exchange rate metadata tracking
- Add billing integration for initial subscription
2026-05-02 03:20:53 +03:00
nutcas3 17e31d7977 refactor: Refactor tenant and rate plan services with improved code organization and currency integration updates
- Update RatePlanCurrencyIntegrator to use billingService.ConvertAmount with CurrencyConversionRequest struct instead of exchangeService
- Remove calculateOverageCost method from rateplan_methods.go (moved or deprecated)
- Rename tenant variable to newTenant in CreateTenant to avoid shadowing
- Extract tenant user methods from tenant_user.go to new tenant_user_methods.go file
2026-05-02 03:18:45 +03:00
nutcas3 a11ad09109 refactor: Move tenant repository implementation to tenant package and update imports
- Move GormTenantRepository implementation from repository package to tenant package
- Move TenantResourceValidator from repository to tenant package
- Update tenant_aware_repository.go to import tenant package for Tenant and TenantStatusActive types
- Remove duplicate tenant model definitions and helper methods from repository package
- Update ValidateTenant to use tenant.Tenant and tenant.TenantStatusActive types
2026-05-02 03:18:18 +03:00
nutcas3 77483349c9 refactor: Extract ES2 types from client.go to separate types.go file
- Move ES2Client struct definition from client.go to types.go
- Move DownloadProfileRequest, DownloadProfileResponse, GetProfileStatusRequest, GetProfileStatusResponse types to types.go
- Move DeleteProfileRequest, DeleteProfileResponse, EnableProfileRequest, EnableProfileResponse types to types.go
- Move DisableProfileRequest, DisableProfileResponse types to types.go
- Add net/http, time, and config package imports to types.go
2026-05-02 02:51:41 +03:00
nutcas3 9faf20cce4 feat: Add TenantRepository interface with CRUD operations, user management, API keys, usage tracking, and event logging
- Add TenantRepository interface with CreateTenant, GetTenant, GetTenantByDomain, UpdateTenant, DeleteTenant, ListTenants, CountTenants methods
- Add CreateTenantUser, GetTenantUser, UpdateTenantUser, DeleteTenantUser, ListTenantUsers, CountTenantUsers for user management
- Add CreateAPIKey, GetAPIKey, GetAPIKeyByHash, UpdateAPIKey, DeleteAPIKey, ListAPIKeys for API key operations
2026-05-02 02:51:14 +03:00
nutcas3 0ebf301c2e refactor: Update tenant integration to use concrete service types and tenant package imports
- Change TenantIntegrationManager.tenantService from Service interface to *services.TenantServiceImpl concrete type
- Change TenantResourceQuotaChecker.tenantService from Service interface to *services.TenantServiceImpl
- Change TenantEventLogger.tenantService from Service interface to *services.TenantServiceImpl
- Update TenantAwareServices fields to use tenant package types (TenantContext, TenantConfig)
2026-05-02 02:50:59 +03:00
nutcas3 bf5ee28917 feat: Add currency analytics, billing, and exchange rate services with multi-currency support and transaction processing
- Add AnalyticsServiceImpl with revenue/volume analysis, exchange rate trends, usage stats, and transaction type analytics
- Add GetRevenueByCurrency, GetTransactionVolumeByCurrency, GetExchangeRateTrends, GetCurrencyUsageStats methods
- Add GetMonthlyRevenueTrends, GetTopCurrenciesByRevenue, GetTransactionTypeAnalytics for reporting
- Add BillingServiceImpl with multi-currency billing, payment
2026-05-02 02:50:41 +03:00
nutcas3 d3d43e5f35 feat: Add tenant integration layer with repository wrapper, analytics types, and performance monitoring
- Add TenantAwareCurrencyRepository wrapper with tenant isolation for all currency repository methods
- Add NewTenantAwareCurrencyRepository and WithTenant methods for tenant context management
- Add TenantIntegrationManager with GetTenantAwareServices for tenant validation and configuration
- Add TenantAwareServices struct with tenant context, config, and currency service fields
- Add TenantResource
2026-05-02 02:44:48 +03:00
nutcas3 d70a3d930d refactor: Move tenant repository files to repository package and update imports
- Move tenant_aware_repository.go from internal/tenant to internal/repository package
- Move repository.go to tenant_repository.go in internal/repository package
- Add tenant package import for type references in tenant_repository.go
- Update filter type references to use tenant package prefix (TenantFilter, TenantUserFilter, TenantUsageFilter)
- Update return type for GetUsageStats to use tenant.TenantUsageStats
2026-05-02 02:39:35 +03:00
nutcas3 eba28198e4 Merge branch 'main' of https://github.com/nutcas3/telecom-platform into new-features 2026-05-02 01:39:58 +03:00
nutcas3 5dd8f4cbb7 feat: Add tenant-aware repository layer with isolation, validation, query building, and resource access control
- Add TenantAwareRepository with GORM database and tenant ID fields
- Add NewTenantAwareRepository, WithTenant, GetTenantID, ValidateTenant methods for tenant context management
- Add TenantScopedQuery and TenantScopedTransaction for tenant-isolated database operations
- Add CreateWithTenant, GetByTenantID, UpdateWithTenant, DeleteWithTenant, ListWithTenant, CountWithTenant helper methods
- Add TenantA
2026-05-02 01:39:46 +03:00
nutcas3 6693f83437 feat: Add tenant service implementation with CRUD operations, user management, API key handling, and event logging
- Add ServiceImpl struct with repository, rate limiter, event publisher, config manager, audit logger, metrics collector, and logger fields
- Add CreateTenant with validation, domain uniqueness check, default settings/quotas/features initialization, and tenant created event
- Add GetTenant, GetTenantByDomain, UpdateTenant, DeleteTenant, and ListTenants methods with event logging
2026-05-02 01:39:36 +03:00
nutcas3 a27c21b873 feat: Add tenant service extended methods with quota management, usage tracking, permissions, and metrics collection
- Add CheckQuota method with quota limit validation, unlimited quota support (-1), and quota exceeded event logging
- Add GetUsageStats with resource breakdown, quota status calculation, warning/critical thresholds, and active user counting
- Add UpdateUsage with automatic usage record creation and existing record updates
- Add GetQuotaStatus, GetTenantConfig, UpdateTenantConfig, Get
2026-05-02 01:39:21 +03:00
nutcas3 b0bb0908e1 feat: Add tenant repository implementation with GORM-based data access layer for multi-tenancy support
- Add GormTenantRepository struct with GORM database field
- Add CreateTenant, GetTenant, GetTenantByDomain, UpdateTenant, DeleteTenant methods with context support
- Add ListTenants and CountTenants with filtering by ID, name, domain, status, plan, sorting, and pagination
- Add CreateTenantUser, GetTenantUser, UpdateTenantUser, DeleteTenantUser methods for user management
- Add ListTenantUsers and
2026-05-02 01:39:10 +03:00
nutcas3 6261c51d70 feat: Add tenant domain models with multi-tenancy support, user management, usage tracking, and API key authentication
- Add Tenant struct with plan, limits, settings, and metadata fields
- Add TenantStatus constants (active, inactive, suspended, deleted)
- Add TenantPlan constants (free, basic, pro, enterprise)
- Add TenantSettings with currency, feature flags, rate limiting, security, and compliance configuration
- Add PasswordPolicy struct with length, character requirements, and age settings
2026-05-02 01:39:00 +03:00
nutcas3 69951d68db feat: Add tenant middleware with authentication, authorization, isolation, and activity logging
- Add TenantMiddleware struct with tenant service and logger fields
- Add ExtractTenantFromHeader and ExtractTenantFromAPIKey methods for tenant identification from headers, subdomains, and API keys
- Add RequireTenant middleware with header and API key extraction fallback and tenant access validation
- Add RequireTenantRole middleware with role-based access control for multiple required roles
2026-05-02 01:38:47 +03:00
nutcas3 00ad4f34e3 feat: Add tenant package interfaces with repository, service, middleware, and supporting components
- Add Repository interface with tenant CRUD, user management, API keys, usage tracking, config, and event operations
- Add Service interface with tenant management, user operations, API key handling, quota checking, config management, authentication, and analytics methods
- Add Middleware interface with request extraction, access validation, context injection, rate limiting, and resource isolation
2026-05-02 01:38:30 +03:00
nutcas3 4c45a50823 feat: Add tenant integration layer with repository wrapper, service manager, quota checker, and event logger
- Add TenantAwareCurrencyRepository wrapper with tenant isolation for all currency repository methods
- Add NewTenantAwareCurrencyRepository and WithTenant methods for tenant context management
- Add TenantIntegrationManager with GetTenantAwareServices for tenant validation and configuration
- Add TenantAwareServices struct with tenant context, config, and currency service fields
- Add TenantResourceQuotaChecker
2026-05-02 01:38:15 +03:00
nutcas3 6b8c7f9760 feat: Add tenant types package with filters, requests, usage stats, events, and metrics domain models
- Add TenantFilter with ID, name, domain, status, plan, pagination, and sorting fields
- Add CreateTenantRequest, UpdateTenantRequest with plan, limits, settings, and metadata support
- Add TenantUserFilter, CreateTenantUserRequest, UpdateTenantUserRequest with role and status management
- Add CreateAPIKeyRequest, UpdateAPIKeyRequest with permissions, rate limits, and expiration support
- Add TenantUs
2026-05-02 01:37:25 +03:00
nutcas3 5e8d217527 feat: Add tenant analytics service with dashboard, usage, performance, cost analytics, and comprehensive reporting
- Add TenantAnalyticsService struct with repository, metrics collector, event publisher, and logger fields
- Add GetTenantDashboard with usage stats, metrics, recent events, and quota status aggregation
- Add GetTenantMetrics with active users, request tracking, error rate calculation, response time analysis, and health score computation
- Add GetUsageAnalytics with time range filtering, resource type breakdown
2026-05-02 01:36:45 +03:00
nutcas3 ea11a73ebc feat: Add tenant handler layer with CRUD, user management, API keys, and analytics endpoints
- Add TenantHandler struct with tenant service and logger fields
- Add CreateTenant, GetTenant, GetTenantByDomain, UpdateTenant, DeleteTenant, and ListTenants endpoints
- Add AddUserToTenant, GetTenantUser, UpdateTenantUser, RemoveUserFromTenant, and ListTenantUsers endpoints
- Add CreateAPIKey, GetAPIKey, UpdateAPIKey, DeleteAPIKey, and ListAPIKeys endpoints with key string return on creation
2026-05-02 01:36:26 +03:00
nutcas3 4fe9d22284 feat: Add repository types package with rate plan, subscription, usage, and analytics domain models
- Add Repository interface with rate plan CRUD, subscription management, usage tracking, and analytics operations
- Add RatePlan struct with pricing, allowances, overage rates, discounts, and metadata fields
- Add RatePlanSubscription struct with billing cycle, auto-renewal, and applied discounts support
- Add RatePlanUsage struct with cycle tracking and data/voice/SMS usage metrics
- Add filter types for rate plans, subscriptions, usage analytics, and revenue analytics
2026-05-02 01:24:23 +03:00
nutcas3 a9df60801b refactor: Rename currency parameter from 'currency' to 'curr' in currencyToModel helper method and add Service interface to rate plan package
- Rename currency parameter to curr in GormRepository.currencyToModel to avoid shadowing currency package name
- Add Service interface with rate plan, subscription, usage, and analytics operations
- Add CreateRatePlan, GetRatePlan, UpdateRatePlan, DeleteRatePlan, ListRatePlans, and SearchRatePlans methods
- Add SubscribeToPlan, GetSubscription, UpdateSubscription, CancelSubscription, GetActiveSubscription, and ListSubscriptions methods
- Add Rec
2026-05-02 01:23:40 +03:00
nutcas3 eb7e05d967 refactor: Update handler constructors to use interface types instead of concrete implementations
- Update CurrencyHandler.exchangeService field from *currency.ExchangeRateService to currency.ExchangeRateService interface
- Update NewCurrencyHandler parameter from *currency.ExchangeRateService to currency.ExchangeRateService interface
- Update RatePlanHandler.service field from *rateplan.Service to rateplan.Service interface
- Update NewRatePlanHandler parameter from *rateplan.Service to rateplan.Service interface
2026-05-02 01:23:24 +03:00
nutcas3 ebb9bb4148 refactor: Update service layer to use repository package types and align imports
- Update Service struct to use repository.Repository interface
- Update all method signatures to use repository package types (RatePlan, RatePlanSubscription, RatePlanUsage, etc.)
- Update filter and request types to use repository package (RatePlanFilter, SubscriptionFilter, CalculateCostRequest, etc.)
- Update status constants to use repository package (SubscriptionStatusActive, PlanStatusActive, DiscountTypePercentage, DiscountTypeFixed)
2026-05-02 01:23:00 +03:00
nutcas3 a31344714e refactor: Add ExchangeRateService interface and format currency types with consistent alignment
- Add ExchangeRateService interface with GetExchangeRate, ConvertAmount, GetRateHistory, UpdateExchangeRate, GetSupportedCurrencies, ValidateCurrencyPair, and RefreshRates methods
- Add CurrencyRevenue struct with currency and revenue fields
- Add TransactionTypeStats struct with type, count, amount, and currency fields
- Align struct field tags consistently across Currency, ExchangeRate, Transaction, and request/response types
2026-05-02 01:22:37 +03:00
nutcas3 295649bcea refactor: Rename service package to services and move repository implementations to repository package
- Rename internal/service to internal/services in carrier-connector
- Update service imports in selection_integration.go and smdp_integration.go
- Move currency repository files from internal/currency to internal/repository
- Move rate plan repository files from internal/rateplan to internal/repository
- Update package declarations and imports for currency domain types
- Add currency package imports
2026-05-02 01:21:18 +03:00
nutcas3 c93dd63474 feat: Add currency handler layer with conversion, billing, exchange rates, and analytics endpoints
- Add CurrencyHandler struct with billing service, exchange service, and logger fields
- Add ConvertCurrency endpoint with JSON binding and amount conversion support
- Add GetExchangeRate endpoint with currency pair path parameters
- Add ProcessBilling endpoint with billing request validation and transaction processing
- Add GetBillingHistory with profile ID filtering, date range, limit, and offset support
2026-05-02 00:38:29 +03:00
nutcas3 077e381995 feat: Add currency repository with GORM implementation, rate plan integration, and transaction management
- Add GormRepository with CRUD operations for currencies, exchange rates, and transactions
- Add repository helper methods for model-to-domain conversions with JSON metadata handling
- Add GetHistoricalRates with date range filtering and chronological ordering
- Add ListExchangeRates with currency pair, active status, and date range filtering
- Add CreateTransaction, GetTransaction, UpdateTransaction, and List
2026-05-02 00:37:52 +03:00
nutcas3 7dbabbb8db feat: Add rate plan currency integrator with subscription creation, cost calculation, and multi-currency billing support
- Add RatePlanCurrencyIntegrator struct with billing service, exchange service, rate plan service, logger, and base currency fields
- Add NewRatePlanCurrencyIntegrator constructor with dependency injection
- Add SubscribeToPlanWithCurrency with price conversion, subscription creation, and initial billing processing
- Add CalculatePlanCostInCurrency with base cost calculation
2026-05-02 00:36:47 +03:00
nutcas3 6b13e0300e refactor: Extract currency interfaces and GORM models into separate files
- Move Repository, ExchangeRateProvider, BillingService, and AnalyticsService interfaces from types.go to new interface.go
- Move BillingSummary and CurrencyUsageStats structs to interface.go
- Move CurrencyModel, ExchangeRateModel, and TransactionModel to new models.go
- Move GORM hooks (BeforeCreate, BeforeUpdate) and TableName methods to models.go
- Remove redundant comments from exchange_rate_service.go
2026-05-02 00:36:19 +03:00
nutcas3 599b7dbd9f feat: Add exchange rate service with multi-provider support, currency conversion, and historical rate tracking
- Add ExchangeRateService struct with repository, logger, providers, and base currency fields
- Add NewExchangeRateService constructor and AddProvider for provider registration
- Add GetExchangeRate with repository caching, provider fallback, and same-currency handling
- Add ConvertAmount wrapper with exchange rate retrieval and amount calculation
- Add RefreshRates with multi-provider rate
2026-05-02 00:35:29 +03:00