Browse Source

refs #1 Syncronizing with release commit: b365027430

qt5
parent
commit
90d9ca6e7f
100 changed files with 2361 additions and 1646 deletions
  1. +5
    -3
      3.0/scripts/build/runtimes/terminal_ru.xml
  2. +1
    -1
      3.0/src/apps/PaymentProcessor/src/Services/CashDispenserManager.cpp
  3. +11
    -4
      3.0/src/apps/PaymentProcessor/src/Services/IntegratedDrivers.cpp
  4. +1
    -1
      3.0/src/apps/PaymentProcessor/src/Services/PaymentService.cpp
  5. +1
    -1
      3.0/src/apps/PaymentProcessor/src/Services/PaymentService.h
  6. +5
    -1
      3.0/src/apps/PaymentProcessor/src/Services/PrintingCommands.cpp
  7. +12
    -0
      3.0/src/apps/PaymentProcessor/src/Services/PrintingCommands.h
  8. +5
    -5
      3.0/src/apps/PaymentProcessor/src/Services/PrintingService.cpp
  9. +28
    -15
      3.0/src/apps/PaymentProcessor/src/Services/SchedulerService.cpp
  10. +0
    -21
      3.0/src/apps/PaymentProcessor/src/Services/SchedulerService.h
  11. +6
    -0
      3.0/src/apps/PaymentProcessor/src/Services/ServiceController.cpp
  12. +3
    -0
      3.0/src/apps/PaymentProcessor/src/Services/ServiceController.h
  13. +21
    -1
      3.0/src/includes/Hardware/Acceptors/CCTalkAcceptorConstants.h
  14. +0
    -1
      3.0/src/includes/Hardware/Acceptors/CCTalkModelData.h
  15. +27
    -26
      3.0/src/includes/Hardware/CashAcceptors/CashAcceptorStatusCodes.h
  16. +1
    -0
      3.0/src/includes/Hardware/CashAcceptors/CashAcceptorStatusesDescriptions.h
  17. +8
    -1
      3.0/src/includes/Hardware/CashAcceptors/SerialCashAcceptor.h
  18. +5
    -4
      3.0/src/includes/Hardware/CashDevices/CCTalkData.h
  19. +1
    -0
      3.0/src/includes/Hardware/CashDevices/CCTalkDeviceBase.h
  20. +33
    -37
      3.0/src/includes/Hardware/CashDevices/CCTalkDeviceConstants.h
  21. +1
    -0
      3.0/src/includes/Hardware/CashDevices/CCTalkModelData.h
  22. +1
    -42
      3.0/src/includes/Hardware/CoinAcceptors/CoinAcceptorBase.h
  23. +38
    -0
      3.0/src/includes/Hardware/Common/ConfigCleaner.h
  24. +29
    -0
      3.0/src/includes/Hardware/Common/ContainerProxy.h
  25. +1
    -0
      3.0/src/includes/Hardware/Common/DeviceDataConstants.h
  26. +13
    -8
      3.0/src/includes/Hardware/Common/HardwareConstants.h
  27. +7
    -0
      3.0/src/includes/Hardware/Dispensers/DispenserStatusCodes.h
  28. +3
    -0
      3.0/src/includes/Hardware/Dispensers/DispenserStatusesDescriptions.h
  29. +21
    -0
      3.0/src/includes/Hardware/Dispensers/PortDispenser.h
  30. +1
    -1
      3.0/src/includes/Hardware/Dispensers/ProtoDispenser.h
  31. +8
    -0
      3.0/src/includes/Hardware/Dispensers/SerialDispenser.h
  32. +106
    -0
      3.0/src/includes/Hardware/FR/FFDataTypes.h
  33. +14
    -28
      3.0/src/includes/Hardware/FR/FRBaseConstants.h
  34. +1
    -0
      3.0/src/includes/Hardware/FR/FRStatusCodes.h
  35. +1
    -0
      3.0/src/includes/Hardware/FR/FRStatusesDescriptions.h
  36. +1
    -299
      3.0/src/includes/Hardware/FR/FiscalFieldDescriptions.h
  37. +7
    -3
      3.0/src/includes/Hardware/Protocols/Common/ProtocolNames.h
  38. +1
    -0
      3.0/src/includes/Hardware/Protocols/Dispensers/Puloon.h
  39. +1
    -97
      3.0/src/includes/SDK/Drivers/CashAcceptor/Par.h
  40. +6
    -2
      3.0/src/includes/SDK/Drivers/FR/FiscalDataTypes.h
  41. +1
    -2
      3.0/src/includes/SDK/Drivers/HardwareConstants.h
  42. +4
    -1
      3.0/src/includes/SDK/Drivers/ICashAcceptor.h
  43. +1
    -1
      3.0/src/includes/SDK/Drivers/IDispenser.h
  44. +17
    -0
      3.0/src/includes/SDK/Drivers/IIOPort.h
  45. +4
    -0
      3.0/src/includes/SDK/PaymentProcessor/Core/ICore.h
  46. +33
    -0
      3.0/src/includes/SDK/PaymentProcessor/Core/ISchedulerService.h
  47. +421
    -398
      3.0/src/includes/SDK/PaymentProcessor/Scripting/PaymentService.h
  48. +3
    -0
      3.0/src/includes/SDK/PaymentProcessor/Scripting/PrinterService.h
  49. +22
    -2
      3.0/src/interface/modern/scenario/card_ucs_charge_scenario.js
  50. +2
    -1
      3.0/src/interface/modern/scenario/constants.js
  51. +3
    -1
      3.0/src/interface/modern/scenario/payment_scenario.js
  52. +9
    -0
      3.0/src/modules/Hardware.sln
  53. +1
    -18
      3.0/src/modules/Hardware/Acceptors/msvc/Acceptors.vcxproj
  54. +1
    -10
      3.0/src/modules/Hardware/Acceptors/msvc/Acceptors.vcxproj.filters
  55. +40
    -274
      3.0/src/modules/Hardware/Acceptors/src/CCTalk/CCTalkAcceptorBase.cpp
  56. +5
    -56
      3.0/src/modules/Hardware/Acceptors/src/CCTalk/CCTalkAcceptorBase.h
  57. +2
    -8
      3.0/src/modules/Hardware/Acceptors/src/CCTalk/CCTalkComplexEnableAcceptor.cpp
  58. +0
    -6
      3.0/src/modules/Hardware/Cardreaders/msvc/CardReaders.vcxproj
  59. +0
    -6
      3.0/src/modules/Hardware/CashAcceptors/msvc/CashAcceptors.vcxproj
  60. +0
    -42
      3.0/src/modules/Hardware/CashAcceptors/src/CCNet/CCNetCashAcceptorBase.cpp
  61. +1
    -11
      3.0/src/modules/Hardware/CashAcceptors/src/CCNet/CCNetCashAcceptorBase.h
  62. +1
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/CCNet/FirmwareVersions.h
  63. +4
    -10
      3.0/src/modules/Hardware/CashAcceptors/src/CCTalk/CCTalkCashAcceptor.cpp
  64. +1
    -6
      3.0/src/modules/Hardware/CashAcceptors/src/CCTalk/CCTalkCashAcceptor.h
  65. +2
    -2
      3.0/src/modules/Hardware/CashAcceptors/src/CCTalk/CCTalkCashAcceptorConstants.h
  66. +1
    -2
      3.0/src/modules/Hardware/CashAcceptors/src/CCTalk/CCTalkCashAcceptorModelData.h
  67. +20
    -5
      3.0/src/modules/Hardware/CashAcceptors/src/CashAcceptorBase.cpp
  68. +5
    -3
      3.0/src/modules/Hardware/CashAcceptors/src/CashAcceptorBase.h
  69. +1
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/EBDS/EBDSCashAcceptor.h
  70. +1
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/ICT/ICTCashAcceptor.h
  71. +1
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/ID003/ID003CashAcceptor.h
  72. +52
    -6
      3.0/src/modules/Hardware/CashAcceptors/src/PortCashAcceptor.cpp
  73. +14
    -2
      3.0/src/modules/Hardware/CashAcceptors/src/PortCashAcceptor.h
  74. +95
    -14
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.cpp
  75. +10
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptor.h
  76. +64
    -7
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPCashAcceptorConstants.h
  77. +40
    -23
      3.0/src/modules/Hardware/CashAcceptors/src/SSP/SSPModelData.h
  78. +1
    -1
      3.0/src/modules/Hardware/CashAcceptors/src/V2e/V2eCashAcceptor.h
  79. +134
    -0
      3.0/src/modules/Hardware/CashDevices/msvc/CashDevices.vcxproj
  80. +35
    -0
      3.0/src/modules/Hardware/CashDevices/msvc/CashDevices.vcxproj.filters
  81. +261
    -0
      3.0/src/modules/Hardware/CashDevices/src/CCTalk/CCTalkDeviceBase.cpp
  82. +87
    -0
      3.0/src/modules/Hardware/CashDevices/src/CCTalk/CCTalkDeviceBase.h
  83. +2
    -1
      3.0/src/modules/Hardware/CashDevices/src/CCTalk/CCTalkModelData.cpp
  84. +2
    -2
      3.0/src/modules/Hardware/CashDevices/src/CCTalk/CCTalkModelData.h
  85. +9
    -6
      3.0/src/modules/Hardware/CashDispensers/msvc/CashDispensers.vcxproj
  86. +29
    -11
      3.0/src/modules/Hardware/CashDispensers/msvc/CashDispensers.vcxproj.filters
  87. +77
    -40
      3.0/src/modules/Hardware/CashDispensers/src/DispenserBase.cpp
  88. +35
    -6
      3.0/src/modules/Hardware/CashDispensers/src/DispenserBase.h
  89. +6
    -14
      3.0/src/modules/Hardware/CashDispensers/src/Puloon/PuloonCashDispenser.cpp
  90. +5
    -11
      3.0/src/modules/Hardware/CashDispensers/src/Puloon/PuloonCashDispenser.h
  91. +0
    -3
      3.0/src/modules/Hardware/CashDispensers/src/Puloon/PuloonCashDispenserData.h
  92. +0
    -0
      3.0/src/modules/Hardware/CashDispensers/src/Puloon/PuloonModelData.h
  93. +204
    -0
      3.0/src/modules/Hardware/CashDispensers/src/Suzo/SuzoHopper.cpp
  94. +64
    -0
      3.0/src/modules/Hardware/CashDispensers/src/Suzo/SuzoHopper.h
  95. +50
    -0
      3.0/src/modules/Hardware/CashDispensers/src/Suzo/SuzoHopperData.h
  96. +35
    -0
      3.0/src/modules/Hardware/CashDispensers/src/Suzo/SuzoHopperModelData.h
  97. +1
    -14
      3.0/src/modules/Hardware/CoinAcceptors/msvc/CoinAcceptors.vcxproj
  98. +3
    -0
      3.0/src/modules/Hardware/CoinAcceptors/msvc/CoinAcceptors.vcxproj.filters
  99. +3
    -10
      3.0/src/modules/Hardware/CoinAcceptors/src/CCTalk/CCTalkCoinAcceptorBase.cpp
  100. +1
    -3
      3.0/src/modules/Hardware/CoinAcceptors/src/CCTalk/CCTalkCoinAcceptorBase.h

+ 5
- 3
3.0/scripts/build/runtimes/terminal_ru.xml View File

