Add td_api::telegramPaymentPurposeGiftedStars.
This commit is contained in:
parent
0bacb9fac2
commit
55391a5355
@ -5627,6 +5627,13 @@ telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters curre
|
||||
//@star_count Number of bought stars
|
||||
telegramPaymentPurposeStars currency:string amount:int53 star_count:int53 = TelegramPaymentPurpose;
|
||||
|
||||
//@description The user buying Telegram stars for other users
|
||||
//@user_id Identifier of the user to which Telegram stars are gifted
|
||||
//@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
|
||||
telegramPaymentPurposeGiftedStars user_id:int53 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
|
||||
|
@ -136,6 +136,21 @@ Result<InputInvoiceInfo> get_input_invoice_info(Td *td, td_api::object_ptr<td_ap
|
||||
result.input_invoice_ = telegram_api::make_object<telegram_api::inputInvoiceStars>(std::move(purpose));
|
||||
break;
|
||||
}
|
||||
case td_api::telegramPaymentPurposeGiftedStars::ID: {
|
||||
auto p = static_cast<td_api::telegramPaymentPurposeGiftedStars *>(invoice->purpose_.get());
|
||||
UserId user_id(p->user_id_);
|
||||
TRY_RESULT(input_user, td->user_manager_->get_input_user(user_id));
|
||||
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 purpose = telegram_api::make_object<telegram_api::inputStorePaymentStarsGift>(
|
||||
std::move(input_user), p->star_count_, p->currency_, p->amount_);
|
||||
result.input_invoice_ = telegram_api::make_object<telegram_api::inputInvoiceStars>(std::move(purpose));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user