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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
//! Checkout-template models: a shop's payment methods, behaviour and smart
//! routing, defined once for the merchant and used in many shops.
use serde::Deserialize;
use serde_json::Value;
/// One checkout template and the shops on it.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateResponse {
/// The template's own profile. The checkout-methods, checkout-branding and
/// routing calls edit the template under this id, as they edit a shop.
pub template_id: String,
/// Shown to the merchant's team only.
pub name: String,
/// Counts the writes made to the template's settings.
pub content_version: i64,
/// ISO 8601 creation time.
pub created_at: String,
/// ISO 8601 last-modification time.
pub modified_at: String,
/// The shops on the template.
#[serde(default)]
pub shops: Vec<CheckoutTemplateShop>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// One shop on a template, and whether it runs the template's current
/// settings.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateShop {
/// The shop (business profile).
pub profile_id: String,
/// `up_to_date`, `changes_not_applied`, `apply_failed` or
/// `never_applied`.
pub status: String,
/// The template's `content_version` the shop last applied in full.
#[serde(default)]
pub applied_version: Option<i64>,
/// ISO 8601 time of that apply.
#[serde(default)]
pub applied_at: Option<String>,
/// Why the last apply stopped; present while `status` is `apply_failed`.
#[serde(default)]
pub last_error: Option<String>,
/// ISO 8601 time of the last apply attempt.
#[serde(default)]
pub last_attempt_at: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The merchant's checkout templates.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateListResponse {
/// The templates.
#[serde(default)]
pub templates: Vec<CheckoutTemplateResponse>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// What an assign or apply did, or would do on a dry run, in each shop.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateApplyResponse {
/// The template.
pub template_id: String,
/// The template's `content_version` that was applied.
pub content_version: i64,
/// Whether nothing was changed.
pub dry_run: bool,
/// Each shop, reported on its own.
#[serde(default)]
pub shops: Vec<CheckoutTemplateShopPlan>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// What an assign or apply did, or would do, in one shop.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateShopPlan {
/// The shop (business profile).
pub profile_id: String,
/// `ready`, `applied`, `unchanged`, `blocked` or `failed`.
pub outcome: String,
/// The template the shop leaves, on an assign.
#[serde(default)]
pub leaves_template_id: Option<String>,
/// Why the shop was left unchanged.
#[serde(default)]
pub blockers: Vec<CheckoutTemplateBlocker>,
/// What changes in the shop: connector accounts added, accounts hidden or
/// shown, routing, payment methods, entries and behaviour settings.
#[serde(default)]
pub changes: Value,
/// Why the apply failed, when it did.
#[serde(default)]
pub error: Option<CheckoutTemplateApplyError>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Why a shop was left unchanged by an assign or apply.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateBlocker {
/// e.g. `shop_not_found`, `connector_switched_off_in_shop`.
pub reason: String,
/// The connector account concerned.
#[serde(default)]
pub merchant_connector_id: Option<String>,
/// The connector concerned.
#[serde(default)]
pub connector: Option<String>,
/// In words.
#[serde(default)]
pub message: Option<String>,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// Why an apply failed in one shop.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateApplyError {
/// Error code.
pub code: String,
/// In words.
pub message: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// The template a shop is on, if any.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateOfShopResponse {
/// The shop (business profile).
pub profile_id: String,
/// `None`: the shop is on no template and edits its own settings.
#[serde(default)]
pub template: Option<CheckoutTemplateRef>,
/// Whether this profile is itself a template.
pub is_template: bool,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}
/// A template by id and name.
#[derive(Debug, Clone, Deserialize)]
#[non_exhaustive]
pub struct CheckoutTemplateRef {
/// The template.
pub template_id: String,
/// Its name.
pub name: String,
/// Any additional response fields not modeled above.
#[serde(flatten)]
pub extra: serde_json::Map<String, Value>,
}