Delete all synced bank profiles from server when removing a device.
This commit is contained in:
parent
3751406c36
commit
a7cefa7fcf
@ -1514,6 +1514,20 @@ void NetworkService::deleteDeviceFromServer() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Сначала удаляем на сервере все банковские профили девайса, которые уже
|
||||
// были синхронизированы (есть bank_profile_id). Несинхронизированные —
|
||||
// пропускаем, на сервере их нет.
|
||||
const QList<BankProfileInfo> profiles = BankProfileDAO::getApplicationsByDeviceId(device.id);
|
||||
for (const BankProfileInfo &bp : profiles) {
|
||||
if (bp.bankProfileId.isEmpty()) continue;
|
||||
const QJsonValue bpResult = deleteJson(m_apiBase + m_pathBankProfile + "/" + bp.bankProfileId, true);
|
||||
if (bpResult.isUndefined()) {
|
||||
qWarning() << "[deleteDeviceFromServer] failed to delete bank_profile on server:" << bp.bankProfileId << bp.code;
|
||||
} else {
|
||||
qDebug() << "[deleteDeviceFromServer] deleted bank_profile on server:" << bp.bankProfileId << bp.code;
|
||||
}
|
||||
}
|
||||
|
||||
const QJsonValue result = deleteJson(m_apiBase + m_pathDevice + device.apiId, true);
|
||||
if (result.isUndefined()) {
|
||||
qWarning() << "[deleteDeviceFromServer] failed to delete device on server:" << device.apiId;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user