diff options
author | 23rd <23rd@vivaldi.net> | 2024-05-17 03:37:56 +0300 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2024-05-30 21:35:06 +0400 |
commit | 9b11b95c5b64d88e97f8a53b32c0b4b326b8afee (patch) | |
tree | 43cd7d235a0789819c794e2fbbe622feb110f289 /Telegram/SourceFiles/payments/payments_form.cpp | |
parent | d0bfee69635e68ec9333e4f86b0c58c61dd47eb4 (diff) |
Added api support of invoice payments for credits.
Diffstat (limited to 'Telegram/SourceFiles/payments/payments_form.cpp')
-rw-r--r-- | Telegram/SourceFiles/payments/payments_form.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index 16469cb1ed..c02ea408b7 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -117,6 +117,8 @@ not_null<Main::Session*> SessionFromId(const InvoiceId &id) { return &message->peer->session(); } else if (const auto slug = std::get_if<InvoiceSlug>(&id.value)) { return slug->session; + } else if (const auto slug = std::get_if<InvoiceCredits>(&id.value)) { + return slug->session; } const auto &giftCode = v::get<InvoicePremiumGiftCode>(id.value); const auto users = std::get_if<InvoicePremiumGiftCodeUsers>( @@ -314,6 +316,15 @@ MTPInputInvoice Form::inputInvoice() const { MTP_int(message->itemId.bare)); } else if (const auto slug = std::get_if<InvoiceSlug>(&_id.value)) { return MTP_inputInvoiceSlug(MTP_string(slug->slug)); + } else if (const auto credits = std::get_if<InvoiceCredits>(&_id.value)) { + return MTP_inputInvoiceStars(MTP_starsTopupOption( + credits->product.isEmpty() + ? MTP_flags(0) + : MTP_flags(MTPDstarsTopupOption::Flag::f_store_product), + MTP_long(credits->credits), + MTP_string(credits->product), + MTP_string(credits->currency), + MTP_long(credits->amount))); } const auto &giftCode = v::get<InvoicePremiumGiftCode>(_id.value); using Flag = MTPDpremiumGiftCodeOption::Flag; |