Documentation
¶
Index ¶
- Constants
- Variables
- func AddonWithAllowedStatus(allowed ...AddonStatus) models.ValidatorFunc[Addon]
- func AddonWithBillingCadenceAligned() models.ValidatorFunc[Addon]
- func AddonWithCompatiblePrices() models.ValidatorFunc[Addon]
- func PlanWithAllowedStatus(allowed ...PlanStatus) models.ValidatorFunc[Plan]
- type Addon
- type AddonInstanceType
- type AddonMeta
- type AddonStatus
- type Alignment
- type AlignmentUpdate
- type BooleanEntitlementTemplate
- type Commitments
- type Discounts
- type DynamicPrice
- type EffectivePeriod
- type EntitlementTemplate
- func (e *EntitlementTemplate) AsBoolean() (BooleanEntitlementTemplate, error)
- func (e *EntitlementTemplate) AsMetered() (MeteredEntitlementTemplate, error)
- func (e *EntitlementTemplate) AsStatic() (StaticEntitlementTemplate, error)
- func (e *EntitlementTemplate) Equal(v *EntitlementTemplate) bool
- func (e *EntitlementTemplate) FromBoolean(t BooleanEntitlementTemplate)
- func (e *EntitlementTemplate) FromMetered(t MeteredEntitlementTemplate)
- func (e *EntitlementTemplate) FromStatic(t StaticEntitlementTemplate)
- func (e *EntitlementTemplate) MarshalJSON() ([]byte, error)
- func (e *EntitlementTemplate) Type() entitlement.EntitlementType
- func (e *EntitlementTemplate) UnmarshalJSON(bytes []byte) error
- func (e *EntitlementTemplate) Validate() error
- type FlatFeeRateCard
- func (r *FlatFeeRateCard) AsMeta() RateCardMeta
- func (r *FlatFeeRateCard) ChangeMeta(fn func(m RateCardMeta) (RateCardMeta, error)) error
- func (r *FlatFeeRateCard) Clone() RateCard
- func (r *FlatFeeRateCard) Compatible(v RateCard) error
- func (r *FlatFeeRateCard) Equal(v RateCard) bool
- func (r *FlatFeeRateCard) GetBillingCadence() *isodate.Period
- func (r *FlatFeeRateCard) Key() string
- func (r *FlatFeeRateCard) MarshalJSON() ([]byte, error)
- func (r *FlatFeeRateCard) Merge(v RateCard) error
- func (r *FlatFeeRateCard) Type() RateCardType
- func (r *FlatFeeRateCard) Validate() error
- type FlatPrice
- type MeteredEntitlementTemplate
- type PackagePrice
- type PaymentTermType
- type PercentageDiscount
- type Phase
- type PhaseMeta
- type Plan
- type PlanAddon
- type PlanAddonConfig
- type PlanAddonMeta
- type PlanMeta
- type PlanStatus
- type Price
- func (p *Price) AsDynamic() (DynamicPrice, error)
- func (p *Price) AsFlat() (FlatPrice, error)
- func (p *Price) AsPackage() (PackagePrice, error)
- func (p *Price) AsTiered() (TieredPrice, error)
- func (p *Price) AsUnit() (UnitPrice, error)
- func (p *Price) Clone() *Price
- func (p *Price) Equal(v *Price) bool
- func (p *Price) FromDynamic(price DynamicPrice)
- func (p *Price) FromFlat(price FlatPrice)
- func (p *Price) FromPackage(price PackagePrice)
- func (p *Price) FromTiered(price TieredPrice)
- func (p *Price) FromUnit(price UnitPrice)
- func (p *Price) GetCommitments() Commitments
- func (p *Price) MarshalJSON() ([]byte, error)
- func (p *Price) Type() PriceType
- func (p *Price) UnmarshalJSON(bytes []byte) error
- func (p *Price) Validate() error
- type PriceTier
- type PriceTierFlatPrice
- type PriceTierUnitPrice
- type PriceType
- type RateCard
- type RateCardMeta
- type RateCardSerde
- type RateCardType
- type RateCards
- func (c RateCards) At(idx int) RateCard
- func (c RateCards) Billables() RateCards
- func (c RateCards) BillingCadenceAligned() bool
- func (c RateCards) Clone() RateCards
- func (c RateCards) Compatible(overlays RateCards) error
- func (c RateCards) Equal(v RateCards) bool
- func (c RateCards) Validate() error
- type StaticEntitlementTemplate
- type StripeTaxConfig
- type TaxBehavior
- type TaxConfig
- type TieredPrice
- type TieredPriceMode
- type UnitPrice
- type UsageBasedRateCard
- func (r *UsageBasedRateCard) AsMeta() RateCardMeta
- func (r *UsageBasedRateCard) ChangeMeta(fn func(m RateCardMeta) (RateCardMeta, error)) error
- func (r *UsageBasedRateCard) Clone() RateCard
- func (r *UsageBasedRateCard) Compatible(v RateCard) error
- func (r *UsageBasedRateCard) Equal(v RateCard) bool
- func (r *UsageBasedRateCard) GetBillingCadence() *isodate.Period
- func (r *UsageBasedRateCard) Key() string
- func (r *UsageBasedRateCard) MarshalJSON() ([]byte, error)
- func (r *UsageBasedRateCard) Merge(v RateCard) error
- func (r *UsageBasedRateCard) Type() RateCardType
- func (r *UsageBasedRateCard) Validate() error
- type UsageDiscount
Constants ¶
const DefaultPaymentTerm = InAdvancePaymentTerm
Variables ¶
var DynamicPriceDefaultMultiplier = decimal.NewFromFloat(1)
var StripeProductTaxCodeRegexp = regexp.MustCompile(`^txcd_\d{8}$`)
Functions ¶
func AddonWithAllowedStatus ¶
func AddonWithAllowedStatus(allowed ...AddonStatus) models.ValidatorFunc[Addon]
func AddonWithBillingCadenceAligned ¶
func AddonWithBillingCadenceAligned() models.ValidatorFunc[Addon]
func AddonWithCompatiblePrices ¶
func AddonWithCompatiblePrices() models.ValidatorFunc[Addon]
func PlanWithAllowedStatus ¶
func PlanWithAllowedStatus(allowed ...PlanStatus) models.ValidatorFunc[Plan]
Types ¶
type Addon ¶
func (Addon) Publishable ¶
Publishable validates the Addon to ensure that it meets all requirements needed for being published. It is a stricter version of Validate. It is the caller responsibility to handle managed resource specific parameters to ensure the Addon is eligible for publishing. E.g. checking the DeletedAt attribute of the addon.Addon.
func (Addon) ValidateWith ¶
func (a Addon) ValidateWith(validators ...models.ValidatorFunc[Addon]) error
type AddonInstanceType ¶
type AddonInstanceType string
const ( AddonInstanceTypeSingle AddonInstanceType = "single" AddonInstanceTypeMultiple AddonInstanceType = "multiple" )
func (AddonInstanceType) Validate ¶
func (a AddonInstanceType) Validate() error
func (AddonInstanceType) Values ¶
func (a AddonInstanceType) Values() []string
type AddonMeta ¶
type AddonMeta struct {
EffectivePeriod
// Key is the unique key for Add-on.
Key string `json:"key"`
// Version
Version int `json:"version"`
// Name
Name string `json:"name"`
// Description
Description *string `json:"description,omitempty"`
// Currency
Currency currency.Code `json:"currency"`
// InstanceType
InstanceType AddonInstanceType `json:"instanceType"`
// Metadata
Metadata models.Metadata `json:"metadata,omitempty"`
// Annotations
Annotations models.Annotations `json:"annotations,omitempty"`
}
func (AddonMeta) Status ¶
func (m AddonMeta) Status() AddonStatus
Status returns the current status of the Addons
type AddonStatus ¶
type AddonStatus string
const ( AddonStatusDraft AddonStatus = "draft" AddonStatusActive AddonStatus = "active" AddonStatusArchived AddonStatus = "archived" AddonStatusInvalid AddonStatus = "invalid" )
func (AddonStatus) Values ¶
func (s AddonStatus) Values() []string
type Alignment ¶
type Alignment struct {
// BillablesMustAlign indicates whether all billable items in a given phase must share the same BillingPeriodDuration.
BillablesMustAlign bool `json:"billablesMustAlign"`
}
type AlignmentUpdate ¶
type AlignmentUpdate struct {
BillablesMustAlign *bool `json:"billablesMustAlign,omitempty"`
}
AlignmentUpdate is used for the nil-ish comparison of the plan service only
type BooleanEntitlementTemplate ¶
type BooleanEntitlementTemplate struct {
// Metadata a set of key/value pairs describing metadata for the RateCard.
Metadata models.Metadata `json:"metadata,omitempty"`
}
func (*BooleanEntitlementTemplate) Equal ¶
func (t *BooleanEntitlementTemplate) Equal(v *BooleanEntitlementTemplate) bool
func (*BooleanEntitlementTemplate) Validate ¶
func (t *BooleanEntitlementTemplate) Validate() error
type Commitments ¶
type Commitments struct {
// MinimumAmount defines the least amount the customer committed to spend.
MinimumAmount *decimal.Decimal `json:"minimumAmount,omitempty"`
// MaximumAmount defines the upper limit of amount the customer entitled to spend.
MaximumAmount *decimal.Decimal `json:"maximumAmount,omitempty"`
}
func (Commitments) Equal ¶
func (c Commitments) Equal(v Commitments) bool
func (Commitments) Validate ¶
func (c Commitments) Validate() error
type Discounts ¶
type Discounts struct {
Percentage *PercentageDiscount `json:"percentage,omitempty"`
Usage *UsageDiscount `json:"usage,omitempty"`
}
func (Discounts) ValidateForPrice ¶
type DynamicPrice ¶
type DynamicPrice struct {
Commitments `json:",inline"`
// Multiplier defines the multiplier applied to the price.
Multiplier decimal.Decimal `json:"multiplier"`
}
func (DynamicPrice) Clone ¶
func (p DynamicPrice) Clone() DynamicPrice
func (*DynamicPrice) Equal ¶
func (p *DynamicPrice) Equal(v *DynamicPrice) bool
func (DynamicPrice) Validate ¶
func (p DynamicPrice) Validate() error
type EffectivePeriod ¶
type EffectivePeriod struct {
// EffectiveFrom defines the time from the Plan or Addon becomes active.
EffectiveFrom *time.Time `json:"effectiveFrom,omitempty"`
// EffectiveTo defines the time from the Plan or Addon becomes archived.
EffectiveTo *time.Time `json:"effectiveTo,omitempty"`
}
EffectivePeriod describes lifecycle of resource based on the time period defined by it.
func (EffectivePeriod) AsPeriod ¶
func (p EffectivePeriod) AsPeriod() timeutil.OpenPeriod
func (EffectivePeriod) Equal ¶
func (p EffectivePeriod) Equal(o EffectivePeriod) bool
Equal returns true if the two EffectivePeriod objects are equal.
func (EffectivePeriod) Validate ¶
func (p EffectivePeriod) Validate() error
type EntitlementTemplate ¶
type EntitlementTemplate struct {
// contains filtered or unexported fields
}
EntitlementTemplate is the template used for instantiating entitlement.Entitlement for RateCard.
func NewEntitlementTemplateFrom ¶
func NewEntitlementTemplateFrom[T MeteredEntitlementTemplate | StaticEntitlementTemplate | BooleanEntitlementTemplate](c T) *EntitlementTemplate
func (*EntitlementTemplate) AsBoolean ¶
func (e *EntitlementTemplate) AsBoolean() (BooleanEntitlementTemplate, error)
func (*EntitlementTemplate) AsMetered ¶
func (e *EntitlementTemplate) AsMetered() (MeteredEntitlementTemplate, error)
func (*EntitlementTemplate) AsStatic ¶
func (e *EntitlementTemplate) AsStatic() (StaticEntitlementTemplate, error)
func (*EntitlementTemplate) Equal ¶
func (e *EntitlementTemplate) Equal(v *EntitlementTemplate) bool
func (*EntitlementTemplate) FromBoolean ¶
func (e *EntitlementTemplate) FromBoolean(t BooleanEntitlementTemplate)
func (*EntitlementTemplate) FromMetered ¶
func (e *EntitlementTemplate) FromMetered(t MeteredEntitlementTemplate)
func (*EntitlementTemplate) FromStatic ¶
func (e *EntitlementTemplate) FromStatic(t StaticEntitlementTemplate)
func (*EntitlementTemplate) MarshalJSON ¶
func (e *EntitlementTemplate) MarshalJSON() ([]byte, error)
func (*EntitlementTemplate) Type ¶
func (e *EntitlementTemplate) Type() entitlement.EntitlementType
func (*EntitlementTemplate) UnmarshalJSON ¶
func (e *EntitlementTemplate) UnmarshalJSON(bytes []byte) error
func (*EntitlementTemplate) Validate ¶
func (e *EntitlementTemplate) Validate() error
type FlatFeeRateCard ¶
type FlatFeeRateCard struct {
RateCardMeta
// BillingCadence defines the billing cadence of the RateCard in ISO8601 format.
// When nil (null) it means it is a one time fee.
// Example: "P1D12H"
BillingCadence *isodate.Period `json:"billingCadence"`
}
func (*FlatFeeRateCard) AsMeta ¶
func (r *FlatFeeRateCard) AsMeta() RateCardMeta
func (*FlatFeeRateCard) ChangeMeta ¶
func (r *FlatFeeRateCard) ChangeMeta(fn func(m RateCardMeta) (RateCardMeta, error)) error
func (*FlatFeeRateCard) Clone ¶
func (r *FlatFeeRateCard) Clone() RateCard
func (*FlatFeeRateCard) Compatible ¶
func (r *FlatFeeRateCard) Compatible(v RateCard) error
func (*FlatFeeRateCard) Equal ¶
func (r *FlatFeeRateCard) Equal(v RateCard) bool
func (*FlatFeeRateCard) GetBillingCadence ¶
func (r *FlatFeeRateCard) GetBillingCadence() *isodate.Period
func (*FlatFeeRateCard) Key ¶
func (r *FlatFeeRateCard) Key() string
func (*FlatFeeRateCard) MarshalJSON ¶
func (r *FlatFeeRateCard) MarshalJSON() ([]byte, error)
func (*FlatFeeRateCard) Merge ¶
func (r *FlatFeeRateCard) Merge(v RateCard) error
func (*FlatFeeRateCard) Type ¶
func (r *FlatFeeRateCard) Type() RateCardType
func (*FlatFeeRateCard) Validate ¶
func (r *FlatFeeRateCard) Validate() error
type FlatPrice ¶
type FlatPrice struct {
// Amount of the flat price.
Amount decimal.Decimal `json:"amount"`
// PaymentTerm defines the payment term of the flat price.
// Defaults to InAdvancePaymentTerm.
PaymentTerm PaymentTermType `json:"paymentTerm,omitempty"`
}
type MeteredEntitlementTemplate ¶
type MeteredEntitlementTemplate struct {
// Metadata a set of key/value pairs describing metadata for the RateCard.
Metadata models.Metadata `json:"metadata,omitempty"`
// IsSoftLimit set to `true` for allowing the subject to use the feature even if the entitlement is exhausted.
IsSoftLimit bool `json:"isSoftLimit,omitempty"`
// IssueAfterReset defines the amount to be automatically granted at entitlement.Entitlement creation or reset.
IssueAfterReset *float64 `json:"issueAfterReset,omitempty"`
// IssueAfterResetPriority defines the grant priority for the default grant.
IssueAfterResetPriority *uint8 `json:"issueAfterResetPriority,omitempty"`
// PreserveOverageAtReset defines whether the overage is preserved after reset.
PreserveOverageAtReset *bool `json:"preserveOverageAtReset,omitempty"`
// UsagePeriod defines the interval of the entitlement in ISO8601 format.
// Defaults to the billing cadence of the rate card.
// Example: "P1D12H"
UsagePeriod isodate.Period `json:"usagePeriod,omitempty"`
}
func (*MeteredEntitlementTemplate) Equal ¶
func (t *MeteredEntitlementTemplate) Equal(v *MeteredEntitlementTemplate) bool
func (*MeteredEntitlementTemplate) Validate ¶
func (t *MeteredEntitlementTemplate) Validate() error
type PackagePrice ¶
type PackagePrice struct {
Commitments `json:",inline"`
Amount decimal.Decimal `json:"amount"`
QuantityPerPackage decimal.Decimal `json:"quantityPerPackage"`
}
func (PackagePrice) Clone ¶
func (p PackagePrice) Clone() PackagePrice
func (*PackagePrice) Equal ¶
func (p *PackagePrice) Equal(v *PackagePrice) bool
func (PackagePrice) Validate ¶
func (p PackagePrice) Validate() error
type PaymentTermType ¶
type PaymentTermType string
const ( InAdvancePaymentTerm PaymentTermType = "in_advance" InArrearsPaymentTerm PaymentTermType = "in_arrears" )
func (PaymentTermType) StringValues ¶
func (p PaymentTermType) StringValues() []string
func (PaymentTermType) Values ¶
func (p PaymentTermType) Values() []string
type PercentageDiscount ¶
type PercentageDiscount struct {
// Percentage defines percentage of the discount.
Percentage models.Percentage `json:"percentage"`
}
func (PercentageDiscount) Clone ¶
func (d PercentageDiscount) Clone() PercentageDiscount
func (PercentageDiscount) Hash ¶
func (d PercentageDiscount) Hash() hasher.Hash
func (PercentageDiscount) Validate ¶
func (d PercentageDiscount) Validate() error
func (PercentageDiscount) ValidateForPrice ¶
func (d PercentageDiscount) ValidateForPrice(price *Price) error
type PhaseMeta ¶
type PhaseMeta struct {
// Key is the unique key for Phase.
Key string `json:"key"`
// Name is the name of the Phase.
Name string `json:"name"`
// Description is the detailed description of the Phase.
Description *string `json:"description,omitempty"`
// Metadata stores user defined metadata for Phase.
Metadata models.Metadata `json:"metadata,omitempty"`
// Duration is the duration of the Phase.
Duration *isodate.Period `json:"duration"`
}
type Plan ¶
func (Plan) ValidForCreatingSubscriptions ¶
FIXME: rename to publishable ValidForCreatingSubscriptions checks if the Plan is valid for creating Subscriptions, a stricter version of Validate
func (Plan) ValidateWith ¶
func (p Plan) ValidateWith(validators ...models.ValidatorFunc[Plan]) error
type PlanAddon ¶
type PlanAddon struct {
PlanAddonMeta
// Plan
Plan Plan `json:"plan"`
// Addon
Addon Addon `json:"addon"`
}
func (PlanAddon) ValidateWith ¶
func (c PlanAddon) ValidateWith(validators ...models.ValidatorFunc[PlanAddon]) error
type PlanAddonConfig ¶
type PlanAddonMeta ¶
type PlanAddonMeta struct {
models.Metadata
models.Annotations
PlanAddonConfig
}
type PlanMeta ¶
type PlanMeta struct {
EffectivePeriod
Alignment
// Key is the unique key for Plan.
Key string `json:"key"`
// Version
Version int `json:"version"`
// Name
Name string `json:"name"`
// Description
Description *string `json:"description,omitempty"`
// Currency
Currency currency.Code `json:"currency"`
// Metadata
Metadata models.Metadata `json:"metadata,omitempty"`
}
func (PlanMeta) Status ¶
func (p PlanMeta) Status() PlanStatus
Status returns the current status of the Plan
type PlanStatus ¶
type PlanStatus string
const ( PlanStatusDraft PlanStatus = "draft" PlanStatusActive PlanStatus = "active" PlanStatusArchived PlanStatus = "archived" PlanStatusScheduled PlanStatus = "scheduled" PlanStatusInvalid PlanStatus = "invalid" )
func (PlanStatus) Values ¶
func (s PlanStatus) Values() []string
type Price ¶
type Price struct {
// contains filtered or unexported fields
}
func NewPriceFrom ¶
func NewPriceFrom[T FlatPrice | UnitPrice | TieredPrice | DynamicPrice | PackagePrice](v T) *Price
func (*Price) AsDynamic ¶
func (p *Price) AsDynamic() (DynamicPrice, error)
func (*Price) AsPackage ¶
func (p *Price) AsPackage() (PackagePrice, error)
func (*Price) AsTiered ¶
func (p *Price) AsTiered() (TieredPrice, error)
func (*Price) FromDynamic ¶
func (p *Price) FromDynamic(price DynamicPrice)
func (*Price) FromPackage ¶
func (p *Price) FromPackage(price PackagePrice)
func (*Price) FromTiered ¶
func (p *Price) FromTiered(price TieredPrice)
func (*Price) GetCommitments ¶
func (p *Price) GetCommitments() Commitments
func (*Price) MarshalJSON ¶
func (*Price) UnmarshalJSON ¶
type PriceTier ¶
type PriceTier struct {
// UpToAmount defines the quantity will be contained in the tier. Inclusive.
// If null, the tier is open-ended.
UpToAmount *decimal.Decimal `json:"upToAmount,omitempty"`
// FlatPrice defines the flat price component of the tier.
FlatPrice *PriceTierFlatPrice `json:"flatPrice,omitempty"`
// UnitPrice defines the unit price component of the tier.
UnitPrice *PriceTierUnitPrice `json:"unitPrice,omitempty"`
}
PriceTier describes a tier of price(s).
type PriceTierFlatPrice ¶
type PriceTierFlatPrice struct {
// Amount of the flat price.
Amount decimal.Decimal `json:"amount"`
}
func (PriceTierFlatPrice) Clone ¶
func (f PriceTierFlatPrice) Clone() PriceTierFlatPrice
func (PriceTierFlatPrice) Equal ¶
func (f PriceTierFlatPrice) Equal(v PriceTierFlatPrice) bool
func (PriceTierFlatPrice) Validate ¶
func (f PriceTierFlatPrice) Validate() error
type PriceTierUnitPrice ¶
type PriceTierUnitPrice struct {
// Amount of the flat price.
Amount decimal.Decimal `json:"amount"`
}
func (PriceTierUnitPrice) Clone ¶
func (u PriceTierUnitPrice) Clone() PriceTierUnitPrice
func (PriceTierUnitPrice) Equal ¶
func (u PriceTierUnitPrice) Equal(v PriceTierUnitPrice) bool
func (PriceTierUnitPrice) Validate ¶
func (u PriceTierUnitPrice) Validate() error
type RateCard ¶
type RateCard interface {
models.Validator
models.Equaler[RateCard]
Type() RateCardType
AsMeta() RateCardMeta
Key() string
Merge(RateCard) error
ChangeMeta(func(m RateCardMeta) (RateCardMeta, error)) error
Clone() RateCard
Compatible(RateCard) error
GetBillingCadence() *isodate.Period
}
type RateCardMeta ¶
type RateCardMeta struct {
// Key is the unique key for Plan.
Key string `json:"key"`
// Name of the RateCard
Name string `json:"name"`
// Description for the RateCard
Description *string `json:"description,omitempty"`
// Metadata a set of key/value pairs describing metadata for the RateCard
Metadata models.Metadata `json:"metadata,omitempty"`
// FeatureKey is the key of the feature assigned to the RateCard
FeatureKey *string `json:"featureKey,omitempty"`
// FeatureID is the ID of the feature assigned to the RateCard
FeatureID *string `json:"featureID,omitempty"`
// EntitlementTemplate defines the template used for instantiating entitlement.Entitlement.
// If Feature is set then template must be provided as well.
EntitlementTemplate *EntitlementTemplate `json:"entitlementTemplate,omitempty"`
// TaxConfig defines provider specific tax information.
TaxConfig *TaxConfig `json:"taxConfig,omitempty"`
// Price defines the price for the RateCard
Price *Price `json:"price"`
// Discounts defines a list of discounts for the RateCard
Discounts Discounts `json:"discounts,omitempty"`
}
func (RateCardMeta) Clone ¶
func (r RateCardMeta) Clone() RateCardMeta
func (RateCardMeta) Equal ¶
func (r RateCardMeta) Equal(v RateCardMeta) bool
func (RateCardMeta) Validate ¶
func (r RateCardMeta) Validate() error
type RateCardSerde ¶
type RateCardSerde struct {
Type RateCardType `json:"type"`
}
type RateCardType ¶
type RateCardType string
const ( FlatFeeRateCardType RateCardType = "flat_fee" UsageBasedRateCardType RateCardType = "usage_based" )
func (RateCardType) Values ¶
func (s RateCardType) Values() []string
type RateCards ¶
type RateCards []RateCard
func (RateCards) BillingCadenceAligned ¶
BillingCadenceAligned returns true if all ratecards in the collection has the same billing cadence.
func (RateCards) Compatible ¶
type StaticEntitlementTemplate ¶
type StaticEntitlementTemplate struct {
// Metadata a set of key/value pairs describing metadata for the RateCard.
Metadata models.Metadata `json:"metadata,omitempty"`
// Config stores a JSON parsable configuration for the entitlement.Entitlement.
// This value is also returned when checking entitlement access, and
// it is useful for configuring fine-grained access settings to the feature implemented in customers own system.
Config json.RawMessage `json:"config,omitempty"`
}
func (*StaticEntitlementTemplate) Equal ¶
func (t *StaticEntitlementTemplate) Equal(v *StaticEntitlementTemplate) bool
func (*StaticEntitlementTemplate) Validate ¶
func (t *StaticEntitlementTemplate) Validate() error
type StripeTaxConfig ¶
type StripeTaxConfig struct {
// Code stores the product tax code.
// See: https://docs.stripe.com/tax/tax-codes
// Example:"txcd_10000000"
Code string `json:"code"`
}
func (*StripeTaxConfig) Equal ¶
func (s *StripeTaxConfig) Equal(v *StripeTaxConfig) bool
func (*StripeTaxConfig) Validate ¶
func (s *StripeTaxConfig) Validate() error
type TaxBehavior ¶
type TaxBehavior string
const ( InclusiveTaxBehavior TaxBehavior = "inclusive" ExclusiveTaxBehavior TaxBehavior = "exclusive" )
func (TaxBehavior) Validate ¶
func (t TaxBehavior) Validate() error
func (TaxBehavior) Values ¶
func (t TaxBehavior) Values() []string
type TaxConfig ¶
type TaxConfig struct {
Behavior *TaxBehavior `json:"behavior,omitempty"`
Stripe *StripeTaxConfig `json:"stripe,omitempty"`
}
TaxConfig stores the provider specific tax configs.
func MergeTaxConfigs ¶
type TieredPrice ¶
type TieredPrice struct {
Commitments `json:",inline"`
// Mode defines whether the tier is volume-based or graduated.
// * VolumeTieredPrice: the maximum quantity within a period determines the per-unit price
// * GraduatedTieredPrice: pricing can change as the quantity grows
Mode TieredPriceMode `json:"mode"`
// Tiers defines the list of PriceTier.
Tiers []PriceTier `json:"tiers"`
}
func (*TieredPrice) Clone ¶
func (t *TieredPrice) Clone() TieredPrice
func (*TieredPrice) Equal ¶
func (t *TieredPrice) Equal(v *TieredPrice) bool
func (*TieredPrice) Validate ¶
func (t *TieredPrice) Validate() error
func (*TieredPrice) WithSortedTiers ¶
func (t *TieredPrice) WithSortedTiers() TieredPrice
type TieredPriceMode ¶
type TieredPriceMode string
const ( // In `volume`-based tiering, the maximum quantity within a period determines the per unit price. VolumeTieredPrice TieredPriceMode = "volume" // In `graduated` tiering, pricing can change as the quantity grows. GraduatedTieredPrice TieredPriceMode = "graduated" )
func NewTieredPriceMode ¶
func NewTieredPriceMode(s string) (TieredPriceMode, error)
func (TieredPriceMode) StringValues ¶
func (p TieredPriceMode) StringValues() []string
func (TieredPriceMode) Values ¶
func (p TieredPriceMode) Values() []TieredPriceMode
type UnitPrice ¶
type UnitPrice struct {
Commitments `json:",inline"`
// Amount of the unit price.
Amount decimal.Decimal `json:"amount"`
}
type UsageBasedRateCard ¶
type UsageBasedRateCard struct {
RateCardMeta
// BillingCadence defines the billing cadence of the RateCard in ISO8601 format.
// Example: "P1D12H"
BillingCadence isodate.Period `json:"billingCadence"`
}
func (*UsageBasedRateCard) AsMeta ¶
func (r *UsageBasedRateCard) AsMeta() RateCardMeta
func (*UsageBasedRateCard) ChangeMeta ¶
func (r *UsageBasedRateCard) ChangeMeta(fn func(m RateCardMeta) (RateCardMeta, error)) error
func (*UsageBasedRateCard) Clone ¶
func (r *UsageBasedRateCard) Clone() RateCard
func (*UsageBasedRateCard) Compatible ¶
func (r *UsageBasedRateCard) Compatible(v RateCard) error
func (*UsageBasedRateCard) Equal ¶
func (r *UsageBasedRateCard) Equal(v RateCard) bool
func (*UsageBasedRateCard) GetBillingCadence ¶
func (r *UsageBasedRateCard) GetBillingCadence() *isodate.Period
func (*UsageBasedRateCard) Key ¶
func (r *UsageBasedRateCard) Key() string
func (*UsageBasedRateCard) MarshalJSON ¶
func (r *UsageBasedRateCard) MarshalJSON() ([]byte, error)
func (*UsageBasedRateCard) Merge ¶
func (r *UsageBasedRateCard) Merge(v RateCard) error
func (*UsageBasedRateCard) Type ¶
func (r *UsageBasedRateCard) Type() RateCardType
func (*UsageBasedRateCard) Validate ¶
func (r *UsageBasedRateCard) Validate() error
type UsageDiscount ¶
func (UsageDiscount) Clone ¶
func (d UsageDiscount) Clone() UsageDiscount
func (UsageDiscount) Hash ¶
func (d UsageDiscount) Hash() hasher.Hash
func (UsageDiscount) Validate ¶
func (d UsageDiscount) Validate() error
func (UsageDiscount) ValidateForPrice ¶
func (d UsageDiscount) ValidateForPrice(price *Price) error