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