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


Java PurchaseUpdatesResponse.getReceipts方法代码示例

本文整理汇总了Java中com.amazon.device.iap.model.PurchaseUpdatesResponse.getReceipts方法的典型用法代码示例。如果您正苦于以下问题:Java PurchaseUpdatesResponse.getReceipts方法的具体用法?Java PurchaseUpdatesResponse.getReceipts怎么用?Java PurchaseUpdatesResponse.getReceipts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazon.device.iap.model.PurchaseUpdatesResponse的用法示例。


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

示例1: onPurchaseUpdatesResponse

import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@Override
public void onPurchaseUpdatesResponse(PurchaseUpdatesResponse response) {

    if (response.getRequestId().equals(mAlreadyPurchasedRequestId)) {
        for (Receipt receipt: response.getReceipts()) {
            if (receipt.getSku().equals(mAlreadyPurchasedProductId)) {

                final PurchaseCallback callback = mPurchaseCallbacks.get(response.getRequestId());
                if (callback != null) {
                    mPurchaseCallbacks.remove(response.getRequestId());
                }

                validatePurchase(receipt, response.getUserData().getUserId(), callback);
            }
        }
        mAlreadyPurchasedProductId = null;
        mAlreadyPurchasedRequestId = null;
    }
}
 
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:20,代码来源:AmazonInAppService.java

示例2: getInventory

import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@NonNull
public static Collection<Purchase> getInventory(
        @NonNull final PurchaseUpdatesResponse response) {

    final List<Receipt> receipts = response.getReceipts();
    final Collection<Purchase> purchases = new ArrayList<>(receipts.size());
    for (final Receipt receipt : receipts) {
        final Purchase purchase = convertPurchase(receipt);
        if (purchase != null) {
            purchases.add(purchase);
        }
    }

    return purchases;
}
 
开发者ID:onepf,项目名称:OPFIab,代码行数:16,代码来源:AmazonUtils.java

示例3: onPurchaseUpdatesResponse

import com.amazon.device.iap.model.PurchaseUpdatesResponse; //导入方法依赖的package包/类
@Override
public void onPurchaseUpdatesResponse(final PurchaseUpdatesResponse purchaseUpdatesResponse) {
    final PurchaseUpdatesResponse.RequestStatus requestStatus = purchaseUpdatesResponse.getRequestStatus();
    final RequestId requestId = purchaseUpdatesResponse.getRequestId();
    Logger.d("onPurchaseUpdatesResponse() reqStatus: ", requestStatus,
            "reqId: ", requestId);

    switch (requestStatus) {
        case SUCCESSFUL:
            for (final String sku : inventory.getAllOwnedSkus()) {
                inventory.erasePurchase(sku);
            }
            final UserData userData = purchaseUpdatesResponse.getUserData();
            final String userId = userData.getUserId();
            if (!userId.equals(currentUserId)) {
                Logger.w("onPurchaseUpdatesResponse() Current UserId: ", currentUserId,
                        ", purchase UserId: ", userId);
                break;
            }
            for (final Receipt receipt : purchaseUpdatesResponse.getReceipts()) {
                inventory.addPurchase(getPurchase(receipt));
            }
            if (purchaseUpdatesResponse.hasMore()) {
                PurchasingService.getPurchaseUpdates(false);
                Logger.d("Initiating Another Purchase Updates with offset: ");
                return;
            }
            break;
        case FAILED:
            break;
    }
    final CountDownLatch countDownLatch = inventoryLatchQueue.poll();
    if (countDownLatch != null) {
        countDownLatch.countDown();
    }
}
 
开发者ID:onepf,项目名称:OpenIAB,代码行数:37,代码来源:AmazonAppstoreBillingService.java


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