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
This commit is contained in:
nutcas3
2026-05-02 05:38:06 +03:00
parent 6fc23dff0b
commit 6f8b53f7da
6 changed files with 246 additions and 19 deletions
@@ -4,6 +4,7 @@ import (
"context"
"time"
"github.com/nutcas3/telecom-platform/apps/carrier-connector/internal/id"
"github.com/nutcas3/telecom-platform/apps/carrier-connector/internal/tenant"
)
@@ -40,7 +41,7 @@ func (s *TenantServiceImpl) buildQuotaStatus(usageStats *tenant.TenantUsageStats
if err != nil {
// Create empty usage if not found
usage = &tenant.TenantUsage{
ID: generateUsageID(resourceType, usageStats.TenantID),
ID: id.GenerateUsageID(resourceType, usageStats.TenantID),
TenantID: usageStats.TenantID,
ResourceType: resourceType,
ResourceCount: 0,