@@ -59,6 +59,9 @@
<!-- UCS plugin -->
<option target="user/user/plugins/ucs.ini" key="PaymentProcessor.ChargeProvider.UcsChargeProvider.configuration_singleton/ucs_runtime_path" value="C:/UCS/BIN" />
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/plugins/ucs.dll" target="plugins/plugins/ucs.dll"/>
<!-- PCS plugin -->
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/plugins/payment_customizer_scenario.dll" target="plugins/plugins/payment_customizer_scenario.dll"/>
<!-- Драйверы, компонент drivers -->
<file source="{QBS_RESULT_PATH}/plugins/drivers/fr.dll" target="drivers/plugins/drivers/fr.dll"/>
@@ -89,9 +92,8 @@
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/cyberplat_monitoring_ru.qm" target="locale/plugins/cyberplat_monitoring_ru.qm"/>
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/platru_ru.qm" target="locale/plugins/platru_ru.qm"/>
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/cyberchange_ru.qm" target="locale/plugins/cyberchange_ru.qm"/>
<!-- <file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/uniteller_ru.qm" target="locale/plugins/uniteller_ru.qm"/> -->
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/ucs_ru.qm" target="locale/plugins/ucs_ru.qm"/> -->
<file if="{CYBERPLAT_BUILD}" source="{QBS_RESULT_PATH}/locale/payment_customizer_scenario_ru.qm" target="locale/plugins/payment_customizer_scenario_ru.qm"/>
<!-- ###################################################################################### -->
<!-- Шрифты для терминалов Beeline -->


+ 1
- 1
3.0/src/apps/PaymentProcessor/src/Services/CashDispenserManager.cpp View File

@@ -207,7 +207,7 @@ void CashDispenserManager::setCashList(DSDK::IDispenser * aDispenser)
unitData << cashUnit.count;
}

aDispenser->setCashList(unitData);
aDispenser->setUnitList(unitData);
}

//---------------------------------------------------------------------------


+ 11
- 4
3.0/src/apps/PaymentProcessor/src/Services/IntegratedDrivers.cpp View File

@@ -100,12 +100,19 @@ void IntegratedDrivers::checkDriverPath(QString & aDriverPath, const QVariantMap
auto parameterIt = std::find_if(parameters.begin(), parameters.end(), [&] (const SPluginParameter & aParameter) -> bool
{ return aParameter.name == jt.key(); });

if ((parameterIt != parameters.end()) && !parameterIt->readOnly && !parameterIt->possibleValues.values().contains(jt.value()) &&
!parameterIt->possibleValues.keys().contains(CHardwareSDK::Mask))
if (parameterIt != parameters.end())
{
paths.removeAt(i--);
SPluginParameter & parameter = *parameterIt;
QList<QVariant> & possibleValueValues = parameter.possibleValues.values();
QList<QString> & possibleValueKeys = parameter.possibleValues.keys();
const QVariant & value = jt.value();

break;
if (!parameter.readOnly && !possibleValueValues.contains(value) && (value != CHardwareSDK::Values::Auto) && !possibleValueKeys.contains(CHardwareSDK::Mask))
{
paths.removeAt(i--);

break;
}
}
}
}


+ 1
- 1
3.0/src/apps/PaymentProcessor/src/Services/PaymentService.cpp View File

@@ -941,7 +941,7 @@ void PaymentService::hangupProcessing()
}
//---------------------------------------------------------------------------
void PaymentService::doUpdatePaymentFields(quint64 aID, std::shared_ptr<PPSDK::IPayment> aPayment, const QList<SDK::PaymentProcessor::IPayment::SParameter> & aFields, bool aForce)
void PaymentService::doUpdatePaymentFields(qint64 aID, std::shared_ptr<PPSDK::IPayment> aPayment, const QList<SDK::PaymentProcessor::IPayment::SParameter> & aFields, bool aForce)
{
if (!aPayment)
{


+ 1
- 1
3.0/src/apps/PaymentProcessor/src/Services/PaymentService.h View File

@@ -222,7 +222,7 @@ private:
bool setChangeAmount(double aChange, std::shared_ptr<PPSDK::IPayment> aPaymentSource);

/// Обновляет параметры платежа.
void doUpdatePaymentFields(quint64 aID, std::shared_ptr<PPSDK::IPayment> aPayment, const QList<SDK::PaymentProcessor::IPayment::SParameter> & aFields, bool aForce = false);
void doUpdatePaymentFields(qint64 aID, std::shared_ptr<PPSDK::IPayment> aPayment, const QList<SDK::PaymentProcessor::IPayment::SParameter> & aFields, bool aForce = false);

signals:
/// Сигнал о завершении обработки платёжной команды, добавленной методом registerPaymentCommand.


+ 5
- 1
3.0/src/apps/PaymentProcessor/src/Services/PrintingCommands.cpp View File

@@ -18,7 +18,6 @@
// Project
#include "PrintingCommands.h"
#include "PrintingService.h"
#include "PrintConstants.h"
#include "PaymentService.h"
namespace FiscalCommand = SDK::Driver::EFiscalPrinterCommand;
@@ -134,6 +133,11 @@ DSDK::SPaymentData PrintFiscalCommand::getPaymentData(const QVariantMap & aParam
result.fiscalParameters[CHardwareSDK::FR::UserPhone] = QString();
result.fiscalParameters[CHardwareSDK::FR::UserMail] = QString();
foreach (auto FFData, CPrintCommands::FFDataList)
{
result.fiscalParameters[FFData] = aParameters[FFData];
}
#if 0
//TODO - решить как на верхнем уровне в интерфейсе мы будем давать возможность
// вводить телефон/email для отправки чека ПЕРЕД печатью этого чека.


+ 12
- 0
3.0/src/apps/PaymentProcessor/src/Services/PrintingCommands.h View File

@@ -13,6 +13,9 @@
#include <SDK/Drivers/FR/FiscalPrinterCommand.h>
#include <SDK/Drivers/IFiscalPrinter.h>
// Project
#include "PrintConstants.h"
namespace FiscalCommand = SDK::Driver::EFiscalPrinterCommand;
namespace PPSDK = SDK::PaymentProcessor;
@@ -24,6 +27,15 @@ namespace CPrintCommands
/// Шаблон имени файла фискального чека.
const char ReceiptNameTemplate[] = "hhmmsszzz";
/// Данные фискальных тегов.
const QStringList FFDataList = QStringList()
<< CPrintConstants::OpPhone
<< CPrintConstants::DealerSupportPhone
<< CPrintConstants::BankPhone
<< CPrintConstants::BankAddress
<< CPrintConstants::BankInn
<< CPrintConstants::BankName;
}
//---------------------------------------------------------------------------


+ 5
- 5
3.0/src/apps/PaymentProcessor/src/Services/PrintingService.cpp View File

@@ -315,12 +315,11 @@ int PrintingService::performPrint(PrintCommand * aCommand, const QVariantMap & a
}
QVariantMap staticParameters;
joinMap(staticParameters, mStaticParameters);
QVariantMap configuration;
configuration.insert(CHardwareSDK::Printer::ContinuousMode, mContinuousMode);
configuration.insert(CHardwareSDK::Printer::ServiceOperation, mServiceOperation);
configuration.insert(CHardwareSDK::Printer::TemplateParameters, aParameters);
configuration.insert(CHardwareSDK::Printer::ReceiptParameters, joinMap(staticParameters, mStaticParameters));
configuration.insert(CHardwareSDK::Printer::ReceiptTemplate, aReceiptTemplate);
printer->setDeviceConfiguration(configuration);
@@ -1445,9 +1444,10 @@ void PrintingService::updateHardwareConfiguration()
if (device)
{
QVariantMap dealerSettings;
if (mStaticParameters.contains(CPrintConstants::DealerTaxSystem)) dealerSettings.insert(CHardwareSDK::FR::DealerTaxSystem, mStaticParameters[CPrintConstants::DealerTaxSystem]);
if (mStaticParameters.contains(CPrintConstants::DealerAgentFlag)) dealerSettings.insert(CHardwareSDK::FR::DealerAgentFlag, mStaticParameters[CPrintConstants::DealerAgentFlag]);
if (mStaticParameters.contains(CPrintConstants::DealerVAT)) dealerSettings.insert(CHardwareSDK::FR::DealerVAT, mStaticParameters[CPrintConstants::DealerVAT]);
if (mStaticParameters.contains(CPrintConstants::DealerTaxSystem)) dealerSettings.insert(CHardwareSDK::FR::DealerTaxSystem, mStaticParameters[CPrintConstants::DealerTaxSystem]);
if (mStaticParameters.contains(CPrintConstants::DealerAgentFlag)) dealerSettings.insert(CHardwareSDK::FR::DealerAgentFlag, mStaticParameters[CPrintConstants::DealerAgentFlag]);
if (mStaticParameters.contains(CPrintConstants::DealerVAT)) dealerSettings.insert(CHardwareSDK::FR::DealerVAT, mStaticParameters[CPrintConstants::DealerVAT]);
if (mStaticParameters.contains(CPrintConstants::DealerSupportPhone)) dealerSettings.insert(CHardwareSDK::FR::DealerSupportPhone, mStaticParameters[CPrintConstants::DealerSupportPhone]);
mPrinterDevices.append(device);


+ 28
- 15
3.0/src/apps/PaymentProcessor/src/Services/SchedulerService.cpp View File

@@ -110,7 +110,7 @@ bool SchedulerService::initialize()
Item item(taskName, settings, userSettings);
if (!mFactory.contains(item.type()))
if (!mFactory.contains(item.type()) && !mExternalTasks.contains(item.name()))
{
toLog(LogLevel::Error, QString("[%1]: Unknown task type '%2'.").arg(item.name()).arg(item.type()));
}
@@ -416,8 +416,18 @@ void SchedulerService::execute()
{
SchedulerService::Item & item = mItems[timer->objectName()];
timer->deleteLater();
SDK::PaymentProcessor::ITask * task;
SDK::PaymentProcessor::ITask * task = mFactory[item.type()](item.name(), CScheduler::LogName, item.params());
// Проверим, что таск может быть пользовательским
if (mExternalTasks[item.name()])
{
task = mExternalTasks[item.name()];
}
else
{
task = mFactory[item.type()](item.name(), CScheduler::LogName, item.params());
}
if (task)
{
@@ -450,22 +460,25 @@ void SchedulerService::onTaskComplete(const QString & aName, bool aComplete)
mWorkingTasks.remove(aName);
}
try
if (task && task != mExternalTasks[aName])
{
QObject * taskObject = dynamic_cast<QObject *>(task);
if (taskObject)
try
{
taskObject->deleteLater();
}
else
{
delete task;
}
QObject * taskObject = dynamic_cast<QObject *>(task);
task = nullptr;
}
catch(...) {}
if (taskObject)
{
taskObject->deleteLater();
}
else
{
delete task;
}
task = nullptr;
}
catch (...) {}
}
mItems[aName].complete(aComplete);


+ 0
- 21
3.0/src/apps/PaymentProcessor/src/Services/SchedulerService.h View File

@@ -158,27 +158,6 @@ private:
QMap<QString, Item> mItems;
QMap<QString, SDK::PaymentProcessor::ITask *> mWorkingTasks;
QReadWriteLock mLock;

protected:
typedef boost::function<SDK::PaymentProcessor::ITask *(const QString & aName, const QString & aLogName, const QString & aParams)> TTaskCreator;

/// зарегистрировать тип задачи в фабрике классов
template <class C>
void registerTaskType(const QString & aType)
{
auto taskCreator = [](const QString & aName, const QString & aLogName, const QString & aParams) -> SDK::PaymentProcessor::ITask *
{
return new C(aName, aLogName, aParams);
};

if (!mFactory.contains(aType))
{
mFactory[aType] = TTaskCreator(taskCreator);
}
}

protected:
QMap<QString, TTaskCreator> mFactory;
};

//---------------------------------------------------------------------------

+ 6
- 0
3.0/src/apps/PaymentProcessor/src/Services/ServiceController.cpp View File

@@ -523,6 +523,12 @@ SDK::PaymentProcessor::ITerminalService * ServiceController::getTerminalService(
}
//---------------------------------------------------------------------------
SDK::PaymentProcessor::ISchedulerService * ServiceController::getSchedulerService() const
{
return boost::polymorphic_cast<PP::ISchedulerService *>(mRegisteredServices.value(CServices::SchedulerService));
}
//---------------------------------------------------------------------------
SDK::PaymentProcessor::IService * ServiceController::getService(const QString & aServiceName) const
{
if (mRegisteredServices.isEmpty())


+ 3
- 0
3.0/src/apps/PaymentProcessor/src/Services/ServiceController.h View File

@@ -125,6 +125,9 @@ protected:
/// Возвращает интерфейс управления терминалом.
virtual SDK::PaymentProcessor::ITerminalService * getTerminalService() const;

/// Возвращает интерфейс управления планировщиком заданий.
virtual SDK::PaymentProcessor::ISchedulerService * getSchedulerService() const;

/// Возвращает сервис с заданным именем.
virtual SDK::PaymentProcessor::IService * getService(const QString & aServiceName) const;



+ 21
- 1
3.0/src/includes/Hardware/Acceptors/CCTalkAcceptorConstants.h View File

@@ -1 +1,21 @@
#include "../../../modules/Hardware/Acceptors/src/CCTalk/CCTalkAcceptorConstants.h"
/* @file Константы устройств на протоколе ccTalk. */

#pragma once

#include "Hardware/CashDevices/CCTalkDeviceConstants.h"

//--------------------------------------------------------------------------------
namespace CCCTalk
{
/// Маска для сортировщика по умолчанию (использовать предустановленные настройки).
const char DefaultSorterMask = '\xFF';

/// Количество номиналов.
const int NominalCount = 16;

/// Фиктивныe девайс-коды устройства, для функционала, связанного с повтором таких статус-кодов
const uchar EscrowDeviceCode = 200;
const uchar StackedDeviceCode = 201;
}

//--------------------------------------------------------------------------------

+ 0
- 1
3.0/src/includes/Hardware/Acceptors/CCTalkModelData.h View File

@@ -1 +0,0 @@
#include "../../../modules/Hardware/Acceptors/src/CCTalk/CCTalkModelData.h"

+ 27
- 26
3.0/src/includes/Hardware/CashAcceptors/CashAcceptorStatusCodes.h View File

@@ -134,32 +134,33 @@ namespace BillAcceptorStatusCode
/// Выброс. Предупреждение, но если долго висит - ошибка.
namespace Reject
{
const int Insertion = 750; /// Купюра неверно вставлена.
const int Dielectric = 751; /// Выброс по диэлектрическому каналу.
const int PreviousOperating = 752; /// Идет прием предыдущей купюры или монеты.
const int Compensation = 753; /// Засунуто несколько купюр.
const int Transport = 754; /// Помеха на конвейере.
const int Identification = 755; /// Идентификация купюры. TODO: прояснить режекты в CCNet.
const int Verification = 756; /// Верификация купюры. TODO: прояснить режекты в CCNet.
const int InhibitNote = 757; /// Запрещенная купюра.
const int Operation = 758; /// Ошибка операции.
const int DataProcessing = 759; /// Ошибка обработки данных.
const int Length = 760; /// Ошибка длины купюры.
const int LengthDoubling = 761; /// Задваивание по длине до эскроу на аппаратах с 2-мя моторами.
const int Width = 762; /// Ошибка ширины купюры.
const int WidthDoubling = 763; /// Задваивание по ширине.
const int Unrecognised = 764; /// Не распознана. TODO: прояснить режекты в CCNet.
const int MagneticSensor = 765; /// Магнитный канал.
const int CapacitanceSensor = 766; /// Емкостный канал.
const int OpticalSensor = 767; /// Оптический канал.
const int UVSensor = 768; /// Ультрафиолетовый канал.
const int DoubleCorrelation = 769; /// Двойная корреляция.
const int Barcode = 770; /// Не совпадает штрих-код с номиналом.
const int Diverter = 771; /// Ошибка направляющих конвейера.
const int UserDefined = 772; /// Инициирован пользователем.
const int Cheated = 773; /// Попытка мошенничества.
const int EscrowTimeout = 774; /// Таймаут ожидания действий после эскроу.
const int Unknown = 775; /// Причина неизвестна.
const int Rejecting = 750; /// В процессе выброса.
const int Insertion = 751; /// Купюра неверно вставлена.
const int Dielectric = 752; /// Выброс по диэлектрическому каналу.
const int PreviousOperating = 753; /// Идет прием предыдущей купюры или монеты.
const int Compensation = 754; /// Засунуто несколько купюр.
const int Transport = 755; /// Помеха на конвейере.
const int Identification = 756; /// Идентификация купюры. TODO: прояснить режекты в CCNet.
const int Verification = 757; /// Верификация купюры. TODO: прояснить режекты в CCNet.
const int InhibitNote = 758; /// Запрещенная купюра.
const int Operation = 759; /// Ошибка операции.
const int DataProcessing = 760; /// Ошибка обработки данных.
const int Length = 761; /// Ошибка длины купюры.
const int LengthDoubling = 762; /// Задваивание по длине до эскроу на аппаратах с 2-мя моторами.
const int Width = 763; /// Ошибка ширины купюры.
const int WidthDoubling = 764; /// Задваивание по ширине.
const int Unrecognised = 765; /// Не распознана. TODO: прояснить режекты в CCNet.
const int MagneticSensor = 766; /// Магнитный канал.
const int CapacitanceSensor = 767; /// Емкостный канал.
const int OpticalSensor = 768; /// Оптический канал.
const int UVSensor = 769; /// Ультрафиолетовый канал.
const int DoubleCorrelation = 770; /// Двойная корреляция.
const int Barcode = 771; /// Не совпадает штрих-код с номиналом.
const int Diverter = 772; /// Ошибка направляющих конвейера.
const int UserDefined = 773; /// Инициирован пользователем.
const int Cheated = 774; /// Попытка мошенничества.
const int EscrowTimeout = 775; /// Таймаут ожидания действий после эскроу.
const int Unknown = 776; /// Причина неизвестна.
}
}



+ 1
- 0
3.0/src/includes/Hardware/CashAcceptors/CashAcceptorStatusesDescriptions.h View File

@@ -171,6 +171,7 @@ namespace BillAcceptorStatusCode
ADD_CA_ERROR(Calibration, QCoreApplication::translate("ValidatorStatuses", "#calibration_error"));
/// Выбросы (в большинстве случае - нормальное состояние).
ADD_CA_STATUS_DATA(Reject, Rejecting, Rejected, Warning, "Rejecting", QCoreApplication::translate("ValidatorStatuses", "#rejecting"));
ADD_CA_REJECT(Insertion);
ADD_CA_REJECT(Dielectric);
ADD_CA_REJECT(PreviousOperating);


+ 8
- 1
3.0/src/includes/Hardware/CashAcceptors/SerialCashAcceptor.h View File

@@ -1 +1,8 @@
#include "../../../modules/Hardware/CashAcceptors/src/SerialCashAcceptor.h"
#include "Hardware/Common/PortPollingDeviceBase.h"
#include "Hardware/Common/SerialDeviceBase.h"
#include "Hardware/CashAcceptors/PortCashAcceptor.h"

//--------------------------------------------------------------------------------
typedef PortCashAcceptor<SerialDeviceBase<PortPollingDeviceBase<ProtoCashAcceptor>>> TSerialCashAcceptor;

//--------------------------------------------------------------------------------

3.0/src/includes/Hardware/Acceptors/CCTalkData.h → 3.0/src/includes/Hardware/CashDevices/CCTalkData.h View File

@@ -19,15 +19,16 @@ namespace CCCTalk
const uchar Common = 0; /// Широкополосная команда.
const uchar Host = 1; /// Хост.
const uchar CoinAcceptor = 2; /// Монетоприемник.
const uchar Payout = 3; /// Хоппер.
const uchar Hopper = 3; /// Хоппер.
const uchar Hopper2 = 6; /// Тоже хоппер.
const uchar BillAcceptor = 40; /// Купюроприемник.
const uchar CardReader = 50; /// Кардридер.
}

