File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,18 @@ class GetGiftPaymentFormQuery final : public Td::ResultHandler {
201
201
break ;
202
202
case telegram_api::payments_paymentFormStarGift::ID: {
203
203
auto payment_form = static_cast <const telegram_api::payments_paymentFormStarGift *>(payment_form_ptr.get ());
204
+ if (!td_->auth_manager_ ->is_bot ()) {
205
+ if (payment_form->invoice_ ->prices_ .size () != 1u ||
206
+ payment_form->invoice_ ->prices_ [0 ]->amount_ > star_count_) {
207
+ td_->star_manager_ ->add_pending_owned_star_count (star_count_, false );
208
+ return promise_.set_error (400 , " Wrong gift price specified" );
209
+ }
210
+ if (payment_form->invoice_ ->prices_ [0 ]->amount_ != star_count_) {
211
+ td_->star_manager_ ->add_pending_owned_star_count (star_count_ - payment_form->invoice_ ->prices_ [0 ]->amount_ ,
212
+ false );
213
+ star_count_ = payment_form->invoice_ ->prices_ [0 ]->amount_ ;
214
+ }
215
+ }
204
216
td_->create_handler <SendGiftQuery>(std::move (promise_))
205
217
->send (std::move (send_input_invoice_), payment_form->form_id_ , star_count_);
206
218
break ;
You can’t perform that action at this time.
0 commit comments