@@ -0,0 +1,84 @@
2+ * Copyright (C) 2013 - Canonical Ltd.
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU Lesser General Public License, as
6+ * published by the Free Software Foundation; either version 2.1 or 3.0
9+ * This program is distributed in the hope that it will be useful, but
10+ * WITHOUT ANY WARRANTY; without even the implied warranties of
11+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12+ * PURPOSE. See the applicable version of the GNU Lesser General Public
13+ * License for more details.
15+ * You should have received a copy of both the GNU Lesser General Public
16+ * License along with this program. If not, see <http://www.gnu.org/licenses/>
18+ * Authored by: Diego Sarmentero <diego.sarmentero@canonical.com>
26+Payments::Payments(QObject *parent)
31+QString Payments::currency() const
36+double Payments::price() const
41+QString Payments::storeItemId() const
43+ return m_store_item_id;
46+QString Payments::formattedPrice() const
49+ return locale.toCurrencyString(m_price, m_currency);
52+void Payments::setCurrency(const QString ¤cy)
54+ if(m_currency != currency){
55+ m_currency = currency;
56+ Q_EMIT currencyChanged(currency);
57+ Q_EMIT formattedPriceChanged(formattedPrice());
61+void Payments::setPrice(const double price)
63+ if(m_price != price){
65+ Q_EMIT priceChanged(price);
66+ Q_EMIT formattedPriceChanged(formattedPrice());
70+void Payments::setStoreItemId(const QString &store_item_id)
72+ if(m_store_item_id != store_item_id){
73+ m_store_item_id = store_item_id;
74+ Q_EMIT storeItemIdChanged(store_item_id);
78+void Payments::start()
80+ qDebug("starting the purchase");
81+ // start the purchase here, raise finished(), error or canceled when done
82+ QTimer::singleShot(3000, this, SIGNAL(finished()));