Add telegramPaymentPurposeStars.
This commit is contained in:
parent
7ab4d9b87b
commit
60064f8c2c
@ -5275,6 +5275,12 @@ telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amo
|
||||
//@month_count Number of months the Telegram Premium subscription will be active for the users
|
||||
telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose;
|
||||
|
||||
//@description The user buying Telegram stars
|
||||
//@currency ISO 4217 currency code of the payment currency
|
||||
//@amount Paid amount, in the smallest units of the currency
|
||||
//@star_count Number of bought stars
|
||||
telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose;
|
||||
|
||||
|
||||
//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method.
|
||||
//-To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org
|
||||
@ -7286,7 +7292,7 @@ updateDefaultReactionType reaction_type:ReactionType = Update;
|
||||
//@tags The new tags
|
||||
updateSavedMessagesTags saved_messages_topic_id:int53 tags:savedMessagesTags = Update;
|
||||
|
||||
//@description The number of stars owned by the current user has changed @star_count The new number of stars owned
|
||||
//@description The number of Telegram stars owned by the current user has changed @star_count The new number of Telegram stars owned
|
||||
updateOwnedStarCount star_count:int53 = Update;
|
||||
|
||||
//@description The revenue earned from sponsored messages in a chat has changed. If chat revenue screen is opened, then getChatRevenueTransactions may be called to fetch new transactions
|
||||
|
@ -79,7 +79,7 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
}
|
||||
switch (invoice->purpose_->get_id()) {
|
||||
case td_api::telegramPaymentPurposePremiumGiftCodes::ID: {
|
||||
auto p = static_cast<const td_api::telegramPaymentPurposePremiumGiftCodes *>(invoice->purpose_.get());
|
||||
auto p = static_cast<td_api::telegramPaymentPurposePremiumGiftCodes *>(invoice->purpose_.get());
|
||||
vector<telegram_api::object_ptr<telegram_api::InputUser>> input_users;
|
||||
for (auto user_id : p->user_ids_) {
|
||||
TRY_RESULT(input_user, td->user_manager_->get_input_user(UserId(user_id)));
|
||||
@ -88,6 +88,9 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
if (p->amount_ <= 0 || !check_currency_amount(p->amount_)) {
|
||||
return Status::Error(400, "Invalid amount of the currency specified");
|
||||
}
|
||||
if (!clean_input_string(p->currency_)) {
|
||||
return Status::Error(400, "Strings must be encoded in UTF-8");
|
||||
}
|
||||
DialogId boosted_dialog_id(p->boosted_chat_id_);
|
||||
TRY_RESULT(boost_input_peer, get_boost_input_peer(td, boosted_dialog_id));
|
||||
int32 flags = 0;
|
||||
@ -105,10 +108,13 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
break;
|
||||
}
|
||||
case td_api::telegramPaymentPurposePremiumGiveaway::ID: {
|
||||
auto p = static_cast<const td_api::telegramPaymentPurposePremiumGiveaway *>(invoice->purpose_.get());
|
||||
auto p = static_cast<td_api::telegramPaymentPurposePremiumGiveaway *>(invoice->purpose_.get());
|
||||
if (p->amount_ <= 0 || !check_currency_amount(p->amount_)) {
|
||||
return Status::Error(400, "Invalid amount of the currency specified");
|
||||
}
|
||||
if (!clean_input_string(p->currency_)) {
|
||||
return Status::Error(400, "Strings must be encoded in UTF-8");
|
||||
}
|
||||
TRY_RESULT(parameters, GiveawayParameters::get_giveaway_parameters(td, p->parameters_.get()));
|
||||
auto option = telegram_api::make_object<telegram_api::premiumGiftCodeOption>(
|
||||
0, p->winner_count_, p->month_count_, string(), 0, p->currency_, p->amount_);
|
||||
@ -116,6 +122,19 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
parameters.get_input_store_payment_premium_giveaway(td, p->currency_, p->amount_), std::move(option));
|
||||
break;
|
||||
}
|
||||
case td_api::telegramPaymentPurposeStars::ID: {
|
||||
auto p = static_cast<td_api::telegramPaymentPurposeStars *>(invoice->purpose_.get());
|
||||
if (p->amount_ <= 0 || !check_currency_amount(p->amount_)) {
|
||||
return Status::Error(400, "Invalid amount of the currency specified");
|
||||
}
|
||||
if (!clean_input_string(p->currency_)) {
|
||||
return Status::Error(400, "Strings must be encoded in UTF-8");
|
||||
}
|
||||
auto option = telegram_api::make_object<telegram_api::starsTopupOption>(0, false /*ignored*/, p->star_count_,
|
||||
string(), p->currency_, p->amount_);
|
||||
result.input_invoice_ = telegram_api::make_object<telegram_api::inputInvoiceStars>(std::move(option));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user