diff options
author | John Preston <johnprestonmail@gmail.com> | 2021-03-23 16:34:34 +0400 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2021-03-23 16:34:34 +0400 |
commit | 28137dfb609fb5da649d46ee125ad789a0580fc8 (patch) | |
tree | 9c640689e479adbf6f74376abf58003bb74e294e /Telegram/SourceFiles/payments/payments_checkout_process.h | |
parent | e7784620d36b146942cda025228f1aa03cff1dd9 (diff) |
Start proper payments processing.
Diffstat (limited to 'Telegram/SourceFiles/payments/payments_checkout_process.h')
-rw-r--r-- | Telegram/SourceFiles/payments/payments_checkout_process.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Telegram/SourceFiles/payments/payments_checkout_process.h b/Telegram/SourceFiles/payments/payments_checkout_process.h new file mode 100644 index 0000000000..1eff37db96 --- /dev/null +++ b/Telegram/SourceFiles/payments/payments_checkout_process.h @@ -0,0 +1,69 @@ +/* +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 +*/ +#pragma once + +#include "payments/ui/payments_panel_delegate.h" +#include "base/weak_ptr.h" + +class HistoryItem; + +namespace Main { +class Session; +} // namespace Main + +namespace Payments::Ui { +class Panel; +class WebviewWindow; +} // namespace Payments::Ui + +namespace Payments { + +class Form; +struct FormUpdate; +struct FormError; +struct SendError; + +class CheckoutProcess final + : public base::has_weak_ptr + , private Ui::PanelDelegate { + struct PrivateTag {}; + +public: + static void Start(not_null<const HistoryItem*> item); + + CheckoutProcess( + not_null<Main::Session*> session, + FullMsgId itemId, + PrivateTag); + ~CheckoutProcess(); + + void requestActivate(); + +private: + [[nodiscard]] not_null<PanelDelegate*> panelDelegate(); + + void handleFormUpdate(const FormUpdate &update); + void handleFormError(const FormError &error); + void handleSendError(const SendError &error); + + void panelRequestClose() override; + void panelCloseSure() override; + void panelSubmit() override; + void panelWebviewMessage(const QJsonDocument &message) override; + bool panelWebviewNavigationAttempt(const QString &uri) override; + + const not_null<Main::Session*> _session; + const std::unique_ptr<Form> _form; + const std::unique_ptr<Ui::Panel> _panel; + std::unique_ptr<Ui::WebviewWindow> _webviewWindow; + + rpl::lifetime _lifetime; + +}; + +} // namespace Payments |