From b323e5ffcff8a55cac9e3a82cc6022bd3b22e081 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 26 Feb 2021 20:56:12 +0400 Subject: [PATCH] 3DSecure in Proof-Of-Concept payments. --- Telegram/SourceFiles/facades.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 6bb2e29406..33a316b543 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -54,8 +54,16 @@ void GetPaymentForm(not_null msg) { window->setGeometry({ 100, 100, 1280, 960 }); window->show(); + window->events() | rpl::start_with_next([=](not_null e) { + if (e->type() == QEvent::Close) { + window->deleteLater(); + } + }, window->lifetime()); + const auto body = window->body(); - const auto webview = new Webview::Window(window); + const auto webview = Ui::CreateChild( + window, + window); body->geometryValue( ) | rpl::start_with_next([=](QRect geometry) { webview->widget()->setGeometry(geometry); @@ -118,12 +126,12 @@ void GetPaymentForm(not_null msg) { MTP_flags(0), MTP_dataJSON(MTP_bytes(serializedCredentials))) )).done([=](const MTPpayments_PaymentResult &result) { - delete window; - App::wnd()->activate(); result.match([&](const MTPDpayments_paymentResult &data) { + delete window; + App::wnd()->activate(); session->api().applyUpdates(data.vupdates()); }, [&](const MTPDpayments_paymentVerificationNeeded &data) { - Ui::Toast::Show("payments.paymentVerificationNeeded"); + webview->navigate(qs(data.vurl())); }); }).fail([=](const RPCError &error) { delete window; @@ -143,7 +151,7 @@ void GetPaymentForm(not_null msg) { "}());"); const auto &data = result.c_payments_paymentForm(); - webview->navigate(qs(data.vurl().v)); + webview->navigate(qs(data.vurl())); }).fail([=](const RPCError &error) { App::wnd()->activate(); Ui::Toast::Show("payments.getPaymentForm: " + error.type());