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


Java Purchase类代码示例

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


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

示例1: doVerify

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
protected void doVerify(@NonNull final List<Purchase> purchases, @NonNull final RequestListener<List<Purchase>> listener) {

    // Prepare params
    Purchase purchase = purchases.get(0);
    boolean isSubscription = Configuration.getSubscriptionProductIds().contains(purchase.sku);
    String purchaseType = isSubscription ? "subscription" : "product";

    // Post purchase verification request
    ApiRequestHandler apiRequestHandler = new ApiRequestHandler(Configuration.getPurchaseConfirmationUrl(purchaseType));
    PurchasesVerificationPayload purchasesVerificationPayload = new PurchasesVerificationPayload(purchase);
    boolean result = apiRequestHandler.post(purchasesVerificationPayload);

    // Trigger success
    if(result) {
        listener.onSuccess(purchases);
    }else{
        listener.onError(apiRequestHandler.getStatusCode(), new PurchaseVerificationException(apiRequestHandler.getResponseText()));
    }

}
 
开发者ID:bakerframework,项目名称:baker-android-refactor,代码行数:22,代码来源:ApiPurchaseVerifier.java

示例2: consume

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
private void consume(final Purchase purchase) {
    mCheckout.whenReady(new Checkout.EmptyListener() {
        @Override
        public void onReady(@Nonnull BillingRequests requests) {
            requests.consume(purchase.token, makeRequestListener());
        }
    });
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:9,代码来源:DonationActivity.java

示例3: onClick

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
public void onClick(Sku sku) {
    final Purchase purchase = mProduct.getPurchaseInState(sku, Purchase.State.PURCHASED);
    if (purchase != null) {
        consume(purchase);
    } else {
        purchase(sku);
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:9,代码来源:DonationActivity.java

示例4: onLoaded

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
public void onLoaded(@NonNull Inventory.Products products) {
    final Inventory.Product product = products.get(ProductTypes.IN_APP);
    mAdapter.setNotifyOnChange(false);
    mAdapter.clear();

    if (product.supported) {
        for (Sku sku : product.getSkus()) {
            final Purchase purchase = product.getPurchaseInState(sku, Purchase.State.PURCHASED);
            final SkuUi skuUi = new SkuUi(sku, purchase != null);
            mAdapter.add(skuUi);
        }

        // Sort items by prices.
        mAdapter.sort(new Comparator<SkuUi>() {
            @Override
            public int compare(@NonNull SkuUi l, @NonNull SkuUi r) {
                return (int) (l.sku.detailedPrice.amount - r.sku.detailedPrice.amount);
            }
        });
        showScene(SCREEN_INVENTORY);
    } else {
        mEmptyView.setText(R.string.donate_billing_not_supported);
        showScene(SCREEN_EMPTY_VIEW);
    }

    mAdapter.notifyDataSetChanged();
}
 
开发者ID:shaobin0604,项目名称:HeartbeatFixerForGCM,代码行数:29,代码来源:DonateDialogFragment.java

示例5: onLoaded

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
public void onLoaded(@NonNull Inventory.Products products) {
    final Inventory.Product product = products.get(ProductTypes.IN_APP);
    mAdapter.setNotifyOnChange(false);
    mAdapter.clear();

    if (product.supported) {
        for (Sku sku : product.getSkus()) {
            final Purchase purchase = product.getPurchaseInState(sku, Purchase.State.PURCHASED);
            final SkuUi skuUi = new MySkuUi(sku, purchase != null);
            mAdapter.add(skuUi);
        }

        // Sort items by prices.
        mAdapter.sort(new Comparator<SkuUi>() {
            @Override
            public int compare(@NonNull SkuUi l, @NonNull SkuUi r) {
                return (int) (l.sku.detailedPrice.amount - r.sku.detailedPrice.amount);
            }
        });

        // Show the inventory.
        refreshUi(SCREEN_INVENTORY);
    } else refreshUi(SCREEN_EMPTY_VIEW);

    mAdapter.notifyDataSetChanged();
}
 
开发者ID:AChep,项目名称:AcDisplay,代码行数:28,代码来源:DonateDialog.java

示例6: PurchasesVerificationPayload

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
public PurchasesVerificationPayload(Purchase purchase) {
    this.data = purchase.data;
    this.order_id = purchase.orderId;
    this.package_name = purchase.packageName;
    this.payload = purchase.payload;
    this.signature = purchase.signature;
    this.sku = purchase.sku;
    this.state = purchase.state.toString();
    this.token = purchase.token;
    this.time = purchase.time;
}
 
开发者ID:bakerframework,项目名称:baker-android-refactor,代码行数:12,代码来源:ApiPurchaseVerifier.java

示例7: purchase

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
private void purchase(Sku sku) {
    final RequestListener<Purchase> listener = makeRequestListener();
    mCheckout.startPurchaseFlow(sku, null, listener);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:5,代码来源:DonationActivity.java

示例8: onSuccess

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
public void onSuccess(@NonNull Purchase purchase) {
    purchased();
}
 
开发者ID:shaobin0604,项目名称:HeartbeatFixerForGCM,代码行数:5,代码来源:DonateDialogFragment.java

示例9: onSuccess

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
public void onSuccess(@NonNull Purchase purchase) {
    onPurchased();
}
 
开发者ID:MagLoft,项目名称:magloft-android-app,代码行数:5,代码来源:ShelfActivity.java

示例10: onSuccess

import org.solovyev.android.checkout.Purchase; //导入依赖的package包/类
@Override
public void onSuccess(@NonNull Purchase purchase) {
    onPurchased(false);
}
 
开发者ID:AChep,项目名称:AcDisplay,代码行数:5,代码来源:DonateDialog.java


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