add event base intelligency
This commit is contained in:
@@ -9,7 +9,7 @@ type PricingProfileITF interface {
|
||||
IsPurchasable() bool
|
||||
GetPurchase() BuyingStrategy
|
||||
GetOverrideStrategyValue() int
|
||||
GetPrice(quantity float64, val float64, start time.Time, end time.Time, params ...string) (float64, error)
|
||||
GetPriceHT(quantity float64, val float64, start time.Time, end time.Time, variation []*PricingVariation, params ...string) (float64, error)
|
||||
}
|
||||
|
||||
type RefundType int
|
||||
@@ -34,10 +34,37 @@ type AccessPricingProfile[T Strategy] struct { // only use for acces such as : D
|
||||
RefundRatio int32 `json:"refund_ratio" bson:"refund_ratio" default:"0"` // RefundRatio is the refund ratio if missing
|
||||
}
|
||||
|
||||
func (a AccessPricingProfile[T]) IsBooked() bool {
|
||||
return a.Pricing.BuyingStrategy == SUBSCRIPTION
|
||||
}
|
||||
|
||||
func (a AccessPricingProfile[T]) IsPurchasable() bool {
|
||||
return a.Pricing.BuyingStrategy == PERMANENT
|
||||
}
|
||||
|
||||
func (a AccessPricingProfile[T]) GetPurchase() BuyingStrategy {
|
||||
return a.Pricing.BuyingStrategy
|
||||
}
|
||||
|
||||
func (a AccessPricingProfile[T]) GetPriceHT(quantity float64, val float64, start time.Time, end time.Time, variations []*PricingVariation, params ...string) (float64, error) {
|
||||
return a.Pricing.GetPriceHT(quantity, val, start, &end, variations)
|
||||
}
|
||||
|
||||
func (b *AccessPricingProfile[T]) GetOverrideStrategyValue() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func GetDefaultPricingProfile() PricingProfileITF {
|
||||
return &AccessPricingProfile[TimePricingStrategy]{
|
||||
Pricing: PricingStrategy[TimePricingStrategy]{
|
||||
Price: 0,
|
||||
Currency: "EUR",
|
||||
BuyingStrategy: PERMANENT,
|
||||
TimePricingStrategy: ONCE,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type ExploitPrivilegeStrategy int
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user