Remove invoice_chat_id/invoice_message_id from messagePaymentSuccessfulBot, because they are incompatible with inline mode.

This commit is contained in:
levlam 2021-04-07 22:58:40 +03:00
parent 5d5f950d2b
commit fbb15a9925
2 changed files with 18 additions and 13 deletions

View File

@ -1767,10 +1767,10 @@ messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageConten
//@description A payment has been completed @invoice_chat_id Identifier of the chat, containing the corresponding invoice message; 0 if unknown @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for the price of the product @total_amount Total price for the product, in the smallest units of the currency
messagePaymentSuccessful invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 = MessageContent;
//@description A payment has been completed; for bots only @invoice_chat_id Identifier of the chat, containing the corresponding invoice message; 0 if unknown @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for price of the product
//@description A payment has been completed; for bots only @currency Currency for price of the product
//@total_amount Total price for the product, in the smallest units of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null
//@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier
messagePaymentSuccessfulBot invoice_chat_id:int53 invoice_message_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent;
messagePaymentSuccessfulBot currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent;
//@description A contact has registered with Telegram
messageContactRegistered = MessageContent;
@ -3840,7 +3840,7 @@ getMessage chat_id:int53 message_id:int53 = Message;
//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get
getMessageLocally chat_id:int53 message_id:int53 = Message;
//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful/messagePaymentSuccessfulBot respectively
//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively
//@chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which to get
getRepliedMessage chat_id:int53 message_id:int53 = Message;

View File

@ -2582,6 +2582,10 @@ FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const M
return {dialog_id, static_cast<const MessageGameScore *>(content)->game_message_id};
case MessageContentType::PaymentSuccessful: {
auto *m = static_cast<const MessagePaymentSuccessful *>(content);
if (!m->invoice_message_id.is_valid()) {
return FullMessageId();
}
auto reply_in_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
return {reply_in_dialog_id, m->invoice_message_id};
}
@ -4357,7 +4361,10 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
is_video);
}
case telegram_api::messageActionPaymentSent::ID: {
LOG_IF(ERROR, td->auth_manager_->is_bot()) << "Receive MessageActionPaymentSent in " << owner_dialog_id;
if (td->auth_manager_->is_bot()) {
LOG(ERROR) << "Receive MessageActionPaymentSent in " << owner_dialog_id;
break;
}
if (!reply_to_message_id.is_valid()) {
LOG(ERROR) << "Receive succesful payment message with " << reply_to_message_id << " in " << owner_dialog_id;
reply_to_message_id = MessageId();
@ -4367,14 +4374,13 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
std::move(payment_sent->currency_), payment_sent->total_amount_);
}
case telegram_api::messageActionPaymentSentMe::ID: {
LOG_IF(ERROR, !td->auth_manager_->is_bot()) << "Receive MessageActionPaymentSentMe in " << owner_dialog_id;
if (!reply_to_message_id.is_valid()) {
LOG(ERROR) << "Receive succesful payment message with " << reply_to_message_id << " in " << owner_dialog_id;
reply_to_message_id = MessageId();
if (!td->auth_manager_->is_bot()) {
LOG(ERROR) << "Receive MessageActionPaymentSentMe in " << owner_dialog_id;
break;
}
auto payment_sent = move_tl_object_as<telegram_api::messageActionPaymentSentMe>(action);
auto result = td::make_unique<MessagePaymentSuccessful>(
reply_in_dialog_id, reply_to_message_id, std::move(payment_sent->currency_), payment_sent->total_amount_);
DialogId(), MessageId(), std::move(payment_sent->currency_), payment_sent->total_amount_);
result->invoice_payload = payment_sent->payload_.as_slice().str();
result->shipping_option_id = std::move(payment_sent->shipping_option_id_);
result->order_info = get_order_info(std::move(payment_sent->info_));
@ -4621,13 +4627,12 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
}
case MessageContentType::PaymentSuccessful: {
const MessagePaymentSuccessful *m = static_cast<const MessagePaymentSuccessful *>(content);
auto invoice_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
if (td->auth_manager_->is_bot()) {
return make_tl_object<td_api::messagePaymentSuccessfulBot>(
invoice_dialog_id.get(), m->invoice_message_id.get(), m->currency, m->total_amount, m->invoice_payload,
m->shipping_option_id, get_order_info_object(m->order_info), m->telegram_payment_charge_id,
m->provider_payment_charge_id);
m->currency, m->total_amount, m->invoice_payload, m->shipping_option_id,
get_order_info_object(m->order_info), m->telegram_payment_charge_id, m->provider_payment_charge_id);
} else {
auto invoice_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
return make_tl_object<td_api::messagePaymentSuccessful>(invoice_dialog_id.get(), m->invoice_message_id.get(),
m->currency, m->total_amount);
}