diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 83a7f16..142dc26 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -246,6 +246,7 @@ bool Client::init_methods() { methods_.emplace("deletemessage", &Client::process_delete_message_query); methods_.emplace("deletemessages", &Client::process_delete_messages_query); methods_.emplace("createinvoicelink", &Client::process_create_invoice_link_query); + methods_.emplace("refundstarpayment", &Client::process_refund_star_payment_query); methods_.emplace("setgamescore", &Client::process_set_game_score_query); methods_.emplace("getgamehighscores", &Client::process_get_game_high_scores_query); methods_.emplace("answerwebappquery", &Client::process_answer_web_app_query_query); @@ -10461,6 +10462,18 @@ td::Status Client::process_create_invoice_link_query(PromisedQueryPtr &query) { return td::Status::OK(); } +td::Status Client::process_refund_star_payment_query(PromisedQueryPtr &query) { + TRY_RESULT(user_id, get_user_id(query.get())); + TRY_RESULT(telegram_payment_charge_id, get_required_string_arg(query.get(), "telegram_payment_charge_id")); + check_user_no_fail( + user_id, std::move(query), + [this, telegram_payment_charge_id = telegram_payment_charge_id.str(), user_id](PromisedQueryPtr query) { + send_request(make_object(user_id, telegram_payment_charge_id), + td::make_unique(std::move(query))); + }); + return td::Status::OK(); +} + td::Status Client::process_set_game_score_query(PromisedQueryPtr &query) { auto chat_id = query->arg("chat_id"); auto message_id = get_message_id(query.get()); diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 7bcffe9..4e0bc74 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -647,6 +647,7 @@ class Client final : public WebhookActor::Callback { td::Status process_delete_message_query(PromisedQueryPtr &query); td::Status process_delete_messages_query(PromisedQueryPtr &query); td::Status process_create_invoice_link_query(PromisedQueryPtr &query); + td::Status process_refund_star_payment_query(PromisedQueryPtr &query); td::Status process_set_game_score_query(PromisedQueryPtr &query); td::Status process_get_game_high_scores_query(PromisedQueryPtr &query); td::Status process_answer_web_app_query_query(PromisedQueryPtr &query);