const QStringList ProtocolTypes = QStringList()
<< CHardware::CashAcceptor::CCTalkTypes::CRC8
<< CHardware::CashAcceptor::CCTalkTypes::CRC16;
// << CHardware::CashAcceptor::CCTalkTypes::CRC16Encrypted;
<< CHardware::CashDevice::CCTalkTypes::CRC8
<< CHardware::CashDevice::CCTalkTypes::CRC16;
// << CHardware::CashDevice::CCTalkTypes::CRC16Encrypted;
}

//--------------------------------------------------------------------------------

+ 1
- 0
3.0/src/includes/Hardware/CashDevices/CCTalkDeviceBase.h View File

@@ -0,0 +1 @@
#include "../../../modules/Hardware/CashDevices/src/CCTalk/CCTalkDeviceBase.h"

3.0/src/modules/Hardware/Acceptors/src/CCTalk/CCTalkAcceptorConstants.h → 3.0/src/includes/Hardware/CashDevices/CCTalkDeviceConstants.h View File

@@ -9,11 +9,10 @@

// Modules
#include "Hardware/Common/Specifications.h"
#include "Hardware/Common/WaitingData.h"

// Project
#include "Hardware/CashAcceptors/CashAcceptorStatusCodes.h"
#include "Hardware/Acceptors/CCTalkData.h"
#include "Hardware/CashDevices/CCTalkData.h"

//--------------------------------------------------------------------------------
namespace CCCTalk
@@ -21,22 +20,17 @@ namespace CCCTalk
/// ACK.
const char ACK = '\x00';

/// Маска для сортировщика по умолчанию (использовать предустановленные настройки).
const char DefaultSorterMask = '\xFF';

/// Пауза перед идентификацией.
const int IdentificationPause = 100;

/// Количество номиналов.
const int NominalCount = 16;

