From 95e4a4f6d9a77ba045a8b6c0b98d92b64559b13c Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 24 May 2024 13:53:20 +0300 Subject: [PATCH] Add starTransaction.product_info. --- td/generate/scheme/td_api.tl | 3 ++- td/telegram/Premium.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index b4fbf4cca..f0a4d93a1 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -876,7 +876,8 @@ starTransactionSourceUnsupported = StarTransactionSource; //@star_count The amount of added owned Telegram stars; negative for outgoing transactions //@date Point in time (Unix timestamp) when the transaction was completed //@source Source of the transaction, or its recipient for outgoing transactions -starTransaction id:string star_count:int53 date:int32 source:StarTransactionSource = StarTransaction; +//@product_info Information about the product; may be null if unknown +starTransaction id:string star_count:int53 date:int32 source:StarTransactionSource product_info:productInfo = StarTransaction; //@description Represents a list of Telegram star transactions //@star_count The amount of owned Telegram stars diff --git a/td/telegram/Premium.cpp b/td/telegram/Premium.cpp index 81bfcdc60..94c151802 100644 --- a/td/telegram/Premium.cpp +++ b/td/telegram/Premium.cpp @@ -17,6 +17,7 @@ #include "td/telegram/DocumentsManager.h" #include "td/telegram/GiveawayParameters.h" #include "td/telegram/Global.h" +#include "td/telegram/InputInvoice.h" #include "td/telegram/MessageEntity.h" #include "td/telegram/MessageId.h" #include "td/telegram/MessageSender.h" @@ -704,8 +705,13 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler { UNREACHABLE(); } }(); - transactions.push_back(td_api::make_object(transaction->id_, transaction->stars_, - transaction->date_, std::move(source))); + td_api::object_ptr product_info; + if (!transaction->title_.empty() || !transaction->description_.empty() || transaction->photo_ != nullptr) { + auto photo = get_web_document_photo(td_->file_manager_.get(), std::move(transaction->photo_), DialogId()); + product_info = get_product_info_object(td_, transaction->title_, transaction->description_, photo); + } + transactions.push_back(td_api::make_object( + transaction->id_, transaction->stars_, transaction->date_, std::move(source), std::move(product_info))); } promise_.set_value(