/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "payments/payments_non_panel_process.h" #include "payments/payments_checkout_process.h" // NonPanelPaymentForm. #include "payments/payments_form.h" #include "history/history_item.h" #include "ui/layers/generic_box.h" #include "window/window_session_controller.h" #include "boxes/send_credits_box.h" namespace Payments { namespace { bool IsCreditsInvoice(not_null item) { const auto media = item->media(); const auto invoice = media ? media->invoice() : nullptr; return invoice && (invoice->currency == "XTR"); } } // namespace Fn ProcessNonPanelPaymentFormFactory( not_null controller) { return [=](NonPanelPaymentForm form) { using CreditsFormDataPtr = std::shared_ptr; if (const auto creditsData = std::get_if(&form)) { controller->uiShow()->show(Box(Ui::SendCreditsBox, *creditsData)); } }; } Fn ProcessNonPanelPaymentFormFactory( not_null controller, not_null item) { return IsCreditsInvoice(item) ? ProcessNonPanelPaymentFormFactory(controller) : nullptr; } } // namespace Payments