1/****************************************************************************
2**
3** Copyright (C) 2015 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the Purchasing module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3-COMM$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef QINAPPTRANSACTION_H
30#define QINAPPTRANSACTION_H
31
32#include <QtCore/qobject.h>
33#include <QtCore/qsharedpointer.h>
34#include <QtCore/qdatetime.h>
35#include <QtPurchasing/qtpurchasingglobal.h>
36
37QT_BEGIN_NAMESPACE
38
39class QInAppProduct;
40class QInAppTransactionPrivate;
41class Q_PURCHASING_EXPORT QInAppTransaction: public QObject
42{
43 Q_OBJECT
44 Q_ENUMS(TransactionStatus FailureReason)
45 Q_PROPERTY(TransactionStatus status READ status CONSTANT)
46 Q_PROPERTY(QInAppProduct* product READ product CONSTANT)
47 Q_PROPERTY(QString orderId READ orderId CONSTANT)
48 Q_PROPERTY(FailureReason failureReason READ failureReason CONSTANT)
49 Q_PROPERTY(QString errorString READ errorString CONSTANT)
50 Q_PROPERTY(QDateTime timestamp READ timestamp CONSTANT)
51public:
52 enum TransactionStatus {
53 Unknown,
54 PurchaseApproved,
55 PurchaseFailed,
56 PurchaseRestored
57 };
58
59 enum FailureReason {
60 NoFailure,
61 CanceledByUser,
62 ErrorOccurred
63 };
64
65 ~QInAppTransaction();
66
67 QInAppProduct *product() const;
68
69 virtual QString orderId() const;
70 virtual FailureReason failureReason() const;
71 virtual QString errorString() const;
72 virtual QDateTime timestamp() const;
73
74 Q_INVOKABLE virtual void finalize() = 0;
75 Q_INVOKABLE virtual QString platformProperty(const QString &propertyName) const;
76
77 TransactionStatus status() const;
78
79protected:
80 explicit QInAppTransaction(TransactionStatus status,
81 QInAppProduct *product,
82 QObject *parent = nullptr);
83
84private:
85 Q_DISABLE_COPY(QInAppTransaction)
86 QSharedPointer<QInAppTransactionPrivate> d;
87};
88
89QT_END_NAMESPACE
90
91#endif // QINAPPTRANSACTION_H
92

source code of qtpurchasing/src/purchasing/inapppurchase/qinapptransaction.h