Skip to content

Commit

Permalink
Custom subscriptions (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
GAlexIHU authored Dec 10, 2024
1 parent 3861393 commit ceef8d3
Show file tree
Hide file tree
Showing 36 changed files with 786 additions and 464 deletions.
7 changes: 4 additions & 3 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
plan "github.com/openmeterio/openmeter/openmeter/productcatalog/plan"
planadapter "github.com/openmeterio/openmeter/openmeter/productcatalog/plan/adapter"
planservice "github.com/openmeterio/openmeter/openmeter/productcatalog/plan/service"
plansubscription "github.com/openmeterio/openmeter/openmeter/productcatalog/subscription"
"github.com/openmeterio/openmeter/openmeter/registry"
registrybuilder "github.com/openmeterio/openmeter/openmeter/registry/builder"
secretadapter "github.com/openmeterio/openmeter/openmeter/secret/adapter"
Expand All @@ -51,7 +52,6 @@ import (
"github.com/openmeterio/openmeter/openmeter/server/router"
"github.com/openmeterio/openmeter/openmeter/subscription"
subscriptionentitlement "github.com/openmeterio/openmeter/openmeter/subscription/adapters/entitlement"
subscriptionplan "github.com/openmeterio/openmeter/openmeter/subscription/adapters/plan"
subscriptionrepo "github.com/openmeterio/openmeter/openmeter/subscription/repo"
subscriptionservice "github.com/openmeterio/openmeter/openmeter/subscription/service"
"github.com/openmeterio/openmeter/pkg/errorsx"
Expand Down Expand Up @@ -358,6 +358,7 @@ func main() {
// Initialize subscriptions
var subscriptionService subscription.Service
var subscriptionWorkflowService subscription.WorkflowService
var planSubscriptionAdapter plansubscription.Adapter
if conf.ProductCatalog.Enabled {
subscriptionRepo := subscriptionrepo.NewSubscriptionRepo(app.EntClient)
subscriptionPhaseRepo := subscriptionrepo.NewSubscriptionPhaseRepo(app.EntClient)
Expand All @@ -369,7 +370,7 @@ func main() {
subscriptionItemRepo,
)

subscriptionPlanAdapter := subscriptionplan.NewSubscriptionPlanAdapter(subscriptionplan.PlanSubscriptionAdapterConfig{
planSubscriptionAdapter = plansubscription.NewPlanSubscriptionAdapter(plansubscription.PlanSubscriptionAdapterConfig{
PlanService: planService,
Logger: logger.With("subsystem", "subscription.plan.adapter"),
})
Expand All @@ -386,7 +387,6 @@ func main() {
subscriptionWorkflowService = subscriptionservice.NewWorkflowService(subscriptionservice.WorkflowServiceConfig{
Service: subscriptionService,
CustomerService: customerService,
PlanAdapter: subscriptionPlanAdapter,
TransactionManager: subscriptionRepo,
})
}
Expand Down Expand Up @@ -437,6 +437,7 @@ func main() {
EntitlementConnector: entitlementConnRegistry.Entitlement,
SubscriptionService: subscriptionService,
SubscriptionWorkflowService: subscriptionWorkflowService,
SubscriptionPlanAdapter: planSubscriptionAdapter,
Logger: logger,
FeatureConnector: entitlementConnRegistry.Feature,
GrantConnector: entitlementConnRegistry.Grant,
Expand Down
Loading

0 comments on commit ceef8d3

Please sign in to comment.