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 {
|
|
Phone,
|
|
Card,
|
|
Balance,
|
|
History,
|
|
FetchProfile,
|
|
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::Phone: return "phone";
|
|
case EventType::Card: return "card";
|
|
case EventType::Balance: return "balance";
|
|
case EventType::History: return "history";
|
|
case EventType::FetchProfile: return "fetch_profile";
|
|
default: return "unknown";
|
|
}
|
|
}
|
|
|
|
inline EventType eventTypeFromString(const QString &str) {
|
|
if (str == "phone") return EventType::Phone;
|
|
if (str == "card") return EventType::Card;
|
|
if (str == "balance") return EventType::Balance;
|
|
if (str == "history") return EventType::History;
|
|
if (str == "fetch_profile") return EventType::FetchProfile;
|
|
return EventType::Unknown;
|
|
}
|
|
|
|
struct EventInfo {
|
|
int id = -1;
|
|
int externalId = -1;
|
|
int accountId = -1;
|
|
QString deviceId;
|
|
|
|
double amount = 0;
|
|
QString phone;
|
|
QString bankName;
|
|
QString comment;
|
|
|
|
EventStatus status = EventStatus::Unknown;
|
|
EventType type = EventType::Unknown;
|
|
|
|
QDateTime updateTime;
|
|
QDateTime completeTime;
|
|
QDateTime timestamp;
|
|
}; |