You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.9 KiB
C

8 years ago
#ifndef EETSENDER_H
#define EETSENDER_H
#include <QObject>
#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;
8 years ago
/**
* @brief The EetSender class Performs send actions.
*/
8 years ago
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
*/
8 years ago
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;
private:
static const QString ms_nsDef;
EetSigner *m_signer;
QNetworkAccessManager *m_manager;
bool m_checkSignature;
EetResult *m_resut;
QString m_serviceUrl;
bool verifySignature(const QByteArray &repData);
private slots:
void replyFinished(QNetworkReply *reply);
8 years ago
signals:
void sendFinished(EetResult *result);
8 years ago
public slots:
};
#endif // EETSENDER_H