Add gift support in assignGooglePlayTransaction.
This commit is contained in:
parent
fd6684ab9d
commit
8673d30109
@ -469,9 +469,9 @@ chatAdministratorRights can_manage_chat:Bool can_change_info:Bool can_post_messa
|
||||
//@currency ISO 4217 currency code for Telegram Premium subscription payment
|
||||
//@amount The amount to pay, in the smallest units of the currency
|
||||
//@month_count Number of month the Telegram Premium subscription will be active
|
||||
//@store_product Name of the store product associated with the option
|
||||
//@store_product_id Identifier of the store product associated with the option
|
||||
//@payment_link An internal link to be opened for gifting Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available
|
||||
premiumGiftOption currency:string amount:int53 month_count:int32 store_product:string payment_link:InternalLinkType = PremiumGiftOption;
|
||||
premiumGiftOption currency:string amount:int53 month_count:int32 store_product_id:string payment_link:InternalLinkType = PremiumGiftOption;
|
||||
|
||||
|
||||
//@description Represents a user
|
||||
@ -6455,8 +6455,8 @@ 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;
|
||||
|
||||
//@description Informs server about a purchase through Google Play. For official applications only @purchase_token Google Play purchase token @purpose Transaction purpose
|
||||
assignGooglePlayTransaction purchase_token:string purpose:StorePaymentPurpose = Ok;
|
||||
//@description Informs server about a purchase through Google Play. For official applications only @package_name Application package name @store_product_id Identifier of the purchased store product @purchase_token Google Play purchase token @purpose Transaction purpose
|
||||
assignGooglePlayTransaction package_name:string store_product_id:string purchase_token:string purpose:StorePaymentPurpose = Ok;
|
||||
|
||||
|
||||
//@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier
|
||||
|
@ -247,14 +247,18 @@ class AssignPlayMarketTransactionQuery final : public Td::ResultHandler {
|
||||
explicit AssignPlayMarketTransactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const string &purchase_token, td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose) {
|
||||
void send(const string &package_name, const string &store_product_id, const string &purchase_token,
|
||||
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());
|
||||
}
|
||||
auto receipt = make_tl_object<telegram_api::dataJSON>(string());
|
||||
receipt->data_ =
|
||||
json_encode<string>(json_object([&purchase_token](auto &o) { o("purchase_token", purchase_token); }));
|
||||
receipt->data_ = json_encode<string>(json_object([&](auto &o) {
|
||||
o("packageName", package_name);
|
||||
o("purchaseToken", purchase_token);
|
||||
o("productId", store_product_id);
|
||||
}));
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::payments_assignPlayMarketTransaction(std::move(receipt), r_input_purpose.move_as_ok())));
|
||||
}
|
||||
@ -525,10 +529,12 @@ void assign_app_store_transaction(Td *td, const string &receipt,
|
||||
td->create_handler<AssignAppStoreTransactionQuery>(std::move(promise))->send(receipt, std::move(purpose));
|
||||
}
|
||||
|
||||
void assign_play_market_transaction(Td *td, const string &purchase_token,
|
||||
void assign_play_market_transaction(Td *td, const string &package_name, const string &store_product_id,
|
||||
const string &purchase_token,
|
||||
td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose,
|
||||
Promise<Unit> &&promise) {
|
||||
td->create_handler<AssignPlayMarketTransactionQuery>(std::move(promise))->send(purchase_token, std::move(purpose));
|
||||
td->create_handler<AssignPlayMarketTransactionQuery>(std::move(promise))
|
||||
->send(package_name, store_product_id, purchase_token, std::move(purpose));
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -35,7 +35,8 @@ void can_purchase_premium(Td *td, td_api::object_ptr<td_api::StorePaymentPurpose
|
||||
void assign_app_store_transaction(Td *td, const string &receipt,
|
||||
td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose, Promise<Unit> &&promise);
|
||||
|
||||
void assign_play_market_transaction(Td *td, const string &purchase_token,
|
||||
void assign_play_market_transaction(Td *td, const string &package_name, const string &store_product_id,
|
||||
const string &purchase_token,
|
||||
td_api::object_ptr<td_api::StorePaymentPurpose> &&purpose, Promise<Unit> &&promise);
|
||||
|
||||
} // namespace td
|
||||
|
@ -7936,9 +7936,12 @@ void Td::on_request(uint64 id, td_api::assignAppStoreTransaction &request) {
|
||||
|
||||
void Td::on_request(uint64 id, td_api::assignGooglePlayTransaction &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.package_name_);
|
||||
CLEAN_INPUT_STRING(request.store_product_id_);
|
||||
CLEAN_INPUT_STRING(request.purchase_token_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
assign_play_market_transaction(this, request.purchase_token_, std::move(request.purpose_), std::move(promise));
|
||||
assign_play_market_transaction(this, request.package_name_, request.store_product_id_, request.purchase_token_,
|
||||
std::move(request.purpose_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::acceptTermsOfService &request) {
|
||||
|
Loading…
Reference in New Issue
Block a user