pub struct Tariff {Show 17 fields
pub country_code: CountryCode,
pub party_id: PartyId,
pub id: CiString<36>,
pub currency: Currency,
pub tariff_type: Option<TariffType>,
pub tariff_alt_text: Vec<DisplayText>,
pub tariff_alt_url: Option<Url>,
pub min_price: Option<PriceLimit>,
pub max_price: Option<PriceLimit>,
pub preauthorize_amount: Option<Number>,
pub elements: Vec<TariffElement>,
pub tax_included: TaxIncluded,
pub start_date_time: Option<DateTime>,
pub end_date_time: Option<DateTime>,
pub energy_mix: Option<EnergyMix>,
pub last_updated: DateTime,
pub extensions: Extensions,
}v2_3_0 only.Expand description
A tariff: one or more TariffElements that price a charging session.
When the list of Tariff Elements contains more than one Element that has a Price Component for a certain dimension, then the first Tariff Element with a Price Component for that dimension in the list with matching Tariff Restrictions will be used.
Spec: 2.3.0 §mod_tariffs_tariff_object
Fields§
§country_code: CountryCodeISO-3166 alpha-2 country code of the CPO that owns this Tariff.
party_id: PartyIdID of the CPO that ‘owns’ this Tariff.
id: CiString<36>Uniquely identifies the tariff within the CPO’s platform.
currency: CurrencyISO-4217 code of the currency of this tariff.
tariff_type: Option<TariffType>The type of the tariff. When omitted, this tariff is valid for all sessions.
tariff_alt_text: Vec<DisplayText>Multi-language alternative tariff info texts.
When a Tariff contains both the
tariff_alt_textandelementsfields, thetariff_alt_textSHALL only contain additional tariff information in human-readable text, not the price information that is also available via theelementsfield.
tariff_alt_url: Option<Url>URL to a web page explaining the tariff in human-readable form.
min_price: Option<PriceLimit>A Charging Session with this tariff will cost at least this amount.
max_price: Option<PriceLimit>A Charging Session with this tariff will cost at most this amount.
The amount a Payment Terminal Provider should preauthorize for a Session with this Tariff. New in OCPI 2.3.0, together with the Payments module.
elements: Vec<TariffElement>The Tariff Elements. Cardinality +.
tax_included: TaxIncludedWhether taxes are included in the amounts in this Tariff. New in OCPI 2.3.0.
start_date_time: Option<DateTime>When this tariff becomes active, in UTC.
end_date_time: Option<DateTime>When this tariff stops being valid, in UTC.
energy_mix: Option<EnergyMix>Details on the energy supplied with this tariff.
last_updated: DateTimeTimestamp when this Tariff was last updated (or created).
extensions: ExtensionsUndocumented JSON fields, preserved verbatim.
Implementations§
Source§impl Tariff
impl Tariff
Sourcepub fn builder() -> TariffBuilder
pub fn builder() -> TariffBuilder
Create an instance of Tariff using the builder syntax
Source§impl Tariff
impl Tariff
Sourcepub fn owner_party(&self) -> PartyRef
pub fn owner_party(&self) -> PartyRef
The CPO that owns this Tariff.
Sourcepub fn is_active_at(&self, instant: DateTime) -> bool
pub fn is_active_at(&self, instant: DateTime) -> bool
Whether this tariff is in its validity window at instant.
An absent start_date_time means “already active”; an absent end_date_time means
“still active”.
Sourcepub fn is_free_of_charge(&self) -> bool
pub fn is_free_of_charge(&self) -> bool
Whether this is the “Free of Charge” shape the spec prescribes.
To define a “Free of Charge” tariff in OCPI, a Tariff containing one Tariff Element with no restrictions containing one Price Component with
type=FLATandprice=0.00has to be provided.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tariff
impl<'de> Deserialize<'de> for Tariff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Tariff
impl JsonSchema for Tariff
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Tariff
Source§impl Upgrade<Tariff> for Tariff
Available on crate feature convert only.
impl Upgrade<Tariff> for Tariff
convert only.Source§fn upgrade(self) -> Converted<Tariff>
fn upgrade(self) -> Converted<Tariff>
tax_included becomes NO.
This is not a guess: a 2.2.1 PriceComponent.price is defined as “Price per unit
(excl. VAT) for this dimension”, so every amount in a 2.2.1 Tariff is pre-tax by
construction, which is exactly what NO means.
preauthorize_amount starts absent — 2.2.1 has no Payments module to preauthorize for.