add sets up
This commit is contained in:
@@ -37,12 +37,11 @@ func (r *DataResource) GetType() string {
|
||||
return tools.DATA_RESOURCE.String()
|
||||
}
|
||||
|
||||
func (abs *DataResource) ConvertToPricedResource(
|
||||
t tools.DataType, request *tools.APIRequest, buyingStrategy int, pricingStrategy int) pricing.PricedItemITF {
|
||||
func (abs *DataResource) ConvertToPricedResource(t tools.DataType, request *tools.APIRequest) pricing.PricedItemITF {
|
||||
if t != tools.DATA_RESOURCE {
|
||||
return nil
|
||||
}
|
||||
p := abs.AbstractInstanciatedResource.ConvertToPricedResource(t, request, buyingStrategy, pricingStrategy)
|
||||
p := abs.AbstractInstanciatedResource.ConvertToPricedResource(t, request)
|
||||
priced := p.(*PricedResource)
|
||||
return &PricedDataResource{
|
||||
PricedResource: *priced,
|
||||
@@ -137,6 +136,10 @@ func (p *DataResourcePricingProfile) GetPrice(amountOfData float64, explicitDura
|
||||
return p.Pricing.GetPrice(amountOfData, explicitDuration, start, &end)
|
||||
}
|
||||
|
||||
func (p *DataResourcePricingProfile) GetPurchase() pricing.BuyingStrategy {
|
||||
return p.Pricing.BuyingStrategy
|
||||
}
|
||||
|
||||
func (p *DataResourcePricingProfile) IsPurchasable() bool {
|
||||
return p.Pricing.BuyingStrategy != pricing.UNDEFINED_SUBSCRIPTION
|
||||
}
|
||||
@@ -166,10 +169,7 @@ func (r *PricedDataResource) GetPrice() (float64, error) {
|
||||
r.UsageEnd = &add
|
||||
}
|
||||
if r.SelectedPricing == nil {
|
||||
if len(r.PricingProfiles) == 0 {
|
||||
return 0, errors.New("pricing profile must be set on Priced Data" + r.ResourceID)
|
||||
}
|
||||
r.SelectedPricing = r.PricingProfiles[0]
|
||||
return 0, errors.New("pricing profile must be set on Priced Data" + r.ResourceID)
|
||||
}
|
||||
pricing := r.SelectedPricing
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user