mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
3DSecure in Proof-Of-Concept payments.
This commit is contained in:
parent
7c979144fc
commit
b323e5ffcf
1 changed files with 13 additions and 5 deletions
|
@ -54,8 +54,16 @@ void GetPaymentForm(not_null<const HistoryItem*> msg) {
|
||||||
window->setGeometry({ 100, 100, 1280, 960 });
|
window->setGeometry({ 100, 100, 1280, 960 });
|
||||||
window->show();
|
window->show();
|
||||||
|
|
||||||
|
window->events() | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
|
if (e->type() == QEvent::Close) {
|
||||||
|
window->deleteLater();
|
||||||
|
}
|
||||||
|
}, window->lifetime());
|
||||||
|
|
||||||
const auto body = window->body();
|
const auto body = window->body();
|
||||||
const auto webview = new Webview::Window(window);
|
const auto webview = Ui::CreateChild<Webview::Window>(
|
||||||
|
window,
|
||||||
|
window);
|
||||||
body->geometryValue(
|
body->geometryValue(
|
||||||
) | rpl::start_with_next([=](QRect geometry) {
|
) | rpl::start_with_next([=](QRect geometry) {
|
||||||
webview->widget()->setGeometry(geometry);
|
webview->widget()->setGeometry(geometry);
|
||||||
|
@ -118,12 +126,12 @@ void GetPaymentForm(not_null<const HistoryItem*> msg) {
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_dataJSON(MTP_bytes(serializedCredentials)))
|
MTP_dataJSON(MTP_bytes(serializedCredentials)))
|
||||||
)).done([=](const MTPpayments_PaymentResult &result) {
|
)).done([=](const MTPpayments_PaymentResult &result) {
|
||||||
delete window;
|
|
||||||
App::wnd()->activate();
|
|
||||||
result.match([&](const MTPDpayments_paymentResult &data) {
|
result.match([&](const MTPDpayments_paymentResult &data) {
|
||||||
|
delete window;
|
||||||
|
App::wnd()->activate();
|
||||||
session->api().applyUpdates(data.vupdates());
|
session->api().applyUpdates(data.vupdates());
|
||||||
}, [&](const MTPDpayments_paymentVerificationNeeded &data) {
|
}, [&](const MTPDpayments_paymentVerificationNeeded &data) {
|
||||||
Ui::Toast::Show("payments.paymentVerificationNeeded");
|
webview->navigate(qs(data.vurl()));
|
||||||
});
|
});
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
delete window;
|
delete window;
|
||||||
|
@ -143,7 +151,7 @@ void GetPaymentForm(not_null<const HistoryItem*> msg) {
|
||||||
"}());");
|
"}());");
|
||||||
|
|
||||||
const auto &data = result.c_payments_paymentForm();
|
const auto &data = result.c_payments_paymentForm();
|
||||||
webview->navigate(qs(data.vurl().v));
|
webview->navigate(qs(data.vurl()));
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
App::wnd()->activate();
|
App::wnd()->activate();
|
||||||
Ui::Toast::Show("payments.getPaymentForm: " + error.type());
|
Ui::Toast::Show("payments.getPaymentForm: " + error.type());
|
||||||
|
|
Loading…
Add table
Reference in a new issue