Add storePaymentPurposePremiumSubscription.is_upgrade.

This commit is contained in:
levlam 2023-01-19 16:49:57 +03:00
parent 65ddaea0f6
commit b339976ddf
3 changed files with 6 additions and 3 deletions

View File

@ -3819,8 +3819,8 @@ premiumState state:formattedText payment_options:vector<premiumPaymentOption> an
//@class StorePaymentPurpose @description Describes a purpose of an in-store payment
//@description The user subscribed to Telegram Premium @is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store
storePaymentPurposePremiumSubscription is_restore:Bool = StorePaymentPurpose;
//@description The user subscribed to Telegram Premium @is_restore Pass true if this is a restore of a Telegram Premium purchase; only for App Store @is_upgrade Pass true if this is an upgrade from a monthly subscription to early subscription; only for App Store
storePaymentPurposePremiumSubscription is_restore:Bool is_upgrade:Bool = StorePaymentPurpose;
//@description The user gifted Telegram Premium to another user @user_id Identifier of the user for which Premium was gifted @currency ISO 4217 currency code of the payment currency @amount Paid amount, in the smallest units of the currency
storePaymentPurposeGiftedPremium user_id:int53 currency:string amount:int53 = StorePaymentPurpose;

View File

@ -90,6 +90,9 @@ static Result<tl_object_ptr<telegram_api::InputStorePaymentPurpose>> get_input_s
if (p->is_restore_) {
flags |= telegram_api::inputStorePaymentPremiumSubscription::RESTORE_MASK;
}
if (p->is_upgrade_) {
flags |= telegram_api::inputStorePaymentPremiumSubscription::UPGRADE_MASK;
}
return make_tl_object<telegram_api::inputStorePaymentPremiumSubscription>(flags, false /*ignored*/,
false /*ignored*/);
}

View File

@ -2692,7 +2692,7 @@ class CliClient final : public Actor {
get_args(args, user_id, currency, amount);
if (currency.empty()) {
send_request(td_api::make_object<td_api::canPurchasePremium>(
td_api::make_object<td_api::storePaymentPurposePremiumSubscription>(false)));
td_api::make_object<td_api::storePaymentPurposePremiumSubscription>(false, false)));
} else {
send_request(td_api::make_object<td_api::canPurchasePremium>(
td_api::make_object<td_api::storePaymentPurposeGiftedPremium>(user_id, currency, amount)));