Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.0
-
None
Description
In : https://doc.qt.io/qt-5/qtpurchasing-gettingstarted-cpp.html
The example code for the following function :
void MyApplication::handleTransaction(QInAppTransaction *transaction)
contains if statement with parentheses that are not closed :
if (!hasAlreadyStoredTransaction(transaction->orderId()) {
and also here :
if (!addHealthPotionToPersistentStorage(transaction->orderId())
there is also a semicolon missing:
popupErrorDialog(tr("Unable to write to persistent storage. Please make sure there is sufficient space and restart."))
here is the full example :
void MyApplication::handleTransaction(QInAppTransaction *transaction) { if (transaction->status() == QInAppTransaction::PurchaseApproved && transaction->product()->identifier() == QStringLiteral("healthPotion")) { if (!hasAlreadyStoredTransaction(transaction->orderId()) { ++m_healthPotions; if (!addHealthPotionToPersistentStorage(transaction->orderId()) popupErrorDialog(tr("Unable to write to persistent storage. Please make sure there is sufficient space and restart.")) else transaction->finalize(); } } else if (transaction->status() == QInAppTransaction::PurchaseFailed) { popupErrorDialog(tr("Purchase not completed.")); transaction->finalize(); } }