add purchase resource in model catalog
This commit is contained in:
parent
e55727d9e2
commit
f663ec80f5
@ -2,6 +2,7 @@ package resources
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/common/models"
|
"cloud.o-forge.io/core/oc-lib/models/common/models"
|
||||||
@ -150,6 +151,7 @@ func (r *PricedDataResource) GetType() tools.DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *PricedDataResource) GetPrice() (float64, error) {
|
func (r *PricedDataResource) GetPrice() (float64, error) {
|
||||||
|
fmt.Println("GetPrice", r.UsageStart, r.UsageEnd)
|
||||||
if r.UsageStart == nil || r.UsageEnd == nil {
|
if r.UsageStart == nil || r.UsageEnd == nil {
|
||||||
return 0, errors.New("usage start and end must be set")
|
return 0, errors.New("usage start and end must be set")
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package resources
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
"cloud.o-forge.io/core/oc-lib/models/common/pricing"
|
||||||
@ -84,6 +85,7 @@ func (abs *PricedResource) GetExplicitDurationInS() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *PricedResource) GetPrice() (float64, error) {
|
func (r *PricedResource) GetPrice() (float64, error) {
|
||||||
|
fmt.Println("GetPrice", r.UsageStart, r.UsageEnd)
|
||||||
if r.UsageStart == nil || r.UsageEnd == nil {
|
if r.UsageStart == nil || r.UsageEnd == nil {
|
||||||
return 0, errors.New("usage start and end must be set")
|
return 0, errors.New("usage start and end must be set")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user