set up
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
type BuyingStrategy int
|
||||
|
||||
// should except... on
|
||||
const (
|
||||
UNLIMITED BuyingStrategy = iota
|
||||
SUBSCRIPTION
|
||||
@@ -40,6 +41,10 @@ const (
|
||||
PER_MONTH
|
||||
)
|
||||
|
||||
func IsTimeStrategy(i int) bool {
|
||||
return len(TimePricingStrategyList()) < i
|
||||
}
|
||||
|
||||
func (t TimePricingStrategy) String() string {
|
||||
return [...]string{"ONCE", "PER SECOND", "PER MINUTE", "PER HOUR", "PER DAY", "PER WEEK", "PER MONTH"}[t]
|
||||
}
|
||||
@@ -101,6 +106,7 @@ func BookingEstimation(t TimePricingStrategy, price float64, locationDurationInS
|
||||
return 0, errors.New("pricing strategy not found")
|
||||
}
|
||||
|
||||
// may suppress in pricing strategy -> to set in map
|
||||
type PricingStrategy[T Strategy] struct {
|
||||
Price float64 `json:"price" bson:"price" default:"0"` // Price is the Price of the pricing
|
||||
Currency string `json:"currency" bson:"currency" default:"USD"` // Currency is the currency of the pricing
|
||||
|
||||
Reference in New Issue
Block a user