Add td_api::reuseStarSubscription.
This commit is contained in:
parent
5303570c76
commit
d3e95a5e85
@ -11484,6 +11484,9 @@ assignGooglePlayTransaction package_name:string store_product_id:string purchase
|
||||
//@is_canceled New value of is_canceled
|
||||
editStarSubscription subscription_id:string is_canceled:Bool = Ok;
|
||||
|
||||
//@description Reuses an active subscription and joins the subscribed chat again @subscription_id Identifier of the subscription
|
||||
reuseStarSubscription subscription_id:string = Ok;
|
||||
|
||||
|
||||
//@description Returns information about features, available to Business users @source Source of the request; pass null if the method is called from settings or some non-standard source
|
||||
getBusinessFeatures source:BusinessFeature = BusinessFeatures;
|
||||
|
@ -452,6 +452,32 @@ class ChangeStarsSubscriptionQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class FulfillStarsSubscriptionQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit FulfillStarsSubscriptionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const string &subscription_id) {
|
||||
send_query(G()->net_query_creator().create(telegram_api::payments_fulfillStarsSubscription(
|
||||
telegram_api::make_object<telegram_api::inputPeerSelf>(), subscription_id)));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::payments_fulfillStarsSubscription>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class RefundStarsChargeQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
@ -700,6 +726,10 @@ void StarManager::edit_star_subscriptions(const string &subscription_id, bool is
|
||||
td_->create_handler<ChangeStarsSubscriptionQuery>(std::move(promise))->send(subscription_id, is_canceled);
|
||||
}
|
||||
|
||||
void StarManager::reuse_star_subscriptions(const string &subscription_id, Promise<Unit> &&promise) {
|
||||
td_->create_handler<FulfillStarsSubscriptionQuery>(std::move(promise))->send(subscription_id);
|
||||
}
|
||||
|
||||
void StarManager::refund_star_payment(UserId user_id, const string &telegram_payment_charge_id,
|
||||
Promise<Unit> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, input_user, td_->user_manager_->get_input_user(user_id));
|
||||
|
@ -40,6 +40,8 @@ class StarManager final : public Actor {
|
||||
|
||||
void edit_star_subscriptions(const string &subscription_id, bool is_canceled, Promise<Unit> &&promise);
|
||||
|
||||
void reuse_star_subscriptions(const string &subscription_id, Promise<Unit> &&promise);
|
||||
|
||||
void refund_star_payment(UserId user_id, const string &telegram_payment_charge_id, Promise<Unit> &&promise);
|
||||
|
||||
void get_star_revenue_statistics(const td_api::object_ptr<td_api::MessageSender> &owner_id, bool is_dark,
|
||||
|
@ -9133,6 +9133,13 @@ void Td::on_request(uint64 id, td_api::editStarSubscription &request) {
|
||||
star_manager_->edit_star_subscriptions(request.subscription_id_, request.is_canceled_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::reuseStarSubscription &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.subscription_id_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
star_manager_->reuse_star_subscriptions(request.subscription_id_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::canPurchaseFromStore &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
|
@ -1880,6 +1880,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::editStarSubscription &request);
|
||||
|
||||
void on_request(uint64 id, td_api::reuseStarSubscription &request);
|
||||
|
||||
void on_request(uint64 id, td_api::canPurchaseFromStore &request);
|
||||
|
||||
void on_request(uint64 id, td_api::assignAppStoreTransaction &request);
|
||||
|
@ -3481,6 +3481,10 @@ class CliClient final : public Actor {
|
||||
bool is_canceled;
|
||||
get_args(args, subscription_id, is_canceled);
|
||||
send_request(td_api::make_object<td_api::editStarSubscription>(subscription_id, is_canceled));
|
||||
} else if (op == "rss") {
|
||||
string subscription_id;
|
||||
get_args(args, subscription_id);
|
||||
send_request(td_api::make_object<td_api::reuseStarSubscription>(subscription_id));
|
||||
} else if (op == "cpfs" || op == "cpfsb") {
|
||||
UserId user_id;
|
||||
string currency;
|
||||
|
Loading…
Reference in New Issue
Block a user