class CDeviceTypeIds : public CDescription<char>
{
public:
CDeviceTypeIds()
{
append(Address::CoinAcceptor, "coinacceptor");
append(Address::Payout, "");
append(Address::Hopper, "payout");
append(Address::Hopper2, "payout");
append(Address::BillAcceptor, "billvalidator");
append(Address::CardReader, "");
}
@@ -48,25 +42,20 @@ namespace CCCTalk
namespace Command
{
/// Общие.
namespace Core
{
const uchar SimplePoll = 254;
const uchar VendorID = 246;
const uchar DeviceTypeID = 245;
const uchar ModelName = 244;
const uchar BuildCode = 192;
}
const uchar SimplePoll = 254;
const uchar VendorID = 246;
const uchar DeviceTypeID = 245;
const uchar ProductCode = 244;
const uchar BuildCode = 192;

/// Общие +.
namespace CorePlus
{
const uchar Serial = 242;
const uchar SoftVersion = 241;
const uchar ProtocolID = 4;
const uchar Reset = 1;
}
const uchar Serial = 242;
const uchar SoftVersion = 241;
const uchar ProtocolID = 4;
const uchar Reset = 1;

const uchar Status = 248;
const uchar GetVariables = 247;
const uchar DBVersion = 243;
const uchar TestCoils = 240;
const uchar SelfCheck = 232;
@@ -78,6 +67,11 @@ namespace CCCTalk
const uchar GetCoinID = 184;
const uchar SetSecurity = 181;
const uchar BaseYear = 170;
const uchar Dispense = 167;
const uchar GetHopperStatus = 166;
const uchar SetVariables = 165;
const uchar EnableHopper = 164;
const uchar TestHopper = 163;
const uchar ModifyInhibitsAndRegesters = 162;
const uchar GetBufferedBillStatuses = 159;
const uchar GetBillID = 157;
@@ -112,18 +106,19 @@ namespace CCCTalk
public:
CDescriptions()
{
append(Core::SimplePoll, EAnswerType::ACK, "perform simple poll");
append(Core::VendorID, EAnswerType::ASCII, "get vendor ID");
append(Core::DeviceTypeID, EAnswerType::ASCII, "get device type ID");
append(Core::ModelName, EAnswerType::ASCII, "get model name");
append(Core::BuildCode, EAnswerType::ASCII, "get build code");
append(SimplePoll, EAnswerType::ACK, "perform simple poll");
append(VendorID, EAnswerType::ASCII, "get vendor ID");
append(DeviceTypeID, EAnswerType::ASCII, "get device type ID");
append(ProductCode, EAnswerType::ASCII, "get product code");
append(BuildCode, EAnswerType::ASCII, "get build code");

append(CorePlus::Serial, EAnswerType::Data, "get serial number", 3);
append(CorePlus::SoftVersion, EAnswerType::ASCII, "get soft version");
append(CorePlus::ProtocolID, EAnswerType::Data, "get protocol ID", 3);
append(CorePlus::Reset, EAnswerType::ACK, "perform reset");
append(Serial, EAnswerType::Data, "get serial number", 3);
append(SoftVersion, EAnswerType::ASCII, "get soft version");
append(ProtocolID, EAnswerType::Data, "get protocol ID", 3);
append(Reset, EAnswerType::ACK, "perform reset");

append(Status, EAnswerType::Data, "get generic status", 1);
append(GetVariables, EAnswerType::Data, "get variables", 4);
append(DBVersion, EAnswerType::Data, "get DB version", 1);
append(TestCoils, EAnswerType::ACK, "test coils");
append(SelfCheck, EAnswerType::Data, "perform selfcheck", 1);
@@ -135,6 +130,11 @@ namespace CCCTalk
append(GetCoinID, EAnswerType::Data, "get coin nominal data", 6);
append(SetSecurity, EAnswerType::ACK, "set security level");
append(BaseYear, EAnswerType::Data, "get a year, which is the base for other dates", 4);
append(Dispense, EAnswerType::Data, "dispense hopper coins", 1);
append(GetHopperStatus, EAnswerType::Data, "get hopper status", 4);
append(SetVariables, EAnswerType::ACK, "set variables");
append(EnableHopper, EAnswerType::ACK, "enable/disable hopper");
append(TestHopper, EAnswerType::Data, "test hopper", 1);
append(ModifyInhibitsAndRegesters, EAnswerType::ACK, "modify inhibits and override registers for sequence of coins");
append(GetBufferedBillStatuses, EAnswerType::Data, "get buffered bill statuses", 1);
append(GetBillID, EAnswerType::Data, "get bill nominal data", 7);
@@ -187,10 +187,6 @@ namespace CCCTalk
}
};

/// Фиктивныe девайс-коды устройства, для функционала, связанного с повтором таких статус-кодов
const uchar EscrowDeviceCode = 200;
const uchar StackedDeviceCode = 201;

//--------------------------------------------------------------------------------
/// Неисправности.
struct SFault

+ 1
- 0
3.0/src/includes/Hardware/CashDevices/CCTalkModelData.h View File

@@ -0,0 +1 @@
#include "../../../modules/Hardware/CashDevices/src/CCTalk/CCTalkModelData.h"

+ 1
- 42
3.0/src/includes/Hardware/CoinAcceptors/CoinAcceptorBase.h View File

@@ -1,42 +1 @@
/* @file Базовый класс монетоприемников. */
#pragma once
#include "Hardware/CashAcceptors/PortCashAcceptor.h"
//--------------------------------------------------------------------------------
namespace CCoinAcceptor
{
/// Таймаут отсылки сигнала об отключении монетника, [мс].
const int DisablingTimeout = 600;
}
//--------------------------------------------------------------------------------
class CoinAcceptorBase : public TSerialCashAcceptor
{
SET_DEVICE_TYPE(CoinAcceptor)
public:
CoinAcceptorBase()
{
mDeviceType = CHardware::Types::CoinAcceptor;
setConfigParameter(CHardware::CashAcceptor::DisablingTimeout, CCoinAcceptor::DisablingTimeout);
setConfigParameter(CHardware::CashAcceptor::StackedFilter, true);
}
/// Принять купюру.
virtual bool stack()
{
// у монетоприемника нет стека
return true;
}
/// Вернуть купюру. Правильный термин - return (ключевое слово).
virtual bool reject()
{
// у монетоприемника нет режекта
return true;
}
};
//--------------------------------------------------------------------------------
#include "../../../modules/Hardware/CoinAcceptors/src/CoinAcceptorBase.h"

+ 38
- 0
3.0/src/includes/Hardware/Common/ConfigCleaner.h View File

@@ -0,0 +1,38 @@
/* @file Config сleaner */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QStringList>
#include <Common/QtHeadersEnd.h>

// Project
#include "DeviceConfigManager.h"

//---------------------------------------------------------------------------
class ConfigCleaner
{
public:
ConfigCleaner(DeviceConfigManager * aConfigManager, const QStringList & aKeys) : mPerformer(aConfigManager), mKeys(aKeys) {}

~ConfigCleaner()
{
if (mPerformer)
{
foreach (const QString & key, mKeys)
{
mPerformer->removeConfigParameter(key);
}
}
}

private:
/// Класс-владелец конфига.
DeviceConfigManager * mPerformer;

/// Список ключей конфига для удаления данных.
QStringList mKeys;
};

//--------------------------------------------------------------------------------

+ 29
- 0
3.0/src/includes/Hardware/Common/ContainerProxy.h View File

@@ -0,0 +1,29 @@
/* @file Прокси-класс для использования константы контейнера в виде класса для статитических вызовов. */

#pragma once

//---------------------------------------------------------------------------
template<class T>
class ContainerProxy: public T
{
public:
ContainerProxy() {}
ContainerProxy(const T & aOther)
{
operator = (aOther);
}

const T & operator= (const T & aOther)
{
this->append(aOther);

return *this;
}

T & data()
{
return * dynamic_cast<T *>(this);
}
};

//---------------------------------------------------------------------------

+ 1
- 0
3.0/src/includes/Hardware/Common/DeviceDataConstants.h View File

@@ -27,6 +27,7 @@ namespace CDeviceData
const char Date[] = "date";
const char FirmwareUpdatable[] = "firmware_updatable";
const char ProjectNumber[] = "project_number";
const char ProductCode[] = "product_code";
const char Vendor[] = "vendor";
const char ProtocolVersion[] = "protocol_version";
const char SDCard[] = "sd_card";


+ 13
- 8
3.0/src/includes/Hardware/Common/HardwareConstants.h View File

@@ -61,6 +61,7 @@ namespace CHardware
const char OpeningTimeout[] = "opening_timeout";
const char OpeningContext[] = "port_opening_context";
const char Suspended[] = "suspended";
const char JustConnected[] = "just_connected";
/// Константы COM-порта.
namespace COM
@@ -91,6 +92,18 @@ namespace CHardware
const char Track3[] = "track3";
}
/// Константы устройства работы с деньгами.
namespace CashDevice
{
/// Типы протокола CCTalk.
namespace CCTalkTypes
{
const char CRC8[] = "CRC8";
const char CRC16[] = "CRC16";
const char CRC16Encrypted[] = "CRC16 Encrypted";
}
}
/// Константы устройства приема денег.
namespace CashAcceptor
{
@@ -103,14 +116,6 @@ namespace CHardware
const char ProcessEnabling[] = "process_enabling";
const char ProcessDisabling[] = "process_disabling";
const char StackedFilter[] = "stacked_filter";
/// Типы протокола CCTalk.
namespace CCTalkTypes
{
const char CRC8[] = "CRC8";
const char CRC16[] = "CRC16";
const char CRC16Encrypted[] = "CRC16 Encrypted";
}
}
/// Константы виртуального устройства приема денег.


+ 7
- 0
3.0/src/includes/Hardware/Dispensers/DispenserStatusCodes.h View File

