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
// this file is @generated
use serde::{Deserialize, Serialize};
use super::customer_id::CustomerId;
/// A spending cap stopped an automatic top-up.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
#[non_exhaustive]
pub struct AutoTopUpCapReachedEventData {
/// What the suppressed top-up would have charged, tax included once it was quoted (before
/// tax when the cap stopped it before then). Caps are always money: for a credit unit wallet,
/// `currency` is the customer's currency.
pub attempted_amount: i64,
/// The cap, tax included, in minor units of `currency`.
pub cap: i64,
/// The currency the cap and the charge are in (ISO 4217).
pub currency: String,
pub customer_id: CustomerId,
/// `DAILY` (rolling day) or `MONTHLY` (calendar month, UTC).
pub period: String,
/// End of the capped period.
pub period_end: chrono::DateTime<chrono::Utc>,
/// Start of the capped period.
pub period_start: chrono::DateTime<chrono::Utc>,
/// 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 AutoTopUpCapReachedEventData {
/// Creates a value from its required fields.
#[must_use]
pub fn new(
attempted_amount: i64,
cap: i64,
currency: impl Into<String>,
customer_id: impl Into<CustomerId>,
period: impl Into<String>,
period_end: chrono::DateTime<chrono::Utc>,
period_start: chrono::DateTime<chrono::Utc>,
) -> Self {
Self {
attempted_amount,
cap,
currency: currency.into(),
customer_id: customer_id.into(),
period: period.into(),
period_end,
period_start,
extra: serde_json::Map::new(),
}
}
}