|
|
|
#ifndef EETSENDER_H
|
|
|
|
#define EETSENDER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
#include "eetcpp_global.h"
|
|
|
|
#include "eetrequest.h"
|
|
|
|
#include "eettemplate.h"
|
|
|
|
#include "eetresult.h"
|
|
|
|
|
|
|
|
#define PRODUCTION_URL "https://prod.eet.cz/eet/services/EETServiceSOAP/v3"
|
|
|
|
#define PLAYGROUND_URL "https://pg.eet.cz/eet/services/EETServiceSOAP/v3"
|
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The EetSender class Performs send actions.
|
|
|
|
*/
|
|
|
|
class EETCPPSHARED_EXPORT EetSender : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit EetSender(QObject *parent = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sends request to EET web service
|
|
|
|
* @param request EET data
|
|
|
|
*/
|
|
|
|
void sendRequest(EetRequest *request);
|
|
|
|
/**
|
|
|
|
* @brief Setup certificate for signing EET request data.
|
|
|
|
* @param certPath Path to certificate p12 file. File must contain private key.
|
|
|
|
* @param passwd Password for accesing p12 file.
|
|
|
|
*/
|
|
|
|
void setupSigner(const QString &certPath, const QString &passwd);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets verifing signature of response data.
|
|
|
|
* @param checkSignature true if you wish to verify.
|
|
|
|
*/
|
|
|
|
void setCheckSignature(bool checkSignature);
|
|
|
|
/**
|
|
|
|
* @brief Returns signature verifing state.
|
|
|
|
* @return true if verify.
|
|
|
|
*/
|
|
|
|
bool checkSignature() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets comunication with playground EET portal.
|
|
|
|
* @param pg true if you wish to communicate with playground portal.
|
|
|
|
*/
|
|
|
|
void setPlayground(bool pg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Returns comunication result.
|
|
|
|
* @return result
|
|
|
|
*/
|
|
|
|
EetResult *resut() const;
|
|
|
|
|
|
|
|
void setTimeout(int timeout);
|
|
|
|
|
|
|
|
static bool m_online;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const QString ms_nsDef;
|
|
|
|
EetSigner *m_signer;
|
|
|
|
QNetworkAccessManager *m_manager;
|
|
|
|
QTimer *m_timer;
|
|
|
|
bool m_checkSignature;
|
|
|
|
EetResult *m_resut;
|
|
|
|
QString m_serviceUrl;
|
|
|
|
|
|
|
|
bool verifySignature(const QByteArray &repData);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void replyFinished(QNetworkReply *reply);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void sendFinished();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EETSENDER_H
|