rust_ocpp/v1_6/messages/stop_transaction.rs
1use crate::v1_6::types::{IdTagInfo, MeterValue, Reason};
2
3use chrono::{DateTime, Utc};
4use validator::Validate;
5
6/// This contains the field definition of the StopTransaction.req PDU sent by the Charge Point to the Central System. See also Stop Transaction
7#[derive(serde::Serialize, serde::Deserialize, Validate, Debug, Clone, PartialEq, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct StopTransactionRequest {
10 /// Required.
11 #[validate(length(min = 1, max = 20))]
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub id_tag: Option<String>, // IdToken, should this be a type?
14 /// Optional. Only filled in when request applies to a specific connector.
15 pub meter_stop: i32,
16 /// Required. This contains the date and time on which the transaction is stopped.
17 pub timestamp: DateTime<Utc>,
18 /// Required. This contains the transaction-id as received by the StartTransactionResponse
19 pub transaction_id: i32,
20 /// Optional. This contains the reason why the transaction was stopped. MAY only be omitted when the Reason is "Local".
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub reason: Option<Reason>,
23 /// Optional. This contains transaction usage details relevant for billing purposes.
24 #[serde(skip_serializing_if = "Option::is_none")]
25 pub transaction_data: Option<Vec<MeterValue>>,
26}
27
28/// This contains the field definition of the TriggerMessage.req PDU sent by the Central System to the Charge Point. See also Trigger Message
29#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
30#[serde(rename_all = "camelCase")]
31pub struct StopTransactionResponse {
32 /// Optional. This contains information about authorization status, expiry and parent id. It is optional, because a transaction may have been stopped without an identifier.
33 #[serde(skip_serializing_if = "Option::is_none")]
34 pub id_tag_info: Option<IdTagInfo>,
35}