Add purpose to canPurchasePremium.
This commit is contained in:
parent
3bfb3cdbb1
commit
a114133854
@ -6438,8 +6438,8 @@ clickPremiumSubscriptionButton = Ok;
|
||||
//@description Returns state of Telegram Premium subscription and promotion videos for Premium features
|
||||
getPremiumState = PremiumState;
|
||||
|
||||
//@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase
|
||||
canPurchasePremium = Ok;
|
||||
//@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase @purpose Transaction purpose
|
||||
canPurchasePremium purpose:StorePaymentPurpose = Ok;
|
||||
|
||||
//@description Informs server about a purchase through App Store. For official applications only @receipt App Store receipt @purpose Transaction purpose
|
||||
assignAppStoreTransaction receipt:bytes purpose:StorePaymentPurpose = Ok;
|
||||
|
@ -176,9 +176,14 @@ class CanPurchasePremiumQuery final : public Td::ResultHandler {
|
||||
explicit CanPurchasePremiumQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send() {
|
||||
send_query(G()->net_query_creator().create(telegram_api::payments_canPurchasePremium(
|
||||
make_tl_object<telegram_api::inputStorePaymentPremiumSubscription>(0, false /*ignored*/))));
|
||||
void send(td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose) {
|
||||
auto r_input_purpose = get_input_store_payment_purpose(td_, purpose);
|
||||
if (r_input_purpose.is_error()) {
|
||||
return on_error(r_input_purpose.move_as_error());
|
||||
}
|
||||
|
||||
send_query(
|
||||
G()->net_query_creator().create(telegram_api::payments_canPurchasePremium(r_input_purpose.move_as_ok())));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
@ -506,8 +511,8 @@ void get_premium_state(Td *td, Promise<td_api::object_ptr<td_api::premiumState>>
|
||||
td->create_handler<GetPremiumPromoQuery>(std::move(promise))->send();
|
||||
}
|
||||
|
||||
void can_purchase_premium(Td *td, Promise<Unit> &&promise) {
|
||||
td->create_handler<CanPurchasePremiumQuery>(std::move(promise))->send();
|
||||
void can_purchase_premium(Td *td, td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose, Promise<Unit> &&promise) {
|
||||
td->create_handler<CanPurchasePremiumQuery>(std::move(promise))->send(std::move(purpose));
|
||||
}
|
||||
|
||||
void assign_app_store_transaction(Td *td, const string &receipt,
|
||||
|
@ -30,7 +30,7 @@ void click_premium_subscription_button(Td *td, Promise<Unit> &&promise);
|
||||
|
||||
void get_premium_state(Td *td, Promise<td_api::object_ptr<td_api::premiumState>> &&promise);
|
||||
|
||||
void can_purchase_premium(Td *td, Promise<Unit> &&promise);
|
||||
void can_purchase_premium(Td *td, td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose, Promise<Unit> &&promise);
|
||||
|
||||
void assign_app_store_transaction(Td *td, const string &receipt,
|
||||
td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose, Promise<Unit> &&promise);
|
||||
|
@ -7917,10 +7917,10 @@ void Td::on_request(uint64 id, const td_api::getPremiumState &request) {
|
||||
get_premium_state(this, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::canPurchasePremium &request) {
|
||||
void Td::on_request(uint64 id, td_api::canPurchasePremium &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
can_purchase_premium(this, std::move(promise));
|
||||
can_purchase_premium(this, std::move(request.purpose_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::assignAppStoreTransaction &request) {
|
||||
|
@ -1307,7 +1307,7 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::getPremiumState &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::canPurchasePremium &request);
|
||||
void on_request(uint64 id, td_api::canPurchasePremium &request);
|
||||
|
||||
void on_request(uint64 id, td_api::assignAppStoreTransaction &request);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user