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
//! Merchant cost rule models: what a merchant's own goods and partners'
//! shares cost it.
use serde::Deserialize;
use serde_json::Value;
/// What a cost rule records: `"goods"`, `"partner_share"` or `"other"`.
///
/// A string rather than an enum, so a category added later still decodes.
pub type MerchantCostRuleCategory = String;
/// A recorded merchant cost rule.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct MerchantCostRuleResponse {
/// Rule ID.
pub id: String,
/// The merchant the rule belongs to.
pub merchant_id: String,
/// The one shop it covers. `None` covers every shop.
#[serde(default)]
pub shop_id: Option<String>,
/// What the rule records — see [`MerchantCostRuleCategory`].
pub category: MerchantCostRuleCategory,
/// Percentage of the transaction, e.g. `42.5` for 42.5 %.
#[serde(default)]
pub percentage: Option<f64>,
/// Flat component in minor units of [`flat_currency`](Self::flat_currency).
#[serde(default)]
pub flat_amount: Option<i64>,
/// ISO 4217 currency of the fixed components. `None` states them in the
/// transaction currency.
#[serde(default)]
pub flat_currency: Option<String>,
/// Per-transaction floor.
#[serde(default)]
pub min_amount: Option<i64>,
/// Per-transaction ceiling.
#[serde(default)]
pub max_amount: Option<i64>,
/// When the rate starts applying (ISO 8601).
pub effective_from: String,
/// When it stops applying (ISO 8601, exclusive). `None` while open-ended.
#[serde(default)]
pub effective_to: Option<String>,
/// Whether the rule is active.
pub is_active: bool,
/// What the merchant calls the rule.
#[serde(default)]
pub label: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The answer to a cost rule delete.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct MerchantCostRuleDeleteResponse {
/// Whether the rule was deleted.
pub deleted: bool,
/// The deleted rule's ID.
pub id: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}