pub struct CostBreakdown {
pub dimensions: Vec<DimensionCost>,
pub total_excl_vat: Number,
pub total_incl_vat: Number,
pub taxes: Vec<TaxLine>,
pub limit_applied: Option<PriceLimitApplied>,
pub notes: Vec<PricingNote>,
}tariffs only.Expand description
The complete, auditable result of pricing a session.
for dimension in &breakdown.dimensions {
println!(
"{:>12} {:>8} billed (measured {:>8}) = {}",
dimension.dimension, dimension.billed, dimension.measured, dimension.cost,
);
for segment in &dimension.segments {
println!(" via {}", segment.applied);
}
}
println!("total {} ({} incl. VAT)", breakdown.total_excl_vat, breakdown.total_incl_vat);Fields§
§dimensions: Vec<DimensionCost>What each dimension cost.
total_excl_vat: NumberThe total excluding VAT, after any min_price/max_price clamp.
total_incl_vat: NumberThe total including VAT, after any clamp.
taxes: Vec<TaxLine>The VAT owed, grouped by percentage.
limit_applied: Option<PriceLimitApplied>Whether a min_price or max_price changed the total.
notes: Vec<PricingNote>Anything the reader of this breakdown should know: see PricingNoteCode.
Empty is the ordinary case. A note is never an error — the total beside it is the engine’s best answer — but every one of them is a reason to look, and most of them are defects in the input rather than in the tariff.
Implementations§
Source§impl CostBreakdown
impl CostBreakdown
Sourcepub fn dimension(
&self,
dimension: TariffDimensionType,
) -> Option<&DimensionCost>
pub fn dimension( &self, dimension: TariffDimensionType, ) -> Option<&DimensionCost>
The cost of one dimension, if it was priced.
Sourcepub fn dimension_total(&self, dimension: TariffDimensionType) -> Number
pub fn dimension_total(&self, dimension: TariffDimensionType) -> Number
The total for one dimension, or zero if it was not priced.
Sourcepub fn total_vat(&self) -> Number
pub fn total_vat(&self) -> Number
The total VAT across all dimensions.
Always equal to total_incl_vat - total_excl_vat; see TaxLine.
Sourcepub fn notes_with(
&self,
code: PricingNoteCode,
) -> impl Iterator<Item = &PricingNote>
pub fn notes_with( &self, code: PricingNoteCode, ) -> impl Iterator<Item = &PricingNote>
The notes carrying code.
Sourcepub fn needs_review(&self) -> bool
pub fn needs_review(&self) -> bool
Whether anything about this session needs a human’s attention.
True when the breakdown carries any note at all. A reconciliation pipeline can use this to split a month’s CDRs into the ones that priced cleanly and the ones that did not.
Sourcepub fn applied_components(&self) -> impl Iterator<Item = &AppliedComponent>
pub fn applied_components(&self) -> impl Iterator<Item = &AppliedComponent>
Every Price Component that contributed, in the order they were applied.
Sourcepub fn to_price_v2_3_0(&self) -> Price
Available on crate feature v2_3_0 only.
pub fn to_price_v2_3_0(&self) -> Price
v2_3_0 only.Sourcepub fn to_price_v2_2_1(&self) -> Price
Available on crate feature v2_2_1 only.
pub fn to_price_v2_2_1(&self) -> Price
v2_2_1 only.The result as an OCPI 2.2.1 Price.
Trait Implementations§
Source§impl Clone for CostBreakdown
impl Clone for CostBreakdown
Source§fn clone(&self) -> CostBreakdown
fn clone(&self) -> CostBreakdown
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CostBreakdown
impl Debug for CostBreakdown
Source§impl<'de> Deserialize<'de> for CostBreakdown
impl<'de> Deserialize<'de> for CostBreakdown
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 Display for CostBreakdown
impl Display for CostBreakdown
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
The whole breakdown, including its notes.
The notes are the part somebody has to act on, so they are not something the default rendering may quietly leave out. An engine that records a finding and then prints a total as if nothing happened is worse than one that never looked.