Add phone number to makePayment and implement fallback logic for generating transaction IDs in payment scripts.
This commit is contained in:
parent
7931a10b88
commit
d27f4b6b22
@ -136,7 +136,7 @@ void PayByCardScript::doStart() {
|
|||||||
xmlScreenParser.parseAndSaveXml(AdbUtils::getScreenDumpAsXml(adbId, ++m_counter));
|
xmlScreenParser.parseAndSaveXml(AdbUtils::getScreenDumpAsXml(adbId, ++m_counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
makePayment(device.adbSerial, app.package, app.pinCode, device.screenWidth, device.screenHeight);
|
makePayment(device.adbSerial, app.package, app.pinCode, app.phone, device.screenWidth, device.screenHeight);
|
||||||
|
|
||||||
emit finishedWithResult(m_error);
|
emit finishedWithResult(m_error);
|
||||||
}
|
}
|
||||||
@ -145,6 +145,7 @@ void PayByCardScript::makePayment(
|
|||||||
const QString &deviceId,
|
const QString &deviceId,
|
||||||
const QString &packageName,
|
const QString &packageName,
|
||||||
const QString &pinCode,
|
const QString &pinCode,
|
||||||
|
const QString &bankProfilePhone,
|
||||||
const int width,
|
const int width,
|
||||||
const int height
|
const int height
|
||||||
) {
|
) {
|
||||||
@ -346,6 +347,7 @@ void PayByCardScript::makePayment(
|
|||||||
qDebug() << "[PayByCard] Saved transaction to DB, id:" << txId << "fee:" << fee;
|
qDebug() << "[PayByCard] Saved transaction to DB, id:" << txId << "fee:" << fee;
|
||||||
|
|
||||||
// Ищем кнопку "Документы" и достаём ID операции
|
// Ищем кнопку "Документы" и достаём ID операции
|
||||||
|
QString externalId;
|
||||||
Node docBtn = xmlScreenParser.findButtonNode("Документы", false);
|
Node docBtn = xmlScreenParser.findButtonNode("Документы", false);
|
||||||
if (!docBtn.isEmpty() && txId != -1) {
|
if (!docBtn.isEmpty() && txId != -1) {
|
||||||
qDebug() << "[PayByCard] Tapping 'Документы'...";
|
qDebug() << "[PayByCard] Tapping 'Документы'...";
|
||||||
@ -377,13 +379,7 @@ void PayByCardScript::makePayment(
|
|||||||
const QString ocrText = recognizeTextFromImage(screenshot);
|
const QString ocrText = recognizeTextFromImage(screenshot);
|
||||||
if (!ocrText.isEmpty()) {
|
if (!ocrText.isEmpty()) {
|
||||||
qDebug() << "[PayByCard] OCR result:\n" << ocrText;
|
qDebug() << "[PayByCard] OCR result:\n" << ocrText;
|
||||||
const QString externalId = extractTransactionId(ocrText);
|
externalId = extractTransactionId(ocrText);
|
||||||
if (!externalId.isEmpty()) {
|
|
||||||
TransactionDAO::updateBankTrExternalId(txId, externalId);
|
|
||||||
qDebug() << "[PayByCard] Extracted transaction ID:" << externalId;
|
|
||||||
} else {
|
|
||||||
qWarning() << "[PayByCard] Could not extract transaction ID from OCR text";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -394,6 +390,15 @@ void PayByCardScript::makePayment(
|
|||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (externalId.isEmpty() && txId != -1) {
|
||||||
|
externalId = "ozon_" + bankProfilePhone + "_" + QString::number(QDateTime::currentSecsSinceEpoch());
|
||||||
|
qDebug() << "[PayByCard] Generated fallback transaction ID:" << externalId;
|
||||||
|
}
|
||||||
|
if (!externalId.isEmpty() && txId != -1) {
|
||||||
|
TransactionDAO::updateBankTrExternalId(txId, externalId);
|
||||||
|
qDebug() << "[PayByCard] Transaction ID:" << externalId;
|
||||||
|
}
|
||||||
|
|
||||||
AdbUtils::goBack(deviceId);
|
AdbUtils::goBack(deviceId);
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
AdbUtils::goBack(deviceId);
|
AdbUtils::goBack(deviceId);
|
||||||
|
|||||||
@ -29,6 +29,7 @@ private:
|
|||||||
const QString &deviceId,
|
const QString &deviceId,
|
||||||
const QString &packageName,
|
const QString &packageName,
|
||||||
const QString &pinCode,
|
const QString &pinCode,
|
||||||
|
const QString &bankProfilePhone,
|
||||||
int width,
|
int width,
|
||||||
int height
|
int height
|
||||||
);
|
);
|
||||||
|
|||||||
@ -137,7 +137,7 @@ void PayByPhoneScript::doStart() {
|
|||||||
xmlScreenParser.parseAndSaveXml(AdbUtils::getScreenDumpAsXml(adbId, ++m_counter));
|
xmlScreenParser.parseAndSaveXml(AdbUtils::getScreenDumpAsXml(adbId, ++m_counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
makePayment(device.adbSerial, app.package, app.pinCode, device.screenWidth, device.screenHeight);
|
makePayment(device.adbSerial, app.package, app.pinCode, app.phone, device.screenWidth, device.screenHeight);
|
||||||
|
|
||||||
emit finishedWithResult(m_error);
|
emit finishedWithResult(m_error);
|
||||||
}
|
}
|
||||||
@ -146,6 +146,7 @@ void PayByPhoneScript::makePayment(
|
|||||||
const QString &deviceId,
|
const QString &deviceId,
|
||||||
const QString &packageName,
|
const QString &packageName,
|
||||||
const QString &pinCode,
|
const QString &pinCode,
|
||||||
|
const QString &bankProfilePhone,
|
||||||
const int width,
|
const int width,
|
||||||
const int height
|
const int height
|
||||||
) {
|
) {
|
||||||
@ -464,6 +465,7 @@ void PayByPhoneScript::makePayment(
|
|||||||
qDebug() << "[PayByPhone] Saved transaction to DB, id:" << txId;
|
qDebug() << "[PayByPhone] Saved transaction to DB, id:" << txId;
|
||||||
|
|
||||||
// Ищем кнопку "Документы" и достаём ID операции
|
// Ищем кнопку "Документы" и достаём ID операции
|
||||||
|
QString externalId;
|
||||||
Node docBtn = xmlScreenParser.findButtonNode("Документы", false);
|
Node docBtn = xmlScreenParser.findButtonNode("Документы", false);
|
||||||
if (!docBtn.isEmpty() && txId != -1) {
|
if (!docBtn.isEmpty() && txId != -1) {
|
||||||
qDebug() << "[PayByPhone] Tapping 'Документы'...";
|
qDebug() << "[PayByPhone] Tapping 'Документы'...";
|
||||||
@ -495,13 +497,7 @@ void PayByPhoneScript::makePayment(
|
|||||||
const QString ocrText = recognizeTextFromImage(screenshot);
|
const QString ocrText = recognizeTextFromImage(screenshot);
|
||||||
if (!ocrText.isEmpty()) {
|
if (!ocrText.isEmpty()) {
|
||||||
qDebug() << "[PayByPhone] OCR result:\n" << ocrText;
|
qDebug() << "[PayByPhone] OCR result:\n" << ocrText;
|
||||||
const QString externalId = extractTransactionId(ocrText);
|
externalId = extractTransactionId(ocrText);
|
||||||
if (!externalId.isEmpty()) {
|
|
||||||
TransactionDAO::updateBankTrExternalId(txId, externalId);
|
|
||||||
qDebug() << "[PayByPhone] Extracted transaction ID:" << externalId;
|
|
||||||
} else {
|
|
||||||
qWarning() << "[PayByPhone] Could not extract transaction ID from OCR text";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -512,6 +508,15 @@ void PayByPhoneScript::makePayment(
|
|||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (externalId.isEmpty() && txId != -1) {
|
||||||
|
externalId = "ozon_" + bankProfilePhone + "_" + QString::number(QDateTime::currentSecsSinceEpoch());
|
||||||
|
qDebug() << "[PayByPhone] Generated fallback transaction ID:" << externalId;
|
||||||
|
}
|
||||||
|
if (!externalId.isEmpty() && txId != -1) {
|
||||||
|
TransactionDAO::updateBankTrExternalId(txId, externalId);
|
||||||
|
qDebug() << "[PayByPhone] Transaction ID:" << externalId;
|
||||||
|
}
|
||||||
|
|
||||||
AdbUtils::goBack(deviceId);
|
AdbUtils::goBack(deviceId);
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
AdbUtils::goBack(deviceId);
|
AdbUtils::goBack(deviceId);
|
||||||
|
|||||||
@ -31,6 +31,7 @@ private:
|
|||||||
const QString &deviceId,
|
const QString &deviceId,
|
||||||
const QString &packageName,
|
const QString &packageName,
|
||||||
const QString &pinCode,
|
const QString &pinCode,
|
||||||
|
const QString &bankProfilePhone,
|
||||||
int width,
|
int width,
|
||||||
int height
|
int height
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user