本文整理汇总了Java中com.amazon.device.iap.model.FulfillmentResult类的典型用法代码示例。如果您正苦于以下问题:Java FulfillmentResult类的具体用法?Java FulfillmentResult怎么用?Java FulfillmentResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FulfillmentResult类属于com.amazon.device.iap.model包,在下文中一共展示了FulfillmentResult类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleReceipt
import com.amazon.device.iap.model.FulfillmentResult; //导入依赖的package包/类
/**
* Method to handle receipts
*
* @param requestId
* @param receipt
* @param userData
*/
public void handleReceipt(final String requestId, final Receipt receipt, final UserData userData) {
showMessage(LOGTYPELOG, "Handle receipt: requestId (" + requestId
+ ") receipt: "
+ receipt
+ ")");
// convert receipt to transaction
Transaction trans = AmazonTransactionUtils.convertReceiptToTransaction(1, requestId, receipt, userData); // provides cancleState also
switch (receipt.getProductType()) {
case CONSUMABLE:
// inform the listener
observer.handlePurchase(trans);
// Automatically consume item
PurchasingService.notifyFulfillment(receipt.getReceiptId(), FulfillmentResult.FULFILLED);
break;
case ENTITLED:
// inform the listener
observer.handlePurchase(trans);
break;
case SUBSCRIPTION:
// TODO: check subscription sample for how to handle consumable purchases
break;
}
}
开发者ID:libgdx,项目名称:gdx-pay,代码行数:37,代码来源:PurchaseManagerAndroidAmazon.java
示例2: consume
import com.amazon.device.iap.model.FulfillmentResult; //导入依赖的package包/类
@Override
public void consume(@NonNull final ConsumeRequest request) {
final Purchase purchase = request.getPurchase();
final String token = purchase.getToken();
if (!TextUtils.isEmpty(token)) {
PurchasingService.notifyFulfillment(token, FulfillmentResult.FULFILLED);
postResponse(new ConsumeResponse(SUCCESS, getName(), purchase));
} else {
postEmptyResponse(request, ITEM_UNAVAILABLE);
}
}
开发者ID:onepf,项目名称:OPFIab,代码行数:12,代码来源:AmazonBillingProvider.java
示例3: onPurchaseResponse
import com.amazon.device.iap.model.FulfillmentResult; //导入依赖的package包/类
@Override
public void onPurchaseResponse(PurchaseResponse response) {
logDebug("onPurchaseResponse " + response.getRequestStatus());
final String requestId = response.getRequestId().toString();
final String userId = response.getUserData().getUserId();
final PurchaseResponse.RequestStatus status = response.getRequestStatus();
final Receipt receipt;
logDebug("onPurchaseResponse: requestId (" + requestId + ") userId (" + userId + ") purchaseRequestStatus (" + status + ")");
switch (status) {
case SUCCESSFUL:
receipt = response.getReceipt();
if (receipt != null) {
logDebug("onPurchaseResponse: receipt json:" + receipt.toJSON());
logDebug("onPurchaseResponse: getUserId:" + response.getUserData().getUserId());
logDebug("onPurchaseResponse: getMarketplace:" + response.getUserData().getMarketplace());
if (receipt.getProductType() == ProductType.SUBSCRIPTION) {
amazonBillingService.subscriptionOwned(receipt.getSku(), false);
} else {
amazonBillingService.productOwned(receipt.getSku(), false);
}
PurchasingService.notifyFulfillment(receipt.getReceiptId(), FulfillmentResult.FULFILLED);
}
break;
case ALREADY_PURCHASED:
logDebug("onPurchaseResponse: already purchased, you should verify the entitlement purchase on your side and make sure the purchase was granted to customer");
receipt = response.getReceipt();
if (receipt != null && !receipt.isCanceled()) {
if (receipt.getProductType() == ProductType.SUBSCRIPTION) {
amazonBillingService.subscriptionOwned(receipt.getSku(), true);
} else {
amazonBillingService.productOwned(receipt.getSku(), true);
}
}
break;
case INVALID_SKU:
logDebug("onPurchaseResponse: invalid SKU! onProductDataResponse should have disabled buy button already.");
break;
case FAILED:
case NOT_SUPPORTED:
logDebug("onPurchaseResponse: failed so remove purchase request from local storage");
break;
}
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:46,代码来源:AmazonBillingListener.java
示例4: onPurchaseUpdatesResponse
import com.amazon.device.iap.model.FulfillmentResult; //导入依赖的package包/类
/**
* This is the callback for {@link PurchasingService#getPurchaseUpdates}.
*
* You will receive Entitlement receipts from this callback.
*
*/
@Override
public void onPurchaseUpdatesResponse(final PurchaseUpdatesResponse response) {
showMessage(LOGTYPELOG, "onPurchaseUpdatesResponse: requestId (" + response.getRequestId()
+ ") purchaseUpdatesResponseStatus ("
+ response.getRequestStatus()
+ ") userId ("
+ response.getUserData().getUserId()
+ ")");
final PurchaseUpdatesResponse.RequestStatus status = response.getRequestStatus();
switch (status) {
case SUCCESSFUL:
updateUserData(response.getUserData());
// for (final Receipt receipt : response.getReceipts()) {
// handleReceipt(response.getRequestId().toString(), receipt, response.getUserData());
// }
// send result to observer --------
List<Transaction> transactions = new ArrayList<Transaction>(response.getReceipts().size());
Array<Receipt> consumables = new Array<Receipt>(response.getReceipts().size());
for (int i = 0; i < response.getReceipts().size(); i++) {
Receipt receipt = response.getReceipts().get(i);
// Memoize consumables for later check
if (receipt.getProductType() == ProductType.CONSUMABLE)
consumables.add(receipt);
transactions.add(AmazonTransactionUtils.convertReceiptToTransaction(i, response.getRequestId().toString(), receipt, response.getUserData()));
}
// send inventory to observer
observer.handleRestore(transactions.toArray(new Transaction[transactions.size()]));
// Automatically consume consumables if this was not previously the case
for (int i = 0; i < consumables.size; i++) {
Receipt consumable = consumables.get(i);
PurchasingService.notifyFulfillment(consumable.getReceiptId(), FulfillmentResult.FULFILLED);
}
//---- check if there are more receipts -------
if (response.hasMore()) {
PurchasingService.getPurchaseUpdates(false);
}
break;
case FAILED:
showMessage(LOGTYPEERROR, "onPurchaseUpdatesResponse: FAILED, should retry request");
observer.handleRestoreError(new Throwable("onPurchaseUpdatesResponse: FAILED, should retry request"));
break;
case NOT_SUPPORTED:
showMessage(LOGTYPEERROR, "onPurchaseUpdatesResponse: NOT_SUPPORTED, should retry request");
observer.handleRestoreError(new Throwable("onPurchaseUpdatesResponse: NOT_SUPPORTED, should retry request"));
break;
}
}
开发者ID:libgdx,项目名称:gdx-pay,代码行数:65,代码来源:PurchaseManagerAndroidAmazon.java
示例5: consume
import com.amazon.device.iap.model.FulfillmentResult; //导入依赖的package包/类
@Override
public void consume(Purchase itemInfo) {
PurchasingService.notifyFulfillment(itemInfo.getToken(), FulfillmentResult.FULFILLED);
}
开发者ID:onepf,项目名称:OpenIAB,代码行数:5,代码来源:AmazonAppstoreBillingService.java
注:本文中的com.amazon.device.iap.model.FulfillmentResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论