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

paymentrequestplus.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) 2011-2016 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_PAYMENTREQUESTPLUS_H
  5. #define STARWELS_QT_PAYMENTREQUESTPLUS_H
  6. #pragma GCC diagnostic push
  7. #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  8. #include "paymentrequest.pb.h"
  9. #pragma GCC diagnostic pop
  10. #include "base58.h"
  11. #include <openssl/x509.h>
  12. #include <QByteArray>
  13. #include <QList>
  14. #include <QString>
  15. static const bool DEFAULT_SELFSIGNED_ROOTCERTS = false;
  16. //
  17. // Wraps dumb protocol buffer paymentRequest
  18. // with extra methods
  19. //
  20. class PaymentRequestPlus
  21. {
  22. public:
  23. PaymentRequestPlus() { }
  24. bool parse(const QByteArray& data);
  25. bool SerializeToString(std::string* output) const;
  26. bool IsInitialized() const;
  27. // Returns true if merchant's identity is authenticated, and
  28. // returns human-readable merchant identity in merchant
  29. bool getMerchant(X509_STORE* certStore, QString& merchant) const;
  30. // Returns list of outputs, amount
  31. QList<std::pair<CScript,CAmount> > getPayTo() const;
  32. const payments::PaymentDetails& getDetails() const { return details; }
  33. private:
  34. payments::PaymentRequest paymentRequest;
  35. payments::PaymentDetails details;
  36. };
  37. #endif // STARWELS_QT_PAYMENTREQUESTPLUS_H