ocpp/v2_1/datatype/transaction
OCPP 2.1 Transaction data type (schema TransactionType).
to_json/decoder map to/from its OCPP-J JSON object; new (when
present) builds a value from the required fields only.
Types
| Field | Type | Req | Description |
|---|---|---|---|
charging_state | ChargingState | — | |
custom_data | CustomData | — | |
operation_mode | OperationMode | — | |
remote_start_id | Int | — | The ID given to remote start request (RequestStartTransactionRequest. This enables to CSMS to match the started transaction to the given start request. |
stopped_reason | Reason | — | |
tariff_id | String | — | (2.1) Id of tariff in use for transaction (max 60 chars) |
time_spent_charging | Int | — | Contains the total time that energy flowed from EVSE to EV during the transaction (in seconds). Note that timeSpentCharging is smaller or equal to the duration of the transaction. |
transaction_id | String | ✓ | This contains the Id of the transaction. (max 36 chars) |
transaction_limit | TransactionLimit | — |
Schema: TransactionType
pub type Transaction {
Transaction(
charging_state: option.Option(charging_state.ChargingState),
custom_data: option.Option(custom_data.CustomData),
operation_mode: option.Option(operation_mode.OperationMode),
remote_start_id: option.Option(Int),
stopped_reason: option.Option(reason.Reason),
tariff_id: option.Option(String),
time_spent_charging: option.Option(Int),
transaction_id: String,
transaction_limit: option.Option(
transaction_limit.TransactionLimit,
),
)
}
Constructors
-
Transaction( charging_state: option.Option(charging_state.ChargingState), custom_data: option.Option(custom_data.CustomData), operation_mode: option.Option(operation_mode.OperationMode), remote_start_id: option.Option(Int), stopped_reason: option.Option(reason.Reason), tariff_id: option.Option(String), time_spent_charging: option.Option(Int), transaction_id: String, transaction_limit: option.Option( transaction_limit.TransactionLimit, ), )
Values
pub fn decoder() -> decode.Decoder(Transaction)
Decode a Transaction from its OCPP-J JSON object, enforcing schema constraints.
pub fn new(transaction_id transaction_id: String) -> Transaction
Construct a Transaction from its required fields, with every optional field set to None.
pub fn to_json(value: Transaction) -> json.Json
Encode a Transaction to its OCPP-J JSON object.