add purchase resource in model catalog
This commit is contained in:
parent
a573a4ce71
commit
ffaa67fb5d
@ -84,7 +84,7 @@ func (r *PricedResource) GetPrice() (float64, error) {
|
|||||||
}
|
}
|
||||||
if r.SelectedPricing == nil {
|
if r.SelectedPricing == nil {
|
||||||
if len(r.PricingProfiles) == 0 {
|
if len(r.PricingProfiles) == 0 {
|
||||||
return 0, errors.New("pricing profile must be set on Priced Resource" + r.ResourceID)
|
return 0, errors.New("pricing profile must be set on Priced Resource " + r.ResourceID)
|
||||||
}
|
}
|
||||||
*r.SelectedPricing = r.PricingProfiles[0]
|
*r.SelectedPricing = r.PricingProfiles[0]
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,20 @@ type ResourcePartnerShip[T pricing.PricingProfileITF] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {
|
func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF {
|
||||||
|
profiles := []pricing.PricingProfileITF{}
|
||||||
if ri.PeerGroups[peerID] != nil {
|
if ri.PeerGroups[peerID] != nil {
|
||||||
|
for _, ri := range ri.PricingProfiles {
|
||||||
|
profiles = append(profiles, ri)
|
||||||
|
}
|
||||||
|
if slices.Contains(groups, "*") {
|
||||||
|
for _, ri := range ri.PricingProfiles {
|
||||||
|
profiles = append(profiles, ri)
|
||||||
|
}
|
||||||
|
return profiles
|
||||||
|
}
|
||||||
for _, p := range ri.PeerGroups[peerID] {
|
for _, p := range ri.PeerGroups[peerID] {
|
||||||
if slices.Contains(groups, p) {
|
if slices.Contains(groups, p) {
|
||||||
profiles := []pricing.PricingProfileITF{}
|
|
||||||
for _, ri := range ri.PricingProfiles {
|
for _, ri := range ri.PricingProfiles {
|
||||||
profiles = append(profiles, ri)
|
profiles = append(profiles, ri)
|
||||||
}
|
}
|
||||||
@ -180,7 +190,7 @@ func (ri *ResourcePartnerShip[T]) GetPricingsProfiles(peerID string, groups []st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return []pricing.PricingProfileITF{}
|
return profiles
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rp *ResourcePartnerShip[T]) GetPeerGroups() map[string][]string {
|
func (rp *ResourcePartnerShip[T]) GetPeerGroups() map[string][]string {
|
||||||
|
Loading…
Reference in New Issue
Block a user