class PurchaseManager {

    @NonNull
    public Completable consumePurchase(@NonNull final ConsumablePurchase consumablePurchase) {
        Logger.info(PurchaseManager.this, "Consuming the purchase of {}", consumablePurchase.getInAppPurchase());

        return rxInAppBillingServiceConnection.bindToInAppBillingService()
                .flatMapCompletable(inAppBillingService -> {
                    try {
                        final int responseCode = inAppBillingService.consumePurchase(API_VERSION, context.getPackageName(), consumablePurchase.getPurchaseToken());
                        if (BILLING_RESPONSE_CODE_OK == responseCode) {
                            Logger.info(PurchaseManager.this, "Successfully consumed the purchase of {}", consumablePurchase.getInAppPurchase());
                            return Completable.complete();
                        } else {
                            Logger.warn(PurchaseManager.this, "Received an unexpected response code, {}, for the consumption of this product.", responseCode);
                            return Completable.error(new Exception("Received an unexpected response code for the consumption of this product."));
                        }
                    } catch (RemoteException e) {
                        Logger.error(PurchaseManager.this, "Failed to consume this purchase", e);
                        return Completable.error(e);
                    }
                });
    }

    @Inject public  PurchaseManager(@NonNull Context context,
                           @NonNull RemoteSubscriptionManager remoteSubscriptionManager,
                           @NonNull PurchaseWallet purchaseWallet,
                           @NonNull Analytics analytics);
    @VisibleForTesting  PurchaseManager(@NonNull Context context,
                    @NonNull RemoteSubscriptionManager remoteSubscriptionManager,
                    @NonNull PurchaseWallet purchaseWallet,
                    @NonNull Analytics analytics,
                    @NonNull Scheduler subscribeOnScheduler,
                    @NonNull Scheduler observeOnScheduler);

}