79 lines
2.0 KiB
C
79 lines
2.0 KiB
C
#pragma once
|
|
|
|
#include <QString>
|
|
#include <QDateTime>
|
|
|
|
enum class EventStatus {
|
|
Wait,
|
|
InProgress,
|
|
Complete,
|
|
Error,
|
|
Unknown
|
|
};
|
|
|
|
enum class EventType {
|
|
FetchProfile,
|
|
FetchTransactions,
|
|
CreateTransaction,
|
|
Unknown
|
|
};
|
|
|
|
|
|
inline QString eventStatusToString(const EventStatus status) {
|
|
switch (status) {
|
|
case EventStatus::Wait: return "wait";
|
|
case EventStatus::Error: return "error";
|
|
case EventStatus::Complete: return "complete";
|
|
case EventStatus::InProgress: return "iPprogress";
|
|
default: return "unknown";
|
|
}
|
|
}
|
|
|
|
inline EventStatus eventStatusFromString(const QString &str) {
|
|
if (str == "error") return EventStatus::Error;
|
|
if (str == "wait") return EventStatus::Wait;
|
|
if (str == "complete") return EventStatus::Complete;
|
|
if (str == "iPprogress") return EventStatus::InProgress;
|
|
return EventStatus::Unknown;
|
|
}
|
|
|
|
inline QString eventTypeToString(const EventType type) {
|
|
switch (type) {
|
|
case EventType::FetchProfile: return "FETCH_PROFILE";
|
|
case EventType::FetchTransactions: return "FETCH_TRANSACTIONS";
|
|
case EventType::CreateTransaction: return "CREATE_TRANSACTION";
|
|
default: return "unknown";
|
|
}
|
|
}
|
|
|
|
inline EventType eventTypeFromString(const QString &str) {
|
|
if (str == "FETCH_PROFILE") return EventType::FetchProfile;
|
|
if (str == "FETCH_TRANSACTIONS") return EventType::FetchTransactions;
|
|
if (str == "CREATE_TRANSACTION") return EventType::CreateTransaction;
|
|
return EventType::Unknown;
|
|
}
|
|
|
|
struct EventInfo {
|
|
int id = -1;
|
|
QString externalId;
|
|
int accountId = -1;
|
|
QString deviceId;
|
|
|
|
double amount = 0;
|
|
QString phone;
|
|
QString bankName;
|
|
QString comment;
|
|
|
|
EventStatus status = EventStatus::Unknown;
|
|
EventType type = EventType::Unknown;
|
|
|
|
QString json;
|
|
bool sentToServer = false;
|
|
|
|
QByteArray screenshot;
|
|
bool hasScreenshot = false;
|
|
|
|
QDateTime updateTime;
|
|
QDateTime completeTime;
|
|
QDateTime timestamp;
|
|
}; |