diff --git a/models/common/pricing/pricing_profile.go b/models/common/pricing/pricing_profile.go index 23b3bf8..f97104d 100755 --- a/models/common/pricing/pricing_profile.go +++ b/models/common/pricing/pricing_profile.go @@ -28,10 +28,28 @@ func RefundTypeList() []RefundType { return []RefundType{REFUND_DEAD_END, REFUND_ON_ERROR, REFUND_ON_EARLY_END} } +type PaymentType int + +const ( + PAY_ONCE PaymentType = iota + PAY_EVERY_WEEK + PAY_EVERY_MONTH + PAY_EVERY_YEAR +) + +func (t PaymentType) String() string { + return [...]string{"PAY ONCE", "PAY_EVERY_WEEK", "PAY_EVERY_MONTH", "PAY_EVERY_YEAR"}[t] +} + +func PaymentTypeList() []PaymentType { + return []PaymentType{PAY_ONCE, PAY_EVERY_WEEK, PAY_EVERY_MONTH, PAY_EVERY_YEAR} +} + type AccessPricingProfile[T Strategy] struct { // only use for acces such as : DATA && PROCESSING - Pricing PricingStrategy[T] `json:"pricing,omitempty" bson:"pricing,omitempty"` // Price is the price of the resource - DefaultRefund RefundType `json:"default_refund" bson:"default_refund"` // DefaultRefund is the default refund type of the pricing - RefundRatio int32 `json:"refund_ratio" bson:"refund_ratio" default:"0"` // RefundRatio is the refund ratio if missing + AllowedPaymentType []PaymentType `json:"allowed_payment_type,omitempty" bson:"allowed_payment_type,omitempty"` // Price is the price of the resource + Pricing PricingStrategy[T] `json:"pricing,omitempty" bson:"pricing,omitempty"` // Price is the price of the resource + DefaultRefund RefundType `json:"default_refund" bson:"default_refund"` // DefaultRefund is the default refund type of the pricing + RefundRatio int32 `json:"refund_ratio" bson:"refund_ratio" default:"0"` // RefundRatio is the refund ratio if missing } func (a AccessPricingProfile[T]) IsBooked() bool { diff --git a/models/workflow/workflow.go b/models/workflow/workflow.go index b51b7ad..39e3db6 100644 --- a/models/workflow/workflow.go +++ b/models/workflow/workflow.go @@ -47,11 +47,11 @@ type Workflow struct { // Schedule *WorkflowSchedule `bson:"schedule,omitempty" json:"schedule,omitempty"` // Schedule is the schedule of the workflow Shared []string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workflow // AbstractWorkflow contains the basic fields of a workflow - Env map[string][]models.Param `json:"env,omitempty" bson:"env,omitempty"` - Inputs map[string][]models.Param `json:"inputs,omitempty" bson:"inputs,omitempty"` - Outputs map[string][]models.Param `json:"outputs,omitempty" bson:"outputs,omitempty"` - Args map[string][]string `json:"args,omitempty" bson:"args,omitempty"` - Exposes map[string][]models.Expose `bson:"exposes,omitempty" json:"exposes,omitempty"` // Expose is the execution + Env map[string][]models.Param `json:"env" bson:"env"` + Inputs map[string][]models.Param `json:"inputs" bson:"inputs"` + Outputs map[string][]models.Param `json:"outputs" bson:"outputs"` + Args map[string][]string `json:"args" bson:"args"` + Exposes map[string][]models.Expose `bson:"exposes" json:"exposes"` // Expose is the execution } func (d *Workflow) GetAccessor(request *tools.APIRequest) utils.Accessor {