1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// this file is @generated
use serde::{Deserialize, Serialize};
use super::{customer_id::CustomerId, event_id::EventId, event_type::EventType};
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[non_exhaustive]
pub struct AutoTopUpEvent {
/// The charge in minor units of `currency`: the credit it would have added, or for a credit
/// unit wallet the price of those credits in the customer's currency. When the credits could
/// not be priced (no selling price), the credits themselves, with `currency` the unit code. On
/// a suspension after a top-up payment was refunded or disputed: that payment's top-up.
pub amount: i64,
/// Failed charges in a row, this one included.
pub consecutive_failures: i32,
/// The currency charged (ISO 4217), or the credit unit code when the credits had no price.
pub currency: String,
pub customer_id: CustomerId,
/// May carry payment provider detail.
pub error: String,
/// Set on `wallet.auto_top_up_suspended`: when it was suspended.
#[serde(skip_serializing_if = "Option::is_none")]
pub suspended_at: Option<chrono::DateTime<chrono::Utc>>,
pub id: EventId,
pub timestamp: chrono::DateTime<chrono::Utc>,
pub r#type: EventType,
/// Properties this version of the SDK does not know, sent back as received.
#[serde(flatten)]
pub extra: serde_json::Map<String, serde_json::Value>,
}
impl AutoTopUpEvent {
/// Creates a value from its required fields.
#[must_use]
pub fn new(
amount: i64,
consecutive_failures: i32,
currency: impl Into<String>,
customer_id: impl Into<CustomerId>,
error: impl Into<String>,
id: impl Into<EventId>,
timestamp: chrono::DateTime<chrono::Utc>,
r#type: EventType,
) -> Self {
Self {
amount,
consecutive_failures,
currency: currency.into(),
customer_id: customer_id.into(),
error: error.into(),
suspended_at: None,
id: id.into(),
timestamp,
r#type,
extra: serde_json::Map::new(),
}
}
}