本文整理汇总了C++中Purchase::getProductId方法的典型用法代码示例。如果您正苦于以下问题:C++ Purchase::getProductId方法的具体用法?C++ Purchase::getProductId怎么用?C++ Purchase::getProductId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Purchase
的用法示例。
在下文中一共展示了Purchase::getProductId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: purchaseRefunded
/**
* Notifies that a purchase has been refunded.
* Platform: Android.
* @param purchase The purchase that has been refunded.
*/
void ApplicationController::purchaseRefunded(Purchase& purchase)
{
MAUtil::String refundString = "You received a refund for " + purchase.getProductId();
maAlert("Product refunded", refundString.c_str(), "OK", NULL,NULL);
Purchase* restoredItem = new Purchase(purchase.getProductId(), this);
mPurchases.add(restoredItem);
mCurrentPurchase = mPurchases.size()-1;
// Notify The UI.
mMainScreen->productRefunded(purchase.getProductId());
}
示例2: requestCompleted
/**
* Notifies that the transaction has been successfully processed.
* The user should receive the purchased product.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
*/
void ApplicationController::requestCompleted(const Purchase& purchase)
{
// Notify UI that a product was purchased.
mMainScreen->productPurchased(purchase.getProductId());
// Update DB.
DatabaseProduct* dbProduct = new DatabaseProduct();
dbProduct->setProductID(purchase.getProductId());
int date = maLocalTime();
dbProduct->setDate(date);
mDatabase->addRow(*dbProduct);
delete dbProduct;
dbProduct = NULL;
}
示例3: productInvalid
/**
* Notifies that the product is not valid on the App Store.
* Platform: iOS.
* @param purchase The object that sent the event.
*/
void ApplicationController::productInvalid(const Purchase& purchase)
{
MAUtil::String errorMessage = "Product " + purchase.getProductId()
+ " is invalid!";
mMainScreen->productError(errorMessage);
mPurchases.remove( mCurrentPurchase );
mCurrentPurchase = -1;
//TODO remove, only for android.test.purchased
// /mPurchases[mCurrentPurchase]->requestPurchase();
}
示例4: purchaseRestored
/**
* Notifies that a purchase has been restored.
* Platform: iOS and Android.
* @param purchase The purchase that has been restored.
*/
void ApplicationController::purchaseRestored(Purchase& purchase)
{
Purchase* restoredItem = new Purchase(purchase.getProductId(), this);
mPurchases.add(restoredItem);
mCurrentPurchase = mPurchases.size()-1;
//restoredItem->addPurchaseListener(this);
restoredItem->verifyReceipt();
// mCurrentPurchase = mPurchase
// Store the product in the repository.
DatabaseProduct* dbProduct = new DatabaseProduct();
dbProduct->setProductID(purchase.getProductId());
int date = maLocalTime();
dbProduct->setDate(date);
mDatabase->addRow(*dbProduct);
delete dbProduct;
dbProduct = NULL;
delete restoredItem;
restoredItem = NULL;
// Notify The UI.
mMainScreen->productRestored(purchase.getProductId());
}
示例5: requestFailed
/**
* Notifies that the transaction has failed.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
* @param errorCode The reason why it failed.
* Note that even if the request fails because it was canceled
* (errorCode = MA_PURCHASE_ERROR_CANCELLED), you will still be
* able to get a receipt for your purchase.
*/
void ApplicationController::requestFailed(const Purchase& purchase,
const int errorCode)
{
mPurchases.remove( mCurrentPurchase );
mCurrentPurchase = -1;
MAUtil::String errorMessage = "Purchase failed for product " + purchase.getProductId();
if ( errorCode == MA_PURCHASE_ERROR_PRODUCT_ALREADY_OWNED)
{
errorMessage += ". Item already owned!";
}
else
{
errorMessage += " with err code = " + MAUtil::integerToString(errorCode);
}
mMainScreen->productError(errorMessage);
}
示例6: receiptError
/**
* Notifies that an error occurred while verifying the receipt.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
* @param errorCode The reason why it failed.
*/
void ApplicationController::receiptError(const Purchase& purchase,
const int errorCode)
{
mMainScreen->productError("Product " + purchase.getProductId()
+ " does not have a receipt!");
}
示例7: receiptInvalid
/**
* Notifies that the transaction is not valid on the App Store /
* Google Play.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
*/
void ApplicationController::receiptInvalid(const Purchase& purchase)
{
mMainScreen->productError("Product " + purchase.getProductId()
+ " does not have a receipt. It may be a managed item.");
}
示例8: requestFailed
/**
* Notifies that the transaction has failed.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
* @param errorCode The reason why it failed.
* Note that even if the request fails because it was canceled
* (errorCode = MA_PURCHASE_ERROR_CANCELLED), you will still be
* able to get a receipt for your purchase.
*/
void ApplicationController::requestFailed(const Purchase& purchase,
const int errorCode)
{
mMainScreen->productError("Purchase failed for product "
+ purchase.getProductId() );
}
示例9: requestCompleted
/**
* Notifies that the transaction has been successfully processed.
* The user should receive the purchased product.
* Platform: Android and iOS.
* @param purchase The object that sent the event.
*/
void ApplicationController::requestCompleted(const Purchase& purchase)
{
// Notify UI that a product was purchased.
mMainScreen->productPurchased(purchase.getProductId());
}
示例10: productInvalid
/**
* Notifies that the product is not valid on the App Store.
* Platform: iOS.
* @param purchase The object that sent the event.
*/
void ApplicationController::productInvalid(const Purchase& purchase)
{
MAUtil::String errorMessage = "Product " + purchase.getProductId()
+ " is invalid!";
mMainScreen->productError(errorMessage);
}