2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 09:05:14 +00:00

Support additional payment methods.

This commit is contained in:
John Preston
2022-07-19 14:28:23 +03:00
parent de0eef8cc6
commit bb251627a9
5 changed files with 68 additions and 4 deletions

View File

@@ -318,6 +318,9 @@ void Form::processForm(const MTPDpayments_paymentForm &data) {
processSavedCredentials(data);
});
}
if (const auto additional = data.vadditional_methods()) {
processAdditionalPaymentMethods(additional->v);
}
fillPaymentMethodInformation();
_updates.fire(FormReady{});
}
@@ -470,6 +473,18 @@ void Form::processSavedCredentials(
refreshPaymentMethodDetails();
}
void Form::processAdditionalPaymentMethods(
const QVector<MTPPaymentFormMethod> &list) {
_paymentMethod.ui.additionalMethods = ranges::views::all(
list
) | ranges::views::transform([](const MTPPaymentFormMethod &method) {
return Ui::PaymentMethodAdditional{
.title = qs(method.data().vtitle()),
.url = qs(method.data().vurl()),
};
}) | ranges::to_vector;
}
void Form::refreshPaymentMethodDetails() {
const auto &saved = _paymentMethod.savedCredentials;
const auto &entered = _paymentMethod.newCredentials;