Add withdrawal state to starTransactionSourceFragment.

This commit is contained in:
levlam 2024-06-13 20:46:04 +03:00
parent 021c305770
commit 0c72e2031b
2 changed files with 21 additions and 4 deletions

View File

@ -861,8 +861,8 @@ starTransactionSourceAppStore = StarTransactionSource;
//@description The transaction is a transaction with Google Play
starTransactionSourceGooglePlay = StarTransactionSource;
//@description The transaction is a transaction with Fragment
starTransactionSourceFragment = StarTransactionSource;
//@description The transaction is a transaction with Fragment @withdrawal_state State of the withdrawal; may be null for refunds from Fragment
starTransactionSourceFragment withdrawal_state:RevenueWithdrawalState = StarTransactionSource;
//@description The transaction is a transaction with another user @user_id Identifier of the user @product_info Information about the bought product; may be null if none
starTransactionSourceUser user_id:int53 product_info:productInfo = StarTransactionSource;

View File

@ -696,8 +696,25 @@ class GetStarsTransactionsQuery final : public Td::ResultHandler {
return td_api::make_object<td_api::starTransactionSourceAppStore>();
case telegram_api::starsTransactionPeerPlayMarket::ID:
return td_api::make_object<td_api::starTransactionSourceGooglePlay>();
case telegram_api::starsTransactionPeerFragment::ID:
return td_api::make_object<td_api::starTransactionSourceFragment>();
case telegram_api::starsTransactionPeerFragment::ID: {
auto state = [&]() -> td_api::object_ptr<td_api::RevenueWithdrawalState> {
if (transaction->transaction_date_ > 0) {
return td_api::make_object<td_api::revenueWithdrawalStateCompleted>(transaction->transaction_date_,
transaction->transaction_url_);
}
if (transaction->pending_) {
return td_api::make_object<td_api::revenueWithdrawalStatePending>();
}
if (transaction->failed_) {
return td_api::make_object<td_api::revenueWithdrawalStateFailed>();
}
if (!transaction->refund_) {
LOG(ERROR) << "Receive " << to_string(transaction);
}
return nullptr;
}();
return td_api::make_object<td_api::starTransactionSourceFragment>(std::move(state));
}
case telegram_api::starsTransactionPeer::ID: {
DialogId dialog_id(
static_cast<const telegram_api::starsTransactionPeer *>(transaction->peer_.get())->peer_);