Skip to main content

Cdr

Struct Cdr 

Source
pub struct Cdr {
Show 32 fields pub country_code: CountryCode, pub party_id: PartyId, pub id: CiString<39>, pub start_date_time: DateTime, pub end_date_time: DateTime, pub session_id: Option<CiString<36>>, pub cdr_token: CdrToken, pub auth_method: AuthMethod, pub authorization_reference: Option<CiString<36>>, pub booking_id: Option<CiString<36>>, pub cdr_location: CdrLocation, pub meter_id: Option<OcpiString<255>>, pub currency: Currency, pub tariffs: Vec<Tariff>, pub charging_periods: Vec<ChargingPeriod>, pub signed_data: Option<SignedData>, pub total_cost: Price, pub total_fixed_cost: Option<Price>, pub total_energy: Number, pub total_energy_cost: Option<Price>, pub total_time: Number, pub total_time_cost: Option<Price>, pub total_parking_time: Option<Number>, pub total_parking_cost: Option<Price>, pub total_reservation_cost: Option<Price>, pub remark: Option<OcpiString<255>>, pub invoice_reference_id: Option<CiString<39>>, pub credit: Option<bool>, pub credit_reference_id: Option<CiString<39>>, pub home_charging_compensation: Option<bool>, pub last_updated: DateTime, pub extensions: Extensions,
}
Available on crate feature v2_3_0 only.
Expand description

A Charge Detail Record: one charging session and its costs.

Spec: 2.3.0 §mod_cdrs_cdr_object

Fields§

§country_code: CountryCode

ISO-3166 alpha-2 country code of the CPO that ‘owns’ this CDR.

§party_id: PartyId

ID of the CPO that ‘owns’ this CDR.

§id: CiString<39>

Uniquely identifies the CDR, unique per country_code/party_id combination.

§start_date_time: DateTime

Start of the charging session, or of the reservation when there was no session.

§end_date_time: DateTime

When the session was completed. Charging may have finished earlier.

§session_id: Option<CiString<36>>

The Session this CDR belongs to.

Is only allowed to be omitted when the CPO has not implemented the Sessions module or this CDR is the result of a reservation that never became a charging session.

§cdr_token: CdrToken

Token used to start this charging session.

§auth_method: AuthMethod

Method used for authentication. The last method used during the session.

§authorization_reference: Option<CiString<36>>

Reference to the authorization given by the eMSP.

§booking_id: Option<CiString<36>>
Available on crate feature bookings only.

The Booking this CDR also belongs to.

Is only allowed to be omitted when the Session was reserved.

Added by the OCPI 2.3.0 bookings release branch, so it is behind the bookings feature.

Spec: 2.3.0-bookings §mod_cdrs_cdr_object

§cdr_location: CdrLocation

Where the charging session took place.

§meter_id: Option<OcpiString<255>>

Identification of the meter inside the Charge Point.

§currency: Currency

Currency of the CDR in ISO 4217 code.

§tariffs: Vec<Tariff>

Relevant Tariffs, as they were at the start of the session.

§charging_periods: Vec<ChargingPeriod>

Charging Periods that make up this session. Cardinality +.

§signed_data: Option<SignedData>

Signed metering data belonging to this session.

§total_cost: Price

Total sum of all the costs of this transaction.

§total_fixed_cost: Option<Price>

Total of the fixed costs, except fixed price components of parking and reservation.

§total_energy: Number

Total energy charged, in kWh.

§total_energy_cost: Option<Price>

Total cost of all the energy used.

§total_time: Number

Total duration of the charging session, charging and not charging, in hours.

§total_time_cost: Option<Price>

Total cost related to the duration of charging.

§total_parking_time: Option<Number>

Total duration during which the EV was not charging, in hours.

§total_parking_cost: Option<Price>

Total cost related to parking, including fixed price components.

§total_reservation_cost: Option<Price>

Total cost related to a reservation, including fixed price components.

§remark: Option<OcpiString<255>>

Human-readable remark, e.g. the reason a transaction was stopped.

§invoice_reference_id: Option<CiString<39>>

Reference to an invoice that will later be sent for this CDR.

§credit: Option<bool>

Whether this is a Credit CDR. Requires credit_reference_id.

§credit_reference_id: Option<CiString<39>>

The id of the CDR this Credit CDR corrects.

§home_charging_compensation: Option<bool>

Whether the energy cost of this home-charging session is compensated to the EV driver.

§last_updated: DateTime

Timestamp when this CDR was last updated (or created).

§extensions: Extensions

Undocumented JSON fields, preserved verbatim.

Implementations§

Source§

impl Cdr

Source

pub fn builder() -> CdrBuilder

Create an instance of Cdr using the builder syntax

Source§

impl Cdr

Source

pub fn owner_party(&self) -> PartyRef

The CPO that owns this CDR.

Source

pub fn is_credit(&self) -> bool

Whether this is a Credit CDR.

Source

pub fn total_charging_time(&self) -> Number

The time the EV was actually charging, in hours.

The actual charging duration … can be calculated: total_charging_time = total_time - total_parking_time.

Source

pub fn dimension_total(&self, dimension: CdrDimensionType) -> Number

The total volume of one dimension across every charging period.

Source

pub fn has_placeholder_timestamps(&self) -> bool

Whether the timestamps are the 1970-1-1T00:00:00Z placeholder the spec permits.

If the MSP and CPO both agree that they accept CDRs that miss either or both the start_date_time and end_date_time … the CPO could send a CDR where the start_date_time and/or end_date_time are set to “1970-1-1T00:00:00Z”.

Trait Implementations§

Source§

impl Clone for Cdr

Source§

fn clone(&self) -> Cdr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cdr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Cdr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Downgrade<Cdr> for Cdr

Available on crate feature convert only.
Source§

fn downgrade(self) -> Converted<Cdr>

Converts to the older version.
Source§

impl JsonSchema for Cdr

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for Cdr

Source§

fn eq(&self, other: &Cdr) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Cdr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Stored for Cdr

Available on crate feature testkit only.
Source§

fn key(&self) -> String

The id this object is keyed by, compared case-insensitively.
Source§

fn last_updated(&self) -> DateTime

The last_updated the pagination filters on.
Source§

impl StructuralPartialEq for Cdr

Source§

impl Upgrade<Cdr> for Cdr

Available on crate feature convert only.
Source§

fn upgrade(self) -> Converted<Cdr>

Converts to the newer version.
Source§

impl Validate for Cdr

Source§

fn validate_in(&self, v: &mut Validator)

Appends this value’s violations to v, relative to v’s current position.
Source§

fn validate(&self) -> Result<(), Violations>

Validates this value as the root of an object graph. Read more

Auto Trait Implementations§

§

impl Freeze for Cdr

§

impl RefUnwindSafe for Cdr

§

impl Send for Cdr

§

impl Sync for Cdr

§

impl Unpin for Cdr

§

impl UnsafeUnpin for Cdr

§

impl UnwindSafe for Cdr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more