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
use crate::client::Bot;
use serde::Serialize;
/// Refunds a successful payment in Telegram Stars. Returns `true` on success.
/// # Documentation
/// <https://core.telegram.org/bots/api#refundstarpayment>
/// # Returns
/// - `bool`
#[derive(Clone, Debug, Serialize)]
pub struct RefundStarPayment {
/// Identifier of the user whose payment will be refunded
pub user_id: i64,
/// Telegram payment identifier
pub telegram_payment_charge_id: Box<str>,
}
impl RefundStarPayment {
/// Creates a new `RefundStarPayment`.
///
/// # Arguments
/// * `user_id` - Identifier of the user whose payment will be refunded
/// * `telegram_payment_charge_id` - Telegram payment identifier
#[must_use]
pub fn new<T0: Into<i64>, T1: Into<Box<str>>>(
user_id: T0,
telegram_payment_charge_id: T1,
) -> Self {
Self {
user_id: user_id.into(),
telegram_payment_charge_id: telegram_payment_charge_id.into(),
}
}
/// Identifier of the user whose payment will be refunded
#[must_use]
pub fn user_id<T: Into<i64>>(self, val: T) -> Self {
let mut this = self;
this.user_id = val.into();
this
}
/// Telegram payment identifier
#[must_use]
pub fn telegram_payment_charge_id<T: Into<Box<str>>>(self, val: T) -> Self {
let mut this = self;
this.telegram_payment_charge_id = val.into();
this
}
}
impl super::TelegramMethod for RefundStarPayment {
type Method = Self;
type Return = bool;
fn build_request<Client>(self, _bot: &Bot<Client>) -> super::Request<Self::Method> {
super::Request::new("refundStarPayment", self, None)
}
}