Files
EetCpp/libEet/eetsender.h
T

87 lines
2.0 KiB
C++
Raw Normal View History

2017-01-07 22:44:24 +01:00
#ifndef EETSENDER_H
#define EETSENDER_H
#include <QObject>
2017-02-21 21:03:49 +01:00
#include <QTimer>
2017-01-07 22:44:24 +01:00
#include "eetcpp_global.h"
#include "eetrequest.h"
#include "eettemplate.h"
2017-01-24 22:27:36 +01:00
#include "eetresult.h"
2017-01-28 14:05:30 +01:00
#define PRODUCTION_URL "https://prod.eet.cz/eet/services/EETServiceSOAP/v3"
#define PLAYGROUND_URL "https://pg.eet.cz/eet/services/EETServiceSOAP/v3"
2017-01-24 22:27:36 +01:00
class QNetworkAccessManager;
class QNetworkReply;
2017-01-07 22:44:24 +01:00
/**
* @brief The EetSender class Performs send actions.
*/
2017-01-07 22:44:24 +01:00
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
*/
2017-01-07 22:44:24 +01:00
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.
*/
2017-01-12 22:14:44 +01:00
void setupSigner(const QString &certPath, const QString &passwd);
/**
* @brief Sets verifing signature of response data.
* @param checkSignature true if you wish to verify.
*/
2017-01-24 22:27:36 +01:00
void setCheckSignature(bool checkSignature);
/**
* @brief Returns signature verifing state.
* @return true if verify.
*/
2017-01-24 22:27:36 +01:00
bool checkSignature() const;
/**
* @brief Sets comunication with playground EET portal.
* @param pg true if you wish to communicate with playground portal.
*/
2017-01-28 14:05:30 +01:00
void setPlayground(bool pg);
/**
* @brief Returns comunication result.
* @return result
*/
2017-01-24 22:27:36 +01:00
EetResult *resut() const;
2017-02-21 21:03:49 +01:00
void setTimeout(int timeout);
static bool m_online;
2017-01-12 22:14:44 +01:00
private:
2017-01-24 22:27:36 +01:00
static const QString ms_nsDef;
2017-01-12 22:14:44 +01:00
EetSigner *m_signer;
2017-01-24 22:27:36 +01:00
QNetworkAccessManager *m_manager;
2017-02-21 21:03:49 +01:00
QTimer *m_timer;
2017-01-24 22:27:36 +01:00
bool m_checkSignature;
EetResult *m_resut;
2017-01-28 14:05:30 +01:00
QString m_serviceUrl;
2017-01-24 22:27:36 +01:00
bool verifySignature(const QByteArray &repData);
private slots:
void replyFinished(QNetworkReply *reply);
2017-01-07 22:44:24 +01:00
signals:
2017-02-21 21:03:49 +01:00
void sendFinished();
2017-01-07 22:44:24 +01:00
public slots:
};
#endif // EETSENDER_H