add purchase resource in model catalog

This commit is contained in:
mr 2025-02-10 11:32:55 +01:00
parent e55727d9e2
commit f663ec80f5
2 changed files with 4 additions and 0 deletions

View File

@ -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")
} }

View File

@ -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")
} }