#![allow(clippy::too_many_arguments)]
use serde::Serialize;
use crate::error::Result;
use crate::Bot;
impl Bot {
pub fn refund_star_payment(
&self,
user_id: i64,
telegram_payment_charge_id: String,
) -> RefundStarPaymentBuilder {
RefundStarPaymentBuilder::new(self, user_id, telegram_payment_charge_id)
}
}
#[derive(Serialize)]
pub struct RefundStarPaymentBuilder<'a> {
#[serde(skip)]
bot: &'a Bot,
pub user_id: i64,
pub telegram_payment_charge_id: String,
}
impl<'a> RefundStarPaymentBuilder<'a> {
pub fn new(bot: &'a Bot, user_id: i64, telegram_payment_charge_id: String) -> Self {
Self {
bot,
user_id,
telegram_payment_charge_id,
}
}
pub fn user_id(mut self, user_id: i64) -> Self {
self.user_id = user_id;
self
}
pub fn telegram_payment_charge_id(mut self, telegram_payment_charge_id: String) -> Self {
self.telegram_payment_charge_id = telegram_payment_charge_id;
self
}
pub async fn send(self) -> Result<bool> {
let form = serde_json::to_value(&self)?;
self.bot.get("refundStarPayment", Some(&form)).await
}
}