Implemented communication with EET portal.
This commit is contained in:
@@ -16,6 +16,7 @@ Voucher::Voucher(QObject *parent) : QObject(parent)
|
|||||||
m_totalPriceVatFirstLower = 0;
|
m_totalPriceVatFirstLower = 0;
|
||||||
m_totalPriceVatSecondLower = 0;
|
m_totalPriceVatSecondLower = 0;
|
||||||
m_totalPrice = 0;
|
m_totalPrice = 0;
|
||||||
|
m_eetStatus = EET_FOR_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Voucher::name() const
|
QString Voucher::name() const
|
||||||
@@ -230,6 +231,56 @@ void Voucher::setPayDateTime(const QDateTime &payDateTime)
|
|||||||
m_payDateTime = payDateTime;
|
m_payDateTime = payDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Voucher::EetStatus Voucher::eetStatus() const
|
||||||
|
{
|
||||||
|
return m_eetStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Voucher::setEetStatus(const Voucher::EetStatus &eetStatus)
|
||||||
|
{
|
||||||
|
m_eetStatus = eetStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime Voucher::eetSendDateTime() const
|
||||||
|
{
|
||||||
|
return m_eetSendDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Voucher::setEetSendDateTime(const QDateTime &eetSendDateTime)
|
||||||
|
{
|
||||||
|
m_eetSendDateTime = eetSendDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Voucher::eetPkp() const
|
||||||
|
{
|
||||||
|
return m_eetPkp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Voucher::setEetPkp(const QString &eetPkp)
|
||||||
|
{
|
||||||
|
m_eetPkp = eetPkp;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Voucher::eetBkp() const
|
||||||
|
{
|
||||||
|
return m_eetBkp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Voucher::setEetBkp(const QString &eetBkp)
|
||||||
|
{
|
||||||
|
m_eetBkp = eetBkp;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Voucher::eetFik() const
|
||||||
|
{
|
||||||
|
return m_eetFik;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Voucher::setEetFik(const QString &eetFik)
|
||||||
|
{
|
||||||
|
m_eetFik = eetFik;
|
||||||
|
}
|
||||||
|
|
||||||
int Voucher::id() const
|
int Voucher::id() const
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
|
|||||||
@@ -28,7 +28,13 @@ class Voucher : public QObject
|
|||||||
Q_PROPERTY(QDecDouble priceVatFirstLower READ priceVatFirstLower WRITE setPriceVatFirstLower)
|
Q_PROPERTY(QDecDouble priceVatFirstLower READ priceVatFirstLower WRITE setPriceVatFirstLower)
|
||||||
Q_PROPERTY(QDecDouble priceVatSecondLower READ priceVatSecondLower WRITE setPriceVatSecondLower)
|
Q_PROPERTY(QDecDouble priceVatSecondLower READ priceVatSecondLower WRITE setPriceVatSecondLower)
|
||||||
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
Q_PROPERTY(QDecDouble totalPrice READ totalPrice WRITE setTotalPrice)
|
||||||
|
Q_PROPERTY(EetStatus eetStatus READ eetStatus WRITE setEetStatus)
|
||||||
|
Q_PROPERTY(QDateTime eetSendDateTime READ eetSendDateTime WRITE setEetSendDateTime)
|
||||||
|
Q_PROPERTY(QString eetBkp READ eetBkp WRITE setEetBkp)
|
||||||
|
Q_PROPERTY(QString eetPkp READ eetPkp WRITE setEetPkp)
|
||||||
|
Q_PROPERTY(QString eetFik READ eetFik WRITE setEetFik)
|
||||||
Q_ENUMS(VoucherStatus)
|
Q_ENUMS(VoucherStatus)
|
||||||
|
Q_ENUMS(EetStatus)
|
||||||
Q_PROPERTY(VoucherStatus status READ status WRITE setStatus)
|
Q_PROPERTY(VoucherStatus status READ status WRITE setStatus)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -42,6 +48,14 @@ public:
|
|||||||
PAID
|
PAID
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EetStatus
|
||||||
|
{
|
||||||
|
EET_FOR_SEND,
|
||||||
|
EET_NOT_ENTERING,
|
||||||
|
EET_SENT,
|
||||||
|
EET_ERROR
|
||||||
|
};
|
||||||
|
|
||||||
int id() const;
|
int id() const;
|
||||||
void setId(int id);
|
void setId(int id);
|
||||||
|
|
||||||
@@ -110,6 +124,21 @@ public:
|
|||||||
QDateTime payDateTime() const;
|
QDateTime payDateTime() const;
|
||||||
void setPayDateTime(const QDateTime &payDateTime);
|
void setPayDateTime(const QDateTime &payDateTime);
|
||||||
|
|
||||||
|
EetStatus eetStatus() const;
|
||||||
|
void setEetStatus(const EetStatus &eetStatus);
|
||||||
|
|
||||||
|
QDateTime eetSendDateTime() const;
|
||||||
|
void setEetSendDateTime(const QDateTime &eetSendDateTime);
|
||||||
|
|
||||||
|
QString eetPkp() const;
|
||||||
|
void setEetPkp(const QString &eetPkp);
|
||||||
|
|
||||||
|
QString eetBkp() const;
|
||||||
|
void setEetBkp(const QString &eetBkp);
|
||||||
|
|
||||||
|
QString eetFik() const;
|
||||||
|
void setEetFik(const QString &eetFik);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class odb::access;
|
friend class odb::access;
|
||||||
#pragma db id auto
|
#pragma db id auto
|
||||||
@@ -131,6 +160,11 @@ private:
|
|||||||
int m_totalPriceVatFirstLower;
|
int m_totalPriceVatFirstLower;
|
||||||
int m_totalPriceVatSecondLower;
|
int m_totalPriceVatSecondLower;
|
||||||
int m_totalPrice;
|
int m_totalPrice;
|
||||||
|
EetStatus m_eetStatus;
|
||||||
|
QDateTime m_eetSendDateTime;
|
||||||
|
QString m_eetPkp;
|
||||||
|
QString m_eetBkp;
|
||||||
|
QString m_eetFik;
|
||||||
#pragma db value_not_null inverse(m_voucher)
|
#pragma db value_not_null inverse(m_voucher)
|
||||||
QOdbList<QSharedPointer<VoucherItem> > m_items;
|
QOdbList<QSharedPointer<VoucherItem> > m_items;
|
||||||
VoucherStatus m_status;
|
VoucherStatus m_status;
|
||||||
|
|||||||
@@ -138,7 +138,13 @@ QByteArray ReceiptGenerator::generate()
|
|||||||
out.append("\x1b\x21");
|
out.append("\x1b\x21");
|
||||||
out.append((char)0);
|
out.append((char)0);
|
||||||
out.append("\x0a");
|
out.append("\x0a");
|
||||||
|
out.append("BKP:");
|
||||||
out.append("\x0a");
|
out.append("\x0a");
|
||||||
|
out.append(prepareString(m_voucher->eetBkp()));
|
||||||
|
out.append("\x0a");
|
||||||
|
out.append("FIK:");
|
||||||
|
out.append("\x0a");
|
||||||
|
out.append(prepareString(m_voucher->eetFik()));
|
||||||
out.append("\x0a");
|
out.append("\x0a");
|
||||||
out.append("\x0a");
|
out.append("\x0a");
|
||||||
out.append("\x0a");
|
out.append("\x0a");
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ ShopSettings::ShopSettings(QObject *parent) : QObject(parent)
|
|||||||
{
|
{
|
||||||
m_codepage = ASCII;
|
m_codepage = ASCII;
|
||||||
m_lettersPerLine = 48;
|
m_lettersPerLine = 48;
|
||||||
|
|
||||||
|
m_eetActive = false;
|
||||||
|
m_eetMode = 1;
|
||||||
|
m_eetTest = 0;
|
||||||
|
m_eetPlayground = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShopSettings::output() const
|
QString ShopSettings::output() const
|
||||||
@@ -45,3 +50,83 @@ void ShopSettings::setByMessage(const QString &byMessage)
|
|||||||
{
|
{
|
||||||
m_byMessage = byMessage;
|
m_byMessage = byMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShopSettings::eetActive() const
|
||||||
|
{
|
||||||
|
return m_eetActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetActive(bool eetActive)
|
||||||
|
{
|
||||||
|
m_eetActive = eetActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShopSettings::eetShopId() const
|
||||||
|
{
|
||||||
|
return m_eetShopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetShopId(const QString &eetShopId)
|
||||||
|
{
|
||||||
|
m_eetShopId = eetShopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShopSettings::eetRegisterId() const
|
||||||
|
{
|
||||||
|
return m_eetRegisterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetRegisterId(const QString &eetRegisterId)
|
||||||
|
{
|
||||||
|
m_eetRegisterId = eetRegisterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ShopSettings::eetMode() const
|
||||||
|
{
|
||||||
|
return m_eetMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetMode(int eetMode)
|
||||||
|
{
|
||||||
|
m_eetMode = eetMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShopSettings::eetCertificate() const
|
||||||
|
{
|
||||||
|
return m_eetCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetCertificate(const QString &eetCertificate)
|
||||||
|
{
|
||||||
|
m_eetCertificate = eetCertificate;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ShopSettings::eetKeyPassword() const
|
||||||
|
{
|
||||||
|
return m_eetKeyPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetKeyPassword(const QString &eetKeyPassword)
|
||||||
|
{
|
||||||
|
m_eetKeyPassword = eetKeyPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShopSettings::eetTest() const
|
||||||
|
{
|
||||||
|
return m_eetTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetTest(bool eetTest)
|
||||||
|
{
|
||||||
|
m_eetTest = eetTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ShopSettings::eetPlayground() const
|
||||||
|
{
|
||||||
|
return m_eetPlayground;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShopSettings::setEetPlayground(bool eetPlayground)
|
||||||
|
{
|
||||||
|
m_eetPlayground = eetPlayground;
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,15 @@ class ShopSettings : public QObject
|
|||||||
Q_PROPERTY(int lettersPerLine READ lettersPerLine WRITE setLettersPerLine)
|
Q_PROPERTY(int lettersPerLine READ lettersPerLine WRITE setLettersPerLine)
|
||||||
Q_PROPERTY(QString byMessage READ byMessage WRITE setByMessage)
|
Q_PROPERTY(QString byMessage READ byMessage WRITE setByMessage)
|
||||||
|
|
||||||
|
Q_PROPERTY(bool eetActive READ eetActive WRITE setEetActive)
|
||||||
|
Q_PROPERTY(QString eetShopId READ eetShopId WRITE setEetShopId)
|
||||||
|
Q_PROPERTY(QString eetRegisterId READ eetRegisterId WRITE setEetRegisterId)
|
||||||
|
Q_PROPERTY(int eetMode READ eetMode WRITE setEetMode)
|
||||||
|
Q_PROPERTY(QString eetCertificate READ eetCertificate WRITE setEetCertificate)
|
||||||
|
Q_PROPERTY(QString eetKeyPassword READ eetKeyPassword WRITE setEetKeyPassword)
|
||||||
|
Q_PROPERTY(bool eetTest READ eetTest WRITE setEetTest)
|
||||||
|
Q_PROPERTY(bool eetPlayground READ eetPlayground WRITE setEetPlayground)
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -31,11 +40,44 @@ public:
|
|||||||
QString byMessage() const;
|
QString byMessage() const;
|
||||||
void setByMessage(const QString &byMessage);
|
void setByMessage(const QString &byMessage);
|
||||||
|
|
||||||
|
bool eetActive() const;
|
||||||
|
void setEetActive(bool eetActive);
|
||||||
|
|
||||||
|
QString eetShopId() const;
|
||||||
|
void setEetShopId(const QString &eetShopId);
|
||||||
|
|
||||||
|
QString eetRegisterId() const;
|
||||||
|
void setEetRegisterId(const QString &eetRegisterId);
|
||||||
|
|
||||||
|
int eetMode() const;
|
||||||
|
void setEetMode(int eetMode);
|
||||||
|
|
||||||
|
QString eetCertificate() const;
|
||||||
|
void setEetCertificate(const QString &eetCertificate);
|
||||||
|
|
||||||
|
QString eetKeyPassword() const;
|
||||||
|
void setEetKeyPassword(const QString &eetKeyPassword);
|
||||||
|
|
||||||
|
bool eetTest() const;
|
||||||
|
void setEetTest(bool eetTest);
|
||||||
|
|
||||||
|
bool eetPlayground() const;
|
||||||
|
void setEetPlayground(bool eetPlayground);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_output;
|
QString m_output;
|
||||||
CODEPAGE m_codepage;
|
CODEPAGE m_codepage;
|
||||||
int m_lettersPerLine;
|
int m_lettersPerLine;
|
||||||
QString m_byMessage;
|
QString m_byMessage;
|
||||||
|
|
||||||
|
bool m_eetActive;
|
||||||
|
QString m_eetShopId;
|
||||||
|
QString m_eetRegisterId;
|
||||||
|
int m_eetMode;
|
||||||
|
QString m_eetCertificate;
|
||||||
|
QString m_eetKeyPassword;
|
||||||
|
bool m_eetTest;
|
||||||
|
bool m_eetPlayground;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QSharedPointer<ShopSettings> ShopSettingsPtr;
|
typedef QSharedPointer<ShopSettings> ShopSettingsPtr;
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "ui_shopsettingsform.h"
|
#include "ui_shopsettingsform.h"
|
||||||
|
|
||||||
#include <settingsservice.h>
|
#include <settingsservice.h>
|
||||||
|
#include <combodata.h>
|
||||||
|
#include <QFileDialog>
|
||||||
#include "shopservice.h"
|
#include "shopservice.h"
|
||||||
|
|
||||||
ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||||
@@ -14,6 +16,17 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
|||||||
registerBinding(ui->lettersPerLine);
|
registerBinding(ui->lettersPerLine);
|
||||||
registerBinding(ui->byMessage);
|
registerBinding(ui->byMessage);
|
||||||
|
|
||||||
|
registerBinding(ui->eetActive);
|
||||||
|
registerBinding(ui->eetShopId);
|
||||||
|
registerBinding(ui->eetRegisterId);
|
||||||
|
QList<ComboData> listModes;
|
||||||
|
listModes << ComboData(0, tr("Simplifyed")) << ComboData(1, tr("Standard"));
|
||||||
|
registerBinding(ui->eetMode, listModes);
|
||||||
|
registerBinding(ui->eetCertificate);
|
||||||
|
registerBinding(ui->eetKeyPassword);
|
||||||
|
registerBinding(ui->eetTest);
|
||||||
|
registerBinding(ui->eetPlayground);
|
||||||
|
|
||||||
m_itemModel = new AutoTableModel<ShopItem>();
|
m_itemModel = new AutoTableModel<ShopItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,3 +54,13 @@ bool ShopSettingsForm::saveRecord()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShopSettingsForm::on_btnCertBrowse_clicked()
|
||||||
|
{
|
||||||
|
QString certFile = QFileDialog::getOpenFileName(this, "Certificate file", "", "P12 Files (*.p12)");
|
||||||
|
|
||||||
|
if (!certFile.isEmpty())
|
||||||
|
{
|
||||||
|
ui->eetCertificate->setText(certFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool saveRecord();
|
bool saveRecord();
|
||||||
|
private slots:
|
||||||
|
void on_btnCertBrowse_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHOPSETTINGSFORM_H
|
#endif // SHOPSETTINGSFORM_H
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -234,6 +234,121 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>EET</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="eetActive">
|
||||||
|
<property name="title">
|
||||||
|
<string>Activate EET</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shop ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="eetShopId"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cash register ID</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="eetRegisterId"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>EET mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="eetMode"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Certificate file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="eetCertificate"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="btnCertBrowse">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Private key password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="eetKeyPassword">
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QCheckBox" name="eetTest">
|
||||||
|
<property name="text">
|
||||||
|
<string>Test mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="eetPlayground">
|
||||||
|
<property name="text">
|
||||||
|
<string>Communication with playground </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ CREATE TABLE \"Voucher\" (
|
|||||||
\"totalPriceVatSecondLower\" INTEGER NOT NULL,
|
\"totalPriceVatSecondLower\" INTEGER NOT NULL,
|
||||||
\"totalPrice\" INTEGER NOT NULL,
|
\"totalPrice\" INTEGER NOT NULL,
|
||||||
\"status\" INTEGER NOT NULL,
|
\"status\" INTEGER NOT NULL,
|
||||||
|
\"eetStatus\" INTEGER NOT NULL,
|
||||||
|
\"eetSendDateTime\" TEXT NULL,
|
||||||
|
\"eetPkp\" TEXT,
|
||||||
|
\"eetBkp\" TEXT,
|
||||||
|
\"eetFik\" TEXT,
|
||||||
CONSTRAINT \"contact_fk\"
|
CONSTRAINT \"contact_fk\"
|
||||||
FOREIGN KEY (\"contact\")
|
FOREIGN KEY (\"contact\")
|
||||||
REFERENCES \"AddressbookData\" (\"id\")
|
REFERENCES \"AddressbookData\" (\"id\")
|
||||||
|
|||||||
@@ -113,3 +113,8 @@ FORMS += \
|
|||||||
paydvouchersdialog.ui
|
paydvouchersdialog.ui
|
||||||
|
|
||||||
TRANSLATIONS = translations/shop_cs_CZ.ts
|
TRANSLATIONS = translations/shop_cs_CZ.ts
|
||||||
|
|
||||||
|
unix|win32: LIBS += -L$$PWD/../../build-EetCpp-Desktop-Debug/libEet -lEetCpp
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../EetCpp/libEet
|
||||||
|
DEPENDPATH += $$PWD/../../EetCpp/libEet
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ void ShopForm::on_payButton_clicked()
|
|||||||
connect(dialog, &QDialog::accepted, [this](){
|
connect(dialog, &QDialog::accepted, [this](){
|
||||||
ShopService srv;
|
ShopService srv;
|
||||||
srv.pay(m_voucher);
|
srv.pay(m_voucher);
|
||||||
|
srv.processEet(m_voucher);
|
||||||
|
|
||||||
ReceiptGenerator generator;
|
ReceiptGenerator generator;
|
||||||
generator.setVoucher(m_voucher);
|
generator.setVoucher(m_voucher);
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
#include "isellableservice.h"
|
#include "isellableservice.h"
|
||||||
#include "shop-odb.hxx"
|
#include "shop-odb.hxx"
|
||||||
|
|
||||||
|
#include "settings/shopsettings.h"
|
||||||
|
|
||||||
|
#include <eetcpp.h>
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
ShopService::ShopService()
|
ShopService::ShopService()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -101,6 +106,7 @@ void ShopService::pay(VoucherPtr voucher)
|
|||||||
|
|
||||||
voucher->setNumSer(numSerStr);
|
voucher->setNumSer(numSerStr);
|
||||||
voucher->setStatus(Voucher::PAID);
|
voucher->setStatus(Voucher::PAID);
|
||||||
|
voucher->setEetStatus(Voucher::EET_FOR_SEND);
|
||||||
voucher->setPayDateTime(QDateTime::currentDateTime());
|
voucher->setPayDateTime(QDateTime::currentDateTime());
|
||||||
|
|
||||||
this->update(voucher);
|
this->update(voucher);
|
||||||
@@ -119,6 +125,62 @@ void ShopService::updateRelatedItem(VoucherItem* item, int countAdded)
|
|||||||
selSrv->addedToVoucher(item->refId(), countAdded);
|
selSrv->addedToVoucher(item->refId(), countAdded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShopService::processEet(VoucherPtr voucher)
|
||||||
|
{
|
||||||
|
if (voucher->eetStatus() == Voucher::EET_NOT_ENTERING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsService srvSettings("SHOP");
|
||||||
|
ShopSettingsPtr settings = srvSettings.loadSettings<ShopSettings>();
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
|
EetRequest request;
|
||||||
|
request.setCelkTrzba(voucher->totalPrice().toDouble());
|
||||||
|
request.setDatTrzby(voucher->payDateTime());
|
||||||
|
request.setIdPokl(settings->eetRegisterId());
|
||||||
|
request.setIdProvoz(settings->eetShopId());
|
||||||
|
request.setPrvniZaslani(voucher->eetStatus() == Voucher::EET_FOR_SEND);
|
||||||
|
request.setDicPopl(m_gs->dic());
|
||||||
|
request.setPoradCis(voucher->numSer());
|
||||||
|
request.setDatOdesl(QDateTime::currentDateTime());
|
||||||
|
request.setRezim((EetRequest::EetRezim)settings->eetMode());
|
||||||
|
|
||||||
|
EetSender *sender = new EetSender(this);
|
||||||
|
sender->setupSigner(settings->eetCertificate(), settings->eetKeyPassword());
|
||||||
|
sender->setPlayground(settings->eetPlayground());
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
|
||||||
|
connect(sender, &EetSender::sendFinished, [this, voucher, sender, &loop](){
|
||||||
|
Transaction tx;
|
||||||
|
|
||||||
|
if (sender->resut()->status() == EetResult::RESPONSE_OK)
|
||||||
|
{
|
||||||
|
voucher->setEetBkp(sender->resut()->bkp());
|
||||||
|
voucher->setEetPkp(sender->resut()->pkp());
|
||||||
|
voucher->setEetFik(sender->resut()->fik());
|
||||||
|
voucher->setEetSendDateTime(QDateTime::currentDateTime());
|
||||||
|
voucher->setEetStatus(Voucher::EET_SENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
voucher->setEetStatus(Voucher::EET_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->update(voucher);
|
||||||
|
tx.commit();
|
||||||
|
sender->deleteLater();
|
||||||
|
|
||||||
|
loop.quit();
|
||||||
|
});
|
||||||
|
|
||||||
|
sender->sendRequest(&request);
|
||||||
|
loop.exec();
|
||||||
|
}
|
||||||
|
|
||||||
void ShopService::moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target)
|
void ShopService::moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target)
|
||||||
{
|
{
|
||||||
Transaction tx;
|
Transaction tx;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public:
|
|||||||
void pay(VoucherPtr voucher);
|
void pay(VoucherPtr voucher);
|
||||||
void moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target);
|
void moveItems(QList<VoucherItemPtr> items, VoucherPtr source, VoucherPtr target);
|
||||||
void updateRelatedItem(VoucherItem* item, int countAdded);
|
void updateRelatedItem(VoucherItem* item, int countAdded);
|
||||||
|
void processEet(VoucherPtr voucher);
|
||||||
QList<VoucherPtr> savedVouchers();
|
QList<VoucherPtr> savedVouchers();
|
||||||
QList<VoucherPtr> tempVouchers();
|
QList<VoucherPtr> tempVouchers();
|
||||||
QList<VoucherPtr> paiedVouchers();
|
QList<VoucherPtr> paiedVouchers();
|
||||||
|
|||||||
Reference in New Issue
Block a user