on 2f2b341 help sign in
65 lines 2.0 kB history raw
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
17#ifndef PAYMENTS_H
18#define PAYMENTS_H
20#include <QObject>
22#include <libpay/pay-package.h>
25class Payments : public QObject
27 Q_OBJECT
28 Q_DISABLE_COPY(Payments)
29 Q_PROPERTY(QString currency READ currency WRITE setCurrency NOTIFY currencyChanged)
30 Q_PROPERTY(double price READ price WRITE setPrice NOTIFY priceChanged)
31 Q_PROPERTY(QString storeItemId READ storeItemId WRITE setStoreItemId NOTIFY storeItemIdChanged)
32 Q_PROPERTY(QString formattedPrice READ formattedPrice NOTIFY formattedPriceChanged)
34public:
35 explicit Payments(QObject *parent = 0);
36 virtual ~Payments();
38 QString currency() const;
39 double price() const;
40 QString storeItemId() const;
41 QString formattedPrice() const;
43 void setCurrency(const QString& currency);
44 void setPrice(const double price);
45 void setStoreItemId(const QString& store_item_id);
46 Q_INVOKABLE void start();
48Q_SIGNALS:
49 void currencyChanged(const QString& currency);
50 void priceChanged(const double price);
51 void storeItemIdChanged(const QString &store_item_id);
52 void formattedPriceChanged(const QString &formatted_price);
54 void purchaseError(const QString &error);
55 void purchaseCompleted();
57private:
58 QString m_currency;
59 double m_price;
60 QString m_store_item_id;
62 PayPackage *m_package;
63};
65#endif // PAYMENTS_H