Files
telecom-platform/apps/carrier-connector/internal/rateplan/interface.go
T
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

67 lines
3.5 KiB
Go

package rateplan
import (
"context"
)
// Service defines the interface for rate plan business operations
type Service interface {
// Rate Plan operations
CreateRatePlan(ctx context.Context, plan *RatePlan) (*RatePlan, error)
GetRatePlan(ctx context.Context, id string) (*RatePlan, error)
UpdateRatePlan(ctx context.Context, plan *RatePlan) (*RatePlan, error)
DeleteRatePlan(ctx context.Context, id string) error
ListRatePlans(ctx context.Context, filter *RatePlanFilter) ([]*RatePlan, error)
SearchRatePlans(ctx context.Context, criteria SearchCriteria) ([]*RatePlan, error)
// Subscription operations
SubscribeToPlan(ctx context.Context, req *SubscribeRequest) (*RatePlanSubscription, error)
GetSubscription(ctx context.Context, id string) (*RatePlanSubscription, error)
UpdateSubscription(ctx context.Context, subscription *RatePlanSubscription) (*RatePlanSubscription, error)
CancelSubscription(ctx context.Context, subscriptionID string, reason string) error
GetActiveSubscription(ctx context.Context, profileID string) (*RatePlanSubscription, error)
ListSubscriptions(ctx context.Context, profileID string, filter *SubscriptionFilter) ([]*RatePlanSubscription, error)
// Usage operations
RecordUsage(ctx context.Context, req *RecordUsageRequest) (*RatePlanUsage, error)
GetUsage(ctx context.Context, id string) (*RatePlanUsage, error)
GetUsageHistory(ctx context.Context, profileID string, limit int) ([]*RatePlanUsage, error)
CalculateCost(ctx context.Context, req *CalculateCostRequest) (*RatePlanCostCalculation, error)
// Analytics operations
GetUsageAnalytics(ctx context.Context, filter *UsageAnalyticsFilter) (*UsageAnalytics, error)
GetRevenueAnalytics(ctx context.Context, filter *RevenueAnalyticsFilter) (*RevenueAnalytics, error)
GetPopularPlans(ctx context.Context, limit int) ([]*RatePlan, error)
}
// Repository defines the interface for rate plan data operations
type Repository interface {
// Rate Plan operations
CreateRatePlan(ctx context.Context, plan *RatePlan) error
GetRatePlan(ctx context.Context, id string) (*RatePlan, error)
UpdateRatePlan(ctx context.Context, plan *RatePlan) error
DeleteRatePlan(ctx context.Context, id string) error
ListRatePlans(ctx context.Context, filter *RatePlanFilter) ([]*RatePlan, error)
CountRatePlans(ctx context.Context, filter *RatePlanFilter) (int, error)
// Subscription operations
CreateSubscription(ctx context.Context, subscription *RatePlanSubscription) error
GetSubscription(ctx context.Context, id string) (*RatePlanSubscription, error)
UpdateSubscription(ctx context.Context, subscription *RatePlanSubscription) error
DeleteSubscription(ctx context.Context, id string) error
ListSubscriptions(ctx context.Context, profileID string, filter *SubscriptionFilter) ([]*RatePlanSubscription, error)
GetActiveSubscription(ctx context.Context, profileID string) (*RatePlanSubscription, error)
// Usage tracking operations
CreateUsage(ctx context.Context, usage *RatePlanUsage) error
GetUsage(ctx context.Context, id string) (*RatePlanUsage, error)
UpdateUsage(ctx context.Context, usage *RatePlanUsage) error
GetCurrentUsage(ctx context.Context, profileID string) (*RatePlanUsage, error)
ListUsageHistory(ctx context.Context, profileID string, limit int) ([]*RatePlanUsage, error)
// Analytics and reporting
GetUsageAnalytics(ctx context.Context, filter *UsageAnalyticsFilter) (*UsageAnalytics, error)
GetRevenueAnalytics(ctx context.Context, filter *RevenueAnalyticsFilter) (*RevenueAnalytics, error)
GetPopularPlans(ctx context.Context, limit int) ([]*RatePlan, error)
}