当前位置: 首页>>代码示例>>C++>>正文


C++ Purchase类代码示例

本文整理汇总了C++中Purchase的典型用法代码示例。如果您正苦于以下问题:C++ Purchase类的具体用法?C++ Purchase怎么用?C++ Purchase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Purchase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Approve

 void Approve(const Purchase &item){
   if(item.GetPrice()<10000000000.0){
     cout<<"Item "<<item.GetItemNumber()<<" is apprived by "<<name_<<endl;
   }
   else{//CEOでも決済できないのでCommityに
     cout<<"Item "<<item.GetItemNumber()<<" will be apprived by commity"<<endl;
   }
 }
开发者ID:AtsushiSakai,项目名称:cpp,代码行数:8,代码来源:ChainOfResponsibility.cpp

示例2: Purchase

void Purchases::newPurchase(int prodId, double cantitaty, QDate date)
{
	Purchase * pur = new Purchase();

	pur->setIdProd(prodId);
	pur->setCantitaty(cantitaty);
	pur->setDate(date);

	addItem(pur);
}
开发者ID:faust4exe,项目名称:expensesQt,代码行数:10,代码来源:purchases.cpp

示例3: maAlert

/**
 * 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());
}
开发者ID:Felard,项目名称:MoSync,代码行数:16,代码来源:ApplicationController.cpp

示例4:

	/**
	 * Notifies that the transaction has been received by the App Store/
	 * Google Play.
	 * Platform: Android and iOS.
	 * @param purchase The object that sent the event.
	 */
	void Test1::requestInProgress(const Purchase& purchase)
	{
		if ( mPurchase->getHandle() == purchase.getHandle() )
		{
			MAUtil::String info = "Product " +
					MAUtil::integerToString(purchase.getHandle()) + " failed, product is in progress";
			mApplicationController.log(info);
			this->setFailedReason(info);
			mApplicationController.testFailed(*this);
		}
	}
开发者ID:Felard,项目名称:MoSync,代码行数:17,代码来源:Test1.cpp

示例5: 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;
}
开发者ID:Felard,项目名称:MoSync,代码行数:20,代码来源:ApplicationController.cpp

示例6: item

void Purchases::deletePurchasesOfProduct(int productId)
{
	for(int i=0; i<itemsCount(); i++){
		Item *it = item(i);
		Purchase *purch = dynamic_cast<Purchase *>(it);
		if (!purch)
			continue;

		if (purch->id() == productId) {
			m_items.removeAll(it);
			delete it;
		}
	}
}
开发者ID:faust4exe,项目名称:expensesQt,代码行数:14,代码来源:purchases.cpp

示例7: getPlatform

	/**
	 * Notifies that the product has been validated by the App Store.
	 * NOTE: On Android there is no validation done at this step, if the
	 * product results to be unavailable, then the application will be later
	 * notified via a requestFailed() callback. The errorCode will equal
	 * #MA_PURCHASE_ERROR_INVALID_PRODUCT.
	 * Platform: iOS and Android.
	 * @param purchase The object that sent the event.
	 */
	void Test1::productValid(const Purchase& purchase)
	{
		if ( purchase.getHandle() == mPurchase->getHandle()
				&& getPlatform() == ANDROID)
		{
			mPurchase->requestPurchase();
		}
	}
开发者ID:Felard,项目名称:MoSync,代码行数:17,代码来源:Test1.cpp

示例8: 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();
}
开发者ID:Felard,项目名称:MoSync,代码行数:15,代码来源:ApplicationController.cpp

示例9: receiptValid

/**
 * Notifies that the transaction has been validated by the App Store /
 * Google Play.
 * Platform: Android and iOS.
 * @param purchase The object that sent the event.
 * @param receipt Transaction receipt.
 */
void ApplicationController::receiptValid(
	const Purchase& purchase,
	Receipt& receipt)
{
	if ( purchase.getHandle() == mPurchases[mCurrentPurchase]->getHandle() )
	{
		// Display the dialog containing the receipt information.
		mMainScreen->fillReceiptDialog(receipt.getAppID(), receipt.getProductID(),
				receipt.getTransactionDate(), receipt.getTransactionID(),
				receipt.getBID(), receipt.getPrice(), receipt.getTitle());
	}
}
开发者ID:Felard,项目名称:MoSync,代码行数:19,代码来源:ApplicationController.cpp

示例10: Purchase

/**
 * 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());
}
开发者ID:Felard,项目名称:MoSync,代码行数:28,代码来源:ApplicationController.cpp

示例11: 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);
}
开发者ID:Felard,项目名称:MoSync,代码行数:25,代码来源:ApplicationController.cpp

示例12: 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() );
}
开发者ID:simonktng,项目名称:MoSync,代码行数:15,代码来源:ApplicationController.cpp

示例13: 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()
			+ " has an invalid receipt!");
}
开发者ID:simonktng,项目名称:MoSync,代码行数:11,代码来源:ApplicationController.cpp

示例14: 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!");
}
开发者ID:Felard,项目名称:MoSync,代码行数:12,代码来源:ApplicationController.cpp

示例15: 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());
}
开发者ID:simonktng,项目名称:MoSync,代码行数:11,代码来源:ApplicationController.cpp


注:本文中的Purchase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。