Exemple #1
0
/*!
  Tries to buy a product with \a iapId.
*/
void IAPurchase::buyProduct(QString iapId)
{
    if (m_buyProductRequestId) {
        // Purchase ongoing, reject this request
        emit busy();
        return;
    }

    Product *product = productFromCacheByProductId(iapId);

    if (!product) {
        // Product does not exist!
        emit productDoesNotExists(iapId);
        return;
    }

    // Buy the product
    int requestId = m_iapClient->purchaseProduct(iapId, IAPClient::ForcedAutomaticRestoration);
    product->setReqId(requestId);

    if (requestId > 0) {
        // Request ok
        m_buyProductRequestId = requestId;
    }
    else {
        // Error
        m_buyProductRequestId = 0;
        emit productPurchaseError();
    }
}
Exemple #2
0
/*!
  Retrieves product specific data from the Nokia Store by \a iapId.
*/
void IAPurchase::getIapDataFromStore(QString iapId)
{
    Product *product = productFromCacheByProductId(iapId);

    if (product) {
        int requestId = m_iapClient->getProductData(iapId);
        if (requestId > 0) {
            product->setReqId(requestId);
            m_productCache.append(product);
        }
        else {
            emit productDataReadError();
        }
    }
    else {
        emit productDataReadError();
    }
}