@@ -7,6 +7,13 @@
//--------------------------------------------------------------------------------
namespace DispenserStatusCode
{
/// OK.
namespace OK
{
const int SingleMode = 800; /// Выдача по 1 монете.
const int Locked = 801; /// Аппарата заблокирован, ждет ввода PIN-кода.
}

/// Предупреждения.
namespace Warning
{


+ 3
- 0
3.0/src/includes/Hardware/Dispensers/DispenserStatusesDescriptions.h View File

@@ -13,6 +13,9 @@ namespace DispenserStatusCode
public:
CSpecifications()
{
ADD_OK_STATUS(SingleMode, "");
ADD_OK_STATUS(Locked, "");

/// Предупреждения.
ADD_WARNING_STATUS(Unit0NearEmpty, QCoreApplication::translate("DispenserStatuses", "#unit_0_near_empty"));
ADD_WARNING_STATUS(Unit1NearEmpty, QCoreApplication::translate("DispenserStatuses", "#unit_1_near_empty"));


+ 21
- 0
3.0/src/includes/Hardware/Dispensers/PortDispenser.h View File

@@ -0,0 +1,21 @@
/* @file Диспенсер на порту. */

#pragma once

// Project
#include "Hardware/Dispensers/SerialDispenser.h"

//--------------------------------------------------------------------------------
class PortDispenser : public TSerialDispenser
{
public:
PortDispenser()
{
mIOMessageLogging = ELoggingType::None;
mMaxBadAnswers = 2;
mPollingInterval = CDispensers::IdlingPollingInterval;
mForceNotWaitFirst = true;
}
};

//--------------------------------------------------------------------------------

+ 1
- 1
3.0/src/includes/Hardware/Dispensers/ProtoDispenser.h View File

@@ -30,7 +30,7 @@ signals:

protected slots:
/// Применить конфигурацию кассет.
virtual void applyCashList() {};
virtual void applyUnitList() {};

/// Выдать.
virtual void dispense(int /*aUnit*/, int /*aItems*/) {};


+ 8
- 0
3.0/src/includes/Hardware/Dispensers/SerialDispenser.h View File

@@ -0,0 +1,8 @@
#include "Hardware/Common/PortPollingDeviceBase.h"
#include "Hardware/Common/SerialDeviceBase.h"
#include "DispenserBase.h"

//--------------------------------------------------------------------------------
typedef DispenserBase<SerialDeviceBase<PortPollingDeviceBase<ProtoDispenser>>> TSerialDispenser;

//--------------------------------------------------------------------------------

+ 106
- 0
3.0/src/includes/Hardware/FR/FFDataTypes.h View File

@@ -0,0 +1,106 @@
/* @file Типы данных для движка фискальных тегов. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QString>
#include <Common/QtHeadersEnd.h>

//---------------------------------------------------------------------------
namespace CFR { namespace FiscalFields
{
// Типы данных.
namespace ETypes
{
enum Enum
{
None = 0,
String,
Byte,
ByteArray,
UnixTime,
VLN,
FVLN,
STLV,
UINT32,
UINT16
};
};

// Описатель типов данных.
namespace Types
{
struct SData
{
int minSize;
bool fixSize;
QString description;

SData(): minSize(0), fixSize(false) {}
SData(int aMinSize, const QString & aDescription, bool aFixSize = false): minSize(aMinSize), fixSize(aFixSize), description(aDescription) {}
};
}

//---------------------------------------------------------------------------
// Обязательность тега.
namespace ERequired
{
enum Enum
{
No = 0,
PM,
Yes
};
}

//---------------------------------------------------------------------------
// Обобщенный тип (класс) тега.
namespace EClassType
{
enum Enum
{
Default = 0,
Money,
INN
};
}

//---------------------------------------------------------------------------
// Структура описателя тега.
struct SData
{
ETypes::Enum type; /// Тип.
QString textKey; /// Текстовый ключ.
QString translationPF; /// Перевод для печатной формы (ПФ).
ERequired::Enum required; /// Обязательность тега.
EClassType::Enum classType; /// Обобщенный тип (класс) тега.

SData(): type(ETypes::None), required(ERequired::No), classType(EClassType::Default) {}

SData(ETypes::Enum aType, const QString & aTextKey, ERequired::Enum aRequired):
type(aType), textKey(aTextKey), translationPF(""), required(aRequired), classType(EClassType::Default) {}

SData(ETypes::Enum aType, const QString & aTextKey, EClassType::Enum aClassType):
type(aType), textKey(aTextKey), translationPF(""), required(ERequired::No), classType(aClassType) {}

SData(ETypes::Enum aType, const QString & aTextKey, const QString & aTranslationPF = ""):
type(aType), textKey(aTextKey), translationPF(aTranslationPF), required(ERequired::No), classType(EClassType::Default) {}

SData(ETypes::Enum aType, const QString & aTextKey, const QString & aTranslationPF, EClassType::Enum aClassType):
type(aType), textKey(aTextKey), translationPF(aTranslationPF), required(ERequired::No), classType(aClassType) {}

SData(ETypes::Enum aType, const QString & aTextKey, const QString & aTranslationPF, ERequired::Enum aRequired, EClassType::Enum aClassType = EClassType::Default):
type(aType), textKey(aTextKey), translationPF(aTranslationPF), required(aRequired), classType(aClassType) {}

bool isString() const { return type == ETypes::String; }
bool isSTLV() const { return type == ETypes::STLV; }
bool isTime() const { return type == ETypes::UnixTime; }

bool isMoney() const { return classType == EClassType::Money; }
bool isINN() const { return classType == EClassType::INN; }
};

}} // namespace CFR::FiscalFields

//---------------------------------------------------------------------------

+ 14
- 28
3.0/src/includes/Hardware/FR/FRBaseConstants.h View File

@@ -427,6 +427,20 @@ namespace CFR
static CPayOffTypes PayOffTypes;
//--------------------------------------------------------------------------------
/// Операция платежного агента (1044).
namespace AgentOperation
{
const char Payment[] = "Платеж";
const char Payout[] = "Выдача наличных";
}
/// Банковский платежный агент?
inline bool isBankAgent(SDK::Driver::EAgentFlags::Enum aAgentFlag) { return (aAgentFlag == SDK::Driver::EAgentFlags::BankAgent) || (aAgentFlag == SDK::Driver::EAgentFlags::BankSubagent); }
/// Обыкновенный платежный агент?
inline bool isPaymentAgent(SDK::Driver::EAgentFlags::Enum aAgentFlag) { return (aAgentFlag == SDK::Driver::EAgentFlags::PaymentAgent) || (aAgentFlag == SDK::Driver::EAgentFlags::PaymentSubagent); }
//--------------------------------------------------------------------------------
/// Ставка НДС (1199).
class CVATRates: public CDescription<char>
{
@@ -494,34 +508,6 @@ namespace CFR
static COperationModeData OperationModeData;
//---------------------------------------------------------------------------
class ConfigCleaner
{
public:
ConfigCleaner(DeviceConfigManager * aConfigManager) : mPerformer(aConfigManager) {}
~ConfigCleaner()
{
if (mPerformer)
{
QStringList fieldNames = QStringList()
<< CFiscalSDK::Cashier
<< CFiscalSDK::CashierINN
<< CFiscalSDK::UserContact
<< CFiscalSDK::TaxSystem
<< CFiscalSDK::AgentFlag;
foreach (const QString & fieldName, fieldNames)
{
mPerformer->removeConfigParameter(fieldName);
}
}
}
private:
DeviceConfigManager * mPerformer;
};
//---------------------------------------------------------------------------
class DealerDataManager
{
public:


+ 1
- 0
3.0/src/includes/Hardware/FR/FRStatusCodes.h View File

@@ -27,6 +27,7 @@ namespace FRStatusCode
const int WrongTaxOnPayment = 264; /// Неверная налоговая ставка на платеже.
const int NeedTimeSynchronization = 265; /// Необходима синхронизация с системным временем.
const int FSVirtualEnd = 266; /// Срок действия ФН должен был закончиться.
const int DealerSupportPhone = 267; /// Телефон техподдержки дилера некорректен.
}
/// Ошибки.


+ 1
- 0
3.0/src/includes/Hardware/FR/FRStatusesDescriptions.h View File

@@ -39,6 +39,7 @@ namespace FRStatusCode
ADD_FR_WARNING(WrongTaxOnPayment, QCoreApplication::translate("FRStatuses", "#wrong_tax_on_payment"));
ADD_FR_WARNING(NeedTimeSynchronization, QCoreApplication::translate("FRStatuses", "#need_time_synchronization"));
ADD_FR_WARNING(FSVirtualEnd, QCoreApplication::translate("FRStatuses", "#fs_virtual_end"));
ADD_FR_WARNING(DealerSupportPhone, QCoreApplication::translate("FRStatuses", "#dealer_support_phone"));
/// Ошибки.
ADD_FR_ERROR(FR, QCoreApplication::translate("FRStatuses", "#fiscal_add_on_error"));


+ 1
- 299
3.0/src/includes/Hardware/FR/FiscalFieldDescriptions.h View File

@@ -1,299 +1 @@
/* @file Описатель фискальных реквизитов, используется в драйверах). */
// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDate>
#include <Common/QtHeadersEnd.h>
// SDK
#include <SDK/Drivers/FR/FiscalFields.h>
// Modules
#include "Hardware/Common/Specifications.h"
#pragma once
//---------------------------------------------------------------------------
namespace CFR
{
/// Сменилась ли ставка НДС с 18% на 20% в РФ.
inline bool isRFVAT20() { return QDate::currentDate() >= QDate(2019, 1, 1); }
}
//---------------------------------------------------------------------------
namespace CFR { namespace FiscalFields
{
// Типы данных.
namespace ETypes
{
enum Enum
{
None = 0,
String,
Byte,
ByteArray,
UnixTime,
VLN,
FVLN,
STLV,
UINT32,
UINT16
};
};
namespace Types
{
struct SData
{
int minSize;
bool fixSize;
QString description;
SData(): minSize(0), fixSize(false) {}
SData(int aMinSize, const QString & aDescription, bool aFixSize = false): minSize(aMinSize), fixSize(aFixSize), description(aDescription) {}
};
#define ADD_FISCAL_TYPE(aType, aMinSize, ...) append(ETypes::aType, SData(aMinSize, #aType, __VA_ARGS__))
class CData: public CSpecification<ETypes::Enum, SData>
{
public:
CData()
{
ADD_FISCAL_TYPE(String, 0);
ADD_FISCAL_TYPE(Byte, 1, true);
ADD_FISCAL_TYPE(ByteArray, 1);
ADD_FISCAL_TYPE(UnixTime, 4, true);
ADD_FISCAL_TYPE(VLN, 1);
ADD_FISCAL_TYPE(FVLN, 2);
ADD_FISCAL_TYPE(STLV, 5);
ADD_FISCAL_TYPE(UINT32, 4, true);
ADD_FISCAL_TYPE(UINT16, 2, true);
}
};
static CData Data;
}
//---------------------------------------------------------------------------
// Обязательность параметра
namespace ERequired
{
enum Enum
{
No = 0,
PM,
Yes
};
}
//---------------------------------------------------------------------------
// Структура описателя.
struct SData
{
ETypes::Enum type;
QString textKey;
QString translationPF;
ERequired::Enum required;
bool isMoney;
SData(): type(ETypes::None), required(ERequired::No), isMoney(false) {}
SData(ETypes::Enum aType, const QString & aTextKey, const QString & aTranslationPF = "", bool aIsMoney = false):
type(aType), textKey(aTextKey), translationPF(aTranslationPF), required(ERequired::No), isMoney(aIsMoney) {}
};
/// Список фискальных тегов.
typedef QList<int> TFields;
typedef QMap<int, SData> TData;
typedef QMap<int, QString> TDescriptionData;
typedef QPair<TData, TDescriptionData> TAllData;
//---------------------------------------------------------------------------
class Data: public CSpecification<int, SData>
{
public:
Data()
{
TAllData allData = process(0);
mBuffer = allData.first;
mDescriptionData = allData.second;
for (auto it = mBuffer.begin(); it != mBuffer.end(); ++it)
{
it->translationPF = QCoreApplication::translate("FiscalFields", it->translationPF.toLatin1());
}
foreach(int field, mBuffer.keys())
{
checkRFVAT20(field);
}
}
static TAllData process(int aField, const SData & aData = SData())
{
static TData data;
static TDescriptionData descriptionData;
if (!aField)
{
return TAllData(data, descriptionData);
}
data.insert(aField, aData);
descriptionData.insert(aField, aData.textKey);
return TAllData();
}
int getKey(const QString & aTextKey) const { return mDescriptionData.values().contains(aTextKey) ? mDescriptionData.key(aTextKey) : 0; }
QString getTextLog(int aField) const { return QString("fiscal field %1 (%2)").arg(aField).arg(value(aField).textKey.replace("_", " ")); }
QString getLogFromList(const TFields & aFields) const { QStringList data; foreach(int field, aFields) data << getTextLog(field); return data.join(", ").replace("fiscal field ", ""); }
private:
inline void checkRFVAT20(int aField);
QMap<int, QString> mDescriptionData;
};
#define ADD_FISCAL_FIELD(aField, aName, aType, ...) const int aName = [] () -> int { CFR::FiscalFields::Data::process(aField, CFR::FiscalFields::SData(CFR::FiscalFields::ETypes::aType, CFiscalSDK::aName, __VA_ARGS__)); return aField; } ();
ADD_FISCAL_FIELD(1000, FDName, String, QCoreApplication::translate("FiscalFields", "#fd_name")); // 1000 (Наименование фискального документа).
ADD_FISCAL_FIELD(1008, UserContact, String, QCoreApplication::translate("FiscalFields", "#user_contact")); // 1008 (Телефон или электронный адрес покупателя).
ADD_FISCAL_FIELD(1009, PayOffAddress, String); // 1009 (Адрес расчетов).
ADD_FISCAL_FIELD(1012, FDDateTime, UnixTime); // 1012 (Дата и время ФД).
ADD_FISCAL_FIELD(1013, SerialFRNumber, String, QCoreApplication::translate("FiscalFields", "#serial_fr_number")); // 1013 (Заводской номер ФР).
ADD_FISCAL_FIELD(1017, OFDINN, String, QCoreApplication::translate("FiscalFields", "#ofd_inn")); // 1017 (ИНН ОФД).
ADD_FISCAL_FIELD(1018, INN, String, QCoreApplication::translate("FiscalFields", "#inn")); // 1018 (ИНН пользователя).
ADD_FISCAL_FIELD(1020, PayOffAmount, VLN, QCoreApplication::translate("FiscalFields", "#payoff_amount"), true); // 1020 (Сумма расчета в чеке).
ADD_FISCAL_FIELD(1021, Cashier, String, QCoreApplication::translate("FiscalFields", "#cashier")); // 1021 (Кассир).
ADD_FISCAL_FIELD(1030, UnitName, String); // 1030 (Наименование товара).
ADD_FISCAL_FIELD(1036, AutomaticNumber, String, QCoreApplication::translate("FiscalFields", "#automatic_number")); // 1036 (Номер автомата).
ADD_FISCAL_FIELD(1037, RNM, String, QCoreApplication::translate("FiscalFields", "#rnm")); // 1037 (Регистрационный номер ККТ).
ADD_FISCAL_FIELD(1038, SessionNumber, UINT32, QCoreApplication::translate("FiscalFields", "#session_number")); // 1038 (Номер смены).
ADD_FISCAL_FIELD(1040, FDNumber, UINT32, QCoreApplication::translate("FiscalFields", "#fd_number")); // 1040 (Номер ФД).
ADD_FISCAL_FIELD(1041, SerialFSNumber, String, QCoreApplication::translate("FiscalFields", "#serial_fs_number")); // 1041 (Заводской номер ФН).
ADD_FISCAL_FIELD(1042, DocumentNumber, UINT32, QCoreApplication::translate("FiscalFields", "#document_number")); // 1042 (Номер чека за смену).
ADD_FISCAL_FIELD(1046, OFDName, String, QCoreApplication::translate("FiscalFields", "#ofd_name")); // 1046 (Наименование ОФД).
ADD_FISCAL_FIELD(1048, LegalOwner, String); // 1048 (Наименование юр. лица владельца).
ADD_FISCAL_FIELD(1054, PayOffType, Byte); // 1054 (Признак расчета).
ADD_FISCAL_FIELD(1055, TaxSystem, Byte, QCoreApplication::translate("FiscalFields", "#tax_system")); // 1055 (СНО на платеже).
ADD_FISCAL_FIELD(1060, FTSURL, String, QCoreApplication::translate("FiscalFields", "#fts_url")); // 1060 (Адрес сайта ФНС).
ADD_FISCAL_FIELD(1062, TaxSystemsReg, Byte, QCoreApplication::translate("FiscalFields", "#tax_systems_reg")); // 1062 (СНО из итогов регистрации).
ADD_FISCAL_FIELD(1074, ProcessingPhone, String, QCoreApplication::translate("FiscalFields", "#processing_phone")); // 1074 (Телефон оператора по приему платежей).
ADD_FISCAL_FIELD(1077, FDSign, ByteArray, QCoreApplication::translate("FiscalFields", "#fd_sign")); // 1077 (Фискальный признак документа).
ADD_FISCAL_FIELD(1097, OFDNotSentFDQuantity, UINT32, QCoreApplication::translate("FiscalFields", "#ofd_not_sent_fd_quantity")); // 1097 (Количество непереданных ФД).
ADD_FISCAL_FIELD(1098, OFDNotSentFDDateTime, UnixTime, QCoreApplication::translate("FiscalFields", "#ofd_not_sent_fd_date_time")); // 1098 (Дата и время первого из непереданных ФД).
ADD_FISCAL_FIELD(1101, ReregistrationCause, Byte, QCoreApplication::translate("FiscalFields", "#reregistration_cause")); // 1101 (Код причины перерегистрации).
ADD_FISCAL_FIELD(1111, FDForSessionTotal, UINT32, QCoreApplication::translate("FiscalFields", "#fd_for_session_total")); // 1111 (Общее количество ФД за смену).
ADD_FISCAL_FIELD(1117, SenderMail, String, QCoreApplication::translate("FiscalFields", "#sender_mail")); // 1117 (Электронная почта отправителя чека).
ADD_FISCAL_FIELD(1118, FiscalsForSessionTotal, UINT32, QCoreApplication::translate("FiscalFields", "#fiscals_for_session_total")); // 1118 (Количество кассовых чеков (БСО) за смену).
ADD_FISCAL_FIELD(1187, PayOffPlace, String, QCoreApplication::translate("FiscalFields", "#payoff_place")); // 1187 (Место расчетов).
ADD_FISCAL_FIELD(1188, ModelVersion, String, QCoreApplication::translate("FiscalFields", "#model_version")); // 1188 (Версия модели ККТ).
ADD_FISCAL_FIELD(1189, FFDFR, Byte, QCoreApplication::translate("FiscalFields", "#ffd_fr")); // 1189 (Версия ФФД ФР).
ADD_FISCAL_FIELD(1190, FFDFS, Byte, QCoreApplication::translate("FiscalFields", "#ffd_fs")); // 1190 (Версия ФФД ФН).
ADD_FISCAL_FIELD(1199, VATRate, Byte); // 1199 (Ставка НДС).
ADD_FISCAL_FIELD(1203, CashierINN, String, QCoreApplication::translate("FiscalFields", "#cashier_inn")); // 1203 (ИНН кассира).
ADD_FISCAL_FIELD(1208, OFDURL, String, QCoreApplication::translate("FiscalFields", "#ofd_url")); // 1208 (Адрес сайта для получения чека).
ADD_FISCAL_FIELD(1209, FFD, Byte); // 1209 (Версия ФФД).
// Данные оператора перевода
ADD_FISCAL_FIELD(1005, TransferOperatorAddress, String, QCoreApplication::translate("FiscalFields", "#transfer_operator_address")); // 1005 (Адрес оператора перевода).
ADD_FISCAL_FIELD(1016, TransferOperatorINN, String, QCoreApplication::translate("FiscalFields", "#transfer_operator_inn")); // 1016 (ИНН оператора перевода).
ADD_FISCAL_FIELD(1026, TransferOperatorName, String, QCoreApplication::translate("FiscalFields", "#transfer_operator_name")); // 1026 (Наименование оператора перевода).
ADD_FISCAL_FIELD(1075, TransferOperatorPhone, String, QCoreApplication::translate("FiscalFields", "#transfer_operator_phone")); // 1075 (Телефон оператора перевода).
// Данные поставщика
ADD_FISCAL_FIELD(1171, ProviderPhone, String, QCoreApplication::translate("FiscalFields", "#provider_phone")); // 1171 (Телефон поставщика).
ADD_FISCAL_FIELD(1226, ProviderINN, String, QCoreApplication::translate("FiscalFields", "#provider_inn")); // 1226 (ИНН поставщика).
// Данные платежного агента
ADD_FISCAL_FIELD(1044, AgentOperation, String, QCoreApplication::translate("FiscalFields", "#agent_operation")); // 1044 (Операция платежного агента).
ADD_FISCAL_FIELD(1057, AgentFlagsReg, Byte); // 1057 (Признак(и) платежного агента из итогов регистрации и на платеже).
ADD_FISCAL_FIELD(1073, AgentPhone, String, QCoreApplication::translate("FiscalFields", "#agent_phone")); // 1073 (Телефон платежного агента).
ADD_FISCAL_FIELD(1222, AgentFlag, Byte); // 1222 (Признак платежного агента на платеже).
// Статусы
ADD_FISCAL_FIELD(1050, FSExpiredStatus, Byte, QCoreApplication::translate("FiscalFields", "#fs_expired_status")); // 1050 (Признак исчерпания ресурса ФН).
ADD_FISCAL_FIELD(1051, FSNeedChangeStatus, Byte, QCoreApplication::translate("FiscalFields", "#fs_need_change_status")); // 1051 (Признак необходимости срочной замены ФН).
ADD_FISCAL_FIELD(1052, FSMemoryEnd, Byte, QCoreApplication::translate("FiscalFields", "#fs_memory_end_status")); // 1052 (Признак заполнения памяти ФН).
ADD_FISCAL_FIELD(1053, OFDNoConnection, Byte, QCoreApplication::translate("FiscalFields", "#ofd_no_connection_status")); // 1053 (Признак превышения времени ожидания ответа ОФД).
// Режимы работы
ADD_FISCAL_FIELD(1001, AutomaticMode, Byte, QCoreApplication::translate("FiscalFields", "#automatic_mode")); // 1001 (Признак автоматического режима).
ADD_FISCAL_FIELD(1002, AutonomousMode, Byte, QCoreApplication::translate("FiscalFields", "#autonomous_mode")); // 1002 (Признак автономного режима).
ADD_FISCAL_FIELD(1056, EncryptionMode, Byte, QCoreApplication::translate("FiscalFields", "#encryption_mode")); // 1056 (Признак шифрования).
ADD_FISCAL_FIELD(1108, InternetMode, Byte, QCoreApplication::translate("FiscalFields", "#internet_mode")); // 1108 (Признак работы с интернет (без принтера).
ADD_FISCAL_FIELD(1109, ServiceAreaMode, Byte, QCoreApplication::translate("FiscalFields", "#service_area_mode")); // 1109 (Признак применения в сфере услуг).
ADD_FISCAL_FIELD(1110, FixedReportingMode, Byte, QCoreApplication::translate("FiscalFields", "#fixed_reporting_mode")); // 1110 (Признак работы с бланками строгой отчетности (БСО).
ADD_FISCAL_FIELD(1126, LotteryMode, Byte, QCoreApplication::translate("FiscalFields", "#lottery_mode")); // 1126 (Признак проведения лотереи).
ADD_FISCAL_FIELD(1193, GamblingMode, Byte, QCoreApplication::translate("FiscalFields", "#gambling_mode")); // 1193 (Признак проведения азартных игр).
ADD_FISCAL_FIELD(1207, ExcisableUnitMode, Byte, QCoreApplication::translate("FiscalFields", "#excisable_unit_mode")); // 1207 (Признак торговли подакцизными товарами).
ADD_FISCAL_FIELD(1221, InAutomateMode, Byte, QCoreApplication::translate("FiscalFields", "#in_automate_mode")); // 1221 (Признак установки в автомате).
// Предмет расчета (на конкретную продажу)
ADD_FISCAL_FIELD(1023, PayOffSubjectQuantity, FVLN); // 1023 (Количество предмета расчета).
ADD_FISCAL_FIELD(1043, PayOffSubjectAmount, VLN, "", true); // 1043 (Стоимость предмета расчета).
ADD_FISCAL_FIELD(1059, PayOffSubject, STLV); // 1059 (Предмет расчета).
ADD_FISCAL_FIELD(1079, PayOffSubjectUnitPrice, VLN, "", true); // 1079 (Цена за единицу предмета расчета с учетом скидок и наценок).
ADD_FISCAL_FIELD(1200, PayOffSubjectTaxAmount, VLN, "", true); // 1200 (Сумма НДС за предмет расчета).
ADD_FISCAL_FIELD(1212, PayOffSubjectType, Byte); // 1212 (Признак предмета расчета).
ADD_FISCAL_FIELD(1214, PayOffSubjectMethodType, Byte); // 1214 (Признак способа расчета).
// Суммы по способу расчета (на весь чек)
ADD_FISCAL_FIELD(1031, CashFiscalTotal, VLN, QCoreApplication::translate("FiscalFields", "#cash_fiscal_total"), true); // 1031 (Сумма по чеку (БСО) наличными).
ADD_FISCAL_FIELD(1081, CardFiscalTotal, VLN, QCoreApplication::translate("FiscalFields", "#card_fiscal_total"), true); // 1081 (Сумма по чеку (БСО) электронными).
ADD_FISCAL_FIELD(1215, PrePaymentFiscalTotal, VLN, QCoreApplication::translate("FiscalFields", "#prepayment_fiscal_total"), true); // 1215 (Сумма по чеку (БСО) предоплатой (зачетом аванса).
ADD_FISCAL_FIELD(1216, PostPaymentFiscalTotal, VLN, QCoreApplication::translate("FiscalFields", "#postpayment_fiscal_total"), true); // 1216 (Сумма по чеку (БСО) постоплатой (в кредит).
ADD_FISCAL_FIELD(1217, CounterOfferFiscalTotal, VLN, QCoreApplication::translate("FiscalFields", "#counter_offer_fiscal_total"), true); // 1217 (Сумма по чеку (БСО) встречным предоставлением).
// Налоги (на весь чек)
ADD_FISCAL_FIELD(1102, TaxAmount02, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_02"), true); // 1102 (Сумма НДС чека по ставке 18(20)%).
ADD_FISCAL_FIELD(1103, TaxAmount03, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_03"), true); // 1103 (Сумма НДС чека по ставке 10%).
ADD_FISCAL_FIELD(1104, TaxAmount04, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_04"), true); // 1104 (Сумма расчета по чеку с НДС по ставке 0%).
ADD_FISCAL_FIELD(1105, TaxAmount05, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_05"), true); // 1105 (Сумма расчета по чеку без НДС).
ADD_FISCAL_FIELD(1106, TaxAmount06, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_06"), true); // 1106 (Сумма НДС чека по расчетной ставке 18/118 (20/120)).
ADD_FISCAL_FIELD(1107, TaxAmount07, VLN, QCoreApplication::translate("FiscalFields", "#tax_amount_07"), true); // 1107 (Сумма НДС чека по расчетной ставке 10/110).
//---------------------------------------------------------------------------
// Список полей итогов для контроля 0-х сумм.
const QSet<int> FiscalTotals = QSet<int>()
<< CFR::FiscalFields::CashFiscalTotal
<< CFR::FiscalFields::CardFiscalTotal
<< CFR::FiscalFields::PrePaymentFiscalTotal
<< CFR::FiscalFields::PostPaymentFiscalTotal
<< CFR::FiscalFields::CounterOfferFiscalTotal;
//---------------------------------------------------------------------------
// Список полей предмета расчета.
const QSet<int> PayOffSubjectFields = QSet<int>()
<< CFR::FiscalFields::UnitName
<< CFR::FiscalFields::VATRate
<< CFR::FiscalFields::PayOffSubjectQuantity
<< CFR::FiscalFields::PayOffSubjectAmount
<< CFR::FiscalFields::PayOffSubjectUnitPrice
<< CFR::FiscalFields::PayOffSubjectTaxAmount
<< CFR::FiscalFields::PayOffSubjectType
<< CFR::FiscalFields::PayOffSubjectMethodType;
//---------------------------------------------------------------------------
// Список полей налогов.
const QSet<int> TaxAmountFields = QSet<int>()
<< CFR::FiscalFields::TaxAmount02
<< CFR::FiscalFields::TaxAmount03
<< CFR::FiscalFields::TaxAmount04
<< CFR::FiscalFields::TaxAmount05
<< CFR::FiscalFields::TaxAmount06
<< CFR::FiscalFields::TaxAmount07;
void Data::checkRFVAT20(int aField)
{
if (isRFVAT20() && TaxAmountFields.contains(aField))
{
mBuffer[aField].translationPF.replace("18", "20");
mDescriptionData[aField].replace("18", "20");
}
}
}} // namespace CFR::FiscalFields
//---------------------------------------------------------------------------
#include "../../../modules/Hardware/FR/src/Base/FiscalFieldDescriptions.h"

+ 7
- 3
3.0/src/includes/Hardware/Protocols/Common/ProtocolNames.h View File

@@ -5,16 +5,20 @@
//--------------------------------------------------------------------------------
namespace ProtocolNames
{
namespace CashAcceptor
namespace CashDevice
{
const char CCNet[] = "CCNet";
const char CCTalk[] = "ccTalk";
const char CCNet[] = "CCNet";
const char SSP[] = "SSP";
}

namespace CashAcceptor
{
const char NPSTalk[] = "NPSTalk";
const char ID003[] = "ID003";
const char EBDS[] = "EBDS";
const char V2e[] = "V2e";
const char ICT[] = "ICT";
const char SSP[] = "SSP";
}

namespace FR


+ 1
- 0
3.0/src/includes/Hardware/Protocols/Dispensers/Puloon.h View File

@@ -0,0 +1 @@
#include "../../../../modules/Hardware/Protocols/CashAcceptor/Puloon/src/Puloon.h"

+ 1
- 97
3.0/src/includes/SDK/Drivers/CashAcceptor/Par.h View File

@@ -1,97 +1 @@
/* @file Описатель валюты для устройств приема денег. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QPair>
#include <QtCore/QMetaType>
#include <Common/QtHeadersEnd.h>

// Project
#include "CurrencyList.h"

namespace SDK {
namespace Driver {

//--------------------------------------------------------------------------------
namespace ECashReceiver
{
enum Enum
{
BillAcceptor,
CoinAcceptor
};
}

struct SPar
{
double nominal; /// Номинал.
int currencyId; /// Цифровой код валюты.
QString currency; /// Буквенный код валюты.
bool enabled; /// Доступность номинала со стороны платежной логики (то, что может запретить сервис).
bool inhibit; /// Доступность номинала со стороны логики драйвера (неизвестная или неподдерживаемая валюта, 0-й номинал и пр.).
ECashReceiver::Enum cashReceiver; /// Приемник денежных средств.

/// Поля, значения которых актуально для конкретной банкноты.

QString serialNumber; /// Серийный номер купюры.

SPar(): nominal(0), currencyId(Currency::NoCurrency), enabled(true), inhibit(true), cashReceiver(ECashReceiver::BillAcceptor) {}
SPar(double aNominal, const QString & aCurrency, ECashReceiver::Enum aCashReceiver = ECashReceiver::BillAcceptor, bool aEnabled = true, bool aInhibit = true):
nominal(aNominal), currencyId(Currency::NoCurrency), currency(aCurrency), enabled(aEnabled), inhibit(aInhibit), cashReceiver(aCashReceiver)
{
inhibit = aInhibit || !aNominal;
}

SPar(double aNominal, int aCurrencyId, ECashReceiver::Enum aCashReceiver = ECashReceiver::BillAcceptor, bool aEnabled = true, bool aInhibit = false):
nominal(aNominal), currencyId(aCurrencyId), enabled(aEnabled), inhibit(aInhibit), cashReceiver(aCashReceiver)
{
inhibit = aInhibit || !aNominal;
}

bool operator==(const SPar & aPar) const
{
return qFuzzyCompare(nominal, aPar.nominal) &&
(cashReceiver == aPar.cashReceiver) &&
((currencyId == aPar.currencyId) ||
((currencyId == Currency::RUB) && (aPar.currencyId == Currency::RUR)) ||
((currencyId == Currency::RUR) && (aPar.currencyId == Currency::RUB)));
}

bool isEqual(const SPar & aPar) const
{
return (*this == aPar) && (enabled == aPar.enabled);
}

bool operator<(const SPar & aPar) const
{
if (!qFuzzyCompare(nominal, aPar.nominal))
{
return (nominal < aPar.nominal);
}

if (currencyId != aPar.currencyId)
{
return (currencyId < aPar.currencyId);
}

return (cashReceiver < aPar.cashReceiver);
}
};

/// Таблица номиналов.
typedef QList<SPar> TParList;
typedef QMap<int, SPar> TParTable;
typedef QPair<int, SDK::Driver::SPar> TParData;

}} // namespace SDK::Driver

Q_DECLARE_METATYPE(SDK::Driver::SPar);
Q_DECLARE_METATYPE(SDK::Driver::TParTable);
Q_DECLARE_METATYPE(SDK::Driver::TParList);

//--------------------------------------------------------------------------------

#include "../../../../modules/SDK/Drivers/src/Par.h"

+ 6
- 2
3.0/src/includes/SDK/Drivers/FR/FiscalDataTypes.h View File

@@ -176,6 +176,9 @@ typedef int TVAT;
typedef QSet<TVAT> TVATs;
typedef double TSum;
/* !!!!!!!!!!!!!! НЕ забываем обновить метод FiscalProtocol::createRequest и parseRequestJsonDoc */
struct SUnitData
{
TSum sum; /// Сумма платежа.
@@ -186,7 +189,7 @@ struct SUnitData
EPayOffSubjectMethodTypes::Enum payOffSubjectMethodType; /// Признак способа расчета (1214).
int section; /// Отдел.
SUnitData() : sum(0), VAT(0), payOffSubjectType(EPayOffSubjectTypes::None), section(-1) {}
SUnitData() : sum(0), VAT(0), payOffSubjectType(EPayOffSubjectTypes::None), payOffSubjectMethodType(EPayOffSubjectMethodTypes::None), section(-1) {}
SUnitData(double aSum, TVAT aVAT, const QString & aName, const QString & aProviderINN, EPayOffSubjectTypes::Enum aPayOffSubjectType, int aSection = -1,
EPayOffSubjectMethodTypes::Enum aPayOffSubjectMethodType = EPayOffSubjectMethodTypes::Full):
sum(aSum), VAT(aVAT), name(aName), providerINN(aProviderINN), payOffSubjectType(aPayOffSubjectType), payOffSubjectMethodType(aPayOffSubjectMethodType), section(aSection) {}
@@ -194,7 +197,8 @@ struct SUnitData
typedef QList<SUnitData> TUnitDataList;
/// Фискальные данные платежа
/// Фискальные данные платежа !!!!!!!!!!!!!! НЕ забываем обновить метод FiscalProtocol::createRequest и parseRequestJsonDoc
struct SPaymentData
{
TUnitDataList unitDataList; /// Список данных товара


+ 1
- 2
3.0/src/includes/SDK/Drivers/HardwareConstants.h View File

@@ -68,6 +68,7 @@ namespace CAllHardware
const char DealerTaxSystem[] = "dealer_tax_system";
const char DealerAgentFlag[] = "dealer_agent_flag";
const char DealerVAT[] = "dealer_vat";
const char DealerSupportPhone[] = "dealer_support_phone";
const char UserPhone[] = "user_phone";
const char UserMail[] = "user_mail";
const char ZReportTime[] = "z_report_time";
@@ -80,8 +81,6 @@ namespace CAllHardware
/// Константы принтера.
namespace Printer
{
const char TemplateParameters[] = "template_parameters";
const char ReceiptParameters[] = "receipt_parameters";
const char ReceiptTemplate[] = "receipt_template";
const char ContinuousMode[] = "continuous_mode";
const char ServiceOperation[] = "service_operation";


+ 4
- 1
3.0/src/includes/SDK/Drivers/ICashAcceptor.h View File

@@ -21,9 +21,12 @@ public:
static const char * StackedSignal; // SIGNAL(stacked(SDK::Driver::TParList aNotes));

public:
/// Установить новую информацию для таблицы номиналов.
/// Установить таблицу номиналов.
virtual void setParList(const TParList & aParList) = 0;

/// Получить таблицу номиналов.
virtual TParList getParList() = 0;

/// Готов ли к работе (инициализировался успешно, ошибок нет).
virtual bool isDeviceReady() = 0;



+ 1
- 1
3.0/src/includes/SDK/Drivers/IDispenser.h View File

@@ -39,7 +39,7 @@ public:
virtual void dispense(int aUnit, int aItems) = 0;

/// Установить конфигурацию кассет.
virtual void setCashList(const TUnitData & aUnitData) = 0;
virtual void setUnitList(const TUnitData & aUnitData) = 0;

/// Получить кол-во лотков диспенсера.
virtual int units() = 0;


+ 17
- 0
3.0/src/includes/SDK/Drivers/IIOPort.h View File

@@ -24,6 +24,23 @@ namespace EPortTypes
};
}

/// Состояния портов. Если не OK - порт не работает.
namespace EPortState
{
enum Enum
{
OK = 0,
DriverError, /// Ошибка 3d-party драйвера.
NoDevice, /// Устройство не подключено, порт отсутствует.
ResetFailed, /// Сбой сброса.
SettingsFailed, /// Сбой установки настроек.
WrongSettings, /// Неверные параметры (при установке извне).
TimeoutExpired, /// Критичная операция не была выполнена за таймаут.
Suspended, /// Критичная операция "зависла".
Incorrect /// Некоррестное состояние.
};
}

//--------------------------------------------------------------------------------
class IIOPort: public IDevice
{


+ 4
- 0
3.0/src/includes/SDK/PaymentProcessor/Core/ICore.h View File

@@ -46,6 +46,7 @@ class ICryptService;
class ISettingsService;
class IDatabaseService;
class IRemoteService;
class ISchedulerService;
class IService;

//------------------------------------------------------------------------------
@@ -94,6 +95,9 @@ public:
/// Возвращает интерфейс управления терминалом.
virtual ITerminalService * getTerminalService() const = 0;

/// Возвращает интерфейс управления планировщиком заданий.
virtual ISchedulerService * getSchedulerService() const = 0;

/// Возвращает список сервисов.
virtual QSet<IService *> getServices() const = 0;



+ 33
- 0
3.0/src/includes/SDK/PaymentProcessor/Core/ISchedulerService.h View File

@@ -2,6 +2,8 @@

#pragma once

#include <boost/function.hpp>

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QObject>
@@ -10,6 +12,7 @@

// Модули
#include <Common/ILog.h>
#include <SDK/PaymentProcessor/Core/ITask.h>

namespace SDK {
namespace PaymentProcessor {
@@ -19,6 +22,36 @@ class ISchedulerService
{
protected:
virtual ~ISchedulerService() {}

public:
typedef boost::function<SDK::PaymentProcessor::ITask *(const QString & aName, const QString & aLogName, const QString & aParams)> TTaskCreator;

/// зарегистрировать тип задачи в фабрике классов
template <class C>
void registerTaskType(const QString & aType)
{
auto taskCreator = [](const QString & aName, const QString & aLogName, const QString & aParams) -> SDK::PaymentProcessor::ITask *
{
return new C(aName, aLogName, aParams);
};

if (!mFactory.contains(aType))
{
mFactory[aType] = TTaskCreator(taskCreator);
}
}

void registerTaskType(const QString & aName, SDK::PaymentProcessor::ITask * aTask)
{
if (!mExternalTasks.contains(aName))
{
mExternalTasks[aName] = aTask;
}
}

protected:
QMap<QString, TTaskCreator> mFactory;
QMap<QString, SDK::PaymentProcessor::ITask *> mExternalTasks;
};

//------------------------------------------------------------------------------


+ 421
- 398
3.0/src/includes/SDK/PaymentProcessor/Scripting/PaymentService.h View File

@@ -1,404 +1,427 @@
/* @file Прокси класс для работы с платежами в скриптах. */
#pragma once
// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QObject>
#include <QtCore/QVariantMap>
#include <QtCore/QStringList>
#include <Common/QtHeadersEnd.h>
// SDK
#include <SDK/PaymentProcessor/Core/Encashment.h>
#include <SDK/PaymentProcessor/Settings/Provider.h>
#include <SDK/PaymentProcessor/Scripting/ScriptArray.h>
#include <SDK/PaymentProcessor/Payment/Amount.h>
#include <SDK/PaymentProcessor/Settings/TerminalSettings.h>
namespace SDK {
namespace PaymentProcessor {
class ICore;
class IPaymentService;
class Directory;
class DealerSettings;
namespace Scripting {
class PaymentService;
//------------------------------------------------------------------------------
class EnumItem: public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ getName CONSTANT)
Q_PROPERTY(QString value READ getValue CONSTANT)
Q_PROPERTY(QString id READ getID CONSTANT)
public:
EnumItem(const SProviderField::SEnumItem & aItem, QObject * aParent)
: QObject(aParent), mItem(aItem)
{}
private:
QString getName() { return mItem.title; }
QString getValue() { return mItem.value; }
QString getID() { return mItem.id; }
private:
SProviderField::SEnumItem mItem;
};
//------------------------------------------------------------------------------
class ProviderField : public QObject
{
Q_OBJECT
Q_PROPERTY(QString type READ getType CONSTANT)
Q_PROPERTY(QString id READ getId CONSTANT)
Q_PROPERTY(QString keyboardType READ getKeyboardType CONSTANT)
Q_PROPERTY(QString language READ getLanguage CONSTANT)
Q_PROPERTY(QString letterCase READ getLetterCase CONSTANT)
Q_PROPERTY(int minSize READ getMinSize CONSTANT)
Q_PROPERTY(int maxSize READ getMaxSize CONSTANT)
Q_PROPERTY(bool isRequired READ isRequired CONSTANT)
Q_PROPERTY(QString title READ getTitle CONSTANT)
Q_PROPERTY(QString comment READ getComment CONSTANT)
Q_PROPERTY(QString extendedComment READ getExtendedComment CONSTANT)
Q_PROPERTY(QString mask READ getMask CONSTANT)
Q_PROPERTY(QString format READ getFormat CONSTANT)
Q_PROPERTY(bool isPassword READ isPassword CONSTANT)
Q_PROPERTY(QString behavior READ getBehavior CONSTANT)
Q_PROPERTY(QString defaultValue READ getDefaultValue CONSTANT)
Q_PROPERTY(QObject * enumItems READ getEnumItems CONSTANT)
Q_PROPERTY(QString url READ getUrl CONSTANT)
Q_PROPERTY(QString html READ getHtml CONSTANT)
Q_PROPERTY(QString backButton READ getBackButton CONSTANT)
Q_PROPERTY(QString forwardButton READ getForwardButton CONSTANT)
Q_PROPERTY(QString dependency READ getDependency CONSTANT)
public:
ProviderField(const SProviderField & aField, QObject * aParent = 0)
: QObject(aParent), mField(aField)
{
}
private:
QString getType() { return mField.type; }
QString getId() { return mField.id; }
QString getKeyboardType() { return mField.keyboardType; }
QString getLanguage() { return mField.language; }
QString getLetterCase() { return mField.letterCase; }
int getMinSize() { return mField.minSize; }
int getMaxSize() { return mField.maxSize; }
bool isRequired() { return mField.isRequired; }
QString getTitle() { return mField.title; }
QString getComment() { return mField.comment; }
QString getExtendedComment() { return mField.extendedComment; }
QString getMask() { return mField.mask; }
QString getFormat() { return mField.format; }
bool isPassword() { return mField.isPassword; }
QString getBehavior() { return mField.behavior; }
QString getDefaultValue() { return mField.defaultValue; }
ScriptArray * getEnumItems();
QString getUrl() { return mField.url; }
QString getHtml() { return mField.html; }
QString getBackButton() { return mField.backButton; }
QString getForwardButton() { return mField.forwardButton; }
QString getDependency() { return mField.dependency; }
SProviderField mField;
};
/* @file Прокси класс для работы с платежами в скриптах. */

#pragma once

// Qt
#include <Common/QtHeadersBegin.h>
#include <QtCore/QObject>
#include <QtCore/QVariantMap>
#include <QtCore/QStringList>
#include <QtCore/QWeakPointer>
#include <Common/QtHeadersEnd.h>

// SDK
#include <SDK/PaymentProcessor/Core/Encashment.h>
#include <SDK/PaymentProcessor/Settings/Provider.h>
#include <SDK/PaymentProcessor/Scripting/ScriptArray.h>
#include <SDK/PaymentProcessor/Payment/Amount.h>
#include <SDK/PaymentProcessor/Settings/TerminalSettings.h>

namespace SDK {
namespace PaymentProcessor {
class ICore;
class IPaymentService;
class Directory;
class DealerSettings;

namespace Scripting {
class PaymentService;

//------------------------------------------------------------------------------
class EnumItem: public QObject
{
Q_OBJECT

Q_PROPERTY(QString name READ getName CONSTANT)
Q_PROPERTY(QString value READ getValue CONSTANT)
Q_PROPERTY(QString id READ getID CONSTANT)

public:
EnumItem(const SProviderField::SEnumItem & aItem, QObject * aParent)
: QObject(aParent), mItem(aItem)
{}

private:
QString getName() { return mItem.title; }
QString getValue() { return mItem.value; }
QString getID() { return mItem.id; }

private:
SProviderField::SEnumItem mItem;
};

//------------------------------------------------------------------------------
class ProviderField : public QObject
{
Q_OBJECT

Q_PROPERTY(QString type READ getType CONSTANT)
Q_PROPERTY(QString id READ getId CONSTANT)

Q_PROPERTY(QString keyboardType READ getKeyboardType CONSTANT)
Q_PROPERTY(QString language READ getLanguage CONSTANT)
Q_PROPERTY(QString letterCase READ getLetterCase CONSTANT)

Q_PROPERTY(int minSize READ getMinSize CONSTANT)
Q_PROPERTY(int maxSize READ getMaxSize CONSTANT)

Q_PROPERTY(bool isRequired READ isRequired CONSTANT)

Q_PROPERTY(QString title READ getTitle CONSTANT)
Q_PROPERTY(QString comment READ getComment CONSTANT)
Q_PROPERTY(QString extendedComment READ getExtendedComment CONSTANT)

Q_PROPERTY(QString mask READ getMask CONSTANT)
Q_PROPERTY(QString format READ getFormat CONSTANT)
Q_PROPERTY(bool isPassword READ isPassword CONSTANT)

Q_PROPERTY(QString behavior READ getBehavior CONSTANT)
Q_PROPERTY(QString defaultValue READ getDefaultValue CONSTANT)
Q_PROPERTY(QObject * enumItems READ getEnumItems CONSTANT)

Q_PROPERTY(QString url READ getUrl CONSTANT)
Q_PROPERTY(QString html READ getHtml CONSTANT)
Q_PROPERTY(QString backButton READ getBackButton CONSTANT)
Q_PROPERTY(QString forwardButton READ getForwardButton CONSTANT)
Q_PROPERTY(QString dependency READ getDependency CONSTANT)

public:
ProviderField(const SProviderField & aField, QObject * aParent = 0)
: QObject(aParent), mField(aField)
{
}

private:
QString getType() { return mField.type; }
QString getId() { return mField.id; }

QString getKeyboardType() { return mField.keyboardType; }
QString getLanguage() { return mField.language; }
QString getLetterCase() { return mField.letterCase; }

int getMinSize() { return mField.minSize; }
int getMaxSize() { return mField.maxSize; }

bool isRequired() { return mField.isRequired; }

QString getTitle() { return mField.title; }
QString getComment() { return mField.comment; }
QString getExtendedComment() { return mField.extendedComment; }

QString getMask() { return mField.mask; }
QString getFormat() { return mField.format; }
bool isPassword() { return mField.isPassword; }

QString getBehavior() { return mField.behavior; }
QString getDefaultValue() { return mField.defaultValue; }
ScriptArray * getEnumItems();

QString getUrl() { return mField.url; }
QString getHtml() { return mField.html; }
QString getBackButton() { return mField.backButton; }