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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
use crate::model::{utils::IntegerOrString, LabeledPrice, ReplyMarkup, ShippingOption};
use serde::{Deserialize, Serialize};
use telexide_proc_macros::build_struct;
/// struct for holding data needed to call
/// [`send_invoice`]
///
/// [`send_invoice`]:
/// ../../api/trait.API.html#method.send_invoice
#[build_struct]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct SendInvoice {
/// Unique identifier for the target private chat
pub chat_id: IntegerOrString,
/// Unique identifier for the target message thread (topic) of the forum;
/// for forum supergroups only
#[serde(skip_serializing_if = "Option::is_none")]
pub message_thread_id: Option<i64>,
/// Product name, 1-32 characters
pub title: String,
/// Product description, 1-255 characters
pub description: String,
/// Bot-defined invoice payload, 1-128 bytes.
/// This will not be displayed to the user, use for your internal processes.
pub payload: String,
/// Payments provider token, obtained via [Botfather](https://t.me/botfather)
pub provider_token: String,
/// The maximum accepted amount for tips in the smallest units of the
/// currency (integer, not float/double). For example, for a maximum tip
/// of `US$ 1.45` pass `max_tip_amount = 145`. See the exp parameter in [currencies.json](https://core.telegram.org/bots/payments/currencies.json),
/// it shows the number of digits past the decimal point
/// for each currency (2 for the majority of currencies). Defaults to 0
#[serde(skip_serializing_if = "Option::is_none")]
pub max_tip_amount: Option<i64>,
/// A vec of suggested amounts of tips in the smallest units of the currency
/// (integer, not float/double). At most 4 suggested tip amounts can be
/// specified. The suggested tip amounts must be positive, passed in a
/// strictly increased order and must not exceed max_tip_amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub suggested_tip_amounts: Option<Vec<i64>>,
/// Unique deep-linking parameter. If left empty, forwarded copies of the
/// sent message will have a Pay button, allowing multiple users to pay
/// directly from the forwarded message, using the same invoice. If
/// non-empty, forwarded copies of the sent message will have a URL
/// button with a deep link to the bot (instead of a Pay button), with the
/// value used as the start parameter.
#[serde(skip_serializing_if = "Option::is_none")]
pub start_parameter: Option<String>,
/// Three-letter ISO 4217 currency code
pub currency: String,
/// Price breakdown, a list of components (e.g. product price, tax,
/// discount, delivery cost, delivery tax, bonus, etc.)
pub prices: Vec<LabeledPrice>,
/// JSON-encoded data about the invoice, which will be shared with the
/// payment provider. A detailed description of required fields should
/// be provided by the payment provider.
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_data: Option<String>,
/// URL of the product photo for the invoice.
/// Can be a photo of the goods or a marketing image for a service.
/// People like it better when they see what they are paying for.
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_url: Option<String>,
/// Photo size
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_size: Option<i64>,
/// Photo width
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_width: Option<i64>,
/// Photo height
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_height: Option<i64>,
/// Pass True, if you require the user's full name to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_name: Option<bool>,
/// Pass True, if you require the user's phone number to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_phone_number: Option<bool>,
/// Pass True, if you require the user's email address to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_email: Option<bool>,
/// Pass True, if you require the user's shipping address to complete the
/// order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_shipping_address: Option<bool>,
/// Pass True, if user's phone number should be sent to provider
#[serde(skip_serializing_if = "Option::is_none")]
pub send_phone_number_to_provider: Option<bool>,
/// Pass True, if user's email address should be sent to provider
#[serde(skip_serializing_if = "Option::is_none")]
pub send_email_to_provider: Option<bool>,
/// Pass True, if the final price depends on the shipping method
#[serde(skip_serializing_if = "Option::is_none")]
pub is_flexible: Option<bool>,
/// Sends the message silently. Users will receive a notification with no
/// sound.
#[serde(skip_serializing_if = "Option::is_none")]
pub disable_notification: Option<bool>,
/// Protects the contents of the sent message from forwarding and saving
#[serde(skip_serializing_if = "Option::is_none")]
pub protect_content: Option<bool>,
/// If the message is a reply, ID of the original message
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_to_message_id: Option<i64>,
/// Additional interface options.
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_markup: Option<ReplyMarkup>,
}
/// struct for holding data needed to call
/// [`answer_shipping_query`]
///
/// [`answer_shipping_query`]:
/// ../../api/trait.API.html#method.answer_shipping_query
#[build_struct]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct AnswerShippingQuery {
/// Unique identifier for the query to be answered
pub shipping_query_id: String,
/// Specify True if delivery to the specified address is possible and
/// False if there are any problems (for example, if delivery to the
/// specified address is not possible)
#[serde(skip_serializing_if = "Option::is_none")]
pub ok: Option<bool>,
/// Required if ok is True.
/// A vec of available shipping options.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping_options: Option<Vec<ShippingOption>>,
/// Required if ok is False.
/// Error message in human readable form that explains why it is impossible
/// to complete the order (e.g. "Sorry, delivery to your desired address
/// is unavailable'). Telegram will display this message to the user.
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
}
/// struct for holding data needed to call
/// [`answer_pre_checkout_query`]
///
/// [`answer_pre_checkout_query`]:
/// ../../api/trait.API.html#method.answer_pre_checkout_query
#[build_struct]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct AnswerPreCheckoutQuery {
/// Unique identifier for the query to be answered
pub pre_checkout_query_id: String,
/// Specify True if everything is alright (goods are available, etc.)
/// and the bot is ready to proceed with the order. Use False if there are
/// any problems.
#[serde(skip_serializing_if = "Option::is_none")]
pub ok: Option<bool>,
/// Required if ok is False. Error message in human readable form that
/// explains the reason for failure to proceed with the checkout (e.g.
/// "Sorry, somebody just bought the last of our amazing black T-shirts
/// while you were busy filling out your payment details. Please choose
/// a different color or garment!"). Telegram will display this message
/// to the user.
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
}
/// struct for holding data needed to call
/// [`create_invoice_link`]
///
/// [`create_invoice_link`]:
/// ../../api/trait.API.html#method.create_invoice_link
#[build_struct]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct CreateInvoiceLink {
/// Product name, 1-32 characters
pub title: String,
/// Product description, 1-255 characters
pub description: String,
/// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
/// the user, use for your internal processes.
pub payload: String,
/// Payment provider token, obtained via [BotFather]
///
/// [BotFather]: https://t.me/botfather
pub provider_token: String,
/// Three-letter ISO 4217 currency code, see [more on currencies]
///
/// [more on currencies]: https://core.telegram.org/bots/payments#supported-currencies
pub currency: String,
/// Price breakdown, a JSON-serialized list of components (e.g. product
/// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
pub prices: Vec<LabeledPrice>,
/// The maximum accepted amount for tips in the smallest units of the
/// currency (integer, not float/double). For example, for a maximum tip of
/// US$ 1.45 pass max_tip_amount = 145. See the exp parameter in
/// [currencies.json], it shows the number of digits past the decimal point
/// for each currency (2 for the majority of currencies). Defaults to 0
///
/// [currencies.json]: https://core.telegram.org/bots/payments/currencies.json
#[serde(skip_serializing_if = "Option::is_none")]
pub max_tip_amount: Option<usize>,
/// A JSON-serialized array of suggested amounts of tips in the smallest
/// units of the currency (integer, not float/double). At most 4 suggested
/// tip amounts can be specified. The suggested tip amounts must be
/// positive, passed in a strictly increased order and must not exceed
/// max_tip_amount.
pub suggested_tip_amounts: Vec<usize>,
/// JSON-serialized data about the invoice, which will be shared with the
/// payment provider. A detailed description of required fields should be
/// provided by the payment provider.
#[serde(skip_serializing_if = "Option::is_none")]
pub provider_data: Option<String>,
/// URL of the product photo for the invoice. Can be a photo of the goods or
/// a marketing image for a service.
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_url: Option<String>,
/// Photo size in bytes
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_size: Option<usize>,
/// Photo width
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_width: Option<usize>,
/// Photo height
#[serde(skip_serializing_if = "Option::is_none")]
pub photo_height: Option<usize>,
/// Pass True if you require the user's full name to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_name: Option<bool>,
/// Pass True if you require the user's phone number to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_phone_number: Option<bool>,
/// Pass True if you require the user's email address to complete the order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_email: Option<bool>,
/// Pass True if you require the user's shipping address to complete the
/// order
#[serde(skip_serializing_if = "Option::is_none")]
pub need_shipping_address: Option<bool>,
/// Pass True if the user's phone number should be sent to the provider
#[serde(skip_serializing_if = "Option::is_none")]
pub send_phone_number_to_provider: Option<bool>,
/// Pass True if the user's email address should be sent to the provider
#[serde(skip_serializing_if = "Option::is_none")]
pub send_email_to_provider: Option<bool>,
/// Pass True if the final price depends on the shipping method
#[serde(skip_serializing_if = "Option::is_none")]
pub is_flexible: Option<bool>,
}