Expand description
§OCPI Tariffs library
Calculate the (sub)totals of a charge session
using the cdr::price
function and use the generated price::Report
to review and compare the calculated
totals versus the sources from the CDR
.
See the price::Report
for a detailed list of all the fields that help analyze and valitate the pricing of a CDR
.
- Use the
cdr::parse
andtariff::parse
function to parse and guess which OCPI version of a CDR or tariff you have. - Use the
cdr::parse_with_version
andtariff::parse_with_version
functions to parse a CDR of tariff as the given version. - Use the
tariff::lint
to lint a tariff: flag common errors, bugs, dangerous constructs and stylistic flaws in the tariff.
Modules§
- cdr
- Module containing the functionality to price charge sessions with provided tariffs.
- country
- An ISO 3166-1 country code.
- currency
- guess
- json
- lint
- Both tariffs and CDRs can be linted - a term borrowed from software development where linting is the act of flagging common errors, bugs, dangerous constructs and stylistic flaws in a some code or data.
- price
- tariff
- timezone
- warning
- These types are the basis for writing functions that can emit a set of
Warning
s based on the value they are trying to create.
Structs§
- Caveat
- A value that may have associated
Warning
s. - Money
- A monetary amount, the currency is dependant on the specified tariff.
- Parse
Error - Errors that can happen if a JSON str is parsed.
- Price
- A price consisting of a value including VAT, and a value excluding VAT.
- Vat
- A VAT percentage.
- Warning
- Groups together a module’s
Kind
and the associatedjson::Element
.
Enums§
- Object
Type - The type of OCPI objects that can be parsed.
- Parse
Error Kind - The kind of Error that occurred.
- Version
- The OCPI versions supported by this crate
Traits§
- Unversioned
- An object with an uncertain
Version
. - Verdict
Ext Verdict
specific extinsion methods for theResult
type.- Versioned
- An object for a specific OCPI
Version
.
Type Aliases§
- Tariff
Id - The Id for a tariff used in the pricing of a CDR.
- Unexpected
Fields - Set of unexpected fields encountered while parsing a CDR or tariff.
- Verdict
- A
Verdict
is a standardResult
withWarning
s potentially issued for both theOk
andErr
variants.