Add td_api::assignGooglePlayTransaction.
This commit is contained in:
parent
44cf826142
commit
2144d8fcd0
@ -6406,6 +6406,9 @@ getPremiumState = PremiumState;
|
|||||||
//@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase
|
//@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase
|
||||||
canPurchasePremium = Ok;
|
canPurchasePremium = Ok;
|
||||||
|
|
||||||
|
//@description Informs server about a Telegram Premium purchase through Google Play. For official applications only @purchase_token Google Play purchase token
|
||||||
|
assignGooglePlayTransaction purchase_token:string = Ok;
|
||||||
|
|
||||||
|
|
||||||
//@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier
|
//@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier
|
||||||
acceptTermsOfService terms_of_service_id:string = Ok;
|
acceptTermsOfService terms_of_service_id:string = Ok;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "td/telegram/MessageEntity.h"
|
#include "td/telegram/MessageEntity.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
|
#include "td/telegram/UpdatesManager.h"
|
||||||
|
|
||||||
#include "td/utils/algorithm.h"
|
#include "td/utils/algorithm.h"
|
||||||
#include "td/utils/buffer.h"
|
#include "td/utils/buffer.h"
|
||||||
@ -167,6 +168,33 @@ class CanPurchasePremiumQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AssignPlayMarketTransactionQuery final : public Td::ResultHandler {
|
||||||
|
Promise<Unit> promise_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AssignPlayMarketTransactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void send(const string &purchase_token) {
|
||||||
|
send_query(G()->net_query_creator().create(telegram_api::payments_assignPlayMarketTransaction(purchase_token)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_result(BufferSlice packet) final {
|
||||||
|
auto result_ptr = fetch_result<telegram_api::payments_assignPlayMarketTransaction>(packet);
|
||||||
|
if (result_ptr.is_error()) {
|
||||||
|
return on_error(result_ptr.move_as_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ptr = result_ptr.move_as_ok();
|
||||||
|
LOG(INFO) << "Receive result for AssignPlayMarketTransactionQuery: " << to_string(ptr);
|
||||||
|
td_->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_error(Status status) final {
|
||||||
|
promise_.set_error(std::move(status));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const vector<Slice> &get_premium_limit_keys() {
|
const vector<Slice> &get_premium_limit_keys() {
|
||||||
static const vector<Slice> limit_keys{"channels",
|
static const vector<Slice> limit_keys{"channels",
|
||||||
"saved_gifs",
|
"saved_gifs",
|
||||||
@ -410,4 +438,8 @@ void can_purchase_premium(Td *td, Promise<Unit> &&promise) {
|
|||||||
td->create_handler<CanPurchasePremiumQuery>(std::move(promise))->send();
|
td->create_handler<CanPurchasePremiumQuery>(std::move(promise))->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void assign_play_market_transaction(Td *td, const string &purchase_token, Promise<Unit> &&promise) {
|
||||||
|
td->create_handler<AssignPlayMarketTransactionQuery>(std::move(promise))->send(purchase_token);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -33,4 +33,6 @@ void get_premium_state(Td *td, Promise<td_api::object_ptr<td_api::premiumState>>
|
|||||||
|
|
||||||
void can_purchase_premium(Td *td, Promise<Unit> &&promise);
|
void can_purchase_premium(Td *td, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void assign_play_market_transaction(Td *td, const string &purchase_token, Promise<Unit> &&promise);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -7898,6 +7898,13 @@ void Td::on_request(uint64 id, const td_api::canPurchasePremium &request) {
|
|||||||
can_purchase_premium(this, std::move(promise));
|
can_purchase_premium(this, std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Td::on_request(uint64 id, td_api::assignGooglePlayTransaction &request) {
|
||||||
|
CHECK_IS_USER();
|
||||||
|
CLEAN_INPUT_STRING(request.purchase_token_);
|
||||||
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
|
assign_play_market_transaction(this, request.purchase_token_, std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
|
void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
CLEAN_INPUT_STRING(request.terms_of_service_id_);
|
CLEAN_INPUT_STRING(request.terms_of_service_id_);
|
||||||
|
@ -1309,6 +1309,8 @@ class Td final : public Actor {
|
|||||||
|
|
||||||
void on_request(uint64 id, const td_api::canPurchasePremium &request);
|
void on_request(uint64 id, const td_api::canPurchasePremium &request);
|
||||||
|
|
||||||
|
void on_request(uint64 id, td_api::assignGooglePlayTransaction &request);
|
||||||
|
|
||||||
void on_request(uint64 id, td_api::acceptTermsOfService &request);
|
void on_request(uint64 id, td_api::acceptTermsOfService &request);
|
||||||
|
|
||||||
void on_request(uint64 id, const td_api::getCountries &request);
|
void on_request(uint64 id, const td_api::getCountries &request);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user