Skip to main content

ronami_core/payloads/
send_invoice.rs

1//! Generated by `codegen_payloads`, do not edit by hand.
2
3use serde::Serialize;
4use url::Url;
5
6use crate::types::EffectId;
7use crate::types::InlineKeyboardMarkup;
8use crate::types::LabeledPrice;
9use crate::types::Message;
10use crate::types::Recipient;
11use crate::types::ReplyParameters;
12use crate::types::SuggestedPostParameters;
13use crate::types::ThreadId;
14use crate::types::TopicId;
15
16impl_payload! {
17    /// Use this method to send invoices. On success, the sent [`Message`] is returned.
18    ///
19    /// [`Message`]: crate::types::Message
20    #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
21    pub SendInvoice (SendInvoiceSetters) => Message {
22        required {
23            /// Unique identifier for the target private chat
24            pub chat_id: Recipient [into],
25            /// Product name, 1-32 characters
26            pub title: String [into],
27            /// Product description, 1-255 characters
28            pub description: String [into],
29            /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
30            pub payload: String [into],
31            /// Three-letter ISO 4217 currency code, see [more on currencies]. Pass `XTR` for payments in [Telegram Stars].
32            ///
33            /// [more on currencies]: https://core.telegram.org/bots/payments#supported-currencies
34            /// [Telegram Stars]: https://t.me/BotNews/90
35            pub currency: String [into],
36            /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
37            pub prices: Vec<LabeledPrice> [collect],
38        }
39        optional {
40            /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
41            pub message_thread_id: ThreadId,
42            /// Identifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
43            pub direct_messages_topic_id: TopicId,
44            /// Payments provider token, obtained via [Botfather]. Pass `None` for payments in [Telegram Stars].
45            ///
46            /// [Botfather]: https://t.me/botfather
47            /// [Telegram Stars]: https://t.me/BotNews/90
48            pub provider_token: String [into],
49            /// 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
50            ///
51            /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
52            pub max_tip_amount: u32,
53            /// 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_.
54            pub suggested_tip_amounts: Vec<u32> [collect],
55            /// 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
56            pub start_parameter: String [into],
57            /// A 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.
58            pub provider_data: String [into],
59            /// 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.
60            pub photo_url: Url,
61            /// Photo size in bytes
62            pub photo_size: u32,
63            /// Photo width
64            pub photo_width: u32,
65            /// Photo height
66            pub photo_height: u32,
67            /// Pass _True_, if you require the user's full name to complete the order
68            pub need_name: bool,
69            /// Pass _True_, if you require the user's phone number to complete the order
70            pub need_phone_number: bool,
71            /// Pass _True_, if you require the user's email address to complete the order
72            pub need_email: bool,
73            /// Pass _True_, if you require the user's shipping address to complete the order
74            pub need_shipping_address: bool,
75            /// Pass _True_, if user's phone number should be sent to provider
76            pub send_phone_number_to_provider: bool,
77            /// Pass _True_, if user's email address should be sent to provider
78            pub send_email_to_provider: bool,
79            /// Pass _True_, if the final price depends on the shipping method
80            pub is_flexible: bool,
81            /// Sends the message [silently]. Users will receive a notification with no sound.
82            ///
83            /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
84            pub disable_notification: bool,
85            /// Protects the contents of sent messages from forwarding and saving
86            pub protect_content: bool,
87            /// Pass `true` to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
88            pub allow_paid_broadcast: bool,
89            /// Unique identifier of the message effect to be added to the message; for private chats only
90            pub message_effect_id: EffectId,
91            /// An object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
92            pub suggested_post_parameters: SuggestedPostParameters,
93            /// Description of the message to reply to
94            pub reply_parameters: ReplyParameters,
95            /// A JSON-serialized object for an [inline keyboard]. If empty, one 'Pay `total price`' button will be shown. If not empty, the first button must be a Pay button.
96            ///
97            /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
98            pub reply_markup: InlineKeyboardMarkup,
99        }
100    }
101}