#include "PayByPhoneScript.h" #include #include "DatabaseManager.h" #include "dao/AccountDAO.h" #include "dao/ApplicationDAO.h" #include "dao/DeviceDAO.h" #include "dao/TransactionDAO.h" #include "db/ApplicationInfo.h" #include "db/DeviceInfo.h" PayByPhoneScript::PayByPhoneScript( AccountInfo account, QString phone, QString bankName, const double amount, QObject *parent ) : CommonScript(parent), m_account(std::move(account)), m_phone(std::move(phone)), m_bankName(std::move(bankName)), m_amount(amount) { } PayByPhoneScript::~PayByPhoneScript() = default; void PayByPhoneScript::doStart() { const DeviceInfo device = DeviceDAO::getDeviceById(m_account.deviceId); const ApplicationInfo app = ApplicationDAO::getApplicationsByDeviceId(m_account.deviceId, m_account.appName); if (device.id.isEmpty() || app.id.isEmpty()) { qDebug() << "Device or app not found...."; return; } m_width = device.screenWidth; m_height = device.screenHeight; m_pinCode = app.pinCode; m_packageName = app.package; if (runAppAndGoToHomeScreen()) { if (goToAllProducts()) { QList accounts = xmlScreenParser.parseAccountsInfo(); for (AccountInfo &account: accounts) { account.deviceId = m_account.deviceId; account.appName = m_account.appName; if (!AccountDAO::upsertAccount(account)) { qDebug() << "Not updated: " << account.lastNumbers; } } } else { qDebug() << "Не смогли открыть 'Все продукты'"; } } else { qDebug() << "Не смогли дойти до домашней страницы...."; } }