ocpp/v2_1/datatype/cost_details
OCPP 2.1 CostDetails data type (schema CostDetailsType).
to_json/decoder map to/from its OCPP-J JSON object; new (when
present) builds a value from the required fields only.
Types
CostDetailsType contains the cost as calculated by Charging Station based on provided TariffType.
NOTE: Reservation is not shown as a chargingPeriod, because it took place outside of the transaction.
| Field | Type | Req | Description |
|---|---|---|---|
charging_periods | List(ChargingPeriod) | — | |
custom_data | CustomData | — | |
failure_reason | String | — | Optional human-readable reason text in case of failure to calculate. (max 500 chars) |
failure_to_calculate | Bool | — | If set to true, then Charging Station has failed to calculate the cost. |
total_cost | TotalCost | ✓ | |
total_usage | TotalUsage | ✓ |
Schema: CostDetailsType
pub type CostDetails {
CostDetails(
charging_periods: option.Option(
List(charging_period.ChargingPeriod),
),
custom_data: option.Option(custom_data.CustomData),
failure_reason: option.Option(String),
failure_to_calculate: option.Option(Bool),
total_cost: total_cost.TotalCost,
total_usage: total_usage.TotalUsage,
)
}
Constructors
-
CostDetails( charging_periods: option.Option( List(charging_period.ChargingPeriod), ), custom_data: option.Option(custom_data.CustomData), failure_reason: option.Option(String), failure_to_calculate: option.Option(Bool), total_cost: total_cost.TotalCost, total_usage: total_usage.TotalUsage, )
Values
pub fn decoder() -> decode.Decoder(CostDetails)
Decode a CostDetails from its OCPP-J JSON object, enforcing schema constraints.
pub fn new(
total_cost total_cost: total_cost.TotalCost,
total_usage total_usage: total_usage.TotalUsage,
) -> CostDetails
Construct a CostDetails from its required fields, with every optional field set to None.
pub fn to_json(value: CostDetails) -> json.Json
Encode a CostDetails to its OCPP-J JSON object.