INNER CODE UNIT · Go

getAvailableModules

theopenlane/core · cmd/catalog/main.go:667

func getAvailableModules(cat *catalog.Catalog, subscription *stripe.Subscription) map[string]catalog.Feature {
	// Get current subscription price IDs
	currentPrices := make(map[string]bool)

	if subscription != nil && subscription.Items != nil {
		for _, item := range subscription.Items.Data {
			if item.Price != nil {
				currentPrices[item.Price.ID] = true
			}
		}
	}

	// Filter out modules that are already in the subscription
	available := make(map[string]catalog.Feature)

	for name, module := range cat.Modules {
		// Skip if any price for this module is already in the subscription
		hasPrice := false

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…