diff --git a/apps/carrier-connector/internal/rateplan/interface.go b/apps/carrier-connector/internal/rateplan/interface.go index 4896d08..592b221 100644 --- a/apps/carrier-connector/internal/rateplan/interface.go +++ b/apps/carrier-connector/internal/rateplan/interface.go @@ -4,6 +4,36 @@ 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 diff --git a/apps/carrier-connector/internal/repository/repository_helpers.go b/apps/carrier-connector/internal/repository/repository_helpers.go index 1570212..9e780f3 100644 --- a/apps/carrier-connector/internal/repository/repository_helpers.go +++ b/apps/carrier-connector/internal/repository/repository_helpers.go @@ -9,16 +9,16 @@ import ( ) // currencyToModel converts currency domain model to database model -func (r *GormRepository) currencyToModel(currency *currency.Currency) *currency.CurrencyModel { +func (r *GormRepository) currencyToModel(curr *currency.Currency) *currency.CurrencyModel { return ¤cy.CurrencyModel{ - Code: currency.Code, - Name: currency.Name, - Symbol: currency.Symbol, - DecimalPlaces: currency.DecimalPlaces, - IsActive: currency.IsActive, - SupportedRegions: strings.Join(currency.SupportedRegions, ","), - CreatedAt: currency.CreatedAt, - UpdatedAt: currency.UpdatedAt, + Code: curr.Code, + Name: curr.Name, + Symbol: curr.Symbol, + DecimalPlaces: curr.DecimalPlaces, + IsActive: curr.IsActive, + SupportedRegions: strings.Join(curr.SupportedRegions, ","), + CreatedAt: curr.CreatedAt, + UpdatedAt: curr.UpdatedAt, } }