Added api support of subscription period in credits invoices.

This commit is contained in:
23rd 2024-11-11 02:23:33 +03:00 committed by John Preston
parent 81bea04db0
commit 03d9fb4115
2 changed files with 4 additions and 0 deletions

View file

@ -456,6 +456,8 @@ void Form::requestForm() {
const auto amount = tlPrices.empty()
? 0
: tlPrices.front().data().vamount().v;
const auto subscriptionPeriod
= data.vinvoice().data().vsubscription_period().value_or(0);
if (currency != ::Ui::kCreditsCurrency || !amount) {
using Type = Error::Type;
_updates.fire(Error{ Type::Form, u"Bad Stars Form."_q });
@ -467,6 +469,7 @@ void Form::requestForm() {
.credits = amount,
.currency = currency,
.amount = amount,
.subscriptionPeriod = subscriptionPeriod,
};
const auto formData = CreditsFormData{
.id = _id,

View file

@ -170,6 +170,7 @@ struct InvoiceCredits {
uint64 amount = 0;
bool extended = false;
PeerId giftPeerId = PeerId(0);
int subscriptionPeriod = 0;
};
struct InvoiceStarGift {