Changeset View
Changeset View
Standalone View
Standalone View
src/qt/paymentserver.h
Show All 30 Lines | |||||
#include "paymentrequestplus.h" | #include "paymentrequestplus.h" | ||||
#include "walletmodel.h" | #include "walletmodel.h" | ||||
#include <QObject> | #include <QObject> | ||||
#include <QString> | #include <QString> | ||||
class OptionsModel; | class OptionsModel; | ||||
class CWallet; | |||||
QT_BEGIN_NAMESPACE | QT_BEGIN_NAMESPACE | ||||
class QApplication; | class QApplication; | ||||
class QByteArray; | class QByteArray; | ||||
class QLocalServer; | class QLocalServer; | ||||
class QNetworkAccessManager; | class QNetworkAccessManager; | ||||
class QNetworkReply; | class QNetworkReply; | ||||
class QSslError; | class QSslError; | ||||
class QUrl; | class QUrl; | ||||
QT_END_NAMESPACE | QT_END_NAMESPACE | ||||
// BIP70 max payment request size in bytes (DoS protection) | // BIP70 max payment request size in bytes (DoS protection) | ||||
static const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000; | static const qint64 BIP70_MAX_PAYMENTREQUEST_SIZE = 50000; | ||||
class PaymentServer : public QObject { | class PaymentServer : public QObject { | ||||
Q_OBJECT | Q_OBJECT | ||||
public: | public: | ||||
// Parse URIs on command line | // Parse URIs on command line | ||||
// Returns false on error | // Returns false on error | ||||
static void ipcParseCommandLine(int argc, char *argv[]); | static void ipcParseCommandLine(interface::Node &node, int argc, | ||||
char *argv[]); | |||||
// Returns true if there were URIs on the command line which were | // Returns true if there were URIs on the command line which were | ||||
// successfully sent to an already-running process. | // successfully sent to an already-running process. | ||||
// Note: if a payment request is given, SelectParams(MAIN/TESTNET) will be | // Note: if a payment request is given, SelectParams(MAIN/TESTNET) will be | ||||
// called so we startup in the right mode. | // called so we startup in the right mode. | ||||
static bool ipcSendCommandLine(); | static bool ipcSendCommandLine(); | ||||
// parent should be QApplication object | // parent should be QApplication object | ||||
Show All 9 Lines | public: | ||||
// Return certificate store | // Return certificate store | ||||
static X509_STORE *getCertStore(); | static X509_STORE *getCertStore(); | ||||
// OptionsModel is used for getting proxy settings and display unit | // OptionsModel is used for getting proxy settings and display unit | ||||
void setOptionsModel(OptionsModel *optionsModel); | void setOptionsModel(OptionsModel *optionsModel); | ||||
// Verify that the payment request network matches the client network | // Verify that the payment request network matches the client network | ||||
static bool verifyNetwork(const payments::PaymentDetails &requestDetails); | static bool verifyNetwork(interface::Node &node, | ||||
const payments::PaymentDetails &requestDetails); | |||||
// Verify if the payment request is expired | // Verify if the payment request is expired | ||||
static bool verifyExpired(const payments::PaymentDetails &requestDetails); | static bool verifyExpired(const payments::PaymentDetails &requestDetails); | ||||
// Verify the payment request size is valid as per BIP70 | // Verify the payment request size is valid as per BIP70 | ||||
static bool verifySize(qint64 requestSize); | static bool verifySize(qint64 requestSize); | ||||
// Verify the payment request amount is valid | // Verify the payment request amount is valid | ||||
static bool verifyAmount(const Amount requestAmount); | static bool verifyAmount(const Amount requestAmount); | ||||
Q_SIGNALS: | Q_SIGNALS: | ||||
// Fired when a valid payment request is received | // Fired when a valid payment request is received | ||||
void receivedPaymentRequest(SendCoinsRecipient); | void receivedPaymentRequest(SendCoinsRecipient); | ||||
// Fired when a valid PaymentACK is received | // Fired when a valid PaymentACK is received | ||||
void receivedPaymentACK(const QString &paymentACKMsg); | void receivedPaymentACK(const QString &paymentACKMsg); | ||||
// Fired when a message should be reported to the user | // Fired when a message should be reported to the user | ||||
void message(const QString &title, const QString &message, | void message(const QString &title, const QString &message, | ||||
unsigned int style); | unsigned int style); | ||||
public Q_SLOTS: | public Q_SLOTS: | ||||
// Signal this when the main window's UI is ready to display payment | // Signal this when the main window's UI is ready to display payment | ||||
// requests to the user | // requests to the user | ||||
void uiReady(); | void uiReady(); | ||||
// Submit Payment message to a merchant, get back PaymentACK: | // Submit Payment message to a merchant, get back PaymentACK: | ||||
void fetchPaymentACK(CWallet *wallet, const SendCoinsRecipient &recipient, | void fetchPaymentACK(WalletModel *walletModel, | ||||
const SendCoinsRecipient &recipient, | |||||
QByteArray transaction); | QByteArray transaction); | ||||
// Handle an incoming URI, URI with local file scheme or file | // Handle an incoming URI, URI with local file scheme or file | ||||
void handleURIOrFile(const QString &s); | void handleURIOrFile(const QString &s); | ||||
private Q_SLOTS: | private Q_SLOTS: | ||||
void handleURIConnection(); | void handleURIConnection(); | ||||
void netRequestFinished(QNetworkReply *); | void netRequestFinished(QNetworkReply *); | ||||
Show All 30 Lines |