Ostrom: add SimplyDynamic_V2 contract type (#28726)
Some checks failed
Some checks failed
This commit is contained in:
parent
388a1480b0
commit
e988deaf25
2 changed files with 26 additions and 11 deletions
|
|
@ -100,8 +100,13 @@ func NewOstromFromConfig(other map[string]any) (api.Tariff, error) {
|
||||||
t.contractType = contract.Product
|
t.contractType = contract.Product
|
||||||
t.zip = contract.Address.Zip
|
t.zip = contract.Address.Zip
|
||||||
|
|
||||||
|
tariffType, err := t.tariffType()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
done := make(chan error)
|
done := make(chan error)
|
||||||
if t.Type() == api.TariffTypePriceStatic {
|
if tariffType == api.TariffTypePriceStatic {
|
||||||
t.cityId, err = t.getCityId()
|
t.cityId, err = t.getCityId()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -253,14 +258,23 @@ func (t *Ostrom) Rates() (api.Rates, error) {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type implements the api.Tariff interface
|
// tariffType returns the tariff type for the current contract, or an error for unknown contract types.
|
||||||
func (t *Ostrom) Type() api.TariffType {
|
func (t *Ostrom) tariffType() (api.TariffType, error) {
|
||||||
switch t.contractType {
|
switch t.contractType {
|
||||||
case ostrom.PRODUCT_DYNAMIC:
|
case ostrom.PRODUCT_DYNAMIC, ostrom.PRODUCT_DYNAMIC_V2:
|
||||||
return api.TariffTypePriceForecast
|
return api.TariffTypePriceForecast, nil
|
||||||
case ostrom.PRODUCT_FAIR, ostrom.PRODUCT_FAIR_CAP:
|
case ostrom.PRODUCT_FAIR, ostrom.PRODUCT_FAIR_CAP:
|
||||||
return api.TariffTypePriceStatic
|
return api.TariffTypePriceStatic, nil
|
||||||
default:
|
default:
|
||||||
panic("invalid contract type: " + t.contractType)
|
return 0, fmt.Errorf("invalid contract type: %s", t.contractType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type implements the api.Tariff interface
|
||||||
|
func (t *Ostrom) Type() api.TariffType {
|
||||||
|
tariffType, err := t.tariffType()
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
return tariffType
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,11 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PRODUCT_FAIR = "SIMPLY_FAIR"
|
PRODUCT_FAIR = "SIMPLY_FAIR"
|
||||||
PRODUCT_FAIR_CAP = "SIMPLY_FAIR_WITH_PRICE_CAP"
|
PRODUCT_FAIR_CAP = "SIMPLY_FAIR_WITH_PRICE_CAP"
|
||||||
PRODUCT_DYNAMIC = "SIMPLY_DYNAMIC"
|
PRODUCT_DYNAMIC = "SIMPLY_DYNAMIC"
|
||||||
PRODUCT_BASIC = "basisProdukt"
|
PRODUCT_DYNAMIC_V2 = "SimplyDynamic_V2"
|
||||||
|
PRODUCT_BASIC = "basisProdukt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Prices struct {
|
type Prices struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue