VMCPlugin/plugins/CalculatePrice/CalculatePriceDefault.cpp

216 lines
6.7 KiB
C++

#include "CalculatePriceDefault.h"
#include <QDebug>
using namespace nsCalculatePriceInterface;
const std::string CalculatePriceInterfacePluginInfoString = R"(
{
"PluginName": "CalculatePriceDummy",
"Version": "1.0",
"git-describe": "",
}
)";
CalculatePriceDefault::CalculatePriceDefault(QObject *parent) :
QObject(parent),
errorCode(1),
errorDescription(""),
pluginState(PLUGIN_STATE::NOT_INITIALIZED)
{
this->pluginInfo = QString::fromUtf8(CalculatePriceInterfacePluginInfoString.c_str());
}
CalculatePriceDefault::~CalculatePriceDefault()
{
}
PLUGIN_STATE CalculatePriceDefault::initCalculatePricePlugin(QObject *healthEventReceiver, const QSettings & settings)
{
Q_UNUSED(healthEventReceiver)
qDebug() << "called CalculatePriceDummy::initCalculatePricePlugin()";
qDebug() << " pluginName from setting is: " << settings.value("PLUGINS/CalculatePricePlugin", "").toString();
this->pluginState = PLUGIN_STATE::INITIALIZED;
return this->pluginState;
}
void CalculatePriceDefault::requestCalculatePrice(const QString & AccessInformation,
const QString & AccessInformationType,
const QString & PermitType)
{
Q_UNUSED(PermitType)
emit this->requestCalculatePriceResult(RESULT_STATE::SUCCESS,
AccessInformation,
AccessInformationType,
"",
"",
"",
"",
"",
"1",
"dummyPlugin"
);
}
void CalculatePriceDefault::requestCalculatePrice(const QString & AccessInformation,
const QString & AccessInformationType,
const QString & PermitType,
const QString & parktime)
{
Q_UNUSED(PermitType)
Q_UNUSED(parktime)
emit this->requestCalculatePriceResult(RESULT_STATE::SUCCESS,
AccessInformation,
AccessInformationType,
"",
"",
"",
"",
"",
"1",
"dummyPlugin"
);
}
void CalculatePriceDefault::requestCalculatePrice(const QString & AccessInformation,
const QString & AccessInformationType,
const QString & PermitType,
nsCalculatePriceInterface::STEP step)
{
Q_UNUSED(AccessInformation)
Q_UNUSED(AccessInformationType)
Q_UNUSED(PermitType)
Q_UNUSED(step)
}
void CalculatePriceDefault::requestCalculatePrice(const QString & AccessInformation,
const QString & AccessInformationType,
const QString & PermitType,
int coinValue)
{
Q_UNUSED(AccessInformation)
Q_UNUSED(AccessInformationType)
Q_UNUSED(PermitType)
Q_UNUSED(coinValue)
}
void CalculatePriceDefault::requestCalculatePrice(const QString & AccessInformation,
const QString & AccessInformationType,
const QString & PermitType,
const QString & parktime,
const QString & cardInfo,
const QString & transactionInfo)
{
Q_UNUSED(PermitType)
Q_UNUSED(parktime)
Q_UNUSED(cardInfo)
Q_UNUSED(transactionInfo)
emit this->requestCalculatePriceResult(RESULT_STATE::SUCCESS,
AccessInformation,
AccessInformationType,
"",
"",
"",
"",
"",
"1",
"dummyPlugin"
);
}
void CalculatePriceDefault::requestProcessTransaction(const QString & AccessInformation,
const QString & AccessInformationType,
const QString &amount,
bool isOffline,
const QString & TransactionId,
const QString & ReceiptData,
const QString & PermitType, const QString &PaymentType)
{
Q_UNUSED(isOffline)
Q_UNUSED(AccessInformation)
Q_UNUSED(AccessInformationType)
Q_UNUSED(amount)
Q_UNUSED(TransactionId)
Q_UNUSED(ReceiptData)
Q_UNUSED(PermitType)
Q_UNUSED(PaymentType)
}
/************************************************************************************************
* Mandatory plugin methods
*
*/
PLUGIN_STATE CalculatePriceDefault::getState()
{
return this->pluginState;
}
quint32 CalculatePriceDefault::getLastError()
{
return this->errorCode;
}
const QString & CalculatePriceDefault::getLastErrorDescription()
{
return this->errorDescription;
}
const QString & CalculatePriceDefault::getPluginInfo()
{
return pluginInfo;
}
const QString CalculatePriceDefault::getString(nsCalculatePriceInterface::RESULT_STATE resultState)
{
QString str;
switch (resultState) {
case nsCalculatePriceInterface::RESULT_STATE::SUCCESS:
str = QString("RESULT_STATE::SUCCESS");
break;
case nsCalculatePriceInterface::RESULT_STATE::ERROR_BACKEND:
str = QString("RESULT_STATE::ERROR_BACKEND");
break;
case nsCalculatePriceInterface::RESULT_STATE::ERROR_NETWORK:
str = QString("RESULT_STATE::ERROR_NETWORK");
break;
case nsCalculatePriceInterface::RESULT_STATE::ERROR_TIMEOUT:
str = QString("RESULT_STATE::ERROR_TIMEOUT");
break;
case nsCalculatePriceInterface::RESULT_STATE::ERROR_PROCESS:
str = QString("RESULT_STATE::ERROR_PROCESS");
break;
case nsCalculatePriceInterface::RESULT_STATE::ERROR_RETRY:
str = QString("RESULT_STATE::ERROR_RETRY");
break;
case nsCalculatePriceInterface::RESULT_STATE::INFO:
str = QString("RESULT_STATE::INFO");
break;
}
return str;
}