entmapping

package
v0.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package entmapping provides some builders to assist in the type mapping between Stripe + the external generic definitions in pkg/catalog and pkg/entitlements and the internal ent generated types not intended for external use, but rather as a helper for the Openlane core application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyStripePrice

func ApplyStripePrice[T OrgPriceSetter[T]](b T, p *stripe.Price) T

ApplyStripePrice sets fields on the provided ent builder from the stripe.Price

func ApplyStripeProduct

func ApplyStripeProduct[T OrgProductSetter[T]](b T, p *stripe.Product) T

ApplyStripeProduct sets fields on the provided ent builder from the stripe.Product

func ApplyStripeSubscription

func ApplyStripeSubscription[T OrgSubscriptionSetter[T]](b T, sub *stripe.Subscription, cust *entitlements.OrganizationCustomer) T

ApplyStripeSubscription sets fields on the ent builder from the stripe.Subscription and customer info

func ApplyStripeSubscriptionItem

func ApplyStripeSubscriptionItem[T OrgModuleSetter[T]](b T, item *stripe.SubscriptionItem) T

ApplyStripeSubscriptionItem sets fields on the ent builder from the stripe.SubscriptionItem

func StripePriceToOrgPrice

func StripePriceToOrgPrice(p *stripe.Price) *ent.OrgPrice

StripePriceToOrgPrice converts a stripe.Price to an OrgPrice

func StripeProductToOrgProduct

func StripeProductToOrgProduct(p *stripe.Product) *ent.OrgProduct

StripeProductToOrgProduct converts a stripe.Product to an OrgProduct

func StripeSubscriptionItemToOrgModule

func StripeSubscriptionItemToOrgModule(item *stripe.SubscriptionItem) *ent.OrgModule

StripeSubscriptionItemToOrgModule converts a stripe.SubscriptionItem to an OrgModule

func StripeSubscriptionToOrgSubscription

func StripeSubscriptionToOrgSubscription(sub *stripe.Subscription, cust *entitlements.OrganizationCustomer) *ent.OrgSubscription

StripeSubscriptionToOrgSubscription converts a stripe.Subscription and OrganizationCustomer info to an OrgSubscription.

Types

type OrgModuleSetter

type OrgModuleSetter[T any] interface {
	SetModule(string) T
	SetPrice(models.Price) T
	SetStripePriceID(string) T
	SetStatus(string) T
	SetVisibility(string) T
	SetModuleLookupKey(string) T
}

OrgModuleSetter defines the methods needed to set OrgModule fields on ent builders

type OrgPriceSetter

type OrgPriceSetter[T any] interface {
	SetStripePriceID(string) T
	SetPrice(models.Price) T
	SetStatus(string) T
	SetActive(bool) T
	SetProductID(string) T
}

OrgPriceSetter defines the methods needed to set OrgPrice fields on ent builders. It uses a generic type parameter so that the concrete builder type is returned from each setter, enabling call chaining.

type OrgProductSetter

type OrgProductSetter[T any] interface {
	SetModule(string) T
	SetStripeProductID(string) T
	SetStatus(string) T
	SetActive(bool) T
	SetPriceID(string) T
}

OrgProductSetter defines the methods needed to set OrgProduct fields on ent builders

type OrgSubscriptionSetter

type OrgSubscriptionSetter[T any] interface {
	SetStripeSubscriptionID(string) T
	SetStripeSubscriptionStatus(string) T
	SetActive(bool) T
	SetStripeCustomerID(string) T
	SetProductTier(string) T
	SetStripeProductTierID(string) T
	SetProductPrice(models.Price) T
	SetTrialExpiresAt(time.Time) T
	SetDaysUntilDue(string) T
	SetFeatures([]string) T
	SetFeatureLookupKeys([]string) T
	SetPaymentMethodAdded(bool) T
}

OrgSubscriptionSetter defines the methods needed to set OrgSubscription fields on ent builders

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL